org-noter 无法自由选择创建笔记的目录

问题

我希望 org-noter 可以固定一个文件路径,但是现在似乎只能在给定的路径下创建

我的尝试

下面是我的配置

  (setq org-noter-notes-search-path '("~/Documents/org/notes/"))
  (setq org-noter-highlight-selected-text t)
  (setq org-noter-max-short-selected-text-lenght 20)

  (require 'org-noter)

  (define-key global-map (kbd "C-c n n") 'org-noter)

  (define-key org-noter-doc-mode-map (kbd "e") 'org-noter-insert-note) ;; 加入左手键位
  (define-key org-noter-doc-mode-map (kbd "M-e") 'org-noter-insert-precise-note) ;; 加入左手键位

  (provide 'init-org-noter)

我查看了 org-noter 的变量表,也询问了 AI,认为应该按照 org-noter-notes-search-path 创建,但是这个目录并没有出现在可选择的路径下

不知道我的理解是否有偏差,向各位大佬请教

;;;org-pdf 笔记
(use-package org-noter
  :defer t
  :ensure t
  :custom
  (org-noter-auto-save-last-location t);自动保存上次位置
  (org-noter-highlight-selected-text t);选中文字后插入笔记自动高亮
  (org-noter-max-short-selected-text-length 35) ;长短文本标准默认为 80
  (org-noter-default-heading-title "第 $p$ 页的笔记");默认短标题格式
  :init
  (setq org-noter-notes-search-path '("~/org/roam/pdfnotes/"));设置笔记搜索路径
   ;; (defun my-org-noter-notes-mode-hook ()
   ;;  "在进入 org-noter-notes-mode 时,在 org-noter-notes buffer 开头调用 org-id-get-create 函数和 org-roam-tag-add;可以实现org-roam搜索."
   ;;  (save-excursion
   ;;    (goto-char (point-min))
   ;;    ;;(org-id-get-create)
   ;;    (org-roam-tag-add '("pdfnotes"))
   ;;    ))

  ;; (add-hook 'org-noter-notes-mode-hook 'my-org-noter-notes-mode-hook)

  (defun org-noter-list-notes ()
    "List of notes in Org-Noter Directories."
    (interactive)
    (let* ((directories org-noter-notes-search-path)
           (buffer (get-buffer-create "*List of notes in Org-Noter Directories*")))
      (with-current-buffer buffer
	;; 开启 org-mode
	(org-mode)
	(erase-buffer)
	(dolist (dir directories)
          (let ((files (directory-files dir nil nil nil)))
            (dolist (file files)
              ;; 过滤掉. 和..
              (when (and (not (string= file "."))
			 (not (string= file "..")))
		;; 生成 org 格式的链接
		(let ((file-path (expand-file-name file dir)))
                  (insert (format "[[file:%s][%s]]\n" file-path (file-name-nondirectory file))))))))
	(goto-char (point-min))
	(set-buffer-modified-p nil)
	(display-buffer buffer))))
  :bind
  (("C-c n n" . org-noter) ;; 与 org-roam 配合
   :map org-noter-doc-mode-map ;; 加入左手键位
   ("e" . org-noter-insert-note)
   ("M-e" . org-noter-insert-precise-note))
  )

我和你的设置差不多,但是可以实现在目标路径下创建 notes

这是你的minibuffer补全框架的问题,有一些补全框架按RET只能选择当前补全列表的候选项,需要按另一个组合键才能使用输入作为选项。

哈哈,我现在使用了另一个方法,先随意创建一个 org noter 的模板,然后打开 org noter 会提示找不到文件,然后就会让我指明文件的路径了。

1 个赞