auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] customize-option breaks preview-latex hook


From: Ikumi Keita
Subject: Re: [AUCTeX-devel] customize-option breaks preview-latex hook
Date: Sat, 17 Feb 2007 02:22:43 +0900

Hi,

David Kastrup <address@hidden> writes:

> I think it is a mistake to make a hook variable customizable _unless_
> one uses the customization type 'hook for it.

Well, LaTeX-mode-hook is already defcustom'ed as 'hook type in latex.el
of AUCTeX 11.84:
----------------------------------------------------------------------
(defcustom LaTeX-mode-hook nil
  "A hook run in LaTeX mode buffers."
  :type 'hook
  :group 'LaTeX)
----------------------------------------------------------------------
My emacs 21.4 does not complain about it.

> This customization type is probably only available for Emacs 22.

cus-edit.el in Emacs 21 contains the same code you quoted, so it must
have the 'hook customization type.  I'm afraid that simply selecting
'hook type does not resolve the problem.  (Excuse me if I'm wrong, I'm
not familiar with Custom library.)

> cus-edit.el provides a fitting setter function we could probably steal
> (see below). 

The problem seems that, when evaluating .emacs at startup process, the
right setter function is not known to custom-set-variables.  If the user
set LaTeX-mode-hook through Custom library, .emacs holds lines like
----------------------------------------------------------------------
(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(LaTeX-mode-hook (quote (turn-on-reftex LaTeX-math-mode)))
...
----------------------------------------------------------------------
And according to custom.el, the definition of custom-set-variables is:
----------------------------------------------------------------------
(defun custom-set-variables (&rest args)
...
            (setq set (or (get symbol 'custom-set) 'custom-set-default))
            (put symbol 'saved-value (list value))
...
                      ((default-boundp symbol)
                       ;; Something already set this, overwrite it.
                       (funcall set symbol (eval value))))
----------------------------------------------------------------------
So, if the symbol LaTeX-mode-hook had 'custom-set property, that value
would be used for setter function and right things (calling add-hook)
would be done.  However, at startup process, LaTeX-mode-hook does not
have such property, so it is overwritten with custom-set-default and the
preset LaTeX-preview-setup is lost.

(Is Custom library in Emacs 22 good at that point?  That is, does it see
that the name of the symbol ends in '-hook' and select the right setter
function for hook variables in custom-set-variables?  If so, the problem
will be resolved by upgrading Emacs.)

Additional note:
The problem which Ataka-san described in
<address@hidden> is not specific to
the cases when updating from 11.80- to 11.81+.  Even if the latest
AUCTeX is in use, the same problem can occur in the case "the user was
not using preview-latex before, and raises an interest to preview-latex
and wants to try."  At least some remarks should be done in the document
for such users, I suppose.

Regards,
--
Ikumi Keita




reply via email to

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