emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Short captions


From: Anthony Cowley
Subject: Re: Short captions
Date: Tue, 11 Feb 2020 14:50:19 -0500
User-agent: mu4e 1.2.0; emacs 28.0.50

Fraga, Eric writes:

> On Monday, 10 Feb 2020 at 23:20, Anthony Cowley wrote:
>> I am having trouble understanding how short captions are supposed to
>> work. Consider this org document:
>
> [...]
>
>> The first matches my expectations. The second is an example of taking
>> the last bit of markup as the short caption. The third seems to lose
>> the short caption altogether.
>
> I can confirm (with a slightly out of date org) this behaviour which
> does seem to be inconsistent and/or wrong.  However, I wasn't able to
> find any discussion of short captions in the org manual so I'm not sure
> if there are caveats on their use.

They are described in section 12.8 Captions 
<https://orgmode.org/manual/Captions.html#Captions>

I think this patch fixes the issue:

diff -ruN A/org-element.el B/org-element.el
--- A/org-element.el    2019-12-03 10:28:06.000000000 -0500
+++ B/org-element.el    2020-02-11 14:47:45.564452900 -0500
@@ -4018,14 +4018,15 @@
               (parsed? (member kwd org-element-parsed-keywords))
               ;; Find main value for any keyword.
               (value
-               (let ((beg (match-end 0))
-                     (end (save-excursion
-                            (end-of-line)
-                            (skip-chars-backward " \t")
-                            (point))))
-                 (if parsed?
-                     (org-element--parse-objects beg end nil restrict)
-                   (org-trim (buffer-substring-no-properties beg end)))))
+                (save-match-data 
+                 (let ((beg (match-end 0))
+                       (end (save-excursion
+                              (end-of-line)
+                              (skip-chars-backward " \t")
+                              (point))))
+                   (if parsed?
+                       (org-element--parse-objects beg end nil restrict)
+                     (org-trim (buffer-substring-no-properties beg end))))))
               ;; If KWD is a dual keyword, find its secondary value.
               ;; Maybe parse it.
               (dual? (member kwd org-element-dual-keywords))


Anthony



reply via email to

[Prev in Thread] Current Thread [Next in Thread]