[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix numbering of captioned images
From: |
Kyle Meyer |
Subject: |
Re: [PATCH] Fix numbering of captioned images |
Date: |
Fri, 30 Apr 2021 00:54:00 -0400 |
Pablo Barraza Cornejo writes:
> When exporting to HTML, the exporter is supposed to check if there
> are additional constraints over a paragraph using
> `org-html-standalone-image-predicate'. A misplaced quote causes
> `org-html-standalone-image-p' to not apply them.
Thanks for catching the issue and for sending a patch. This looks like
a regression introduced way back in 8.2.7 by ab1ce2a75 (ox-html: Fix
spurious "figure" divs on empty paragraphs, 2014-05-15).
> Subject: [PATCH] ox-html.el/inline-image export: Fix caption numbering.
The convention in this project is to leave off the trailing period from
the subject.
> * lisp/ox-html.el (org-html-standalone-image-p): Remove quote which
> causes `org-html-standalone-image-p' to not check if
> `org-html-standalone-image-predicate' is bound.
Please fill this line to ~70 characters (set in the repo's
.dir-locals.el).
> (and (eq (org-element-type paragraph) 'paragraph)
> - (or (not (fboundp 'org-html-standalone-image-predicate))
> + (or (not (fboundp org-html-standalone-image-predicate))
> (funcall org-html-standalone-image-predicate paragraph))
This quote will indeed result in the fboundp call always returning nil:
(let ((org-html-standalone-image-predicate #'org-html--has-caption-p))
(fboundp 'org-html-standalone-image-predicate)) ; => nil
(let ((org-html-standalone-image-predicate #'org-html--has-caption-p))
(fboundp org-html-standalone-image-predicate)) ; => t
However, the proposed change will introduce another issue.
org-html-standalone-image-predicate is defined as
(defvar org-html-standalone-image-predicate)
That means it's left uninitialized:
(defvar my/foo) ; => my/foo
(boundp 'my/foo) ; => nil
(fboundp my/foo) ; error: (void-variable my/foo)
What about returning to the boundp/fboundp combination that was in place
before ab1ce2a75?
(and (boundp 'my/foo)
(fboundp my/foo)) ; => nil
(let ((my/foo #'ignore))
(and (boundp 'my/foo)
(fboundp my/foo))) ; => t