From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Problem with define-minor-mode with :global t. Date: Fri, 15 Jul 2005 16:32:40 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1121460045 2939 80.91.229.2 (15 Jul 2005 20:40:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 15 Jul 2005 20:40:45 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 15 22:40:36 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DtWyR-0003TN-FH for ged-emacs-devel@m.gmane.org; Fri, 15 Jul 2005 22:39:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DtX0E-0005O6-VP for ged-emacs-devel@m.gmane.org; Fri, 15 Jul 2005 16:41:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DtWuN-0000V6-OW for emacs-devel@gnu.org; Fri, 15 Jul 2005 16:35:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DtWuL-0000Tk-0e for emacs-devel@gnu.org; Fri, 15 Jul 2005 16:35:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DtWuK-0000Ol-M3 for emacs-devel@gnu.org; Fri, 15 Jul 2005 16:35:40 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DtWzs-0000fG-AI for emacs-devel@gnu.org; Fri, 15 Jul 2005 16:41:24 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id DA0A42CF5C7; Fri, 15 Jul 2005 16:32:46 -0400 (EDT) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 450CC4AC00A; Fri, 15 Jul 2005 16:32:41 -0400 (EDT) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 0FE68E6C1B; Fri, 15 Jul 2005 16:32:41 -0400 (EDT) Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: (Kim F. Storm's message of "Fri, 15 Jul 2005 11:06:00 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.845, requis 5, autolearn=not spam, AWL 0.06, BAYES_00 -4.90) X-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:40952 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:40952 > In CUA, I have this: > (define-minor-mode cua-mode > "..." > :global t > ...) > Now, assume I have a buffer `xyz' which definitely don't want > cua-mode enabled. > If I do things in the following sequence, it works alright: > M-x cua-mode RET > C-x b xyz RET > M-: (set (make-local-variable 'cua-mode) nil) RET > But if I (accidentally) do it in this sequence: > C-x b xyz RET > M-: (set (make-local-variable 'cua-mode) nil) RET > M-x cua-mode RET > then I end up _enabling_ cua mode in just the xyz buffer, > while the global setting is still nil. > I think that it would make sense if specifying :global t on > define-minor-mode would enforce changing the default (global) value of > the mode variable rather than the potentially buffer-local value. IIRC, the reason why I used `setq' is that most pre-existing global minor modes used setq rather than setq-default. I assumed the reason was to make it possible to make the mode buffer-local in a specific buffer. Feel free to change it to setq-default if you feel it's better. I don't have any preference. Stefan