From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: How global is a define-global-minor-mode mode? Date: Fri, 26 Jan 2007 00:56:19 +0100 Message-ID: <45B943A3.8020600@gmail.com> References: <4581996F.3050700@student.lu.se> <87y7nxmqzh.fsf@stupidchicken.com> <45B6A179.9020604@gmail.com> <45B7B3AE.9020000@gmail.com> <45B9255B.6030002@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040009070103040308000405" X-Trace: sea.gmane.org 1169769467 8768 80.91.229.12 (25 Jan 2007 23:57:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 25 Jan 2007 23:57:47 +0000 (UTC) Cc: cyd@stupidchicken.com, emacs-devel@gnu.org, Stefan Monnier , rms@gnu.org To: "Lennart Borgman (gmail)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 26 00:57:45 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HAETO-0002UJ-ME for ged-emacs-devel@m.gmane.org; Fri, 26 Jan 2007 00:57:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HAETO-0002Ql-7t for ged-emacs-devel@m.gmane.org; Thu, 25 Jan 2007 18:57:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HAETB-0002QT-Tr for emacs-devel@gnu.org; Thu, 25 Jan 2007 18:57:29 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HAETA-0002Pr-Vi for emacs-devel@gnu.org; Thu, 25 Jan 2007 18:57:29 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HAETA-0002Pl-P9 for emacs-devel@gnu.org; Thu, 25 Jan 2007 18:57:28 -0500 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1HAET9-0004eF-3v; Thu, 25 Jan 2007 18:57:27 -0500 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:60333 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1HAET3-0002Qm-7q; Fri, 26 Jan 2007 00:57:22 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666 In-Reply-To: <45B9255B.6030002@gmail.com> X-Antivirus: avast! (VPS 000706-2, 2007-01-25), Outbound message X-Antivirus-Status: Clean X-Scan-Result: No virus found in message 1HAET3-0002Qm-7q. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1HAET3-0002Qm-7q c3ea26f64e192cb9d6ab88d6705ad00d X-detected-kernel: Linux 2.6? (barebone, rare!) 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:65470 Archived-At: This is a multi-part message in MIME format. --------------040009070103040308000405 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Lennart Borgman (gmail) wrote: > Now back to the tests. If the above was a bit hard to grasp then maybe > the test will help. To run the tests first load this file and customize > the defcustom, define-minor-mode and define-global-minor-mode, all to t. > Then restart Emacs and load the file again and now look in the *Message* > buffer for the result. And here are the tests, sorry ... ;-) --------------040009070103040308000405 Content-Type: text/plain; name="defcustom-or-minor.el" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="defcustom-or-minor.el" (message "\n\n>>>>>>> defcustom-or-minor.el starting loading, temp-global-mode=%s" (if (boundp 'temp-global-mode) temp-global-mode "not boundp")) (message "\n****** Declarations: *********") (define-minor-mode temp-mode "dummy" :init-value nil :lighter nil :global t :group 'temp-test :initialize 'custom-initialize-set :set (lambda(sym val) (message " temp-mode :set => sym=%s, val=%s" sym val) (set-default sym val)) (message " temp-mode body => temp-mode=%s, current-buffer=%s" temp-mode (current-buffer))) (define-global-minor-mode temp-global-mode temp-mode (lambda() ;;(message "here %s" (substring (buffer-name) 0 1)) (when (cond ((member (substring (buffer-name) 0 1) '(" " "*" ".")) nil) (t t)) (message " temp-global-mode turn on called") (temp-mode 1))) :group 'temp-test :initialize 'custom-initialize-set :set (lambda(sym val) (message " temp-global-mode :set => sym=%s, val=%s" sym val) (set-default sym val))) (defcustom temp-defcustom nil "doc" :type 'boolean :group 'temp-test :set (lambda(sym val) (message " temp-defcustom :set => sym=%s, val=%s" sym val) (set-default sym val))) (message "\n****** Running tests: *********") (message "*** (customize-set-variable 'temp-defcustom t) =>") (customize-set-variable 'temp-defcustom t) (message "\n*** (customize-set-variable 'temp-mode t) =>") (customize-set-variable 'temp-mode t) (message "*** (temp-mode 1) =>") (temp-mode 1) (message "\n*** (customize-set-variable 'temp-global-mode t) =>") (temp-global-mode 1) (message "*** (temp-global-mode 1) =>") (customize-set-variable 'temp-global-mode t) (message "\n<<<<<<<<< defcustom-or-minor.el loaded: temp-global-mode=%s, temp-mode=%s, temp-defcustom=%s\n\n" temp-global-mode temp-mode temp-defcustom) --------------040009070103040308000405 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------040009070103040308000405--