如何在 emacs 的模式行中显示书签的名称(来自“书签”或“书签+”),而不是文件名?
问问题
111 次
1 回答
1
一个有点奇怪的请求,但你去(适用于文件和 dired 缓冲区):
(defun show-bookmarks-mode-line ()
(interactive)
(let (bname text)
(and
(setq bname (if (eq major-mode 'dired-mode)
default-directory
(buffer-file-name)))
(setq bname (expand-file-name bname))
(setq text
(delq nil
(mapcar
(lambda (x)
(and (equal bname
(expand-file-name
(bookmark-get-filename x)))
(substring-no-properties (car x))))
bookmark-alist)))
(setq text
(mapconcat
#'identity
text
", "))
(let ((mode-line-buffer-identification
(propertize text 'face 'mode-line-buffer-id)))
(force-mode-line-update)
(sit-for 5))
(force-mode-line-update))))
你能详细说明你为什么需要它吗?
于 2013-07-19T19:15:00.910 回答