From unknown Fri Aug 15 21:19:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19690: [PATCH] Clarify mode switch messages to avoid potential confusion Resent-From: Kelly Dean Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Jan 2015 03:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19690 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 19690@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.142224378818541 (code B ref -1); Mon, 26 Jan 2015 03:44:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Jan 2015 03:43:08 +0000 Received: from localhost ([127.0.0.1]:56438 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFaZv-0004oz-Ld for submit@debbugs.gnu.org; Sun, 25 Jan 2015 22:43:08 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48436) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFaZs-0004oU-6N for submit@debbugs.gnu.org; Sun, 25 Jan 2015 22:43:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFaZl-00039E-VT for submit@debbugs.gnu.org; Sun, 25 Jan 2015 22:42:58 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFaZl-00039A-Rw for submit@debbugs.gnu.org; Sun, 25 Jan 2015 22:42:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFaZk-00072K-R5 for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 22:42:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFaZg-000386-R6 for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 22:42:56 -0500 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:35628) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFaZg-00034L-JR for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 22:42:52 -0500 Received: from mfilter15-d.gandi.net (mfilter15-d.gandi.net [217.70.178.143]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id 5A9E341C05C for ; Mon, 26 Jan 2015 04:42:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter15-d.gandi.net Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter15-d.gandi.net (mfilter15-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id w0wBpuXWeXjU for ; Mon, 26 Jan 2015 04:42:45 +0100 (CET) X-Originating-IP: 66.220.3.179 Received: from localhost (gm179.geneticmail.com [66.220.3.179]) (Authenticated sender: kelly@prtime.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 4531841C056 for ; Mon, 26 Jan 2015 04:42:43 +0100 (CET) From: Kelly Dean Date: Mon, 26 Jan 2015 03:40:58 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -5.0 (-----) --=-=-= Content-Type: text/plain This is only a feature enhancement, not a bug report. When first learning Emacs, I was often confused about whether a minor mode was enabled globally or just in the current buffer. For example, show-paren-mode is global, but whitespace-mode is buffer-local (unless you use global-whitespace-mode). I still sometimes misinterpret this. Sure, the user can find out, but the attached patch helps make things clear, by indicating if the mode being toggled is buffer-local. It will be especially helpful for alerting users in the relatively rare cases when they toggle a normally-global minor mode that has been set buffer-locally. BTW, in define-minor-mode, last-message is indirected, but I don't see any reason not to just use it directly. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=dmm-mode-switch-msgs.patch --- emacs-24.4/lisp/emacs-lisp/easy-mmode.el +++ emacs-24.4/lisp/emacs-lisp/easy-mmode.el @@ -279,14 +279,23 @@ (if (called-interactively-p 'any) (progn ,(if (and globalp (symbolp mode)) + ;; Unnecessary but harmless if mode set buffer-locally `(customize-mark-as-set ',mode)) ;; Avoid overwriting a message shown by the body, ;; but do overwrite previous messages. (unless (and (current-message) (not (equal ,last-message (current-message)))) - (message ,(format "%s %%sabled" pretty-name) - (if ,mode "en" "dis"))))) + (let ((local + ,(if globalp + (if (symbolp mode) + `(if (assq ',mode (buffer-local-variables)) + " in current buffer" + "") + "") + " in current buffer"))) + (message ,(format "%s %%sabled%%s" pretty-name) + (if ,mode "en" "dis") local))))) ,@(when after-hook `(,after-hook))) (force-mode-line-update) ;; Return the new setting. --=-=-=-- From unknown Fri Aug 15 21:19:33 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Kelly Dean Subject: bug#19690: closed (Re: Clarify mode switch messages to avoid potential confusion) Message-ID: References: X-Gnu-PR-Message: they-closed 19690 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 19690@debbugs.gnu.org Date: Wed, 18 Feb 2015 01:07:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1424221622-27717-1" This is a multi-part message in MIME format... ------------=_1424221622-27717-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #19690: [PATCH] Clarify mode switch messages to avoid potential confusion 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 19690@debbugs.gnu.org. --=20 19690: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D19690 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1424221622-27717-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 19690-done) by debbugs.gnu.org; 18 Feb 2015 01:06:27 +0000 Received: from localhost ([127.0.0.1]:46765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YNt5u-0007CF-ST for submit@debbugs.gnu.org; Tue, 17 Feb 2015 20:06:27 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:48391) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YNt5t-0007C7-46 for 19690-done@debbugs.gnu.org; Tue, 17 Feb 2015 20:06:25 -0500 Received: from mfilter9-d.gandi.net (mfilter9-d.gandi.net [217.70.178.138]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id 472C941C05A for <19690-done@debbugs.gnu.org>; Wed, 18 Feb 2015 02:06:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter9-d.gandi.net Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter9-d.gandi.net (mfilter9-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id T9pzpqN55vvm for <19690-done@debbugs.gnu.org>; Wed, 18 Feb 2015 02:06:23 +0100 (CET) X-Originating-IP: 66.220.3.179 Received: from localhost (gm179.geneticmail.com [66.220.3.179]) (Authenticated sender: kelly@prtime.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 09B1E41C061 for <19690-done@debbugs.gnu.org>; Wed, 18 Feb 2015 02:06:21 +0100 (CET) From: Kelly Dean To: 19690-done@debbugs.gnu.org Subject: Re: Clarify mode switch messages to avoid potential confusion Date: Wed, 18 Feb 2015 01:05:03 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 19690-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.7 (/) Applied to trunk. ------------=_1424221622-27717-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 26 Jan 2015 03:43:08 +0000 Received: from localhost ([127.0.0.1]:56438 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFaZv-0004oz-Ld for submit@debbugs.gnu.org; Sun, 25 Jan 2015 22:43:08 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48436) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFaZs-0004oU-6N for submit@debbugs.gnu.org; Sun, 25 Jan 2015 22:43:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFaZl-00039E-VT for submit@debbugs.gnu.org; Sun, 25 Jan 2015 22:42:58 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFaZl-00039A-Rw for submit@debbugs.gnu.org; Sun, 25 Jan 2015 22:42:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFaZk-00072K-R5 for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 22:42:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFaZg-000386-R6 for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 22:42:56 -0500 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:35628) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFaZg-00034L-JR for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 22:42:52 -0500 Received: from mfilter15-d.gandi.net (mfilter15-d.gandi.net [217.70.178.143]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id 5A9E341C05C for ; Mon, 26 Jan 2015 04:42:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter15-d.gandi.net Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter15-d.gandi.net (mfilter15-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id w0wBpuXWeXjU for ; Mon, 26 Jan 2015 04:42:45 +0100 (CET) X-Originating-IP: 66.220.3.179 Received: from localhost (gm179.geneticmail.com [66.220.3.179]) (Authenticated sender: kelly@prtime.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 4531841C056 for ; Mon, 26 Jan 2015 04:42:43 +0100 (CET) From: Kelly Dean To: bug-gnu-emacs@gnu.org Subject: [PATCH] Clarify mode switch messages to avoid potential confusion Date: Mon, 26 Jan 2015 03:40:58 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -5.0 (-----) --=-=-= Content-Type: text/plain This is only a feature enhancement, not a bug report. When first learning Emacs, I was often confused about whether a minor mode was enabled globally or just in the current buffer. For example, show-paren-mode is global, but whitespace-mode is buffer-local (unless you use global-whitespace-mode). I still sometimes misinterpret this. Sure, the user can find out, but the attached patch helps make things clear, by indicating if the mode being toggled is buffer-local. It will be especially helpful for alerting users in the relatively rare cases when they toggle a normally-global minor mode that has been set buffer-locally. BTW, in define-minor-mode, last-message is indirected, but I don't see any reason not to just use it directly. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=dmm-mode-switch-msgs.patch --- emacs-24.4/lisp/emacs-lisp/easy-mmode.el +++ emacs-24.4/lisp/emacs-lisp/easy-mmode.el @@ -279,14 +279,23 @@ (if (called-interactively-p 'any) (progn ,(if (and globalp (symbolp mode)) + ;; Unnecessary but harmless if mode set buffer-locally `(customize-mark-as-set ',mode)) ;; Avoid overwriting a message shown by the body, ;; but do overwrite previous messages. (unless (and (current-message) (not (equal ,last-message (current-message)))) - (message ,(format "%s %%sabled" pretty-name) - (if ,mode "en" "dis"))))) + (let ((local + ,(if globalp + (if (symbolp mode) + `(if (assq ',mode (buffer-local-variables)) + " in current buffer" + "") + "") + " in current buffer"))) + (message ,(format "%s %%sabled%%s" pretty-name) + (if ,mode "en" "dis") local))))) ,@(when after-hook `(,after-hook))) (force-mode-line-update) ;; Return the new setting. --=-=-=-- ------------=_1424221622-27717-1--