tom-tan/auctex-latexmk

tex-buf is no longer a part of auctex

Closed this issue ยท 18 comments

see the changelog of auctex.

It was sufficient to edit the (require 'tex-buf) to read (require 'tex)

It was sufficient to edit the (require 'tex-buf) to read (require 'tex)

No, I don't think that's true. As latex.el is already required, tex.el should be required by latex.el. And for backward compatibility, I think we shall keep requiring tex-buf.el as long as it exists.

fab6 commented

Hi,
do you have an advice, how to tell straight that it should use an older commit of auctex until this is working again?
Thanks in advance!

Hi, do you have an advice, how to tell straight that it should use an older commit of auctex until this is working again? Thanks in advance!

try https://github.com/raxod502/straight.el#how-do-i-pin-package-versions-or-use-only-tagged-releases

fab6 commented

ok, thank you

AUCTeX 13.1 was released on 2022-02-20. Couldn't find the change you mentioned in either of these changelogs @wang1zhen:

Is it sufficient to use 13.0, or do you recommend an earlier version?

That mirror may be out of date. https://git.savannah.gnu.org/gitweb/?p=emacs/elpa.git;a=commit;h=4b1c7015ae77b88832af35510232e1a1b716da3a

It is removed with the release of 13.1.2.

I now also ran into this issue.

In the AUCTeX.info (for version 13.1.2 from 2022-04-08), it says:

   * Now 'tex-buf.el' is merged into 'tex.el' and no longer exists.  If
     your personal code has '(require 'tex-buf)', one of the following
     prescriptions would serve.
       1. Remove '(require 'tex-buf)'.
       2. Replace it with '(require 'tex)'.
       3. Replace it with '(require 'latex)'.

//update: ach, I just noticed PR #40 :-)

FWIW, here's how I'm locally working around the issue at runtime until upstream is patched:

(defun my-auctex-latexmk-advice (req feature &rest args)
  "Call REQ with FEATURE and ARGS, unless FEATURE is `tex-buf'."
  (unless (eq feature 'tex-buf)
    (apply req feature args)))

(with-eval-after-load 'latex
  (unwind-protect
      (progn (advice-add 'require :around #'my-auctex-latexmk-advice)
             (auctex-latexmk-setup))
    (advice-remove 'require #'my-auctex-latexmk-advice)))

The change from PR #40 did the trick for me (applied to my copy of auctex-latexmk.el): 13c26e1

- (require 'tex-buf)
(require 'latex)
+ (require 'tex-buf nil t)

(This tries to load tex-buf but since require's noerror parameter is true, it does not result in an error in case it is not found. This makes the patch backwards-compatible.)

The change from PR #40 did the trick for me (applied to my copy of auctex-latexmk.el): 13c26e1

- (require 'tex-buf)
(require 'latex)
+ (require 'tex-buf nil t)

(This tries to load tex-buf but since require's noerror parameter is true, it does not result in an error in case it is not found. This makes the patch backwards-compatible.)

This solution is problematic in my setting, where my OS package installer insists on installing auctex 12.3, but I insist on upgrading auctex via MELPA.

tex-buf is still found and loaded even if I use auctex 13.1.3.

for latex-extra I proposed:

- (require 'tex-buf)
  (require 'latex)
+ (unless (string-prefix-p "13" AUCTeX-version)
+   (require 'tex-buf))

The change from PR #40 did the trick for me (applied to my copy of auctex-latexmk.el): 13c26e1

- (require 'tex-buf)
(require 'latex)
+ (require 'tex-buf nil t)

(This tries to load tex-buf but since require's noerror parameter is true, it does not result in an error in case it is not found. This makes the patch backwards-compatible.)

This solution is problematic in my setting, where my OS package installer insists on installing auctex 12.3, but I insist on upgrading auctex via MELPA.

tex-buf is still found and loaded even if I use auctex 13.1.3.

for latex-extra I proposed:

- (require 'tex-buf)
  (require 'latex)
+ (unless (string-prefix-p "13" AUCTeX-version)
+   (require 'tex-buf))

I guess you might need to remove the old version of auctex files manually

I guess you might need to remove the old version of auctex files manually

The old auctex was installed by my OS package manager. I can remove it, but there is some dependency that gets it reinstalled with the next update.

@basil-conto thanks for sharing your runtime fix. Do you put those lines before the require/use-package lines?

The Error still appears in *Messages* for me with:

(defun my-auctex-latexmk-advice (req feature &rest args)
  "Call REQ with FEATURE and ARGS, unless FEATURE is `tex-buf'."
  (unless (eq feature 'tex-buf)
    (apply req feature args)))

(with-eval-after-load 'latex
  (unwind-protect
      (progn (advice-add 'require :around #'my-auctex-latexmk-advice)
             (auctex-latexmk-setup))
    (advice-remove 'require #'my-auctex-latexmk-advice)))

(use-package auctex-latexmk
  :ensure t
  :config
  (auctex-latexmk-setup)
  )

@felker

The Error still appears in *Messages* for me with:

That may be because you're calling auctex-latexmk-setup twice, once with the surrounding advice in place, and once without.

Or it may be because of the :ensure keyword, since the function advice I posted does not work around the tex-buf error during package installation.

Considering you see the error in the *Messages* buffer, I'm guessing it's the former.

Do you put those lines before the require/use-package lines?

The lines I wrote are standalone, i.e. independent of any use-package stanzas you may have. Here's how you could write the same advice more closely coupled with use-package, but disclaimer: I don't use use-package so this is only lightly tested.

(use-package auctex-latexmk
  :ensure t
  :defer t
  :after latex
  :functions auctex-latexmk-setup
  :preface
  (defun my-auctex-latexmk-advice (req feature &rest args)
    "Call REQ with FEATURE and ARGS, unless FEATURE is `tex-buf'."
    (unless (eq feature 'tex-buf)
      (apply req feature args)))
  :init
  (unwind-protect
      (progn (advice-add 'require :around #'my-auctex-latexmk-advice)
             (auctex-latexmk-setup))
    (advice-remove 'require #'my-auctex-latexmk-advice)))

Note that, as I mentioned above, this will not fix the tex-buf error the first time auctex-latexmk is installed thanks to the :ensure keyword.

@basil-conto thanks! for someone who doesnt utilize use-package, you are more fluent with it than I am ๐Ÿ˜„ This worked and didnt throw the error, with or without :ensure t.

For some reason this doesn't work for me and I get the following error at startup

Error (use-package): auctex-latexmk/:init: Symbolโ€™s value as variable is void: TeX-expand-list Disable showing Disable logging

For some reason this doesn't work for me and I get the following error at startup

That shouldn't happen, as auctex-latexmk.el loads latex.el, which loads tex.el, which defines TeX-expand-list.

Can you get a backtrace for the error? E.g. via M-x toggle-debug-on-error, by setting (setq debug-on-error t), or by starting Emacs with the --debug-init option?

Do you have any other tex, latex, auctex, or auctex-latexmk configurations? Do you have a copy of auctex-latexmk-setup lying somewhere? Have you tried reinstalling your packages, or commenting out parts of your user-init-file to see if any other parts of it may be giving rise to this issue? What is your M-x emacs-version?