aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-13 06:32:08 -0500
committerCraig Jennings <c@cjennings.net>2026-05-13 06:32:08 -0500
commit2db16de600c0edc7bbe723f97041f1a46bd4a611 (patch)
treecd8b7fe183708e4d377b71f8482067e05aabdadb /modules
parent0128bf4fec65ba73b084e70061a54ff1e67e7b63 (diff)
downloaddotemacs-2db16de600c0edc7bbe723f97041f1a46bd4a611.tar.gz
dotemacs-2db16de600c0edc7bbe723f97041f1a46bd4a611.zip
fix(calibredb-epub): point cj/nov--file-path at nov-file-name
The fallback chain was checking `nov-epub-filename` and `nov-epub-file`, but neither symbol exists in nov.el — the real var is `nov-file-name`, set by `nov-mode` from the visited file. Both `boundp` arms always returned nil, so the fallbacks were dead code. The bug was dormant rather than active: `buffer-file-name` always holds the EPUB path for normal nov buffers and covered the first arm of the `or`. I replaced both wrong-named arms with a single live arm on `nov-file-name`, and added a Boundary test that exercises it.
Diffstat (limited to 'modules')
-rw-r--r--modules/calibredb-epub-config.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/calibredb-epub-config.el b/modules/calibredb-epub-config.el
index c1dba8b5b..bf9ec97ea 100644
--- a/modules/calibredb-epub-config.el
+++ b/modules/calibredb-epub-config.el
@@ -322,12 +322,12 @@ computed column based on the window text area width."
(t v))))
(defun cj/nov--file-path ()
- "Return the current EPUB file path when in nov-mode, or nil."
+ "Return the current EPUB file path when in nov-mode, or nil.
+Falls back to nov's own `nov-file-name' (set by `nov-mode' from the visited
+file) so the function still resolves when `buffer-file-name' has been cleared."
(when (derived-mode-p 'nov-mode)
- ;; In nov, the buffer visits the .epub; buffer-file-name is usually the EPUB.
(or buffer-file-name
- (and (boundp 'nov-epub-filename) nov-epub-filename)
- (and (boundp 'nov-epub-file) nov-epub-file))))
+ (and (boundp 'nov-file-name) nov-file-name))))
(defun cj/nov-jump-to-calibredb ()
"Open CalibreDB focused on the current EPUB's book entry.