获取emacs中所有标签的列表

发布于 2024-10-21 23:35:13 字数 176 浏览 3 评论 0原文

有没有办法从标签表列表中定义的文件中获取所有标签?我已经像这样设置了标签文件:

(setq tags-table-list '("~/project/TAGS"))

我尝试了 (tags-completion-table),但它不包含所有标签。

Is there a way to get all of the tags from the files defined in your tags table list? I've set my tags file like this:

(setq tags-table-list '("~/project/TAGS"))

I've tried (tags-completion-table), but it doesn't contain all the tags.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一曲爱恨情仇 2024-10-28 23:35:13

如果您只有一个 TAGS 文件,则 Mx Visit-tags-table ~/project/TAGS(visit-tags-table "~/project/TAGS" ) 应该将 TAGS 表加载到缓冲区中,这意味着 Emacs 可以以与 Mx Tags-search 相同的方式访问它。

如果您向项目添加更多 TAGS 文件或有多个项目,(setq Tags-table-list '("~/project1/TAGS" "~/Project2/TAGS" ...)) 并执行 (visit-tags-table-buffer t) 应在每次调用时访问下一个表,直到列表末尾。

编辑:

(defvar buffer-in-string)
(defvar string-list)
(defun write-buffer-to-string ()
  (interactive)
  (setq buffer-in-string (buffer-substring (point-min) (point-max)))
  (kill-buffer) ;; If the buffer is big, it makes sense to kill it,
                ;; since its contents are copied into the string anyway
  (setq string-list (split-string buffer-in-string " "))
)

这应该将缓冲区放入字符串中。应该有一种更优雅的方式,但目前,这是我以我非常有限的 elisp 流利程度所能写出的最多的方式。

If you got only one TAGS file, M-x visit-tags-table ~/project/TAGS or (visit-tags-table "~/project/TAGS") should load the TAGS table into a buffer which means it becomes accessible to Emacs in the same way it would be used for, M-x tags-search.

If you add more TAGS files to the project or have more than one project, (setq tags-table-list '("~/project1/TAGS" "~/Project2/TAGS" ...)) and doing (visit-tags-table-buffer t) should visit the next table each time it is called, until the end of the list.

EDIT:

(defvar buffer-in-string)
(defvar string-list)
(defun write-buffer-to-string ()
  (interactive)
  (setq buffer-in-string (buffer-substring (point-min) (point-max)))
  (kill-buffer) ;; If the buffer is big, it makes sense to kill it,
                ;; since its contents are copied into the string anyway
  (setq string-list (split-string buffer-in-string " "))
)

That should bring the buffer into a string. There should be a more elegant way, but at the moment, this is the most I could write with my very limited elisp fluency.

你的心境我的脸 2024-10-28 23:35:13

函数tags-completion-table为您提供了一个可供使用的完成表。从文档字符串:

按需构建“tags-completion-table”。
完成表中包含的标签是当前的标签
标签表及其(递归)包含的标签表。

并且tags-lazy-completion-table为您提供了一个可供使用的完成函数。它使用tags-completion-table

Function tags-completion-table gives you a completion table to use. From the doc string:

Build 'tags-completion-table' on demand.
The tags included in the completion table are those in the current
tags table and its (recursively) included tags tables.

And tags-lazy-completion-table gives you a completion function to use. It uses tags-completion-table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文