bastibe/org-journal

`org-journal-new-entry` insert duplicate header on narrowed journal buffer

Opened this issue · 0 comments

Describe the bug
org-journal-new-entry insert duplicate header on narrowed journal buffer

To Reproduce

$ emacs -Q -l /path/to/org-journal.el
;; M-x eval-expression RET (  shortcut M-:  )
(progn
  (call-interactively 'org-journal-new-entry)
  (end-of-buffer)
  (shr-ensure-newline)
  (skip-chars-backward "[ \n]")
  ;; narrow down to last entry
  (narrow-to-region (pos-bol) (point-max))
  (call-interactively 'org-journal-new-entry)
  (widen)
)

buffer content

* Sunday, 03/31/2024
** 17:41 
* Sunday, 03/31/2024
** 17:41

Expected behavior
do NOT insert duplicate daily header, widen before calling function

* Sunday, 03/31/2024
** 17:41
** 17:41
(defun org-journal-new-entry
  (save-restriction
    (widen)
     ...))

Screenshots
no

Desktop (please complete the following information):

  • OS: gnu/linux
  • Emacs Version "30.0.50"

Your Emacs Configuration
no