Don’t break asynchronous jumpers (fix #6898)

This commit is contained in:
Eivind Fonn 2016-08-24 10:04:50 +02:00
parent 131e0faef9
commit 734c87fb24
2 changed files with 12 additions and 8 deletions

View file

@ -42,12 +42,16 @@ sets `spacemacs-jump-handlers' in buffers of that mode."
(catch 'done
(let ((old-buffer (current-buffer))
(old-point (point)))
(dolist (handler spacemacs-jump-handlers)
(ignore-errors
(call-interactively handler))
(unless (and (eq old-point (point))
(equal old-buffer (current-buffer)))
(throw 'done t))))
(dolist (-handler spacemacs-jump-handlers)
(let ((handler (if (listp -handler) (car -handler) -handler))
(async (when (listp -handler)
(plist-get (cdr -handler) :async))))
(ignore-errors
(call-interactively handler))
(when (or async
(not (eq old-point (point)))
(not (equal old-buffer (current-buffer))))
(throw 'done t)))))
(message "No jump handler was able to find this symbol.")))
;; Set the `:jump' property manually instead of just using `evil-define-motion'

View file

@ -125,8 +125,8 @@
(defun c-c++/post-init-ycmd ()
(add-hook 'c++-mode-hook 'ycmd-mode)
(add-hook 'spacemacs-jump-handlers-c++-mode 'ycmd-goto)
(add-hook 'spacemacs-jump-handlers-c-mode 'ycmd-goto)
(add-hook 'spacemacs-jump-handlers-c++-mode '(ycmd-goto :async t))
(add-hook 'spacemacs-jump-handlers-c-mode '(ycmd-goto :async t))
(dolist (mode '(c++-mode c-mode))
(spacemacs/set-leader-keys-for-major-mode mode
"gG" 'ycmd-goto-imprecise)))