protesilaos / denote

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

`denote-rename-buffer-mode` and `nov.el` #229

Closed arsaber101 closed 7 months ago

arsaber101 commented 8 months ago

Hi Prot,

First, thanks for your packages, and most of all thanks for your wonderful documentation, a life saving for illiterates in programming languages like me.

I stumble upon something that might be a bug with denote-rename-buffer-mode when i am visiting .epub files in emacs with the nov.el library.

My setup :

The issue disappears.

So my question is, far out my comfort zone : might it be possible for the user to disable the hook to denote-rename-buffer functions for some file-types ?

Thanks again, Bernard

protesilaos commented 7 months ago

Hello @arsaber101!

I just pushed a change. Can you evaluate the following and then try to open an epub file?

(defun denote-rename-buffer (&optional buffer)
  "Rename current buffer or optional BUFFER with `denote-rename-buffer-format'.
The symbol of this function is the default value of the user
option `denote-rename-buffer-function' and is thus used by the
`denote-rename-buffer-mode'."
  (when-let ((file (buffer-file-name buffer))
             ((denote-file-has-identifier-p file))
             (new-name (denote-rename-buffer--format (or buffer (current-buffer))))
             ((not (string-blank-p new-name))))
    (rename-buffer new-name :unique)))
arsaber101 commented 7 months ago

It works. Perfect. Thanks again.

protesilaos commented 7 months ago

You are welcome! Closing now.