bug-auctex
[Top][All Lists]
Advanced

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

bug#21188: Preview installed from the package manager changes LaTeX-mode


From: Tassilo Horn
Subject: bug#21188: Preview installed from the package manager changes LaTeX-mode-hook
Date: Wed, 05 Aug 2015 08:48:30 +0200
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

Joseph Mingrone <address@hidden> 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

Attachment: signature.asc
Description: PGP signature


reply via email to

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