all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* advice on a variable
@ 2002-12-17  7:33 Ittay Freiman
  2002-12-17  9:26 ` Kai Großjohann
  2002-12-17 16:43 ` Kevin Rodgers
  0 siblings, 2 replies; 3+ messages in thread
From: Ittay Freiman @ 2002-12-17  7:33 UTC (permalink / raw)


hi,

i'm writing a minor mode which binds some keys in a minor mode map. i
would like it to be turned on/off globally, but i also want it to be
disabled for some buffer types / major modes.

the best 'trick' would be, i think, to be able to advice the mode
variable (a.k.a ittay-mode) so that when its value is gotten it will
actually run a function that, based on the current buffer and the
global value will return t/nil. then i put the mode variable and the
map in minor-mode-map-alist.

how can this be done? (i've tried using defcustom with :get, but
simply evaluating the variable's value doesn't go through it). I don't
want to make it local and set its values based in hooks.

thanx,
ittay

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

* Re: advice on a variable
  2002-12-17  7:33 advice on a variable Ittay Freiman
@ 2002-12-17  9:26 ` Kai Großjohann
  2002-12-17 16:43 ` Kevin Rodgers
  1 sibling, 0 replies; 3+ messages in thread
From: Kai Großjohann @ 2002-12-17  9:26 UTC (permalink / raw)


ittay@qlusters.com (Ittay Freiman) writes:

> how can this be done? (i've tried using defcustom with :get, but
> simply evaluating the variable's value doesn't go through it). I don't
> want to make it local and set its values based in hooks.

But doing it via hooks seems the cleanest way to do it.  If your minor
mode can be turned off as well as on, then you can just add
turn-off-ittay-mode to the mode hooks where you want it off...

-- 
~/.signature is: umop ap!sdn    (Frank Nobis)

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

* Re: advice on a variable
  2002-12-17  7:33 advice on a variable Ittay Freiman
  2002-12-17  9:26 ` Kai Großjohann
@ 2002-12-17 16:43 ` Kevin Rodgers
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2002-12-17 16:43 UTC (permalink / raw)


Ittay Freiman wrote:

> i'm writing a minor mode which binds some keys in a minor mode map. i
> would like it to be turned on/off globally, but i also want it to be
> disabled for some buffer types / major modes.


Then it is by defnition buffer local.


> the best 'trick' would be, i think, to be able to advice the mode
> variable (a.k.a ittay-mode) so that when its value is gotten it will
> actually run a function that, based on the current buffer and the
> global value will return t/nil. then i put the mode variable and the
> map in minor-mode-map-alist.


That would be a trick.  But only functions can be advised, and there is no
universal function through which all Lisp variable values are accessed.


> how can this be done? (i've tried using defcustom with :get, but
> simply evaluating the variable's value doesn't go through it). I don't
> want to make it local and set its values based in hooks.


You don't have a choice.

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

end of thread, other threads:[~2002-12-17 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-17  7:33 advice on a variable Ittay Freiman
2002-12-17  9:26 ` Kai Großjohann
2002-12-17 16:43 ` Kevin Rodgers

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.