emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dale Sedivec <dale@codefu.org>
To: emacs-orgmode@gnu.org
Subject: Bug: Blank line when logging state changes [9.0.9 (9.0.9-692-gfbf31d.dirty-elpaplus @ /tmp/emacs/.emacs.d/elpa/org-plus-contrib-20170801/)]
Date: Tue, 1 Aug 2017 11:27:05 -0500	[thread overview]
Message-ID: <CAEj9N4J-M5_n+Dq4zK-+MoHZpXbA5KqQwCm4RivorP1HC_Pynw@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1329 bytes --]

Hi!

I think a recent change to org-split-string in master may have made logging
of state changes a little uglier, adding "\\" and an empty line with
trailing whitespace.  Steps to reproduce:

1. Start fresh Emacs with no local configuration (e.g. mkdir /tmp/emacs &&
HOME=/tmp/emacs emacs)

2. Install org-plus-contrib package dated 20170731

3. Create an org file with the following two lines:

~~~~~~
#+TODO: TODO(!) DONE(!)
* Test
~~~~~~

4. Move point to the beginning of the "* Test" headline and call org-todo
with C-c C-t to change it to a TODO item

Expected result:

~~~~~~
* TODO Test
  - State "TODO"       from              [2017-08-01 Tue 11:18]
~~~~~~

Actual result:

~~~~~~
* TODO Test
  - State "TODO"       from              [2017-08-01 Tue 11:18] \\

~~~~~~

Note the " \\" and blank line with trailing whitespace in the actual result.

I strongly suspect this is a result of a change in behavior of
org-split-string in f776e65373.  Before that commit, calling

    (org-split-string "" "\n")

as org-store-log-note is doing returned nil.  After f776e65373 it returns
'("").

IMHO the new behavior of org-split-string actually seems correct to me
(splitting a string should arguably never result in nil), so I've fixed
this by patching org-store-log-note as demonstrated in the attached patch.

Regards,
Dale

[-- Attachment #1.2: Type: text/html, Size: 2010 bytes --]

[-- Attachment #2: org-store-log-note.diff --]
[-- Type: text/plain, Size: 469 bytes --]

--- org.el.orig	2017-08-01 10:58:56.000000000 -0500
+++ org.el	2017-08-01 11:26:12.000000000 -0500
@@ -13640,7 +13640,9 @@
       (setq txt (replace-match "" t t txt)))
     (when (string-match "\\s-+\\'" txt)
       (setq txt (replace-match "" t t txt)))
-    (setq lines (org-split-string txt "\n"))
+    (setq lines (if (zerop (length txt))
+		    nil
+		  (org-split-string txt "\n")))
     (when (org-string-nw-p note)
       (setq note
 	    (org-replace-escapes

             reply	other threads:[~2017-08-01 16:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 16:27 Dale Sedivec [this message]
2017-08-01 18:30 ` Bug: Blank line when logging state changes [9.0.9 (9.0.9-692-gfbf31d.dirty-elpaplus @ /tmp/emacs/.emacs.d/elpa/org-plus-contrib-20170801/)] Nicolas Goaziou

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=CAEj9N4J-M5_n+Dq4zK-+MoHZpXbA5KqQwCm4RivorP1HC_Pynw@mail.gmail.com \
    --to=dale@codefu.org \
    --cc=emacs-orgmode@gnu.org \
    /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).