1

我设置了一些书签来跳转到dired缓冲区。C-x r b以前,Emacs 会在点击召回书签后在 minibuffer 中为我提供一个小的(内联)候选列表,但在我的.emacs文件被黑客入侵以将其拆分为模块之后,候选列表已经消失。

我假设我无意中更改了一些与idoor相关的设置autocomplete,我都使用了这两个设置,但我无法弄清楚它是什么。有人可以提出解决方案吗?[编辑:书签仍然存在,如果我输入书签的名称,我可以跳转到它们,但没有提示列表。如果我按 TAB,我会得到一个包含完成候选的缓冲区,但我没有将它们放入 minibuffer。]

小缓冲区

以前我会得到这个:

小缓冲区2

我认为这与我从Scott Frazer复制的以下一组函数有关。

(require 'bookmark)

(defun my-ido-bookmark-jump ()
  "Jump to bookmark using ido"
  (interactive)
  (let ((dir (my-ido-get-bookmark-dir)))
    (when dir
      (find-alternate-file dir))))

(defun my-ido-get-bookmark-dir ()
  "Get the directory of a bookmark."
  (let* ((name (ido-completing-read "Use dir of bookmark: " (bookmark-all-names) nil t))
         (bmk (bookmark-get-bookmark name)))
    (when bmk
      (setq bookmark-alist (delete bmk bookmark-alist))
      (push bmk bookmark-alist)
      (let ((filename (bookmark-get-filename bmk)))
        (if (file-directory-p filename)
            filename
          (file-name-directory filename))))))

(defun my-ido-dired-mode-hook ()
  (define-key dired-mode-map "$" 'my-ido-bookmark-jump))

(add-hook 'dired-mode-hook 'my-ido-dired-mode-hook)


(defun my-ido-use-bookmark-dir ()
  "Get directory of bookmark"
  (interactive)
  (let* ((enable-recursive-minibuffers t)
         (dir (my-ido-get-bookmark-dir)))
    (when dir
      (ido-set-current-directory dir)
      (setq ido-exit 'refresh)
      (exit-minibuffer))))

;;define-key ido-file-dir-completion-map (kbd "$") 'my-ido-use-bookmark-dir)

(add-hook 'ido-setup-hook 'ido-my-keys)
(defun ido-my-keys ()
"Add my keybindings for ido."
(define-key ido-file-dir-completion-map (kbd "$") 'my-ido-use-bookmark-dir))
4

1 回答 1

4

尝试这个

(global-set-key (kbd "C-x r b")
    (lambda ()
      (interactive)
      (bookmark-jump
       (ido-completing-read "Jump to bookmark: " (bookmark-all-names)))))
于 2013-10-19T06:58:35.150 回答