Emacs主题标签(#tagsLikeThisOne)自动补全

达科·德拉斯科维奇(Darko Draskovic)

我在阅读书籍,文章等时(主要是人文学科)使用Emacs进行标签标记。我想知道Emacs是否可以自动构建输入的主题标签列表(可能在单独的文件中)?另外,当我开始输入井号标签时,Emacs可以从假设列表中读取内容吗?提供增量(或制表符)自动补全功能。我需要此功能才能具有一致的标记。

谢谢!

亚历克斯·沃罗比耶夫(Alex Vorobiev)

您可以使用Exuberant ctags生成TAGS文件。例如,如果您的笔记处于组织模式,则可以执行以下操作:

(require 'org-ctags)
(setq org-ctags-path-to-ctags "/path/to/ctags")

;; Regular expression for the hashtags.
;; Nnote that this would remove the existing definition and effectively disable 
;; the standard use of org-ctags which is to tag <<links>>. If you want to preserve old
;; behavior you need to combine the two regexes.
(setq org-ctags-tag-regexp "/(#[^+]+)/\\1/d,definition/")

(org-ctags-create-tags "directory")

现在,您可以使用org-ctags-find-tag-interactive来搜索声称具有自动补全功能的标签:

(add-hook 'org-mode-hook
    (lambda ()
      (define-key org-mode-map "\C-co" 'org-ctags-find-tag-interactive)))

但是我更喜欢Helm完成,所以我就这样做M-x helm-etags-select您也可以忽略org-ctags和自己构建TAGS:

 ctags --langdef=orgmode --langmap=orgmode:.org
       --regex-orgmode="/(#[^+]+)/\1/d,definition/"
       -f /your/path/TAGS -e -R /your/path/*.org

(或创建一个方便的emacs函数来为您完成此操作)。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章