From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70382: 29.3; Info-fontify-node renders cross-references misleadingly Date: Sun, 14 Apr 2024 19:21:57 +0300 Message-ID: <86edb7ncd6.fsf@gnu.org> References: <18edd090d56.b4d9f833651238.7754717828208203833@excalamus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4119"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70382@debbugs.gnu.org To: matt@excalamus.com, Juri Linkov , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 14 18:23:01 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rw2dA-0000pS-RR for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Apr 2024 18:23:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rw2d3-0004Lq-Fv; Sun, 14 Apr 2024 12:22:55 -0400 Original-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 1rw2d1-0004KD-Ef for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2024 12:22:51 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rw2d1-0006BQ-64 for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2024 12:22:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rw2dC-0008Jc-74 for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2024 12:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Apr 2024 16:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70382 X-GNU-PR-Package: emacs Original-Received: via spool by 70382-submit@debbugs.gnu.org id=B70382.171311174031579 (code B ref 70382); Sun, 14 Apr 2024 16:23:02 +0000 Original-Received: (at 70382) by debbugs.gnu.org; 14 Apr 2024 16:22:20 +0000 Original-Received: from localhost ([127.0.0.1]:36029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rw2cW-0008DG-6A for submit@debbugs.gnu.org; Sun, 14 Apr 2024 12:22:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rw2cT-0008CD-DF for 70382@debbugs.gnu.org; Sun, 14 Apr 2024 12:22:18 -0400 Original-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 ) 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==; In-Reply-To: <18edd090d56.b4d9f833651238.7754717828208203833@excalamus.com> (message from Matt on Sun, 14 Apr 2024 16:35:41 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283292 Archived-At: > Date: Sun, 14 Apr 2024 16:35:41 +0200 > From: Matt > > 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