From cbabd1dac3b6a809da8332b326daec926c6c5495 Mon Sep 17 00:00:00 2001 From: Spencer Williams Date: Sun, 6 Apr 2025 13:29:08 -0400 Subject: Minor cleanup --- seam.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'seam.el') diff --git a/seam.el b/seam.el index 7ed2f8b..bfac0a0 100644 --- a/seam.el +++ b/seam.el @@ -70,6 +70,9 @@ naming. Must be a function taking two arguments: TITLE and TYPE." (defun seam-html-directories () (mapcar #'car seam-export-alist)) +(defun seam-slugify (title) + (downcase (string-join (string-split title "\\W+" t) "-"))) + (defun seam-lookup-slug (slug) (cl-dolist (type seam-note-types) (let ((file (file-name-concat seam-note-directory type (concat slug ".org")))) @@ -184,9 +187,6 @@ naming. Must be a function taking two arguments: TITLE and TYPE." (let ((completion-ignore-case t)) (apply seam-completing-read-function args))) -(defun seam-slugify (title) - (downcase (string-join (string-split title "\\W+" t) "-"))) - (defun seam-make-note (title &optional type select) (unless type (setq type seam-default-note-type)) @@ -313,9 +313,9 @@ completion prompt is given to choose the type." (let* ((old (buffer-file-name)) (type (seam-get-note-type old t))) (when type - (let* ((title (or (seam-get-title-from-buffer) - (error "Note must have a title"))) - (slug (seam-get-slug-from-buffer)) + (unless (seam-get-title-from-buffer) + (error "Note must have a title")) + (let* ((slug (seam-get-slug-from-buffer)) (new (seam-make-file-name slug type))) (unless (string= old new) ;This is valid because ;`seam-save-buffer' cannot -- cgit v1.2.3