From: Anthony Cowley <acowley@gmail.com>
To: "Fraga, Eric" <e.fraga@ucl.ac.uk>
Cc: Emacs Org-Mode Help <emacs-orgmode@gnu.org>
Subject: Re: Short captions
Date: Tue, 11 Feb 2020 14:50:19 -0500 [thread overview]
Message-ID: <87ftfgc39g.fsf@gmail.com> (raw)
In-Reply-To: <8736bh466v.fsf@ucl.ac.uk>
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
next prev parent reply other threads:[~2020-02-11 19:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-11 4:20 Short captions Anthony Cowley
2020-02-11 13:14 ` Fraga, Eric
2020-02-11 19:50 ` Anthony Cowley [this message]
2020-02-12 8:17 ` Bastien
2020-02-12 10:13 ` Fraga, Eric
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=87ftfgc39g.fsf@gmail.com \
--to=acowley@gmail.com \
--cc=e.fraga@ucl.ac.uk \
--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).