all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* About the `:variable' keyword in `define-minor-mode'
@ 2013-02-14 14:37 Xue Fuqiao
  2013-02-14 15:02 ` Stefan Monnier
       [not found] ` <mailman.19937.1360854183.855.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Xue Fuqiao @ 2013-02-14 14:37 UTC (permalink / raw)
  To: help-gnu-emacs

In the docstring of `define-minor-mode':

  [...]
  :variable PLACE [...]
                PLACE can also be of the form (GET . SET), where GET is
                an expression that returns the current state, and SET
                is a function that takes one argument, the new state,
                and sets it.

I don't understand the meaning of GET.  The docstring says it returns
the current state, but where will it return?

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao



^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: About the `:variable' keyword in `define-minor-mode'
@ 2013-02-14 23:50 Xue Fuqiao
  0 siblings, 0 replies; 5+ messages in thread
From: Xue Fuqiao @ 2013-02-14 23:50 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks for Stefan and Michael.

> > > In the docstring of `define-minor-mode':
> > >   [...]
> > >   :variable PLACE [...]
> > >                 PLACE can also be of the form (GET . SET), where GET is
> > >                 an expression that returns the current state, and SET
> > >                 is a function that takes one argument, the new state,
> > >                 and sets it.
> >
> > > I don't understand the meaning of GET.  The docstring says it returns
> > > the current state, but where will it return?
> >
> > It will return it to the context?
> I think he wanted to know where and how it is referenced/used (in the code).

That's true.

> So, if e.g. GET is `(car foo)', the car of the value of the variable
> `foo' will be looked at to decide whether the mode is turned on or off.
> Does this help?

I see, that helps.

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-14 23:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-14 14:37 About the `:variable' keyword in `define-minor-mode' Xue Fuqiao
2013-02-14 15:02 ` Stefan Monnier
     [not found] ` <mailman.19937.1360854183.855.help-gnu-emacs@gnu.org>
2013-02-14 15:53   ` Michael Heerdegen
2013-02-14 15:53   ` Michael Heerdegen
  -- strict thread matches above, loose matches on Subject: below --
2013-02-14 23:50 Xue Fuqiao

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.