emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John J Foerch <jjfoerch@earthlink.net>
To: emacs-orgmode@gnu.org
Subject: org-property-format, trailing whitespace
Date: Sat, 18 Apr 2015 13:21:01 -0400	[thread overview]
Message-ID: <87r3rhz72a.fsf@hecubus.retroj.net> (raw)

Hello,

There is a certain case when org-mode leaves trailing whitespace on
":LOGBOOK:" and ":END:" lines and this was bringing me a little
annoyance, as I like to keep my org files neat.  I finally tracked down
the source of the problem.

I use the following configuration to automatically create a logbook
drawer for each TODO:

    (setq org-treat-insert-todo-heading-as-state-change t
          org-log-into-drawer t
          org-todo-keywords '((sequence "TODO(t!)" "|" "DONE(d!)")))

Down at the end of `org-indent-line', a bit of code meant to clean up
the whitespace of properties inserts the trailing whitespace in the case
of the ":LOGBOOK:" and ":END:" lines.

    (if (looking-at org-property-re)
        (replace-match (concat (match-string 4)
                               (format org-property-format
                                       (match-string 1) (match-string 3)))
                       t t))

The ":LOGBOOK:" and ":END:" lines are matched by this block.  The
default value of org-property-format is "%-10s %s", so ":LOGBOOK:" and
":END:" are considered property keys and get padded out to 10
characters; then an additional space is added after that, followed by
nothing because `(match-string 3)' is nil.

I'm not sure of the best way to rewrite the above block to eliminate the
trailing whitespace, but I would really appreciate any help in getting
such a change applied.

Thank you,

John Foerch

             reply	other threads:[~2015-04-18 17:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-18 17:21 John J Foerch [this message]
2015-04-18 17:41 ` org-property-format, trailing whitespace Rasmus
2015-04-18 18:18   ` John J Foerch

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=87r3rhz72a.fsf@hecubus.retroj.net \
    --to=jjfoerch@earthlink.net \
    --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).