2

I'm using AUCTeX (v.11.89.6 with Emacs 25.1). I have no problems with it, just a small nuisance. Whenever I use TeX-insert-macro (C-c C-m) I get many options I never use. For instance, when I wish to insert the command \enquote{...}, I run TeX-insert-macro and start typing enq. The first option I get is MakeHyphenQuote and so I have to scroll down to select enquote.

enter image description here

To go around this issue, I used to edit the csquotes.el style file and remove MakeHyphenQuote from the list. However, each time AUCTeX updates itself, my file is removed and all customisation gets lost.

I also tried editing the TeX-symbol-list variable (which, according to apropos-value, seems to hold these commands), but couldn't make it to work.

So my question is whether I can remove MakeHyphenQuote (or any other command or environment) from the list used by AUCTeX for command insertion.


Update: just to clarify, I'm using ivy-mode.

7
  • 1
    That's not AUCTeX's standard behavior. What is the value of the variable completion-styles your .tex file buffer? Oct 29, 2016 at 17:53
  • Are you using ivy-mode? It should use recent used command as the first choice when you type it for the next time.
    – xuhdev
    Oct 29, 2016 at 21:38
  • @ArashEsbato The value is: (basic partial-completion emacs22)
    – NVaughan
    Oct 29, 2016 at 21:41
  • 1
    So I think your actual problem does not exist when you do the same thing again...
    – xuhdev
    Oct 29, 2016 at 21:43
  • 1
    I think you should tag your question with ivy. I don't use ivy so I can't offer an answer. Oct 30, 2016 at 8:40

2 Answers 2

0

I finally managed to tackle this problem with the following function:

(defun nv/cleanauctex ()
  "Removes two elements from TeX-symbol-list"
  (interactive)
  (setq TeX-symbol-list (remove '("MakeHyphenBlockQuote" "Language" "Opening quotation mark" "Delimiter for citation" "Closing quotation mark") TeX-symbol-list))
  (setq TeX-symbol-list (remove '("MakeHyphenQuote" "Babel's language name" "Opening quotation mark" "Closing quotation mark") TeX-symbol-list))
  )

After AucTeX loads csquotes.el (which contains the symbols related to the csquotes.sty LaTeX package), I run this function which expunges two elements from the TeX-symbol-list variable.

Unfortunately, I have to manually run the function after I have opened a .tex file. (A hook doesn't work as AucTeX dynamically loads the symbols according to the preamble's packages.)

1
  • If you know which function loads the symbols, you can add your function as :after advice to that one.
    – Omar
    Nov 21, 2020 at 0:24
0

I know this is an old question, and the answer given by the OP is a good one, but it could make better use of the style files structure of AUCTeX to work without the need of any manual intervention.

The OP's answer does show how to remove the undesired elements from TeX-symbol-list, it just would have to come at the right moment. The built-in style file for csquotes does indeed add "MakeHyphenBlockQuote" and "MakeHyphenQuote" to TeX-add-symbols. But you can have a personal csquotes.el placed wherever TeX-style-private points to (by default ~/.emacs.d/auctex/style). This file will be called in addition, and after the built-in style file, thus being able to override its settings.

So, you can have a ~/.emacs.d/auctex/style/csquotes.el with:

;;; csquotes.el --- AUCTeX style for `csquotes.sty' -*- lexical-binding: t; -*-

;;; Commentary:

;; This file extends support for the csquotes package.

;;; Code:

(TeX-add-style-hook
 "csquotes"
 (lambda ()
   (setq TeX-symbol-list
         (assq-delete-all
          (car (assoc "MakeHyphenQuote" (TeX-symbol-list)))
          TeX-symbol-list))
   (setq TeX-symbol-list
         (assq-delete-all
          (car (assoc "MakeHyphenBlockQuote" (TeX-symbol-list)))
          TeX-symbol-list)))
 TeX-dialect)

;;; csquotes.el ends here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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