all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
Cc: cyd@stupidchicken.com, emacs-devel@gnu.org,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	rms@gnu.org
Subject: Re: How global is a define-global-minor-mode mode?
Date: Fri, 26 Jan 2007 00:56:19 +0100	[thread overview]
Message-ID: <45B943A3.8020600@gmail.com> (raw)
In-Reply-To: <45B9255B.6030002@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

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 ... ;-)

[-- Attachment #2: defcustom-or-minor.el --]
[-- Type: text/plain, Size: 1935 bytes --]

(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)

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-01-25 23:56 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-14 18:35 How global is a define-global-minor-mode mode? Lennart Borgman
2006-12-25  0:43 ` Richard Stallman
2006-12-29 15:44 ` Richard Stallman
2006-12-29 17:21   ` Lennart Borgman (gmail)
2006-12-30  6:23     ` Richard Stallman
2006-12-30 10:57       ` Lennart Borgman (gmail)
2006-12-31  1:46         ` Richard Stallman
2006-12-31  2:27           ` Lennart Borgman (gmail)
2006-12-31 22:13             ` Richard Stallman
2007-01-03  0:18   ` Johan Bockgård
2007-01-03 21:11     ` Richard Stallman
2007-01-20 19:34 ` Chong Yidong
2007-01-21 22:27   ` Richard Stallman
2007-01-21 23:11   ` Stefan Monnier
2007-01-22  9:04     ` Richard Stallman
2007-01-22 14:55       ` Stefan Monnier
2007-01-23 20:55         ` Richard Stallman
2007-01-23 23:00           ` Stefan Monnier
2007-01-23 23:59             ` Lennart Borgman (gmail)
2007-01-24  1:15               ` Stefan Monnier
2007-01-24 19:29                 ` Lennart Borgman (gmail)
2007-01-25  4:57                   ` Stefan Monnier
2007-01-25  8:56                     ` Lennart Borgman (gmail)
2007-01-25 19:27                       ` Stefan Monnier
2007-01-25 21:47                     ` Lennart Borgman (gmail)
2007-01-25 23:56                       ` Lennart Borgman (gmail) [this message]
2007-01-26  4:34                         ` Stefan Monnier
2007-01-27 19:43                           ` Chong Yidong
2007-01-26  4:35                       ` Stefan Monnier
2007-01-28  7:42                       ` Richard Stallman
2007-01-28  7:42             ` Richard Stallman
2007-01-28 15:47               ` Chong Yidong
2007-01-28 16:37                 ` David Kastrup
2007-01-28 19:53                   ` Chong Yidong
2007-01-29  4:32               ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45B943A3.8020600@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.