Skip to content

Commit

Permalink
bugfix: insertion of new headline title
Browse files Browse the repository at this point in the history
In the original code, if there is whitespace on the last line of the file, then
the headline will be improperly inserted *after* the whitespace.

In this bugfix, we look for `\n` as the last character of the file and add `\n`
before "* <title>" if the last character is anything else.
  • Loading branch information
petermao committed Jul 1, 2023
1 parent 44a1a41 commit 3e88084
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion org-noter.el
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ DOCUMENT-FILE-NAME is the document filename."
(setq notes-files-annotating notes-files)
(with-current-buffer (find-file-noselect (car notes-files))
(goto-char (point-max))
(insert (if (save-excursion (beginning-of-line) (looking-at "[[:space:]]*$")) "" "\n")
(insert (if (save-excursion (backward-char) (looking-at-p "\n")) "" "\n")
"* " document-base)
(org-entry-put nil org-noter-property-doc-file
(file-relative-name document-used-path
Expand Down

0 comments on commit 3e88084

Please sign in to comment.