Comments (7)
Thank you @tjstankus! I just pushed the changes. Please let me know if it now works for you.
from denote.
Thank you for addressing this so quickly @protesilaos! Unfortunately, I'm still hitting the same issue after updating. To provide more context, I'm using doom-emacs and the denote-specific part of my config looks like this:
;; denote
(require 'denote)
(require 'denote-org-dblock)
(setq denote-directory (expand-file-name "~/Dropbox/org/denote"))
(require 'denote-journal-extras)
;; Set to nil to prompt for title
(setq denote-journal-extras-title-format nil)
In the meantime, there's a straightforward workaround:
(setq denote-journal-extras-title-format 'day-date-month-year)
- edit file front matter
denote-rename-file-using-front-matter
from denote.
Oh, this is strange! Could it be that there was some old code kept around during your session and the new one will take effect upon restart? I can no longer reproduce the error: it works as expected on my end.
Screenshots below.
Ordinary prompt for title, with current date as the default value
User input at the prompt
The resulting buffer
from denote.
Thanks @protesilaos! I'm still seeing the issue. Again, not a big deal because I can work around it like I mentioned. And it may very well be something in my config. I recorded this video showing the issue on my machine - maybe it will help. Thank you for your generous work on this package!
from denote.
Thank you @tjstankus! I could not reproduce your issue, though I still rewrote the helper function. Here is its current implementation:
(defun denote-journal-extras-daily--title-format ()
"Return `denote-journal-extras-title-format' or prompt for title."
(format-time-string
(if (and denote-journal-extras-title-format
(stringp denote-journal-extras-title-format))
denote-journal-extras-title-format
(pcase denote-journal-extras-title-format
('day "%A")
('day-date-month-year "%A %e %B %Y")
('day-date-month-year-24h "%A %e %B %Y %H:%M")
('day-date-month-year-12h "%A %e %B %Y %I:%M %^p")
(_ (denote-title-prompt (format-time-string "%F")))))))
I also wrote this test for it:
(ert-deftest denote-test--denote-journal-extras-daily--title-format ()
"Make sure that `denote-journal-extras-daily--title-format' yields the desired format."
(should (and
;; These three should prompt, but I am here treating the
;; prompt as if already returned a string. The test for
;; the `denote-title-prompt' can be separate.
(stringp
(cl-letf (((symbol-function 'denote-title-prompt) #'identity)
(denote-journal-extras-title-format nil))
(denote-journal-extras-daily--title-format)))
(stringp
(cl-letf (((symbol-function 'denote-title-prompt) #'identity)
(denote-journal-extras-title-format t))
(denote-journal-extras-daily--title-format)))
(stringp
(cl-letf (((symbol-function 'denote-title-prompt) #'identity)
(denote-journal-extras-title-format :some-arbitrary-keyword))
(denote-journal-extras-daily--title-format)))
;; And these return the following values
(string-match-p
"\\<.*?\\>"
(let ((denote-journal-extras-title-format 'day))
(denote-journal-extras-daily--title-format)))
(string-match-p
"\\<.*?\\> [0-9]\\{,2\\} \\<.*?\\> [0-9]\\{,4\\}"
(let ((denote-journal-extras-title-format 'day-date-month-year))
(denote-journal-extras-daily--title-format)))
(string-match-p
"\\<.*?\\> [0-9]\\{,2\\} \\<.*?\\> [0-9]\\{,4\\} [0-9]\\{,2\\}:[0-9]\\{,2\\} \\<.*?\\>"
(let ((denote-journal-extras-title-format 'day-date-month-year-12h))
(denote-journal-extras-daily--title-format)))
(string-match-p
"\\<.*?\\> [0-9]\\{,2\\} \\<.*?\\> [0-9]\\{,4\\} [0-9]\\{,2\\}:[0-9]\\{,2\\}"
(let ((denote-journal-extras-title-format 'day-date-month-year-24h))
(denote-journal-extras-daily--title-format))))))
You can try the test by checking if the following returns a non-nil value (a 0
still counts as non-nil):
(and
;; These three should prompt, but I am here treating the
;; prompt as if already returned a string. The test for
;; the `denote-title-prompt' can be separate.
(stringp
(cl-letf (((symbol-function 'denote-title-prompt) #'identity)
(denote-journal-extras-title-format nil))
(denote-journal-extras-daily--title-format)))
(stringp
(cl-letf (((symbol-function 'denote-title-prompt) #'identity)
(denote-journal-extras-title-format t))
(denote-journal-extras-daily--title-format)))
(stringp
(cl-letf (((symbol-function 'denote-title-prompt) #'identity)
(denote-journal-extras-title-format :some-arbitrary-keyword))
(denote-journal-extras-daily--title-format)))
;; And these return the following values
(string-match-p
"\\<.*?\\>"
(let ((denote-journal-extras-title-format 'day))
(denote-journal-extras-daily--title-format)))
(string-match-p
"\\<.*?\\> [0-9]\\{,2\\} \\<.*?\\> [0-9]\\{,4\\}"
(let ((denote-journal-extras-title-format 'day-date-month-year))
(denote-journal-extras-daily--title-format)))
(string-match-p
"\\<.*?\\> [0-9]\\{,2\\} \\<.*?\\> [0-9]\\{,4\\} [0-9]\\{,2\\}:[0-9]\\{,2\\} \\<.*?\\>"
(let ((denote-journal-extras-title-format 'day-date-month-year-12h))
(denote-journal-extras-daily--title-format)))
(string-match-p
"\\<.*?\\> [0-9]\\{,2\\} \\<.*?\\> [0-9]\\{,4\\} [0-9]\\{,2\\}:[0-9]\\{,2\\}"
(let ((denote-journal-extras-title-format 'day-date-month-year-24h))
(denote-journal-extras-daily--title-format))))
from denote.
@protesilaos I updated again and it works - thank you!
from denote.
Very well! We can safely close this. Thank you!
from denote.
Related Issues (20)
- Prevent newline between front matter and templates HOT 2
- question: why IDENTIFIER and not ID HOT 2
- New fontification is not limited to Denote files HOT 3
- Identifier showing up in keyword section when creating/renaming denote files HOT 2
- Ignored Files Regexp HOT 9
- Denote disappears after doom emacs is restarted HOT 2
- Dynamic block is not working HOT 3
- Nested dynamic blocks breaks the update functionality HOT 4
- denote-journal-extras-new-or-existing-entry creates new file every time HOT 9
- Merging 2 notes into 1 HOT 3
- denote-file-prompt shouldn't match archive files ? HOT 3
- denote-add-links doesn't use titles as descriptions inside silos HOT 9
- Denote seems to interfere with magit on Emacs 29.3 HOT 2
- Show entries in Calendar HOT 1
- Rename existing files after changes to denote-file-name-components-order? HOT 3
- markdown links in org files are opened in an external app HOT 4
- `denote-rename-buffer-mode` breaks Org capture detection HOT 6
- Support using functions in `denote-templates` HOT 4
- Title as first element causes shell problems due to leading `--` HOT 6
- Proposal: add frontmatter normalization functions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from denote.