small-fixes

This commit is contained in:
Thomas von Dein
2017-07-21 21:17:00 +02:00
parent 090d8c6922
commit af1266d946

View File

@@ -17,6 +17,11 @@
Use the default or someting like: Use the default or someting like:
'(lambda() (thing-at-point 'word))") '(lambda() (thing-at-point 'word))")
;; FIXME: implement ;;;;;;;;;;;
(defcustom followcursor-ask-for-regex nil
"If set to t, ask for regex on mode start to use for marking.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(make-variable-buffer-local (make-variable-buffer-local
(defvar followcursor--last-point nil (defvar followcursor--last-point nil
"Buffer local variable storing last recorded cursor position.")) "Buffer local variable storing last recorded cursor position."))
@@ -33,13 +38,19 @@ Return t if there are currently 2 visible windows."
t t
nil)) nil))
;; check previous 'thing and do nothing it's the same (eg when moving inside word) (defun followcursor-remove-highlights ()
(interactive)
(hi-lock-mode 0)
(other-window 1)
(hi-lock-mode 0)
(other-window 1))
(defun followcursor--mark-and-highlight (mark-what hl-here hl-there) (defun followcursor--mark-and-highlight (mark-what hl-here hl-there)
"Marks thing at point using form ''WHAT and highlights using form ''WHICH." "Marks thing at point using form ''WHAT and highlights using form ''WHICH."
(interactive) (interactive)
(when (followcursor--setup-ok) (when (followcursor--setup-ok)
(let ((thing (funcall mark-what))) (let ((thing (funcall mark-what)))
(when thing (if thing
(unless (eq thing followcursor-previous-thing) (unless (eq thing followcursor-previous-thing)
;; highlight here ;; highlight here
(hi-lock-mode 0) (hi-lock-mode 0)
@@ -49,7 +60,9 @@ Return t if there are currently 2 visible windows."
(hi-lock-mode 0) (hi-lock-mode 0)
(funcall hl-there thing) (funcall hl-there thing)
;; go to here buffer ;; go to here buffer
(other-window 1)))))) (other-window 1)
(setq followcursor-previous-thing thing))
(followcursor-remove-highlights)))))
(defun followcursor-mark-symbol-lazy () (defun followcursor-mark-symbol-lazy ()
"Mark symbol at point, be tolerant about what constitutes a symbol." "Mark symbol at point, be tolerant about what constitutes a symbol."
@@ -82,10 +95,7 @@ Return t if there are currently 2 visible windows."
"Disable followcursor-mode." "Disable followcursor-mode."
(interactive) (interactive)
(remove-hook 'post-command-hook 'followcursor-mark-when-moved) (remove-hook 'post-command-hook 'followcursor-mark-when-moved)
(hi-lock-mode 0) (followcursor-remove-highlights))
(other-window 1)
(hi-lock-mode 0)
(other-window 1))
;;;###autoload ;;;###autoload
(defun followcursor-mark-when-moved () (defun followcursor-mark-when-moved ()