How can I advertise a binding for TeX-next-error in AucTeX?I There are several bindings for next-error, normally C-x `, M-g n, M-g M-n. With

(put 'next-error :advertised-binding "\M-gn")

I will see M-g n in the Compile menu in Compilation mode, for example.

In AucTeX’s LaTeX mode I haven’t been able to change the advertised binding for the Next Error command in the Command menu, either with the same code, or by using TeX-next-error instead, which it really is bound to. How can I do this?

  • 1
    thanks for the question! TIL: :advertised-binding
    – jue
    Dec 11 '18 at 19:40

next-error is a function, you want to change a property of a function (not change a property of a variable). So you need to use function-put instead of put.

(function-put 'next-error :advertised-binding "\M-gn")

The problem is not function-put versus put. Either works fine.

The problem is with your representation of the key binding as "\M-gn". Just use this (with either put or function-put):

(put 'next-error :advertised-binding (kbd "M-g n"))


(put 'next-error :advertised-binding [?\M-g ?n])


(put 'next-error :advertised-binding [(meta ?g) ?n])

(substitute-command-keys "The advertised binding is \\[next-error]")

When in doubt use kbd. It's also generally best for human readers, as the string argument shows the key-sequence representation that Emacs shows us in Help etc., generally.

  • I don't think that's it either. When just doing emacs -Q, a put-command and then a substitute-command-keys-command, the put-command in the question works just as fine as your alternatives. But I still don't know how to get this to work in AucTeX (where next-error is remapped to TeX-next-error).
    – pst
    Jan 14 '19 at 12:40
  • Not sure I understand you. If next-error is remapped to TeX-next-error then why would you expect that changing the advertised-binding of next-error would have any effect? Did you try setting advertised-binding of TeX-next-error? I guess I'm not completely understanding the question.
    – Drew
    Jan 14 '19 at 14:48

You can do it with (global-set-key (kbd "M-g n") 'TeX-next-error). In the text menu will change automatically.

  • I think you have missed what :advertised-binding is. See (elisp) Keys in Documentation!
    – pst
    Dec 11 '18 at 23:10
  • I see..I will.. Dec 14 '18 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.