在Emacs中自动跳转到标记

在Emacs中自动跳转到标记,emacs,ctags,etag,Emacs,Ctags,Etag,我想让find tag自动接受默认选项(即点上的单词),并在没有提示的情况下跳转到标记位置 这可能吗 我还使用了Emacswiki中建议的find标记版本,以防匹配重新运行CTAG。所以我想要这样的东西: is current word a known tag? -> yes: jump to it without further confirmation -> no: rerun ctags is it known now? -> yes: jump to it withou

我想让
find tag
自动接受默认选项(即点上的单词),并在没有提示的情况下跳转到标记位置

这可能吗

我还使用了Emacswiki中建议的find标记版本,以防匹配重新运行CTAG。所以我想要这样的东西:

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

谢谢大家!

这是我的CTAG设置,非常适合我。我向你借的

PS:您可能需要这些:

git://github.com/jrockway/eproject.git
git://github.com/emacsmirror/etags-select.git

嗯,我找到了一个黑客解决方案:

;; auto jump
(global-set-key (kbd "C-x C-M->") 'find-tag) ; bind to some unused placeholder
(global-set-key (kbd "M-.") (kbd "C-x C-M-> <return>"))
;;自动跳转
(全局设置键(kbd“C-x C-M->”)的查找标记);绑定到某个未使用的占位符
(全局设置键(kbd“M-”)(kbd“C-x C-M->”))
首先将find标记绑定到一些您永远不会使用的伪绑定(这一步是避免无限循环所必需的)。然后将
M-.
绑定到此新绑定+


丑陋,但有效。。。如果有人有更好的答案(包括原始问题中描述的失败搜索的处理),我将保留问题的开放性。

这里有一个稍微修改的版本,它加载依赖的gems(在ruby on rails中很有用)


这是谷歌上最热门的“find tags emacs no prompt”(查找标签emacs no prompt)之一。对于这个简单的版本,没有海报中提到的ctag再生逻辑,关键似乎是:

(find-tag (find-tag-default))
所以,对我来说,这是可行的:

(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)

默认情况下,Emacs 25会执行此操作
M-。
xref find definitions
)跳转到定义,然后
M-,
xref pop marker stack
)弹回来。

谢谢。我会试着看一看,虽然我更喜欢没有eproject的解决方案…我试过你的设置,它会在项目根目录中创建一个标记文件,但当我在树中更深的文件上创建标记文件时,它会抱怨没有标记文件。如果我在该目录中创建一个,它会工作,但会为每个唯一的标记提供2个匹配项(可能是因为2个标记文件?)。因此,我要么得到0个匹配项,要么得到2个匹配项,但无法使其正常工作。。。有什么想法吗?原因是什么?作为etags的作者,我可以建议。我真的应该给那些东西自己的GitHub页面…把我的评论移到一个答案而不是为我工作!emacs再次询问标签,这让我非常恼火。伟大的
(find-tag (find-tag-default))
(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)