[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Archiving always adds a newline before entries
From: |
John Wiegley |
Subject: |
Archiving always adds a newline before entries |
Date: |
Mon, 26 Aug 2024 18:22:46 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
I like to avoid blank lines between Org-mode entries, but have found that when
archiving (and not use datetrees), that this is not supported by Org-mode
out-of-the-box. Mainly it’s due to these lines:
(if (and heading (not (and datetree-date (not datetree-subheading-p))))
…
;; No specific heading, just go to end of file, or to the
;; beginning, depending on `org-archive-reversed-order'.
(if org-archive-reversed-order
…
(goto-char (point-max))
;; Subtree narrowing can let the buffer end on
;; a headline. `org-paste-subtree' then deletes it.
;; To prevent this, make sure visible part of buffer
;; always terminates on a new line, while limiting
;; number of blank lines in a date tree.
---> (unless (and datetree-date (bolp)) (insert "\n"))))
;; Paste
(org-paste-subtree (org-get-valid-level level (and heading 1)))
The line indicated above always appends a newline at the end of the buffer,
so that the pasted tree appears after this newline. It would be nice if this
followed the configuration of ‘org-blank-before-new-entry’, for example.
Meanwhile, I corrected the behavior with advice. Not ideal, since it affects
all cases of pasting subtrees, but it works well enough:
(advice-add 'org-paste-subtree :before #'(lambda (_) (delete-blank-lines)))
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Archiving always adds a newline before entries,
John Wiegley <=