protesilaos / denote

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

`denote-get-identifier-at-point` fails with "Wrong type argument: stringp, denote-link-ol-help-echo" #449

Closed brabalan closed 1 month ago

brabalan commented 2 months ago

In the function denote-get-identifier-at-point, the call to get-text-property position 'help-echo return the symbol denote-link-ol-help-echo. As a consequence, the string-match right after fails as it’s not a string.

protesilaos commented 1 month ago

Oops! This is a regression caused by a change I made (added a :help-echo, which is useful).

Does this work for you?

(defun denote-get-identifier-at-point (&optional point)
  "Return the Denote identifier at point or optional POINT."
  (when-let ((position (or point (point)))
             (face-at-point (get-text-property position 'face))
             (_ (or (eq face-at-point 'denote-faces-link)
                    (member 'denote-faces-link face-at-point))))
    (or (get-text-property position 'denote-link-id)
        (when-let ((link-data (get-text-property position 'htmlize-link))
                   (link (cadr link-data)))
          (string-match denote-id-regexp link)
          (match-string-no-properties 0 link)))))
brabalan commented 1 month ago

Yes, it works, thanks!

protesilaos commented 1 month ago

Very well! I just pushed the change. Closing now.