On Sat, Jul 29, 2023 at 11:53 AM Ikumi Keita <ik...@ikumi.que.jp> wrote: > > Hi Hongyi, > > >>>>> Hongyi Zhao <hongyi.z...@gmail.com> writes: > > On Sat, Jul 29, 2023 at 12:03 AM Ikumi Keita <ik...@ikumi.que.jp> wrote: > >> > >> >>>>> Hongyi Zhao <hongyi.z...@gmail.com> writes: > >> > I see, due to auctex has already been installed, I must test it as > >> > follows: > >> > >> > emacs -Q > >> > M-x package-reinstall RET auctex RET > >> > >> > Open a tex file, and `M-: (setq LaTeX-electric-left-right-brace t) RET' > >> > >> > Then test the problem discussed here. > >> > >> > See the attached screenshot for the results. > >> > >> What's wrong? It seems to me that it works as you expected. The round > >> parens appear in pair in the screenshot. > > > You've said: > > > Is that buffer in AUCTeX latex mode? I suspect that it's in emacs > > built-in latex mode due to '-Q' option. > > > > But I've confirmed that the buffer is really in AUCTeX latex mode, as > > indicated by the AUCTeX menu bars and the following info given by `C-h > > v major-mode RET`: > > Sorry, I still don't see your points. If I understand correctly, > 1. Previously, "emacs -Q" session resulted in built-in latex mode and > `LaTeX-electric-left-right-brace' wasn't effective. You typed "(" but > emacs didn't complete it to "()". > 2. Now you have enabled AUCTeX latex mode even in "emacs -Q" session and > AUCTeX responds to `LaTeX-electric-left-right-brace'. You typed "(" > and got "()" as expected. > Then what's wrong?
Let me comments and explains step-by-step: 1. You said: "emacs -Q" session resulted in built-in latex mode Yes. This is true in all my testings. After the above step 1, I observed the following behavior: 2. If AUCTeX hasn't installed by `package-install', after I installed it by `package-install' and open a .tex file, then AUCTeX LaTeX mode will be enabled automatically. 3. If AUCTeX has already installed by `package-install', after I re-installed it by `package-reinstall' and open a .tex file, then *still* AUCTeX LaTeX mode will be enabled automatically. 4. If AUCTeX has already installed by `package-install', and I open a .tex file immediately without reinstall AUCTeX, then AUCTeX LaTeX mode will *not* be enabled automatically and the built-in latex mode still will be effective for the opened tex buffer. This is why it is necessary to test it using the following commands to ensure that the latest version of AUCTeX is freshly installed for the current Emacs session initiated by `emacs -Q'. M-x package-refresh-contents RET M-x package-reinstall RET auctex RET > Regards, > Ikumi Keita > #StandWithUkraine #StopWarInUkraine Best, Zhao