2015-06-15 09:05:52 +02:00
|
|
|
;;; defuns-editor.el
|
|
|
|
;; for ../core-editor.el
|
|
|
|
|
2015-11-08 17:59:11 -05:00
|
|
|
(defvar *linum-mdown-line* nil)
|
|
|
|
|
|
|
|
(defun narf--line-at-click ()
|
|
|
|
(save-excursion
|
|
|
|
(let ((click-y (cdr (cdr (mouse-position))))
|
|
|
|
(line-move-visual-store line-move-visual))
|
|
|
|
(setq line-move-visual t)
|
|
|
|
(goto-char (window-start))
|
|
|
|
(next-line (1- click-y))
|
|
|
|
(setq line-move-visual line-move-visual-store)
|
|
|
|
;; If you are using tabbar substitute the next line with
|
|
|
|
;; (line-number-at-pos))))
|
|
|
|
(1+ (line-number-at-pos)))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun narf/mouse-drag-line ()
|
|
|
|
(interactive)
|
|
|
|
(goto-line (narf--line-at-click))
|
|
|
|
(set-mark (point))
|
|
|
|
(setq *linum-mdown-line* (line-number-at-pos)))
|
2015-06-15 09:05:52 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
2015-11-08 17:59:11 -05:00
|
|
|
(defun narf/mouse-select-line ()
|
2015-06-15 09:05:52 +02:00
|
|
|
(interactive)
|
2015-11-08 17:59:11 -05:00
|
|
|
(when *linum-mdown-line*
|
|
|
|
(let (mu-line)
|
|
|
|
(setq mu-line (narf--line-at-click))
|
2015-11-14 02:41:53 -05:00
|
|
|
(goto-line *linum-mdown-line*)
|
2015-11-08 17:59:11 -05:00
|
|
|
(if (> mu-line *linum-mdown-line*)
|
|
|
|
(progn
|
|
|
|
(set-mark (point))
|
|
|
|
(goto-line mu-line)
|
|
|
|
(end-of-line))
|
|
|
|
(set-mark (line-end-position))
|
|
|
|
(goto-line mu-line)
|
|
|
|
(beginning-of-line))
|
2015-11-14 02:41:53 -05:00
|
|
|
(setq *linum-mdown-line* nil))))
|
2015-06-15 09:05:52 +02:00
|
|
|
|
2015-12-11 02:21:49 -05:00
|
|
|
;;;###autoload (autoload 'narf:align "defuns-editor" nil t)
|
|
|
|
(evil-define-operator narf:align (&optional beg end bang pattern)
|
|
|
|
(interactive "<r><!><//>")
|
|
|
|
(align-regexp
|
|
|
|
beg end
|
|
|
|
(concat "\\(\\s-*\\)"
|
|
|
|
(if bang
|
|
|
|
(regexp-quote pattern)
|
|
|
|
(rxt-pcre-to-elisp pattern)))
|
|
|
|
1 1))
|
|
|
|
|
2015-06-15 09:05:52 +02:00
|
|
|
(provide 'defuns-editor)
|
|
|
|
;;; defuns-editor.el ends here
|