emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org.el: fix org--get-outline-path-1
@ 2016-02-29 14:35 Tobias Getzner
  2016-02-29 15:32 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Getzner @ 2016-02-29 14:35 UTC (permalink / raw)
  To: emacs-orgmode

Headline titles may be empty, in which case the respective match group
will be nil. This would throw an error when trying to regexp-replace
checkbox cookies.

TODO: Depending on preference, a place-holder string might be a better
choice (for user-display) rather than leaving the outline-path element empty.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3e2f1c1..f45b9fc 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11611,7 +11611,7 @@ (defun org--get-outline-path-1 (&optional use-cache)
                             ;; Remove statistical/checkboxes cookies.
                             (replace-regexp-in-string
                              "\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" ""
-                             (org-match-string-no-properties 4))))))
+                             (or (org-match-string-no-properties 4) ""))))))
        (if (org-up-heading-safe)
            (let ((path (cons heading (org--get-outline-path-1 use-cache))))
              (when use-cache
-- 
2.7.2

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

* Re: [PATCH] org.el: fix org--get-outline-path-1
  2016-02-29 14:35 [PATCH] org.el: fix org--get-outline-path-1 Tobias Getzner
@ 2016-02-29 15:32 ` Nicolas Goaziou
  2016-02-29 19:04   ` Tobias Getzner
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2016-02-29 15:32 UTC (permalink / raw)
  To: Tobias Getzner; +Cc: emacs-orgmode

Hello,

Tobias Getzner <tobias.getzner@gmx.de> writes:

> Headline titles may be empty, in which case the respective match group
> will be nil. This would throw an error when trying to regexp-replace
> checkbox cookies.

Indeed. Thank you for the report. I applied a slightly different fix,
tho.

> TODO: Depending on preference, a place-holder string might be a better
> choice (for user-display) rather than leaving the outline-path element
> empty.

This makes sense. Maybe something like "[Empty]". WDYT?


Regards,

-- 
Nicolas Goaziou

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

* Re: [PATCH] org.el: fix org--get-outline-path-1
  2016-02-29 15:32 ` Nicolas Goaziou
@ 2016-02-29 19:04   ` Tobias Getzner
  0 siblings, 0 replies; 3+ messages in thread
From: Tobias Getzner @ 2016-02-29 19:04 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Tobias Getzner <tobias.getzner@gmx.de> writes:
>
>> Headline titles may be empty, in which case the respective match group
>> will be nil. This would throw an error when trying to regexp-replace
>> checkbox cookies.
>
> Indeed. Thank you for the report. I applied a slightly different fix,
> tho.

Thanks for fixing!

>> TODO: Depending on preference, a place-holder string might be a better
>> choice (for user-display) rather than leaving the outline-path element
>> empty.
>
> This makes sense. Maybe something like "[Empty]". WDYT?

[Empty] seems good to me.

Regards,
Tobias

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

end of thread, other threads:[~2016-02-29 19:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-29 14:35 [PATCH] org.el: fix org--get-outline-path-1 Tobias Getzner
2016-02-29 15:32 ` Nicolas Goaziou
2016-02-29 19:04   ` Tobias Getzner

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