如何使用组织注释文件?

发布于 2024-12-02 14:03:03 字数 349 浏览 1 评论 0原文

我最近发现了 org-annotate-file。我想用它来注释 pdf 文档或音乐文件或我计算机上的任何其他文件,并将我的注释写入 annotations.org 文件中。我不想在 pdf 中包含注释。但我不明白“访问文件”是什么意思?它必须是 emacs 可以打开的文件吗?

但更一般地说,是否有一个包可以执行以下操作:我以 dired 模式访问一个目录,在我感兴趣的某个主题上标记一堆文件,然后通过一个命令将文件的链接发送到我的annotations.org文件(可能作为标题下的副标题,可能是目录名称),然后我可以在注释文件中写入注释。然后,通过一个命令,我应该能够访问任何文件(组织模式允许)或在外部程序中打开它。这在某些包中可能吗?

谢谢。

I recently found org-annotate-file. I would like to use it to annotate pdf documents or music files or any other files on my computer, and write my annotations in a file annotations.org. I am not looking to include annotations IN the pdf. But what I cannot figure out is what it means to "visit a file"? Does it have to be a file that emacs can open?

But more generally, is there a package that can do something like this: I visit a directory in dired mode, mark a bunch of files on some topic of my interest, and with one command I send links to the files to my annotations.org file (maybe as subheadings under a heading, which may be the directory name), and then I can write the annotations in the annotations file. Then with one command, I should be able to reach any of the files (which org-mode will allow) or open it in an external program. Is this possible in some package?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞笑我太脆弱 2024-12-09 14:03:03

当然是可以做到的。然而,我发现的似乎是 org-annotate-file.el 的实际代码
这里,似乎没有接受注释一个尚未打开的文件(访问的意思是打开的),因为注释的函数使用当前打开的文件作为名称的来源。 org-annotate-file 的当前实现是这样的:

(defun org-annotate-file ()
  "Put a section for the current file into your annotation file"
  (interactive)
  (error-if-no-file)
  (org-annotate-file-show-section))

至少你可以修改它以接受任意文件(如果你提供它):

(defun org-annotate-file (&optional filename)
  "Put a section for the current file into your annotation file"
  (interactive "FFile to tag: ")
  ; if a file is specified, bypass the check for error when no file
  (if filename
     (org-annotate-file-show-section filename)
     (progn
      (error-if-no-file)
      (org-annotate-file-show-section))))

每当你执行 时,都会要求你输入文件名Mx 组织注释文件。

您还必须更改 org-annotate-file-show-section 来接受文件名或缓冲区。第一个让应该是这样的:

(defun org-annotate-file-show-section (&optional buffer-or-file)
  "Visit the buffer named `org-annotate-file-storage-file' and
show the relevant section"
  (let* ((line (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
                 (filename (if (stringp buffer-or-file)
                            buffer-or-file
                            (get-filename buffer-or-file (buffer-file-name))))
                 (link (get-link filename))
         (search-link (org-make-link-string
                       (concat "file:" filename "::" line)
                               (org-annotate-file-prettyfy-desc line))))
        (show-annotations filename link)
.... rest of the code....

可以从这里开始 dired 集成,但我仍然不熟悉 dired API...

编辑:我正在 bitbucket 中创建一个分支来进行修改。我发现该实用程序非常有用,我自己也可能会使用它。我将在这里发布链接。这是: https://bitbucket.org/dsevilla/org-annotate-file/源代码

Of course, it can be done. However, it seems the actual code of org-annotate-file.el, that I found
here, doesn't seem to accept annotating a file that has not been opened (visited means here opened), because the function to annotate uses the current open file as a source for the name. The current implementation of org-annotate-file is this:

(defun org-annotate-file ()
  "Put a section for the current file into your annotation file"
  (interactive)
  (error-if-no-file)
  (org-annotate-file-show-section))

At least you could modify it to accept an arbitrary file (if you provide it):

(defun org-annotate-file (&optional filename)
  "Put a section for the current file into your annotation file"
  (interactive "FFile to tag: ")
  ; if a file is specified, bypass the check for error when no file
  (if filename
     (org-annotate-file-show-section filename)
     (progn
      (error-if-no-file)
      (org-annotate-file-show-section))))

This ask you for a file name whenever you do M-xorg-annotate-file.

You also have to change the org-annotate-file-show-section to accept either a file name or a buffer. The first let should be like this:

(defun org-annotate-file-show-section (&optional buffer-or-file)
  "Visit the buffer named `org-annotate-file-storage-file' and
show the relevant section"
  (let* ((line (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
                 (filename (if (stringp buffer-or-file)
                            buffer-or-file
                            (get-filename buffer-or-file (buffer-file-name))))
                 (link (get-link filename))
         (search-link (org-make-link-string
                       (concat "file:" filename "::" line)
                               (org-annotate-file-prettyfy-desc line))))
        (show-annotations filename link)
.... rest of the code....

dired integration can be started from here, but I'm still not familiar with the dired API...

EDIT: I'm creating a branch in bitbucket for that modifications. I find the utility very useful and might use it myself. I'll post the link here. And here it is: https://bitbucket.org/dsevilla/org-annotate-file/src

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文