GNU bug report logs - #70382
29.3; Info-fontify-node renders cross-references misleadingly

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: matt@HIDDEN; dated Sun, 14 Apr 2024 14:37:03 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 70382 <at> debbugs.gnu.org:


Received: (at 70382) by debbugs.gnu.org; 14 Apr 2024 16:22:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 14 12:22:20 2024
Received: from localhost ([127.0.0.1]:36029 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rw2cW-0008DG-6A
	for submit <at> debbugs.gnu.org; Sun, 14 Apr 2024 12:22:20 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:55962)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rw2cT-0008CD-DF
 for 70382 <at> debbugs.gnu.org; Sun, 14 Apr 2024 12:22:18 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1rw2cC-00065B-7O; Sun, 14 Apr 2024 12:22:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=eqrGQqWoatjVdJwSOKrPLnM51pVCwKpXPt2e/H4bBlE=; b=nAGJU0/koEe13HO1GCjo
 2+dtJOke6c6FQcaJx8LXZ8qUkbu4SrC4KdSLOg5oRSC+MxnIqM3GnE/Fulu9a6zq5z4kOxFO6+PRa
 rWk370fZ/5GE0vkHQsczRQmCebgNKg07grK5IgiXtriy/vH8mLfC3lv5YvF1AeE0aBF9PiD7Bp7Ek
 8eEQY41OpChyuwium9UXRXQFycRrXWE9QzsF6oDbZ+lPG1qtIvbq1Oyk4B3sSBadz1jeX8DXpUFS2
 gTJVKE4yKsLxk65mkTuY7u6J0b1TQrYDSbiwKK7V1ZH4COIpuC5h+EKWfGtK5zj7B/9q7jfsG204c
 VmESu2XtOBDK/w==;
Date: Sun, 14 Apr 2024 19:21:57 +0300
Message-Id: <86edb7ncd6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: matt@HIDDEN, Juri Linkov <juri@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <18edd090d56.b4d9f833651238.7754717828208203833@HIDDEN>
 (message from Matt on Sun, 14 Apr 2024 16:35:41 +0200)
Subject: Re: bug#70382: 29.3;
 Info-fontify-node renders cross-references misleadingly
References: <18edd090d56.b4d9f833651238.7754717828208203833@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70382
Cc: 70382 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sun, 14 Apr 2024 16:35:41 +0200
> From: Matt <matt@HIDDEN>
> 
> 6. Open 'texinfo.info' in Emacs:
> 
>     emacs -Q texinfo.info
> 
> 7. Go to line 3570 (M-g M-g 3570)
> 
> 8. Observe that the texinfo source matches the command-line info reader:
> 
>     ‘@xref’
>          Used to start a sentence with an Info cross-reference saying ‘*Note
>          NAME: NODE.’ or with 'See ...' in other output formats.
> 
>     ‘@ref’
>          Used within or, more often, at the end of a sentence; produces an
>          Info cross-reference saying ‘*note NAME: NODE.’, and just the
>          reference in other output formats, without the preceding 'See'.
> 
> 9. Open 'texinfo.info' using the Emacs info reader using 'C-u C-h i texinfo.info'
> 
> 10. Press 6 1 to navigate to "5.1 Different Cross-reference Commands"
> 
> 11. Observe that both "*Note" and "*note" are rendered as lowercase "see":
> 
>     ‘@xref’
>          Used to start a sentence with an Info cross-reference saying ‘see
>          NAME.’ or with 'See ...' in other output formats.
> 
>     ‘@ref’
>          Used within or, more often, at the end of a sentence; produces an
>          Info cross-reference saying ‘see NAME.’, and just the
>          reference in other output formats, without the preceding 'See'.
> 
> This is a problem because 'makeinfo' does *not* compile texinfo to other formats as described by the Emacs rendered version of the Texinfo info manual!  Specifically, 'makeinfo' renders @xref as (capital 'S') "See" in HTML and other formats.  The Emacs rendering misleads readers to believe that @xref renders as (lowercase 's') "see" in HTML and other formats.
> 
> I attempted a fix and was unsuccessful.  Emacs controls the default rendering of info files, in part, with 'Info-hide-note-references'.  The default for 'Info-hide-note-references' is to "replace '*note' with 'see'."  Unfortunately, 'Info-fontify-node', which handles the actual rendering, ignores case sensitivity.  This causes a match on "*Note", which corresponds to @xref commands, to be considered as "*note" and, because of the default behavior of 'Info-hide-note-references', to be replaced with (lowercase 's') "see ".
> 
> In the attached diff, I attempted to make the default 'Info-hide-note-references' behavior match the description in the texinfo.texi document for HTML.  That is, to replace "See" for @xref related notes (capital 'N' "*Note").  I attempted to differentiate which type of "note" pattern was matched.  However, I was unable to get the match to work correctly.  Despite setting 'case-fold-search' to nil, lowercase "*note" was still matched and incorrectly replaced the same as @xref.

Thanks.

The problem here is not the case-sensitivity.  The problem is that
info.el, the Emacs Info reader, attempts to decide whether to display
"See" or "see" based on the surrounding text (such as whether the
reference is at the beginning of a sentence etc.).  This does not work
in that specific node of the Texinfo manual, because it specifically
shows what makeinfo produces in the Info file, not how the references
will look in the reader.  You will see that the paragraph about @ref
in that section is also shown incorrectly (the Emacs Info reader
doesn't show "see" for @ref), and the paragraph about @pxref
incorrectly says the result starts with "*note" (it actually starts
with "see").

I think the only sane way of dealing with this problem is to disable
Info-hide-note-references in that particular node (and any other
nodes, if we find them, where there's a similar issue).  The patch
below attempts to do that.

Juri and Stefan, do you see a cleaner solution?

diff --git a/lisp/info.el b/lisp/info.el
index b459406..24b4402 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -4876,6 +4876,9 @@ Info-breadcrumbs
     ;; 				    'font-lock-face 'header-line line)
     line))
 
+(defvar info--dont-hide-references
+  '(("texinfo" "Cross Reference Commands"))
+  "Manuals and nodes where `Info-hide-note-references' should be ignored.")
 (defun Info-fontify-node ()
   "Fontify the node."
   (save-excursion
@@ -4893,6 +4896,14 @@ Info-fontify-node
                  (or (eq Info-fontify-maximum-menu-size t)
 		     (< (- (point-max) (point-min))
 			Info-fontify-maximum-menu-size))))
+           (Info-hide-note-references
+            (if (member Info-current-node
+                        (assoc-string
+                         (file-name-sans-extension
+                          (file-name-nondirectory Info-current-file))
+                         info--dont-hide-references t))
+                nil
+              Info-hide-note-references))
            rbeg rend)
 
       ;; Fontify header line




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70382; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Apr 2024 14:36:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 14 10:36:15 2024
Received: from localhost ([127.0.0.1]:35947 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rw0xo-0000Q3-TU
	for submit <at> debbugs.gnu.org; Sun, 14 Apr 2024 10:36:14 -0400
Received: from lists.gnu.org ([2001:470:142::17]:40824)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <matt@HIDDEN>) id 1rw0xm-0000Oe-FF
 for submit <at> debbugs.gnu.org; Sun, 14 Apr 2024 10:36:11 -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 <matt@HIDDEN>)
 id 1rw0xV-00038r-VW
 for bug-gnu-emacs@HIDDEN; Sun, 14 Apr 2024 10:35:53 -0400
Received: from sender4-pp-f112.zoho.com ([136.143.188.112])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <matt@HIDDEN>)
 id 1rw0xT-0005t3-VD
 for bug-gnu-emacs@HIDDEN; Sun, 14 Apr 2024 10:35:53 -0400
ARC-Seal: i=1; a=rsa-sha256; t=1713105344; cv=none; 
 d=zohomail.com; s=zohoarc; 
 b=GPusQMgw63v+6NQXKnC2Tp2KkZ6kgq8zzl3LlcnShRV0xerQZbQPAA3ez2V+u+PppKAe+uBqShtcOMo5JcUkamPaPH41lrCw+coJ7KHtjloEur/GIiKU+aTkiKO+lHhTOX1QWVJ3m3xJg9yMFrFvkTKaKoLLuFbNSQsqejB3hZ0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc; t=1713105344;
 h=Content-Type:Date:Date:From:From:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc;
 bh=5TNLI5gVg0l+KK2K6ROQosvLnhoCkdi1YLgC6BG/qEk=; 
 b=CFATulF2EY9QGVr1p6RjOqDWH/ORH7Tx9nDDNOj8kw7CnLZ0XFbRQmoEVQepe4Qfr9pDLfDgZkIZYh2K4tHE1KwdJtGDJswlgEs6dzejVXRckgy5GvuAmfYej1+2rnpUMuuMUzO2OuD+TLlxAUk2tIa+oQw+Yg1pY9nX8qiG9WI=
ARC-Authentication-Results: i=1; mx.zohomail.com;
 dkim=pass  header.i=excalamus.com;
 spf=pass  smtp.mailfrom=matt@HIDDEN;
 dmarc=pass header.from=<matt@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1713105344; 
 s=zmail; d=excalamus.com; i=matt@HIDDEN;
 h=Date:Date:From:From:Reply-To:Reply-To:To:To:Message-Id:Message-Id:In-Reply-To:Subject:Subject:MIME-Version:Content-Type:Cc;
 bh=5TNLI5gVg0l+KK2K6ROQosvLnhoCkdi1YLgC6BG/qEk=;
 b=Qo6/bOM/I37hzHKHRrEzlUlZRfCB8ASCOyIZD0SpuTOklo0rW48mOntoCIaSS/sE
 l39RfBKIhl8Xkzdpj4Zl/xeYzOyZI4Rx/NB46t293LFX1FfSD6JoO90gt+dekGVSRkB
 moXkl+u5FBpSdseFXICBVUyQjXhZ1B9wZfx1KHBc=
Received: from mail.zoho.com by mx.zohomail.com
 with SMTP id 1713105341879407.45958537511024;
 Sun, 14 Apr 2024 07:35:41 -0700 (PDT)
Date: Sun, 14 Apr 2024 16:35:41 +0200
From: Matt <matt@HIDDEN>
To: "bug-gnu-emacs" <bug-gnu-emacs@HIDDEN>
Message-Id: <18edd090d56.b4d9f833651238.7754717828208203833@HIDDEN>
In-Reply-To: 
Subject: 29.3; Info-fontify-node renders cross-references misleadingly
MIME-Version: 1.0
Content-Type: multipart/mixed; 
 boundary="----=_Part_2106971_28527971.1713105341782"
Importance: 3
User-Agent: Zoho Mail
X-Mailer: Zoho Mail
X-Zoho-Virus-Status: 1
X-Zoho-AV-Stamp: zmail-av-1.1.0/213.57.70
Received-SPF: pass client-ip=136.143.188.112; envelope-from=matt@HIDDEN;
 helo=sender4-pp-f112.zoho.com
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,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: matt@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

------=_Part_2106971_28527971.1713105341782
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Authors of GNU documentation who use Emacs to read the Texinfo info manual =
are misled by the default settings into using the wrong Texinfo commands.

The following uses:
- info (GNU texinfo) 7.1
- tar

1. Download the latest version of the texinfo info manual (version 7.1, 18 =
October 2023): https://www.gnu.org/software/texinfo/manual/texinfo/

2. Extract 'texinfo.info' from the tarball:

    tar xzvf texinfo.info.tar.gz

3. Open 'texinfo.info' in the Info reader:

    info ./texinfo.info

4. Press 6 1 to navigate to "5.1 Different Cross-reference Commands"

5. Observe that @xref uses (capital 'N') "*Note" and @ref uses (lowercase '=
n') "*note":

    =E2=80=98@xref=E2=80=99
         Used to start a sentence with an Info cross-reference saying =E2=
=80=98*Note
         NAME: NODE.=E2=80=99 or with 'See ...' in other output formats.

    =E2=80=98@ref=E2=80=99
         Used within or, more often, at the end of a sentence; produces an
         Info cross-reference saying =E2=80=98*note NAME: NODE.=E2=80=99, a=
nd just the
         reference in other output formats, without the preceding 'See'.

6. Open 'texinfo.info' in Emacs:

    emacs -Q texinfo.info

7. Go to line 3570 (M-g M-g 3570)

8. Observe that the texinfo source matches the command-line info reader:

    =E2=80=98@xref=E2=80=99
         Used to start a sentence with an Info cross-reference saying =E2=
=80=98*Note
         NAME: NODE.=E2=80=99 or with 'See ...' in other output formats.

    =E2=80=98@ref=E2=80=99
         Used within or, more often, at the end of a sentence; produces an
         Info cross-reference saying =E2=80=98*note NAME: NODE.=E2=80=99, a=
nd just the
         reference in other output formats, without the preceding 'See'.

9. Open 'texinfo.info' using the Emacs info reader using 'C-u C-h i texinfo=
.info'

10. Press 6 1 to navigate to "5.1 Different Cross-reference Commands"

11. Observe that both "*Note" and "*note" are rendered as lowercase "see":

    =E2=80=98@xref=E2=80=99
         Used to start a sentence with an Info cross-reference saying =E2=
=80=98see
         NAME.=E2=80=99 or with 'See ...' in other output formats.

    =E2=80=98@ref=E2=80=99
         Used within or, more often, at the end of a sentence; produces an
         Info cross-reference saying =E2=80=98see NAME.=E2=80=99, and just =
the
         reference in other output formats, without the preceding 'See'.

This is a problem because 'makeinfo' does *not* compile texinfo to other fo=
rmats as described by the Emacs rendered version of the Texinfo info manual=
!  Specifically, 'makeinfo' renders @xref as (capital 'S') "See" in HTML an=
d other formats.  The Emacs rendering misleads readers to believe that @xre=
f renders as (lowercase 's') "see" in HTML and other formats.

I attempted a fix and was unsuccessful.  Emacs controls the default renderi=
ng of info files, in part, with 'Info-hide-note-references'.  The default f=
or 'Info-hide-note-references' is to "replace '*note' with 'see'."  Unfortu=
nately, 'Info-fontify-node', which handles the actual rendering, ignores ca=
se sensitivity.  This causes a match on "*Note", which corresponds to @xref=
 commands, to be considered as "*note" and, because of the default behavior=
 of 'Info-hide-note-references', to be replaced with (lowercase 's') "see "=
.

In the attached diff, I attempted to make the default 'Info-hide-note-refer=
ences' behavior match the description in the texinfo.texi document for HTML=
.  That is, to replace "See" for @xref related notes (capital 'N' "*Note").=
  I attempted to differentiate which type of "note" pattern was matched.  H=
owever, I was unable to get the match to work correctly.  Despite setting '=
case-fold-search' to nil, lowercase "*note" was still matched and incorrect=
ly replaced the same as @xref.

--
Matt Trzcinski
Emacs Org contributor (ob-shell)
Learn more about Org mode at https://orgmode.org
Support Org development at=C2=A0https://liberapay.com/org-mode

------=_Part_2106971_28527971.1713105341782
Content-Type: application/octet-stream; 
	name=v01-make-Info-hide-note-references-render-more-like-command-line-info-reader.diff
Content-Transfer-Encoding: 7bit
X-ZM_AttachId: 139323981417830130
Content-Disposition: attachment; 
	filename=v01-make-Info-hide-note-references-render-more-like-command-line-info-reader.diff

diff --git a/lisp/info.el b/lisp/info.el
index b459406959e..1b0fee0efac 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -5038,6 +5038,14 @@ first line or header line, and for breadcrumb links.")
 				 (save-excursion
 				   (search-forward "\n\n" start t)))
 			       "See ")
+			      ((save-match-data (let ((case-fold-search nil))
+				 (save-excursion
+				   (search-forward "*Note" next t)))
+			       "Banana "))
+			      ((save-match-data (let ((case-fold-search nil))
+				 (save-excursion
+				   (search-forward "*note" next t)))
+			       "banana "))
 			      (t "see "))))
                 (goto-char next)
                 (add-text-properties

------=_Part_2106971_28527971.1713105341782--





Acknowledgement sent to matt@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#70382; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 14 Apr 2024 16:30:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.