From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id MEEsCJ/zPGTugAAASxT56A (envelope-from ) for ; Mon, 17 Apr 2023 09:22:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id oEcaCJ/zPGQouAAAauVa8A (envelope-from ) for ; Mon, 17 Apr 2023 09:22:07 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8C7EA6B78 for ; Mon, 17 Apr 2023 09:22:05 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1poJAe-0007KT-GX; Mon, 17 Apr 2023 03:21:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1po5BJ-0000Kb-7C for emacs-orgmode@gnu.org; Sun, 16 Apr 2023 12:24:49 -0400 Received: from mail.linj.tech ([5.255.109.209]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1po5BH-0005xU-8G for emacs-orgmode@gnu.org; Sun, 16 Apr 2023 12:24:48 -0400 From: Lin Jian DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linj.tech; s=mail; t=1681662275; bh=PqfJ7HeeKAQXRGoqjzYtPX3k5g3vgVRx7gq31CsBAE4=; h=From:To:Subject:Date; b=UJ+LUCgghcpbQqij5FgF9LQomwWKxue1S5/EiHMJEPXkssFTbFI+CploKNJr9Oyjm BERAVSuT+Gg0gYnQYujuYUUXCLrCmXHa3XltWrpEKefpsPI9toZ6+RVn4Hp+cP2CI0 NVbkxLg7QeCQ/s0pUe4y6JVzRrHcH952hN5lJyXrPOc38VQXgEe9UGpm8rdQa1lzt5 AKGcVPkX6YQNB1aTCiN5dnpsjBZGZbiM4LnxTwLv+6//Tbjro+mTXf9wGIzx+pEKWt Vrz7t2DzL8ZmSL4Rj64PMkeEYNmTz2kIYJqgPD6RUGplY3dopyQ1i4s6EkRENbqFmR mQ8kTJfPStL5Q== 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 Message-ID: <87sfczztg6.fsf@linj.tech> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=5.255.109.209; envelope-from=me@linj.tech; helo=mail.linj.tech X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 17 Apr 2023 03:20:42 -0400 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1681716126; a=rsa-sha256; cv=none; b=XtXdfkwhd1r1acvgQo8V4AQJ7VUSr26FxLQu1rwoyaGNJeGFlRVPj5+7pgA42hGM25Q+mP OAa5KeVBPIDCI2QLV7WtAM7rp+h1dhTe4n8xn1iA/hY3vpBmpAKLMxc56nDO8PwePLU/6z e8jTcWEJ911nbwXUwP2vIutrWSOXzaAQGQgSuL810/PUtwWTT/N9eKH06y2ooV2yPdeiC0 A7JhU8XzwWOgD17Lwl/O0BDOVtb2+kUWtafhMIFmZBTtoik1P2/d+SjXei/FN97D38hgj5 TYwGq7b8hGmcDiVN6Qotv05RgHT+MGhLh+kv3RqgzrRT8mXS9gqkPIrkztixMg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=linj.tech header.s=mail header.b=UJ+LUCgg; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=linj.tech ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1681716126; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=PqfJ7HeeKAQXRGoqjzYtPX3k5g3vgVRx7gq31CsBAE4=; b=sUXa0xfrI5AYf1XTHwfvYTCDON5Ul5IC4Y8DJLuqhbLpIvGyx9J2u8WWPbb23a+A2hbYWy K5ikWuH+Qs7Ftp6W4xZnHPqMtraNGxhnIzOV7bLztUwC/4ta3c2hGNp+wZgYWJHlAhbBoI MXyJx8k/pJycdyUdp31GKQexI46898oLa0CaCT1FG6thkpxgxoxwi38j5XZfIQWeIKdSyc zk7b4bZDV7A0e77q6sto8AgaX+ubebU8F+S8e4UKeLCJw1xYkC+0vzl8m5t+a2MLxxcOMX tB8UZytY9bsE9ZcY2QQvc5C/tvHIiXl1My9euHHjS9yJAQuWnQLj9dKLeOuVbQ== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -4.21 X-Spam-Score: -4.21 X-Migadu-Queue-Id: 8C7EA6B78 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=linj.tech header.s=mail header.b=UJ+LUCgg; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=linj.tech X-TUID: nUqC+nXdBP3w 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