emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines


From: Ihor Radchenko
Subject: [PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines
Date: Wed, 27 Jul 2022 11:32:41 +0800

Tor Kringeland <tor.kringeland@ntnu.no> writes:

> Currently if you insert a note on a heading that has double newlines in
> it, the empty newlines will be padded with spaces.  For example
>
> #+begin_example
> * heading
>   - Note taken on [2022-07-26 Tue 16:00] \\
>     note with
>     
>     newlines it in
> #+end_example
>
> It would be nice to (if this is not considered a bug) to have an option
> which would not insert these unecessary spaces when adding notes 

See the attached patch.

Best,
Ihor

>From 49b1092d7f82354390304dcc40e72cea73618956 Mon Sep 17 00:00:00 2001
Message-Id: 
<49b1092d7f82354390304dcc40e72cea73618956.1658892670.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Wed, 27 Jul 2022 11:30:19 +0800
Subject: [PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines
 in notes

See m235eo9d8b.fsf@ntnu.no">https://orgmode.org/list/m235eo9d8b.fsf@ntnu.no
---
 lisp/org.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ca0b12550..6817e44c1 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10397,8 +10397,9 @@ (defun org-store-log-note ()
           (let ((ind (org-list-item-body-column (line-beginning-position))))
             (dolist (line lines)
               (insert-and-inherit "\n")
-              (indent-line-to ind)
-              (insert-and-inherit line)))
+               (unless (string-empty-p line)
+                (indent-line-to ind)
+                (insert-and-inherit line))))
           (message "Note stored")
           (org-back-to-heading t))))))
   ;; Don't add undo information when called from `org-agenda-todo'.
-- 
2.35.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]