-->

emacs的流量可我掌舵,找到默认目录预先指定?(emacs ow can I helm-find

2019-10-21 16:52发布

我用emacs的主要注意事项。 我所有的笔记中:〜/ Dropbox的/ UNI /注意事项

我想打一个快捷键(例如C-F12)做掌舵人,发现总是从上面DIR无关源缓冲区的。

我努力了:

(global-set-key (kbd "C-<f2>") (lambda () (interactive) (helm-find "~/Dropbox/Uni/Notes/")))

但是,当我运行它,它仍然会提示我要“DefaultDirectory”这通常是与当前的缓冲区。

[编辑]
我做了一个破解办法:

(global-set-key (kbd "<C-f2>")
    (lambda ()
      (interactive)
      (find-file "~/Dropbox/Uni/Notes/leo.org")
      (helm-find nil)))

打开一个文件,然后当我做了掌舵找到的,它是相对于leo.org的位置。 但是,一个更好的解决方案将是首选。

[编辑]以下解决方案完美的作品。

Answer 1:

干得好:

(defmacro helm-find-note (dir)
  `(defun ,(intern (format "helm-find-note-%s" dir)) ()
     (interactive)
     (let ((default-directory ,dir))
       (helm-find nil))))

(global-set-key (kbd "C-M-3") (helm-find-note "~/Downloads"))


文章来源: emacs ow can I helm-find with default directory pre-specified?