From unknown Fri Aug 15 19:57:12 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78839: [PATCH] Fix bold or underline of underscores Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Jun 2025 15:18:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78839 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 78839@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.175034626818791 (code B ref -1); Thu, 19 Jun 2025 15:18:04 +0000 Received: (at submit) by debbugs.gnu.org; 19 Jun 2025 15:17:48 +0000 Received: from localhost ([127.0.0.1]:35673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uSH1N-0004so-TJ for submit@debbugs.gnu.org; Thu, 19 Jun 2025 11:17:47 -0400 Received: from lists.gnu.org ([2001:470:142::17]:49772) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uSH1I-0004rY-Nw for submit@debbugs.gnu.org; Thu, 19 Jun 2025 11:17:43 -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 1uSH1C-0003Lr-Dr for bug-gnu-emacs@gnu.org; Thu, 19 Jun 2025 11:17:35 -0400 Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uSH17-00029G-8C for bug-gnu-emacs@gnu.org; Thu, 19 Jun 2025 11:17:32 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=K45ydy/d WonRVaLF/J8JCmCOPzVHRPzDTUfu2ReAZfY=; h=date:subject:to:from; d=ledu-giraud.fr; b=Nl7EjPPPsFCB7nEY94kE8KrYknQQLHYp+WdyNJafWY1fWPnhMP iTvMrBgcxn7ZoqrFjpI6h26DvipXWQYLNECA== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=K45ydy/dWonRVaLF /J8JCmCOPzVHRPzDTUfu2ReAZfY=; h=date:subject:to:from; d=ledu-giraud.fr; b=d7f0F7gp/suvqItDX8t7CKZNsMDxkFDKRzMBSaREPK6z+oZoNA ypeJzKHAt2tS0OV2H9DswGOX3n+ps+ALbWbOdFUl4c/tiySDp4a++9ABuWGtZMbUC3nglm Lqml4yJzrzx1JpTdf50lWckQtYOmHuC5+jz5XzyZ93mM1I0ukVX5aWu9pktRdlC/IsX8+N wEwUepRj2Ee6qcdcQ7UwKsh7oOkRe1aEZKbNF+qWmjfK2SPQK0Jsvz7k1IogIlNcUWFGz2 Es/nG+nzXUtZcflOT1uqPe7K5mhccrVSmsgmrTxNJwHcxJNhs53TR6XFqOCmFcTHeGknns GvHS1VrusiTw== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id c90ab11e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Thu, 19 Jun 2025 17:17:23 +0200 (CEST) From: Manuel Giraud Date: Thu, 19 Jun 2025 17:17:21 +0200 Message-ID: <87plezn4la.fsf@ledu-giraud.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch Hi, Here is a patch for something that was bothering me in the man page rendering. How to reproduce it: - emacs -Q - M-x load-theme modus-operandi ;; for a more ;; clear distinction ;; of faces - M-x man ssh_config See that the underscore '_' in "ssh_config" (in the line after NAME) is rendered with the Man-underline while its surrounding use Man-overstrike. This patch tries to fix those discrepancies. In GNU Emacs 31.0.50 (build 4, x86_64-unknown-openbsd7.7) of 2025-06-18 built on computer Repository revision: 27a524602ff9899139e7f45e7607711c96a9b666 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101016 System Description: OpenBSD computer 7.7 GENERIC.MP#14 amd64 Configured using: 'configure CC=egcc CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs --bindir=/home/manuel/bin --with-x-toolkit=no --with-toolkit-scroll-bars=no --without-cairo --without-dbus --without-gconf --without-gsettings --without-compress-install' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fix-bold-or-underline-of-underscores.patch >From 40dabba0b39a93abc64d574895727b59f0d5e253 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Thu, 19 Jun 2025 16:42:57 +0200 Subject: [PATCH] Fix bold or underline of underscores * lisp/man.el (Man-fontify-manpage): Fix the "_\b_" case. --- lisp/man.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lisp/man.el b/lisp/man.el index 397162a7ad1..9e1d294b1ec 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1379,17 +1379,24 @@ Man-fontify-manpage (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)))) (goto-char (point-min)) - (while (and (search-forward "_\b" nil t) (not (eobp))) - (delete-char -2) - (put-text-property (point) (1+ (point)) 'font-lock-face 'Man-underline)) + (while (and (re-search-forward "_\b\\([^_]\\)" nil t) (not (eobp))) + (replace-match "\\1") + (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)) (goto-char (point-min)) - (while (search-forward "\b_" nil t) - (delete-char -2) + (while (re-search-forward "\\([^_]\\)\b_" nil t) + (replace-match "\\1") (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)) (goto-char (point-min)) - (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t) + (while (re-search-forward "\\([^_]\\)\\(\b+\\1\\)+" nil t) (replace-match "\\1") (put-text-property (1- (point)) (point) 'font-lock-face 'Man-overstrike)) + ;; Special case for "__": is it an underlined underscore or a bold + ;; underscore? Look at the face after it to know. + (goto-char (point-min)) + (while (search-forward "_\b_" nil t) + (delete-char -2) + (let ((face (get-text-property (point) 'font-lock-face))) + (put-text-property (1- (point)) (point) 'font-lock-face face))) (goto-char (point-min)) (while (re-search-forward "o\b\\+\\|\\+\bo" nil t) (replace-match "o") -- 2.49.0 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- From unknown Fri Aug 15 19:57:12 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Manuel Giraud Subject: bug#78839: closed (Re: bug#78839: [PATCH] Fix bold or underline of underscores) Message-ID: References: <86ecvdjyr3.fsf@gnu.org> <87plezn4la.fsf@ledu-giraud.fr> X-Gnu-PR-Message: they-closed 78839 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 78839@debbugs.gnu.org Date: Sat, 21 Jun 2025 08:17:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1750493822-11150-1" This is a multi-part message in MIME format... ------------=_1750493822-11150-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #78839: [PATCH] Fix bold or underline of underscores which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 78839@debbugs.gnu.org. --=20 78839: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D78839 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1750493822-11150-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 78839-done) by debbugs.gnu.org; 21 Jun 2025 08:16:28 +0000 Received: from localhost ([127.0.0.1]:33518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uStOm-0002rj-07 for submit@debbugs.gnu.org; Sat, 21 Jun 2025 04:16:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49524) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uStOi-0002qi-OI for 78839-done@debbugs.gnu.org; Sat, 21 Jun 2025 04:16:25 -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 ) id 1uStOd-0007gm-CC; Sat, 21 Jun 2025 04:16:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=xdR6BGSjXl4rFuNvzYMr5NPWk0w4wJdb7yV9ODPTqCA=; b=b3pO8k3kb501 sreXky/Jm3lgl10KlykaKV8kkYe3Z1m6k6QV4XthnuJ39H92M3XN6R5mnTIyUG9fz+ohxXM+V+VCI CqbtLC9FYTjiIg4cdPPV1AQRt53MCS5EO84ntPZkex7jWx0sARlWL/z/of20kLebfG8+NcyEo1eps IN+F7hgL/0Fs16P6r4fYDFurIoqPFdkeki5JwvtCp09xCZbf/MMAjq1nIIRQ5sEu3PkeSHFg/KdkC u8NbZV9np0d4ci177An3NV+XAx/KTRPKYdwsjhXgfNzHTEgL2NruAlggowDR9CFlyECBURkokWGJ4 UkDmnNSnrtCRHIM6OkQdHg==; Date: Sat, 21 Jun 2025 11:16:16 +0300 Message-Id: <86ecvdjyr3.fsf@gnu.org> From: Eli Zaretskii To: Manuel Giraud In-Reply-To: <87plezn4la.fsf@ledu-giraud.fr> (message from Manuel Giraud on Thu, 19 Jun 2025 17:17:21 +0200) Subject: Re: bug#78839: [PATCH] Fix bold or underline of underscores References: <87plezn4la.fsf@ledu-giraud.fr> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78839-done Cc: 78839-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Manuel Giraud > Date: Thu, 19 Jun 2025 17:17:21 +0200 > > Here is a patch for something that was bothering me in the man page > rendering. How to reproduce it: > > - emacs -Q > - M-x load-theme modus-operandi ;; for a more > ;; clear distinction > ;; of faces > - M-x man ssh_config > > See that the underscore '_' in "ssh_config" (in the line after NAME) is > rendered with the Man-underline while its surrounding use > Man-overstrike. This patch tries to fix those discrepancies. Thanks, installed on master, and closing the bug. ------------=_1750493822-11150-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 19 Jun 2025 15:17:48 +0000 Received: from localhost ([127.0.0.1]:35673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uSH1N-0004so-TJ for submit@debbugs.gnu.org; Thu, 19 Jun 2025 11:17:47 -0400 Received: from lists.gnu.org ([2001:470:142::17]:49772) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uSH1I-0004rY-Nw for submit@debbugs.gnu.org; Thu, 19 Jun 2025 11:17:43 -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 1uSH1C-0003Lr-Dr for bug-gnu-emacs@gnu.org; Thu, 19 Jun 2025 11:17:35 -0400 Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uSH17-00029G-8C for bug-gnu-emacs@gnu.org; Thu, 19 Jun 2025 11:17:32 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=K45ydy/d WonRVaLF/J8JCmCOPzVHRPzDTUfu2ReAZfY=; h=date:subject:to:from; d=ledu-giraud.fr; b=Nl7EjPPPsFCB7nEY94kE8KrYknQQLHYp+WdyNJafWY1fWPnhMP iTvMrBgcxn7ZoqrFjpI6h26DvipXWQYLNECA== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=K45ydy/dWonRVaLF /J8JCmCOPzVHRPzDTUfu2ReAZfY=; h=date:subject:to:from; d=ledu-giraud.fr; b=d7f0F7gp/suvqItDX8t7CKZNsMDxkFDKRzMBSaREPK6z+oZoNA ypeJzKHAt2tS0OV2H9DswGOX3n+ps+ALbWbOdFUl4c/tiySDp4a++9ABuWGtZMbUC3nglm Lqml4yJzrzx1JpTdf50lWckQtYOmHuC5+jz5XzyZ93mM1I0ukVX5aWu9pktRdlC/IsX8+N wEwUepRj2Ee6qcdcQ7UwKsh7oOkRe1aEZKbNF+qWmjfK2SPQK0Jsvz7k1IogIlNcUWFGz2 Es/nG+nzXUtZcflOT1uqPe7K5mhccrVSmsgmrTxNJwHcxJNhs53TR6XFqOCmFcTHeGknns GvHS1VrusiTw== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id c90ab11e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Thu, 19 Jun 2025 17:17:23 +0200 (CEST) From: Manuel Giraud To: bug-gnu-emacs@gnu.org Subject: [PATCH] Fix bold or underline of underscores X-Debbugs-Cc: Date: Thu, 19 Jun 2025 17:17:21 +0200 Message-ID: <87plezn4la.fsf@ledu-giraud.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch Hi, Here is a patch for something that was bothering me in the man page rendering. How to reproduce it: - emacs -Q - M-x load-theme modus-operandi ;; for a more ;; clear distinction ;; of faces - M-x man ssh_config See that the underscore '_' in "ssh_config" (in the line after NAME) is rendered with the Man-underline while its surrounding use Man-overstrike. This patch tries to fix those discrepancies. In GNU Emacs 31.0.50 (build 4, x86_64-unknown-openbsd7.7) of 2025-06-18 built on computer Repository revision: 27a524602ff9899139e7f45e7607711c96a9b666 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101016 System Description: OpenBSD computer 7.7 GENERIC.MP#14 amd64 Configured using: 'configure CC=egcc CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs --bindir=/home/manuel/bin --with-x-toolkit=no --with-toolkit-scroll-bars=no --without-cairo --without-dbus --without-gconf --without-gsettings --without-compress-install' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fix-bold-or-underline-of-underscores.patch >From 40dabba0b39a93abc64d574895727b59f0d5e253 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Thu, 19 Jun 2025 16:42:57 +0200 Subject: [PATCH] Fix bold or underline of underscores * lisp/man.el (Man-fontify-manpage): Fix the "_\b_" case. --- lisp/man.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lisp/man.el b/lisp/man.el index 397162a7ad1..9e1d294b1ec 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1379,17 +1379,24 @@ Man-fontify-manpage (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)))) (goto-char (point-min)) - (while (and (search-forward "_\b" nil t) (not (eobp))) - (delete-char -2) - (put-text-property (point) (1+ (point)) 'font-lock-face 'Man-underline)) + (while (and (re-search-forward "_\b\\([^_]\\)" nil t) (not (eobp))) + (replace-match "\\1") + (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)) (goto-char (point-min)) - (while (search-forward "\b_" nil t) - (delete-char -2) + (while (re-search-forward "\\([^_]\\)\b_" nil t) + (replace-match "\\1") (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)) (goto-char (point-min)) - (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t) + (while (re-search-forward "\\([^_]\\)\\(\b+\\1\\)+" nil t) (replace-match "\\1") (put-text-property (1- (point)) (point) 'font-lock-face 'Man-overstrike)) + ;; Special case for "__": is it an underlined underscore or a bold + ;; underscore? Look at the face after it to know. + (goto-char (point-min)) + (while (search-forward "_\b_" nil t) + (delete-char -2) + (let ((face (get-text-property (point) 'font-lock-face))) + (put-text-property (1- (point)) (point) 'font-lock-face face))) (goto-char (point-min)) (while (re-search-forward "o\b\\+\\|\\+\bo" nil t) (replace-match "o") -- 2.49.0 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- ------------=_1750493822-11150-1--