[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Attempt to remove TeX-auto-update
From: |
Ikumi Keita |
Subject: |
Re: Attempt to remove TeX-auto-update |
Date: |
Fri, 19 Mar 2021 18:03:05 +0900 |
Hi all,
I committed the proposed change. I used it for a while personally
without problems, but it might still have some issues I'm not aware of.
Please report back if it causes any troubles.
Regards,
Ikumi Keita
>>>>> Ikumi Keita <ikumi@ikumi.que.jp> writes:
> Hi all,
> In order to reduce byte compile warnings, I'm examining the usage of
> `TeX-auto-update'. I came to think, as discussed below, that we can get
> rid of `TeX-auto-update' variable, so I share my idea as the attached
> patch so that others can discuss it and find possible shortcomings.
> I think that we can regard `TeX-auto-update' as an indicator whether it
> is AUCTeX document buffer because it is set in
> `VirTeX-common-initialization' and `TeX-texinfo-mode'. For that purpose
> we can use `TeX-mode-p' instead.
> In addition, `BibTeX-auto-store' also sets `TeX-auto-update' to `BibTeX'.
> `BibTeX-auto-store' is only called in 'bibtex-mode-hook', so I think it
> is only in bibtex mode buffer that `TeX-auto-update' can be `BibTeX'.
> AUCTeX refers to `TeX-auto-update' only at the following two pieces of
> code, except bib-cite.el:
> ---- (1) -------------------------------------------------------------
> (defun TeX-safe-auto-write ()
> "Call `TeX-auto-write' safely."
> (condition-case _ignored
> (and (boundp 'TeX-auto-update)
> TeX-auto-update
> (TeX-auto-write))
> (error nil))
> ;; Continue with the other write file hooks.
> nil)
> ----------------------------------------------------------------------
> ---- (2) -------------------------------------------------------------
> (defun TeX-update-style (&optional force)
> [...]
> (unless (or (and (boundp 'TeX-auto-update)
> (eq TeX-auto-update 'BibTeX)) ; Not a real TeX buffer
> (and (not force)
> TeX-style-hook-applied-p))
> [... Apply various style hooks]
> ----------------------------------------------------------------------
> About piece (1): The reason why `TeX-safe-auto-write' tests whether
> `TeX-auto-update' is bound and non-nil is, I suppose, that this function
> formerly had a chance to be stored in `write-file-hooks' as a global
> hook; In that case, this function is called when _any_ buffer is going
> to be saved in a file, so it is necessary to distinguish that the
> current buffer is AUCTeX document or not.
> Now that `TeX-safe-auto-write' is stored in `write-contents-functions'
> as a local hook, I think that such check is no longer necessary.
> About piece (2): Here, `TeX-update-style' tries to skip applying various
> style hooks in BibTeX buffer. This check is needed since
> `TeX-safe-auto-write' is called via `write-contents-functions' in
> bibtex mode buffers, which in turn calls `TeX-auto-write'
> calling `TeX-update-style'. I think that it's enough to check that
> `major-mode' is `bibtex-mode' or not, instead of looking at
> `TeX-auto-update'.
> These functions are modified along with the above consideration in the
> attached patch.
> In bib-cite.el, we see several other usages of `TeX-auto-update'.
> In the attached patch, I replaced test for `TeX-auto-update' with a
> check for `TeX-mode-p' in `bib-get-bibliography' and a check for
> `TeX-mode-p' or `major-mode' being `bibtex-mode' in `bib-apropos'.
> I did so because I assumed that `bib-get-bibliography' won't be called
> in bibtex mode buffer but I'm not sure this assumption is right or not.
> In the patch I omitted let-bound of `TeX-auto-update' in
> `bib-create-auto-file' because the changes in `TeX-safe-auto-write' and
> `TeX-update-style' would compensate it.
> Any comments and advices are much appreciated.
> Best regards,
> Ikumi Keita
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Attempt to remove TeX-auto-update,
Ikumi Keita <=