protesilaos / denote

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

Prettification of links to Denote attachments #434

Closed pprevos closed 1 month ago

pprevos commented 1 month ago

The denote-retrieve-title-or-filename function returns the raw title string for Denote attachments: (eq (denote-filename-is-note-p file) nil)

So instead of the link title being: this-is-a-denote-attachment, it should be something like: This Is a Denote Attachment.

The titlecase package can help, so I created this helper function:

(defun ews-denote-file-title-to-title-case (title)
  "Convert Denote filename title string to title case."
  (let ((title-deslugged (replace-regexp-in-string "-" " " title)))
    (titlecase--string title-deslugged titlecase-style)))

How can we elegantly add such a function to Denote. Could we advise denote-retrieve-filename-title?

jeanphilippegg commented 1 month ago

I am not sure I understand the use case. In your title, you mention links. Maybe customizing denote-link-description-function is what you are looking for? This user option allows you to specify how your link descriptions are created. You can include some desluggification in there.

pprevos commented 1 month ago

Thanks. I was unaware of this variable. I have created a bespoke function that meets my needs.

jeanphilippegg commented 1 month ago

You're welcome!