From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Cowley Subject: Re: Short captions Date: Tue, 11 Feb 2020 14:50:19 -0500 Message-ID: <87ftfgc39g.fsf@gmail.com> References: <8736bh466v.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:47693) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1bYA-0007fT-Cp for emacs-orgmode@gnu.org; Tue, 11 Feb 2020 14:50:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1bY9-0007w7-5j for emacs-orgmode@gnu.org; Tue, 11 Feb 2020 14:50:26 -0500 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]:37242) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j1bY8-0007uq-Th for emacs-orgmode@gnu.org; Tue, 11 Feb 2020 14:50:25 -0500 Received: by mail-qt1-x830.google.com with SMTP id w47so8939182qtk.4 for ; Tue, 11 Feb 2020 11:50:24 -0800 (PST) In-reply-to: <8736bh466v.fsf@ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: "Fraga, Eric" Cc: Emacs Org-Mode Help 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 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