From: Lin Jian <me@linj.tech>
To: emacs-orgmode@gnu.org
Subject: [BUG] org-cite-activate causes org-fontify-like-in-org-mode to fail for a citation [9.6.4]
Date: Sun, 16 Apr 2023 23:28:36 +0800 [thread overview]
Message-ID: <87sfczztg6.fsf@linj.tech> (raw)
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See
https://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------
Steps to reproduce this bug:
0. emacs -q
1. (require 'org)
2. (setq org-cite-global-bibliography '("/path/to/references.bib"))
3. Here is the content of /path/to/references.bib:
@article{23-access-aalope,
author = {Valentine Aalo and
Kostas P. Peppas and
George P. Efthymoglou},
title = {Performance Analysis of Beacon-Assisted Wireless Powered Communications
With Spatially Random Sensors},
journal = {{IEEE} Access},
volume = {11},
pages = {12754--12763},
year = {2023},
url = {https://doi.org/10.1109/ACCESS.2023.3241755},
doi = {10.1109/ACCESS.2023.3241755},
timestamp = {Sat, 25 Feb 2023 21:34:36 +0100},
biburl = {https://dblp.org/rec/journals/access/AaloPE23.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
4. (org-fontify-like-in-org-mode "[cite:@23-access-aalope]")
5. check the *Message* buffer and you will see:
font-lock-default-fontify-region: End of buffer
6. I think the message in step 5 is a bug. If this bug is fixed, we
should see this in the *Message* buffer instead:
#("[cite:@23-access-aalope]" 0 6 (font-lock-multiline t face org-cite) 6 23 (font-lock-multiline t face (org-cite-key org-cite) mouse-face highlight help-echo "Valentine Aalo, Kostas P. Peppas, George P. Efthymoglou. Performance Analysis of Beacon-Assisted Wireless Powered Communications With Spatially Random Sensors, {IEEE} Access, 2023." keymap (keymap (mouse-1 . org-open-at-point))) 23 24 (font-lock-multiline t face org-cite))
Bellow is my findings of this bug.
(org-fontify-like-in-org-mode)
-> (font-lock-ensure)
-> ...
-> (font-lock-fontify-keywords-region) ;; [1]
-> (org-cite-activate) ;; [2]
-> (org-cite-basic-activate)
-> (org-cite-basic--print-entry)
-> (org-cite-basic--shorten-names)
-> (split-string) ;; match data is changed here
-> ...
-> (org-cite-activate) ;; [3]
-> (font-lock-fontify-keywords-region) ;; [4] [5]
At the end of [2], (match-beginning 0) is 1. At the end of [3],
(match-beginning 0) is changed to 35 by split-string. So, [4] is nil.
As a result, [5] runs, which causes an end-of-buffer error.
I propose wrapping the whole let[6] in save-match-data to fix this bug.
[1]: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/font-lock.el?h=emacs-28.2#n1760
[2]: https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/oc.el?h=release_9.6.4#n1231
[3]: https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/oc.el?h=release_9.6.4#n1235
[4]: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/font-lock.el?h=emacs-28.2#n1763
[5]: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/font-lock.el?h=emacs-28.2#n1764
[6]: https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/oc.el?h=release_9.6.4#n1232
Emacs : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)
Package: Org mode version 9.6.4
next reply other threads:[~2023-04-17 7:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-16 15:28 Lin Jian [this message]
2023-04-17 10:48 ` [BUG] org-cite-activate causes org-fontify-like-in-org-mode to fail for a citation [9.6.4] Ihor Radchenko
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=87sfczztg6.fsf@linj.tech \
--to=me@linj.tech \
--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).