自动跳转到Emacs中的标记

use*_*592 3 emacs etag ctags

我想find-tag自动接受默认选项(即点上的单词)并跳转到标签位置而不提示.

这可能吗?

我也在使用来自Emacswiki的建议版本的find-tag,如果匹配重新运行ctags.所以我想要这样的事情:

is current word a known tag?
-> yes: jump to it without further confirmation
-> no: rerun ctags
is it known now?
-> yes: jump to it without further confirmation
-> no: prompt user for input
Run Code Online (Sandbox Code Playgroud)

谢谢!

Mic*_*rth 5

这是谷歌"查找标签emacs没有提示"的热门点击之一.对于简单版本 - 没有海报提到的ctag-regeneration逻辑 - 似乎关键是:

(find-tag (find-tag-default))
Run Code Online (Sandbox Code Playgroud)

所以,对我来说,这是有效的:

(defun find-tag-no-prompt ()
  "Jump to the tag at point without prompting"
  (interactive)
  (find-tag (find-tag-default)))
;; don't prompt when finding a tag
(global-set-key (kbd "M-.") 'find-tag-no-prompt)
Run Code Online (Sandbox Code Playgroud)