GNU bug report logs -
#21188
Preview installed from the package manager changes LaTeX-mode-hook
Previous Next
Reported by: Joseph Mingrone <jrm <at> ftfl.ca>
Date: Tue, 4 Aug 2015 18:26:02 UTC
Severity: normal
Done: Tassilo Horn <tsdh <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Joseph Mingrone <jrm <at> ftfl.ca> writes:
Hi Joseph,
> If I customize LaTeX-mode-hook and load a .tex file, the value of
> `LaTeX-mode-hook' is wiped and replaced with only preview-mode-setup.
>
> If I comment out the line
>
> (add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
>
> in auctex-autoloads.el, the customized value of `LaTeX-mode-hook' is
> not wiped.
This "wiping" is strange. `LaTeX-preview-setup' removes itself from
`LaTeX-mode-hook' and adds `preview-mode-setup' instead. However, this
should not affect other functions which also happen to be added to
`LaTeX-mode-hook'.
I just tried with emacs 24.5 and ELPA AUCTeX 11.88.6. My emacs just
contained
(add-hook 'LaTeX-mode-hook (lambda () :test))
After emacs startup, the value of `LaTeX-mode-hook' was
(LaTeX-preview-setup (lambda nil :test))
And after opening some tex file, the value was
(preview-mode-setup (lambda nil :test))
So that's expected, and my test lambda didn't get wiped out.
> If I change
>
> '(LaTeX-mode-hook '(flyspell-mode LaTeX-math-mode turn-on-reftex))
>
> within (custom-set-variables.. in my init file to
>
> '(LaTeX-mode-hook '(flyspell-mode LaTeX-math-mode turn-on-reftex) t)
>
> the customized value is not wiped.
Hm, the second version says that your customs should be set right NOW
and also made the default value of `LaTeX-mode-hook'. The former will
apply the customization at some future point in time, I think after the
(defcustom LaTeX-mode-hook ...) form has been evaluated when AUCTeX
loads.
I can reproduce the behavior you describe when I use customize instead
of plain `add-hook' but I fail to see why your customizations are lost
with the first entry above. My understanding is that your value should
be set just when loading latex.el after evaling the corresponding
defcustom form. That would be ok. AUCTeX itself just uses `add-hook'
and `remove-hook' on `LaTeX-mode-hook', so your configs should persist.
Anyone got a clue?
Ok, here are some workarounds:
1. Use `add-hook' to add `flyspell-mode' and friends to
`LaTeX-mode-hook'.
2. Put (package-initialize) *before* the `custom-set-variables'
section. Then `LaTeX-mode-hook' is already defined when the
`custom-set-variables' are applied which seems to fix the issue,
too.
3. Use a t NOW argument for customizing `LaTeX-mode-hook' as you've
found out yourself.
Bye,
Tassilo
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 9 years and 284 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.