Fixed a stray paren

And fixed some warnings in the resulting code.
This commit is contained in:
Howard Abrams 2024-09-28 08:37:22 -07:00
parent ffe662ced0
commit 809a542e6d

View file

@ -18,6 +18,8 @@ A literate programming configuration file for extending the Journaling capabilit
;; ;;
;; This file is not part of GNU Emacs. ;; This file is not part of GNU Emacs.
;; ;;
;;; Commentary:
;;
;; *NB:* Do not edit this file. Instead, edit the original literate file at: ;; *NB:* Do not edit this file. Instead, edit the original literate file at:
;; ~/other/hamacs/org-journaling.org ;; ~/other/hamacs/org-journaling.org
;; And tangle the file to recreate this one. ;; And tangle the file to recreate this one.
@ -81,7 +83,7 @@ $0
And the code to connect that template to those files: And the code to connect that template to those files:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(ha-auto-insert-file (rx "journal/" (regexp org-journal-rx)) "journal")) (ha-auto-insert-file (rx "journal/" (regexp org-journal-rx)) "journal")
#+END_SRC #+END_SRC
Note that when I create a new journal entry, I want a title that should insert a date to match the file's name, not necessarily the current date (see below). Note that when I create a new journal entry, I want a title that should insert a date to match the file's name, not necessarily the current date (see below).
@ -122,6 +124,7 @@ Capturing a task (that when uncompleted, would then spillover to following days)
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun org-journal-find-location () (defun org-journal-find-location ()
"Create or load a new journal buffer. Used for `org-capture'."
(org-journal-new-entry) (org-journal-new-entry)
(goto-char (point-max))) (goto-char (point-max)))
@ -166,6 +169,8 @@ Given this splitter function, we create a function that takes some sort of opera
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun find-file-number-change (f) (defun find-file-number-change (f)
"Return a filename based on applying F to current buffer.
Where F would be something like `1+' or `1-'."
(let* ((filename (buffer-file-name)) (let* ((filename (buffer-file-name))
(parts (split-string-with-number (parts (split-string-with-number
(file-name-base filename))) (file-name-base filename)))
@ -181,9 +186,8 @@ And this allows us to create two simple functions that can load the "next" and "
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun find-file-increment () (defun find-file-increment ()
"Takes the current buffer, and loads the file that is 'one "Load file that is _one more_ than the file in current buffer.
more' than the file contained in the current buffer. This This requires that the current file contain a number that can be
requires that the current file contain a number that can be
incremented." incremented."
(interactive) (interactive)
(find-file (find-file-number-change '1+))) (find-file (find-file-number-change '1+)))
@ -191,9 +195,8 @@ And this allows us to create two simple functions that can load the "next" and "
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun find-file-decrement () (defun find-file-decrement ()
"Takes the current buffer, and loads the file that is 'one "Load file that is _one less_ than the file in current buffer.
less' than the file contained in the current buffer. This This requires that the current file contain a number that can be
requires that the current file contain a number that can be
decremented." decremented."
(interactive) (interactive)
(find-file (find-file-number-change '1-))) (find-file (find-file-number-change '1-)))