简体   繁体   中英

Emacs, quick-jump and go-mode: point not updated during navigation

I want to combine the go-mode godef-jump with quick-jump, such that I drop a marker both before and after the jump.

(defun my-go-quick-jump-push-def-hook (pnt)
  (interactive "d")
  (message "%s %d" (buffer-name) pnt)
  (quick-jump-push-marker)
  (godef-jump pnt)
  (quick-jump-push-marker)
  (message "%s %d" (buffer-name) (point))
)

(defun my-go-mode-hook ()
  (local-set-key (kbd "M-.") 'my-go-quick-jump-push-def-hook)
)

However, the message calls indicate that the buffer has not been updated after the call to godef-jump completes, and nor does (point) give a different value from pnt . But godef-jump does complete and does change the buffer where necessary. So something's up with the evaluation order that I can't figure out - it's almost like the actual navigation is going on lazily. Is this expected or is this something odd that go-mode is doing?

go-mode is at https://github.com/dominikh/go-mode.el/blob/master/go-mode.el , quick-jump is at http://www.emacswiki.org/emacs/quick-jump.el

Many thanks.

Update: this problem seems to only happen when the jump is to a different buffer. I don't know enough about with-current-buffer (used in godef--find-file-line-column ) to understand what's going wrong - my reading of the docs is that with-current-buffer shouldn't cause that buffer to be activated at all once the body completes, so I'm at a loss to understand why godef-jump works at all...

Answering my own question, basically, see the PR I made, and the discussion: https://github.com/dominikh/go-mode.el/pull/85

The problem was specific to go-mode, and has now been fixed there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM