emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [WISH LIST] Remove leading spaces in notes
@ 2022-07-26 14:10 Tor Kringeland
  2022-07-27  3:32 ` [PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Tor Kringeland @ 2022-07-26 14:10 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines
  2022-07-26 14:10 [WISH LIST] Remove leading spaces in notes Tor Kringeland
@ 2022-07-27  3:32 ` Ihor Radchenko
  2022-07-27  8:38   ` Tor Kringeland
  2022-07-31  5:09   ` Ihor Radchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Ihor Radchenko @ 2022-07-27  3:32 UTC (permalink / raw)
  To: Tor Kringeland; +Cc: emacs-orgmode@gnu.org

[-- 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines
  2022-07-27  3:32 ` [PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines Ihor Radchenko
@ 2022-07-27  8:38   ` Tor Kringeland
  2022-07-31  5:09   ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Tor Kringeland @ 2022-07-27  8:38 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org

Ihor Radchenko <yantar92@gmail.com> writes:

> See the attached patch.

Thanks!  This works as expected now.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines
  2022-07-27  3:32 ` [PATCH] * lisp/org.el (org-store-log-note): Do not indent empty lines Ihor Radchenko
  2022-07-27  8:38   ` Tor Kringeland
@ 2022-07-31  5:09   ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2022-07-31  5:09 UTC (permalink / raw)
  To: Tor Kringeland; +Cc: emacs-orgmode@gnu.org

Ihor Radchenko <yantar92@gmail.com> writes:

> See the attached patch.

Applied onto main via f095cfc3c.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f095cfc3c0c0905fdfb95ad2485e4a7b9f5a1a47

Best,
Ihor



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-31  5:08 UTC | newest]

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

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).