diff options
author | Spencer Williams <spnw@plexwave.org> | 2025-07-06 20:01:25 -0400 |
---|---|---|
committer | Spencer Williams <spnw@plexwave.org> | 2025-07-06 20:10:34 -0400 |
commit | 3f10699d75dafa7266340b8eb0a2e0fb12b6540a (patch) | |
tree | 0bde0709bdfba5315d229c7b35df3bc1b99ad1a1 | |
parent | f4b1e329fc6e3878bfff648649f5d654b1f2808c (diff) |
Use helper to retrieve slugs from filenames
-rw-r--r-- | lisp/seam-export.el | 2 | ||||
-rw-r--r-- | lisp/seam.el | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/lisp/seam-export.el b/lisp/seam-export.el index 71a7921..b5d7046 100644 --- a/lisp/seam-export.el +++ b/lisp/seam-export.el @@ -239,7 +239,7 @@ notes)." (defun seam-export--note-to-html (note-file html-directory) (seam-ensure-directory-exists html-directory) (let ((html-file (file-name-concat html-directory - (concat (file-name-base note-file) ".html"))) + (concat (seam-get-slug-from-file-name note-file) ".html"))) (modified (file-attribute-modification-time (file-attributes note-file)))) (with-temp-buffer diff --git a/lisp/seam.el b/lisp/seam.el index 2824fc7..a5b0b0d 100644 --- a/lisp/seam.el +++ b/lisp/seam.el @@ -172,6 +172,9 @@ naming. Must be a function taking two arguments: TITLE and TYPE." (insert-file-contents file) (seam-get-title-from-buffer))) +(defun seam-get-slug-from-file-name (file) + (string-remove-prefix "-" (file-name-base file))) + (cl-defun seam-get-slug-from-buffer (&optional (buffer (current-buffer))) (or (with-current-buffer buffer (save-mark-and-excursion @@ -295,11 +298,12 @@ completion prompt is given to choose the type." (seam-get-links-from-buffer))) (defun seam-delete-html-files-for-note (note-file) - (dolist (dir (seam-html-directories)) - (let ((html (file-name-concat dir (concat (file-name-base note-file) ".html")))) - (when (file-exists-p html) - (delete-file html) - (message "Deleted %s" html))))) + (let ((html-nd (concat (seam-get-slug-from-file-name note-file) ".html"))) + (dolist (dir (seam-html-directories)) + (let ((html (file-name-concat dir html-nd))) + (when (file-exists-p html) + (delete-file html) + (message "Deleted %s" html)))))) (defun seam--rename-file (old new interactive) (rename-file old new) |