emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Tor Kringeland <tor.kringeland@ntnu.no>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines
Date: Wed, 27 Jul 2022 11:32:41 +0800	[thread overview]
Message-ID: <87czdrb57q.fsf@localhost> (raw)
In-Reply-To: <m235eo9d8b.fsf@ntnu.no>

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org.el-org-store-log-note-Do-not-indent-empty-l.patch --]
[-- Type: text/x-patch, Size: 1085 bytes --]

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 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	other threads:[~2022-07-27  3:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 14:10 [WISH LIST] Remove leading spaces in notes Tor Kringeland
2022-07-27  3:32 ` Ihor Radchenko [this message]
2022-07-27  8:38   ` [PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines Tor Kringeland
2022-07-31  5:09   ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czdrb57q.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tor.kringeland@ntnu.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).