unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* highlight-sexp-mode add-hook with (highlight-sexp-mode 0)
@ 2022-10-26 21:55 Heime
  2022-10-27  2:51 ` Emanuel Berg
  2022-10-27  5:43 ` Eli Zaretskii
  0 siblings, 2 replies; 4+ messages in thread
From: Heime @ 2022-10-26 21:55 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

I am using highlight-sexp-mode with the following in my init file

(add-hook 'emacs-lisp-mode-hook 'highlight-sexp-mode)

But then I also call  

(if highlight-sexp-mode (highlight-sexp-mode 0))

Yet when I load an ".el" file, I still get "highlight-sexp-mode" activated.








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

* Re: highlight-sexp-mode add-hook with (highlight-sexp-mode 0)
  2022-10-26 21:55 highlight-sexp-mode add-hook with (highlight-sexp-mode 0) Heime
@ 2022-10-27  2:51 ` Emanuel Berg
  2022-10-27  5:43 ` Eli Zaretskii
  1 sibling, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2022-10-27  2:51 UTC (permalink / raw)
  To: help-gnu-emacs

Heime wrote:

> (if highlight-sexp-mode (highlight-sexp-mode 0))

Better to use `when' here in terms of Lisp.

Note that not all minor modes have variables, that should have
generated an error if so in this case so I don't think that's
it tho. (Example: `auto-save-mode', only a function.)

And actually there's no real need to check if something is
enabled if you just want to disable it, just disable it.

To disable stuff from Lisp, -1 is more clear than 0.

However ... that's a lot said about such a small thing,
without saying why it doesn't work.

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: highlight-sexp-mode add-hook with (highlight-sexp-mode 0)
  2022-10-26 21:55 highlight-sexp-mode add-hook with (highlight-sexp-mode 0) Heime
  2022-10-27  2:51 ` Emanuel Berg
@ 2022-10-27  5:43 ` Eli Zaretskii
  2022-10-27  6:19   ` Heime
  1 sibling, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2022-10-27  5:43 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Wed, 26 Oct 2022 21:55:23 +0000
> From: Heime <heimeborgia@protonmail.com>
> 
> I am using highlight-sexp-mode with the following in my init file
> 
> (add-hook 'emacs-lisp-mode-hook 'highlight-sexp-mode)
> 
> But then I also call  
> 
> (if highlight-sexp-mode (highlight-sexp-mode 0))
> 
> Yet when I load an ".el" file, I still get "highlight-sexp-mode" activated.

Crystal ball says you do the latter too early, or in the wrong buffer.



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

* Re: highlight-sexp-mode add-hook with (highlight-sexp-mode 0)
  2022-10-27  5:43 ` Eli Zaretskii
@ 2022-10-27  6:19   ` Heime
  0 siblings, 0 replies; 4+ messages in thread
From: Heime @ 2022-10-27  6:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

------- Original Message -------
On Thursday, October 27th, 2022 at 5:43 AM, Eli Zaretskii <eliz@gnu.org> wrote:


> > Date: Wed, 26 Oct 2022 21:55:23 +0000
> > From: Heime heimeborgia@protonmail.com
> > 
> > I am using highlight-sexp-mode with the following in my init file
> > 
> > (add-hook 'emacs-lisp-mode-hook 'highlight-sexp-mode)
> > 
> > But then I also call
> > 
> > (if highlight-sexp-mode (highlight-sexp-mode 0))
> > 
> > Yet when I load an ".el" file, I still get "highlight-sexp-mode" activated.
> 
> 
> Crystal ball says you do the latter too early, or in the wrong buffer.

Because I do 

(if highlight-sexp-mode (highlight-sexp-mode 0))

in my init file.  Sounds that the procedure should be to remove the mode hook
if I want to disable the capture of files by "highlight-sexp-mode" if a mode hook
had already been activated.



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

end of thread, other threads:[~2022-10-27  6:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-26 21:55 highlight-sexp-mode add-hook with (highlight-sexp-mode 0) Heime
2022-10-27  2:51 ` Emanuel Berg
2022-10-27  5:43 ` Eli Zaretskii
2022-10-27  6:19   ` Heime

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).