Pick title from the first fire words/characters from the file #630
Replies: 2 comments 4 replies
-
|
Do you mean when renaming a file? Not out of the box. The following hack works by putting the words in future history (accesed with (defvar my/denote-word-limit 10
"Number of words taken to create file title.")
(defun my/denote-get-words ()
"Return the first `my/denote-word-limit' words from current note."
(save-excursion
(goto-char (point-min))
(when (denote--file-has-front-matter-p
buffer-file-name
(denote-filetype-heuristics buffer-file-name))
(forward-line 5)) ; change if you changed default front matter!
(let ((n (line-number-at-pos))
(p (point))
string)
(save-excursion
(forward-word my/denote-word-limit)
(if (eq (line-number-at-pos) n)
(setq string (buffer-substring-no-properties p (point)))
(goto-char p)
(buffer-substring-no-properties (point) (line-end-position)))))))
(defun my/denote-rename-file-with-words ()
"Like `denote-rename-file', but put first words into future history for title."
(interactive)
(let ((denote-title-prompt-current-default (my/denote-get-words)))
(call-interactively #'denote-rename-file))) |
Beta Was this translation helpful? Give feedback.
-
|
You can disable all prompts with The core of Denote is its file-naming scheme though. If your files do not have meaningful names, then the only advantage left of Denote is the linking. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Sorry if this has been asked or discussed earlier. I want to know if it would be possible to have denote pick file name in the following manner.
This is what I have seen Apple Notes, Notion, etc. seem to be doing and feels like the right approach for me as I am not pressed on to provide the name upfront.
Beta Was this translation helpful? Give feedback.
All reactions