Hi Tristan and Arash, another possible simple solution is to copy and paste the "english.el" style file from your
~/.emacs.d/elpa/auctex-11.90.2/style/ directory into the one with your own style files, defined in TeX-style-local, which for me is ~/.emacs.d/auctex/.auctex-style/ and rename it there to "canadian.el". Of course you can also edit it to create your own canadian style file. I did something similar for the "british.el" style. Is that correct, people? By the way, I noticed that emacs's own lisp/language directory already contains an "english.el". Does someone know if there's any path conflict with the auctex one? Cheers, J On 2017-07-01 22:11, Arash Esbati wrote: > Tristan Miller <[email protected]> writes: > >> AUCTeX automatically changes the quote and hyphen insertion when using >> certain Babel languages. However, I can't help wondering whether the >> mechanism it uses to detect the language is a little overenthusiastic. >> >> I usually write in some variant of English, but need to write >> occasional passages in some other language. So I usually have >> something like the following in my preamble: >> >> \usepackage[ngerman,canadian]{babel} >> >> This causes AUCTeX to change the behaviour of the " and - keys to >> support German text, which is not convenient when the vast majority of >> the document is in English. >> >> Does it really make sense for AUCTeX to do this when the last entry in >> the argument list for Babel is an English one? Even if so, what can I >> do to automatically suppress this behaviour? I still want the >> appropriate non-English behaviour of " and - when a non-English >> language is the last argument to Babel; I just don't want the >> non-English behaviour when "english", "american", "british", etc. is >> the last argument. > > Hi Tristan, > > thanks for this report. Within AUCTeX, babel.el runs style files for > language options in reverse order, so canadian.el would come last. > > The first issue with your setup is that AUCTeX does not have a style > file for canadian language. This can be cured easily be adding > something like this to AUCTeX: > > --8<---------------cut here---------------start------------->8--- > (TeX-add-style-hook > "canadian" > (lambda () > (TeX-run-style-hooks "english")) > LaTeX-dialect) > --8<---------------cut here---------------end--------------->8--- > > But that will not help either since english.el does not reset the > variable `TeX-quote-language' which is changed by ngerman.el. This > patch should fix the issue with quotes: > > --8<---------------cut here---------------start------------->8--- > diff --git a/style/english.el b/style/english.el > index 90254c23..33e05e8c 100644 > --- a/style/english.el > +++ b/style/english.el > @@ -5,6 +5,8 @@ > (TeX-add-style-hook > "english" > (lambda () > + (unless (eq (car TeX-quote-language) 'override) > + (setq TeX-quote-language nil)) > (run-hooks 'TeX-language-en-hook)) > LaTeX-dialect) > --8<---------------cut here---------------end--------------->8--- > > Regarding the - key, I could not figure how to solve it with an entry in > `LaTeX-babel-hyphen-language-alist' and setting > `LaTeX-babel-hyphen-language' to "english". Others? > > Best, Arash > > _______________________________________________ > auctex mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/auctex > _______________________________________________ auctex mailing list [email protected] https://lists.gnu.org/mailman/listinfo/auctex
