emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-property-format, trailing whitespace
@ 2015-04-18 17:21 John J Foerch
  2015-04-18 17:41 ` Rasmus
  0 siblings, 1 reply; 3+ messages in thread
From: John J Foerch @ 2015-04-18 17:21 UTC (permalink / raw)
  To: emacs-orgmode

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

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

* Re: org-property-format, trailing whitespace
  2015-04-18 17:21 org-property-format, trailing whitespace John J Foerch
@ 2015-04-18 17:41 ` Rasmus
  2015-04-18 18:18   ` John J Foerch
  0 siblings, 1 reply; 3+ messages in thread
From: Rasmus @ 2015-04-18 17:41 UTC (permalink / raw)
  To: emacs-orgmode

Hi John,

Thanks for your report.

John J Foerch <jjfoerch@earthlink.net> writes:

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

It seems you are running Org 8.2.  Would you mind to test if this behavior
is fixed in the 8.3 git version?

Thanks,
Rasmus

-- 
One thing that is clear: it's all down hill from here 

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

* Re: org-property-format, trailing whitespace
  2015-04-18 17:41 ` Rasmus
@ 2015-04-18 18:18   ` John J Foerch
  0 siblings, 0 replies; 3+ messages in thread
From: John J Foerch @ 2015-04-18 18:18 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Hi John,
>
> Thanks for your report.
>
> John J Foerch <jjfoerch@earthlink.net> writes:
>
>> 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))
>>
>
> It seems you are running Org 8.2.  Would you mind to test if this behavior
> is fixed in the 8.3 git version?
>
> Thanks,
> Rasmus

It appears to have been fixed in 8.3.  Thank you!

-John

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

end of thread, other threads:[~2015-04-18 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-18 17:21 org-property-format, trailing whitespace John J Foerch
2015-04-18 17:41 ` Rasmus
2015-04-18 18:18   ` John J Foerch

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