protesilaos / denote

Simple notes for Emacs with an efficient file-naming scheme
https://protesilaos.com/emacs/denote
GNU General Public License v3.0
545 stars 55 forks source link

Cannot insert links in org indirect buffer #418

Closed coherentstate closed 3 months ago

coherentstate commented 3 months ago

Hi Prot,

Thanks for developing this awesome package!

Recently I came across the following issue. Steps to reproduce:

  1. Open a denote file.
  2. Go to a heading and invoke org-tree-to-indirect-buffer.
  3. Invoke denote-link-or-create.

This leads to the error The current file type is not recognized by denote.

Best, Abhirup

protesilaos commented 3 months ago

From: coherentstate @.***> Date: Fri, 30 Aug 2024 10:17:25 -0700

Hi Prot,

Hello Abhirup,

Thanks for developing this awesome package!

You are welcome!

Recently I came across the following issue. Steps to reproduce:

  1. Open a denote file.
  2. Go to a heading and invoke org-tree-to-indirect-buffer.
  3. Invoke denote-link-or-create.

This leads to the error The current file type is not recognized by denote.

Indeed. We are checking if the buffer is backed by a file, but we have some exceptions for Org.

Can you evaluate the following and try again?

(defun denote--file-type-org-extra-p ()
  "Return non-nil if this is an `org-capture' or Org Note buffer."
  (and (derived-mode-p 'org-mode)
       (or (and (bound-and-true-p org-capture-mode)
                (string-match-p "\\`CAPTURE-.*" (buffer-name)))
           (string-match-p "\\`\\*Org Note\\*" (buffer-name))
           (null buffer-file-name))))

-- Protesilaos Stavrou https://protesilaos.com

coherentstate commented 3 months ago

Thanks for the quick response. I evaluated the function and its working.

protesilaos commented 3 months ago

Great! I just pushed the change.