From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kelly Dean Newsgroups: gmane.emacs.bugs Subject: bug#19690: [PATCH] Clarify mode switch messages to avoid potential confusion Date: Mon, 26 Jan 2015 03:40:58 +0000 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1422243855 6976 80.91.229.3 (26 Jan 2015 03:44:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2015 03:44:15 +0000 (UTC) To: 19690@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 26 04:44:15 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YFaay-00085R-Ut for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Jan 2015 04:44:13 +0100 Original-Received: from localhost ([::1]:39880 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFaay-00082S-AQ for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 22:44:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFaat-00081M-TB for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 22:44:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFaap-0003Jn-DZ for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 22:44:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFaap-0003Je-9C for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 22:44:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YFaao-0004qR-VU for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 22:44:03 -0500 X-Loop: help-debbugs@gnu.org 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 X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142224378818541 (code B ref -1); Mon, 26 Jan 2015 03:44:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Jan 2015 03:43:08 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:98738 Archived-At: --=-=-= 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. --=-=-=--