Re: AUCTeX and "builtin latex mode" integration

2023-11-08 Thread Ikumi Keita
> Ikumi Keita writes: > OK, it doesn't pick up an entry of latex-mode for japanese-LaTeX-mode > yet, I expect I can arrange it to cover such cases as well. Thank you. Here is such a code. It seems to work on my side. >From 248a8ae6a3ba7c29555c97eca2b431fcbba05238 Mon Sep 17 00:00:00 2001

Re: AUCTeX and "builtin latex mode" integration

2023-10-28 Thread Ikumi Keita
> Stefan Monnier writes: > How 'bout a hack more like: I tried to localize the range which my advice affects, within the phase of application of directory local variables. Now that you proposed this approach, I think I don't have to worry about bad side effects due to having `derived-mode-p'

Re: AUCTeX and "builtin latex mode" integration

2023-10-28 Thread Ikumi Keita
> Stefan Monnier writes: > Indeed which symbol is used as *the* file-type is somewhat arbitrary. > In the case of ConTeXt, it makes sense to use `ConTeXt-mode`. > And I'd agree that there's also a good case to be made for `LaTeX-mode`, > but history (and general Emacs practice of using

Re: AUCTeX and "builtin latex mode" integration

2023-10-27 Thread Stefan Monnier
>> Hmm... this does look awful  > Exactly.  How 'bout a hack more like: (defvar auctex--extra-mode-parent '((LaTeX-mode . latex-mode) ...)) (advice-add 'derived-mode-p :after-until #'auctex--compat-derived-mode-p) (defun auctex--compat-derived-mode-p ( modes)

Re: AUCTeX and "builtin latex mode" integration

2023-10-27 Thread Ikumi Keita
> Stefan Monnier writes: > So, IIUC, you're counting on Someone™ to do the work on the Emacs side  Yes.  Actually, I only looked at very limited portion of the related codes in emacs core and don't have reasonable ideas how to do that in emacs side. > I hope we can arrange the code in

Re: AUCTeX and "builtin latex mode" integration

2023-10-26 Thread Stefan Monnier
>>> (a-2) Now `TeX-add-local-master' adds entry of new mode names such as >>> %%% Local Variables: >>> %%% mode: LaTeX <-- not `latex' >>> %%% End: > >> I don't like this very much: IMO the `mode:` cookie should really not specify >> the "mode" to use but rather describe the file-type (Emacs

Re: AUCTeX and "builtin latex mode" integration

2023-10-26 Thread Stefan Monnier
>> We should fix this for Emacs-30. >> [ And then add some backward compatibility hack (presumably using >> an advice for when AUCTeX is used on Emacs<30). ] > I attach my tentative proposal for Emacs<30, using an advice. So, IIUC, you're counting on Someone™ to do the work on the Emacs side 

Re: AUCTeX and "builtin latex mode" integration

2023-10-25 Thread Ikumi Keita
> Stefan Monnier writes: >> [Incompatibility] >> 1. directory local variables >> Currently, directory local variables are prepared in a entry like >> (latex-mode (reftex-label-alist . (("equation" ?e "eq:%f-" "\\eqref{%s}") >> ("align" ?e "eq:%f-" "\\eqref{%s}") >> ("gather" ?e "eq:%f-"

Re: AUCTeX and "builtin latex mode" integration

2023-10-05 Thread Stefan Monnier
> (a) The mode names change as follows: > plain-tex-mode -> plain-TeX-mode > latex-mode -> LaTeX-mode > doctex-mode-> docTeX-mode > context-mode -> ConTeXt-mode > texinfo-mode -> Texinfo-mode > ams-tex-mode -> AmSTeX-mode > japanese-plain-tex-mode ->

Re: AUCTeX and "builtin latex mode" integration

2023-10-04 Thread Ikumi Keita
Hi all, I think that most coding task is done with feature/fix-mode-names-overlap branch. The remaining major problems I'm aware of are the following two, the detail of which are explained below in this message. 1. incompatibility of directory local variables 2. simple-minded reference to

Re: AUCTeX and "builtin latex mode" integration

2023-09-23 Thread Ikumi Keita
> (I infer that `xref-find-references' doesn't work in cperl-mode if it is > redirected from perl-mode by `major-mode-remap-alist', not altering > `auto-mode-alist'.) First, this inference of mine wasn't right because `semantic-symref-filepattern-alist' has the following entry: (cperl-mode

Re: AUCTeX and "builtin latex mode" integration

2023-09-22 Thread Stefan Monnier
> (defun semantic-symref-derive-find-filepatterns ( mode) > ...(snip)... > (let* ((mode (or mode major-mode)) <-- mode = LaTeX-mode > ...(snip)... > ;; No hit, try auto-mode-alist. > (dolist (X auto-mode-alist) <-- Looking at `auto-mode-alist' > (when (and (eq (cdr X)

Re: AUCTeX and "builtin latex mode" integration

2023-09-22 Thread Ikumi Keita
Hi Stefan and all, In this message, I talk about topics of the following two categories: [A] Topics discussed so far [B] Incompatibility found anew [A] Topics discussed so far > Stefan Monnier writes: >> 2. ConTeXt modes > If at all possible, I recommend to use different names for the

Re: AUCTeX and "builtin latex mode" integration

2023-08-28 Thread Stefan Monnier
>>> 2. ConTeXt modes >> In the case of `ConTeXt-mode`, maybe the better option is to make the >> submodes be minor modes? > Hmm. Some difficulties for that idea come up to my mind: Well, I did say "maybe" :-) > 2. As they are minor mode, en-mode and nl-mode can be turned on at the >same

Re: AUCTeX and "builtin latex mode" integration

2023-08-28 Thread Ikumi Keita
Hi Stefan and all, > Stefan Monnier writes: > Looks good to me (I mean: it doesn't literally look good, but given what > we have, this seems about as clean as it gets). Thanks for your comments. Then I'll take this approach. > Only detail, I'd move the > (if (eq (symbol-function

Re: AUCTeX and "builtin latex mode" integration

2023-08-27 Thread Stefan Monnier
>This is much unsatisfactory. I'm currently thinking to apply the >attached patch to sort out the disorders of mode names. It works as >follows: >(a) It uses the names without `TeX-' prefix for LaTeX-mode, >plain-TeX-mode and TeX-mode. >(b) Those mode definitions are

Re: AUCTeX and "builtin latex mode" integration

2023-08-27 Thread Ikumi Keita
Hi all, I pushed a commit, to the feature branch, that uses `define-derived-mode' for major modes such as LaTeX-mode. I chose `TeX--VirTeX-mode' as the name of base modes except Texinfo mode. Here are some related issues I'd like to hear thoughts of those interested in this topic. 1. Ugly

Re: AUCTeX and "builtin latex mode" integration

2023-05-15 Thread Ikumi Keita
Hi Arash, > Arash Esbati writes: > Yes, it was about "Unfriendly take-over of AUCTeX once installed", but I > think somewhere in the discussion, there was also sort of > "latex-mode-hook vs. LaTeX-mode-hook is confusing". I haven't arrived at such claims yet. > I was thinking about the

Re: AUCTeX and "builtin latex mode" integration

2023-05-11 Thread Stefan Monnier
> d. Directory local variables >> Maybe the simplest option is to get used to the idea of setting >> `derived-mode-parent` manually for those modes which are "morally" >> a child mode, even though the implementation (and behavior) does not >> inherit much if anything? > > Do you mean > (put

Re: AUCTeX and "builtin latex mode" integration

2023-05-11 Thread Ikumi Keita
> Stefan Monnier writes: > I think the problem lies elsewhere: when the desktop file says "use > `latex-mode`", how can we distinguish the two cases: > - it's an "old" desktop file, so we should probably redirect it to > `LaTeX-mode`). > - it's a "new" desktop file but the user really

Re: AUCTeX and "builtin latex mode" integration

2023-05-09 Thread Arash Esbati
Hi Keita, Ikumi Keita writes: >> Arash Esbati writes: >> I have to re-read the thread, but wasn't a point also that latex-mode >> and LaTeX-mode are also confusing to some users? > > According to my (unreliable) memory :-), ;-) > the thread began with a complaint that "I customized

Re: AUCTeX and "builtin latex mode" integration

2023-05-09 Thread Stefan Monnier
>> Not sure either, but we can arrange to re-instate the aliases (they're >> not autoloads) upon unload, if so desired (actually, I think all it >> takes (in Emacs-29) is to use `(defalias 'LaTeX-mode nil)` instead of >> `(fset 'LaTeX-mode nil)`. Also, while I'm here, I think we should check >>

Re: AUCTeX and "builtin latex mode" integration

2023-05-09 Thread Ikumi Keita
Hi Arash, > Arash Esbati writes: > I have to re-read the thread, but wasn't a point also that latex-mode > and LaTeX-mode are also confusing to some users? According to my (unreliable) memory :-), the thread began with a complaint that "I customized latex-mode-hook because the mode name is

Re: AUCTeX and "builtin latex mode" integration

2023-05-09 Thread Ikumi Keita
Hi Stefan and all, > Stefan Monnier writes: > FWIW, here's how I'd do it (using the command line): > git push --set-upstream origin HEAD:feature/fix-mode-names-overlap Thanks, it worked well. >> a. Invoked mode >> a-1 >> Suppose that Alice prefers built-in plain-tex-mode over AUCTeX

Re: AUCTeX and "builtin latex mode" integration

2023-05-08 Thread Hongyi Zhao
On Mon, May 8, 2023 at 6:45 PM Arash Esbati wrote: > > Ikumi Keita writes: > > > I attach a tentative patch to make AUCTeX major mode names not overwrap > > built-in TeX modes. In this patch, the new mode names (value of > > `major-mode') are > > - plain-TeX-mode > > - LaTeX-mode > > -

Re: AUCTeX and "builtin latex mode" integration

2023-05-08 Thread Arash Esbati
Ikumi Keita writes: > I attach a tentative patch to make AUCTeX major mode names not overwrap > built-in TeX modes. In this patch, the new mode names (value of > `major-mode') are > - plain-TeX-mode > - LaTeX-mode > - docTeX-mode > - Texinfo-mode > - ConTeXt-mode > - AmSTeX-mode > (There

Re: AUCTeX and "builtin latex mode" integration

2023-05-07 Thread Stefan Monnier
Hi, and thanks, it's great to see concrete movement towards trying to fix this longstanding issue. > 1. I'd like to push it to savannah server as a feature branch of AUCTeX >repository (it isn't ready to merge into master branch yet.) Do you >think it's OK? Can't of any reason why not,

Re: AUCTeX and "builtin latex mode" integration

2023-05-07 Thread Ikumi Keita
Hi all, I attach a tentative patch to make AUCTeX major mode names not overwrap built-in TeX modes. In this patch, the new mode names (value of `major-mode') are - plain-TeX-mode - LaTeX-mode - docTeX-mode - Texinfo-mode - ConTeXt-mode - AmSTeX-mode (There are additional renamed modes +

Re: AUCTeX and "builtin latex mode" integration

2023-02-02 Thread Uwe Brauer
>>> "IK" == Ikumi Keita writes: > Hi Uwe, >> Uwe Brauer writes: >>> AFAIK the only clean way is to actually change those bindings. >>> Yes, users will complain, and it may even break some 3rd party code, so >>> it'll be somewhat painful. >> Given that, and I am using for example cdlatex I

Re: AUCTeX and "builtin latex mode" integration

2023-02-01 Thread Ikumi Keita
> Stefan Monnier writes: >>> OTOH you should be able to completely hide the "base" menus (by >>> overriding their bindings with something silly like the `ignore` >>> command). >> Do you mean menus provided by built-in tex mode by "base" menus? > Yes. I see. Then ability to hide the base

Re: AUCTeX and "builtin latex mode" integration

2023-02-01 Thread Ikumi Keita
Hi Uwe, > Uwe Brauer writes: >> AFAIK the only clean way is to actually change those bindings. >> Yes, users will complain, and it may even break some 3rd party code, so >> it'll be somewhat painful. > Given that, and I am using for example cdlatex I must ask: > is this drastic change

Re: AUCTeX and "builtin latex mode" integration

2023-02-01 Thread Stefan Monnier
>> [ And in Emacs-30, you can use `major-mode-remap-alist` so that >> `mode: latex` will not call `latex-mode` but some other function, >> such as `LaTeX-mode`. ] > Yes, `major-mode-remap-alist` provides a clean way. However AUCTeX still > need to keep the current code for a certain period

Re: AUCTeX and "builtin latex mode" integration

2023-02-01 Thread Ikumi Keita
Hi Stefan, > Stefan Monnier writes: >> 1. I first tried [A] because [B] wouldn't be easy to retain >> compatibility for users who have >> - a lot of files with "mode: latex" tag in the file local variables >> section. > The `mode:` specifies which function is called to enable the mode, >

Re: AUCTeX and "builtin latex mode" integration

2023-01-31 Thread Uwe Brauer
>>> "SM" == Stefan Monnier writes: [Snip]... >> (define-key map "\C-c\C-i" #'tex-bibtex-file) >> (define-key map "\C-c\C-o" #'latex-insert-block) >> >> ;; Redundant keybindings, for consistency with SGML mode. >> (define-key map "\C-c\C-t" #'latex-insert-block) >> [...] >> (define-key map

Re: AUCTeX and "builtin latex mode" integration

2023-01-31 Thread Stefan Monnier
> 1. I first tried [A] because [B] wouldn't be easy to retain > compatibility for users who have >- a lot of files with "mode: latex" tag in the file local variables > section. The `mode:` specifies which function is called to enable the mode, rather than which value of `major-mode` will

Re: AUCTeX and "builtin latex mode" integration

2023-01-31 Thread Ikumi Keita
Hi all, I at last began to work on this issue and would like to share thoughts. There are three topics 1.-3. below. Two approaches were proposed before: [A] Turn AUCTeX modes into minor mode. [B] AUCTeX modes stay major modes but use `major-mode' values dictinct from those of emacs built-in

Re: AUCTeX and "builtin latex mode" integration

2022-10-02 Thread Arash Esbati
Stefan Monnier writes: > You may have seen an on-going discussion about the annoyance of the > mixups between latex-mode and LaTeX-mode and such. Yes, it was time for it again. Some time before that there was a discussion on emacs-devel if AUCTeX should replace the stock tex/latex mode :-) >

Re: AUCTeX and "builtin latex mode" integration

2022-09-25 Thread Ikumi Keita
> Stefan Monnier writes: >> Oh, I see where that happens (and why it doesn't happen if we redirect >> with `defalias`). Sorry, I was talking based on my memory when I hacked `japanese-latex-mode' in tex-jp.el to deal with double loading issue. I forgot that `hack-one-local-variable' uses

Re: AUCTeX and "builtin latex mode" integration

2022-09-25 Thread Stefan Monnier
> Oh, I see where that happens (and why it doesn't happen if we redirect > with `defalias`). Hmm... no I still can't reproduce it, even with something else than a defalias. Stefan

Re: AUCTeX and "builtin latex mode" integration

2022-09-25 Thread Stefan Monnier
Stefan Monnier [2022-09-25 10:01:40] wrote: >> 1. Suppose that the file has %%% mode:latex as file variable. When emacs >> opens this file, it runs `latex-mode' accordingly, which in turn runs >> AUCTeX `LaTeX-mode' by redirectiton. Then it sets `major-mode' to >> `LaTeX-mode'. After that,

Re: AUCTeX and "builtin latex mode" integration

2022-09-25 Thread Stefan Monnier
> be a derived mode of `latex-mode'. However, defining `LaTeX-mode' by > (define-derived-mode LaTeX-mode latex-mode ...) would cause infinite > loop when redirection is enabled. Yes, it's ugly. That's part of the reason for the weird way we define `tex-mode` in `tex-mode.el` (and that was

Re: AUCTeX and "builtin latex mode" integration

2022-09-25 Thread Stefan Monnier
> 1. Suppose that the file has %%% mode:latex as file variable. When emacs > opens this file, it runs `latex-mode' accordingly, which in turn runs > AUCTeX `LaTeX-mode' by redirectiton. Then it sets `major-mode' to > `LaTeX-mode'. After that, `hack-local-variables' runs; it sees that > `major

Re: AUCTeX and "builtin latex mode" integration

2022-09-25 Thread Ikumi Keita
Hi Stefan and all, > Stefan Monnier writes: >> Then the idea of turning AUCTeX into minor mode itself does not help. > Not necessarily, but it could if we can arrange for latex-mode and > auctex-mode not to collide in their keymaps (and syntax table, ...), so > that entries added to

Re: AUCTeX and "builtin latex mode" integration

2022-09-23 Thread Stefan Monnier
> Indeed. I learned people are often tempted to use `latex-' prefix to > customize the behavior of AUCTeX. It means that, in addition to > `latex-mode-hook', `latex-mode-map' and `latex-mode-syntax-table' (and > their counterparts of plain-tex-mode, texinfo-mode and doctex-mode) are > potential

Re: AUCTeX and "builtin latex mode" integration

2022-09-22 Thread Ikumi Keita
> Ikumi Keita writes: > (b) AUCTeX abandons the relationship between `LaTeX-mode' and > `latex-mode'. I.e. `LaTeX-mode' no longer pretends to be > `latex-mode'. > In this case, > 1. Users who have files with -*- latex -*- or > %%% mode: latex > should

Re: AUCTeX and "builtin latex mode" integration

2022-09-22 Thread Christopher Dimech
> Sent: Thursday, September 22, 2022 at 9:33 PM > From: "Ikumi Keita" > To: "Stefan Monnier" > Cc: "Tassilo Horn" , "David Kastrup" , > auctex-devel@gnu.org > Subject: Re: AUCTeX and "builtin latex mode" integration > > H

Re: AUCTeX and "builtin latex mode" integration

2022-09-22 Thread Ikumi Keita
Hi Stefan and all, > I think it's on gnu.emacs.help, aka help-gnu-emacs. I read the thread. > It started with someone complaining that rainbow-delimiters doesn't work > with LaTeX's braces, derived into AUCTeX-vs-plain because IIUC the > problem was that they enabled the mode via

Re: AUCTeX and "builtin latex mode" integration

2022-09-21 Thread Christopher Dimech
> Sent: Wednesday, September 21, 2022 at 1:43 AM > From: "Stefan Monnier" > To: "Tassilo Horn" > Cc: "David Kastrup" , auctex-devel@gnu.org > Subject: Re: AUCTeX and "builtin latex mode" integration > > Tassilo Horn [2022-09-20 08:3

Re: AUCTeX and "builtin latex mode" integration

2022-09-21 Thread Christopher Dimech
> Sent: Wednesday, September 21, 2022 at 3:58 AM > From: "Stefan Monnier" > To: "Tassilo Horn" > Cc: "David Kastrup" , auctex-devel@gnu.org > Subject: Re: AUCTeX and "builtin latex mode" integration > > >>> I wonder why/if it

Re: AUCTeX and "builtin latex mode" integration

2022-09-21 Thread Christopher Dimech
> Sent: Wednesday, September 21, 2022 at 6:53 PM > From: "Tassilo Horn" > To: "Christopher Dimech" > Cc: "Stefan Monnier" , "David Kastrup" > , auctex-devel@gnu.org > Subject: Re: AUCTeX and "builtin latex mode" integration &

Re: AUCTeX and "builtin latex mode" integration

2022-09-21 Thread Tassilo Horn
Christopher Dimech writes: > Have seen that the built-in tex-mode and latex-mode have two powerful > features: 1) the prettify-symbols-mode where things such as \alpha are > displayed with the corresponding greek glyph symbol; and 2) the > ability to reposition the height of superscripts and

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Christopher Dimech
> Sent: Wednesday, September 21, 2022 at 10:10 AM > From: "Stefan Monnier" > To: "Tassilo Horn" > Cc: "David Kastrup" , auctex-devel@gnu.org > Subject: Re: AUCTeX and "builtin latex mode" integration > > > Maybe we could start b

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Stefan Monnier
> Maybe we could start by stating some goals: > > - AUCTeX should not set the `major-mode` to point to > non-AUCTeX functions (even if/when it overrides those functions). > > - Cleanup the mode function names. Currently, AUCTeX's LaTeX mode is > variously called: > > latex-mode >

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Stefan Monnier
Maybe we could start by stating some goals: - AUCTeX should not set the `major-mode` to point to non-AUCTeX functions (even if/when it overrides those functions). - Cleanup the mode function names. Currently, AUCTeX's LaTeX mode is variously called: latex-mode TeX-latex-mode

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Stefan Monnier
>>> I wonder why/if it's important that the AUCTeX modes identify as the >>> builtin modes, i.e., what would be the issue with having (La)TeX-mode >>> major-modes which have no relationship to (la)tex-mode at all plus a >>> setup command users would call in their init file in order to modify >>>

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Tassilo Horn
Stefan Monnier writes: >> I wonder why/if it's important that the AUCTeX modes identify as the >> builtin modes, i.e., what would be the issue with having (La)TeX-mode >> major-modes which have no relationship to (la)tex-mode at all plus a >> setup command users would call in their init file in

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Uwe Brauer
>>> "SM" == Stefan Monnier writes: >> 1. Why can't latex-mode not be removed/substituted by auctex? > For technical/administrative/historical reasons. >> 2. What's about reftex? Right now, since auctex provides a mayor >> mode, you can put it in a hook to startup reftex when you open a >> latex

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Stefan Monnier
> 1. Why can't latex-mode not be removed/substituted by auctex? For technical/administrative/historical reasons. > 2. What's about reftex? Right now, since auctex provides a mayor >mode, you can put it in a hook to startup reftex when you open a >latex file with auctex

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Stefan Monnier
>> You may have seen an on-going discussion about the annoyance of the >> mixups between latex-mode and LaTeX-mode and such. > Could you tell us where that discussion takes place? I think it's on gnu.emacs.help, aka help-gnu-emacs. It started with someone complaining that rainbow-delimiters

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Stefan Monnier
Tassilo Horn [2022-09-20 08:38:27] wrote: > Stefan Monnier writes: >> What I'm really asking here is if there's a willingness to introduce >> the inevitable bit of breakage in exchange for a supposed longer term >> benefit, and/or if someone can think of a better way to move towards a >> better

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Uwe Brauer
>>> "SM" == Stefan Monnier writes: > You may have seen an on-going discussion about the annoyance of the > mixups between latex-mode and LaTeX-mode and such. > I do think it would be good to try and "integrate" the two modes, for > some definition of "integrate". The question being indeed

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Ikumi Keita
Hi Stefan, > Stefan Monnier writes: > You may have seen an on-going discussion about the annoyance of the > mixups between latex-mode and LaTeX-mode and such. Could you tell us where that discussion takes place? > I do think it would be good to try and "integrate" the two modes, for > some

Re: AUCTeX and "builtin latex mode" integration

2022-09-20 Thread Tassilo Horn
Stefan Monnier writes: > What I'm really asking here is if there's a willingness to introduce > the inevitable bit of breakage in exchange for a supposed longer term > benefit, and/or if someone can think of a better way to move towards a > better long-term arrangement than the status quo. I

Re: AUCTeX and "builtin latex mode" integration

2022-09-19 Thread Stefan Monnier
David Kastrup [2022-09-19 23:20:27] wrote: > Stefan Monnier writes: >> I'm wondering if it would be possible to turn AUCTeX into a minor mode. ]... > Doesn't really seem to fit the conventions for major and minor mode > keybindings. Not sure what you mean by that. Are you presuming that the

AUCTeX and "builtin latex mode" integration

2022-09-19 Thread Stefan Monnier
You may have seen an on-going discussion about the annoyance of the mixups between latex-mode and LaTeX-mode and such. I do think it would be good to try and "integrate" the two modes, for some definition of "integrate". The question being indeed what "integration" is the best way forward. I'm