emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Pablo Barraza Cornejo <pbarrazacornejo@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Fix numbering of captioned images
Date: Fri, 30 Apr 2021 00:54:00 -0400	[thread overview]
Message-ID: <87k0oks787.fsf@kyleam.com> (raw)
In-Reply-To: <87mttgiiuy.fsf@gmail.com>

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

>      (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

  reply	other threads:[~2021-04-30  4:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30  2:52 [PATCH] Fix numbering of captioned images Pablo Barraza Cornejo
2021-04-30  4:54 ` Kyle Meyer [this message]
2021-04-30  5:44   ` Pablo Barraza Cornejo
2021-05-01  4:43     ` Kyle Meyer

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:

  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=87k0oks787.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=pbarrazacornejo@gmail.com \


* 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


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