修改notmuch的tag名称

作为emacs中的邮件客户端,notmuch有很多内置的标签,比如inbox,unread之类的。

但是有些tag的名称太长了,比如attachment之类的,导致邮件列表的总是折行,所以想重新命名标签,比如,用‘A’来代替attachment。找了一下,发现notmuch并没有提供标签重命名的接口。

通过google找到了notmuch-labeler,可以达到重新命名标签的目的。例如:

(notmuch-labeler-rename "attachment" "A" ':foreground "blue")

但是,安装了这个包之后,每次启动emacs都会出现如下警告。

Warning (bytecomp): reference to free variable ‘notmuch-search-query-string’

虽然不影响使用,但还是想把这个问题解决掉。大家有知道的吗?

Tags special to notmuch

这边有提哪些tag可以配置哪些不可以哦

这个也可以看下 Approaches to initial tagging of messages

(use-package notmuch-labeler
  :commands notmuch-labeler-rename
  :after notmuch
  :config
  (notmuch-labeler-rename "unread" "new" ':foreground "blue"))

如果你用 use-package 的话 加个

:after notmuch

主要是在notmuch 加载之后 执行 notmuch-labeler-rename

测试可行。之前都不知道这个package

我用的就是use-package。按照你的方法,启动notmuch后,notmuch-labeler-rename没有自动加载。通过load-library手动加载notmuch-labeler-rename之后,一切正常,没有出现警告。

能不能启动notmuch的时候,自动加载这个包?

你有设置 always-defer 没有? (setq use-package-always-defer t)

如果有的话

要加一行

:defer nil

(use-package notmuch-labeler
  :commands notmuch-labeler-rename
  :after notmuch
  :defer nil
  :config
  (notmuch-labeler-rename "unread" "new" ':foreground "blue"))

这样 notmuch 加载后就会自动加载这个包

我没有设置always-defer。

BTW,我的notmuch是直接用的系统包,不是通过elpa安装的。不知道是不是与此有关。

我用的也是系统包。我的配置就这些。 其他的就不知道了

(use-package notmuch
  :load-path "/usr/share/emacs/site-lisp"
  :commands notmuch
  :defer t
  :config
  ;; all notmuch config here
  )

(use-package notmuch-labeler
  :commands notmuch-labeler-rename
  :after notmuch
  :defer nil
  :config
  (notmuch-labeler-rename "unread" "new" ':foreground "blue"))

多谢你的回复!

我之前把notmuch-labeler的配置写到了notmuch配置的 :config 下面了。现在把notmuch-labeler的配置拿出来,就没有警告了。

BTW,安装notmuch-labeler之后,notmuch作为依赖又安装了一遍。。。

1 个赞