help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Hook on other minor modes


From: uzibalqa
Subject: RE: [External] : Hook on other minor modes
Date: Tue, 27 Jun 2023 14:10:42 +0000

------- Original Message -------
On Tuesday, June 27th, 2023 at 11:50 AM, Drew Adams <drew.adams@oracle.com> 
wrote:


> > > > > It enables minor mode `tika-minor-mode' when minor mode` 
> > > > > outline-minor-mode' is enabled AND when `outline-minor-mode' is 
> > > > > disabled. See` C-h f
> > > > > define-minor-mode':
> > > > > It's useful if you want to provide behavior for when it's enabled OR
> > > > > when it's disabled, OR both. You can do any of those things. Pretty
> > > > > useful, I'd say.
> > 
> > Can't one simply enable something.
> 
> 
> Put a function `foo' on` outline-minor-mode-hook'. Define `foo' so that it 
> enables` tika-minor-mode when `outline-minor-mode' is non-nil. That's all it 
> has to do. Is that so hard?  

It is the thing that makes sense.

Had been concentrated upon 

(add-hook 'outline-minor-mode 'tika-minor-mode)

which could produce unintended consequences if one wants to activate 
tika-minor-mode 
only when outline-minor-mode is activated.

-------------

For things like

(add-hook 'fortran-mode-hook #'tika-minor-mode)

where I want to enable tika-minor-mode when fortran mode is enabled.  Would you
suggest using a function that checks whether fortran-mode is activated ?





 
> The point is that by having the hook run when the hook's minor-mode is 
> enabled AND when it's disabled you can do whatever you want. That includes 
> only enabling some other mode when the hook's mode is enabled.
> 
> Simple, flexible, elegant. Que demande le peuple ?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]