Hi Eric, Thank you -- that inspired me to make electric-pair-pairs a buffer local variable. Surprisingly (to me) electric still pairs double-quote (") as I would expect and single-quote (') works in all the contexts I can think of right now.
questions/comments: 1. Your `(defvar electric-pair-inhibit-predicate)` did not seem necessary, so I removed it in my patch 2. I don't understand the `\\s_` option in your `looking-at` argument, but kept it in, as it seems to do no harm to any of my matlab code. 3. I added the `\\.` to `looking-at` to handle non-conjugate transpose. 4. I tried using `nconc` to add single quote to the local `electric-pair-pairs`, but it would always change the global value as well, so I fell back to `setq`. This is some bit of elisp that I just don't understand. 5. I'm using emacs 28.1 now with the native-compilation on. I find that the changes to matlab.el don't work for the first m-file opened, but on the second one (or kill and open the first) all the electric mods work as desired. Peter On Tue, Apr 26, 2022 at 4:10 PM Eric Ludlam <ericlud...@gmail.com> wrote: > Hi, yes - I meant `show-paren-mode'. Not sure what I was thinking at the > time. > In the code for matlab.el, it is all about show-paren-* features it is > extending. > > I poked around some more to see how to extend electric-pair-mode, and > found the defcustom `electric-pair-inhibit-predicate'. I hacked together a > little thing that prevents the mode from pairing up a single quote after a > symbol, ie - when used as transpose. The downside is it also disables the > user's selection, so not sure what to do about that. > > Anyway, I attached it as a way to brainstorm what the right patterns are > to fix the original problem. > > Eric > > On Tue, Apr 26, 2022 at 2:30 AM Uwe Brauer <o...@mat.ucm.es> wrote: > >> >>> "PM" == Peter Mao <peter....@gmail.com> writes: >> >> Hi all >> > hi Eric and John, >> > Thanks for your responses. Eric -- did you mean `show-paren-mode`? I >> > can't find any references to a `paren-mode` in melpa, elpa or emacs >> > (28.1). I'll try it out if I can find it! >> >> I was wondering myself. I tend to believe that years ago there was some >> paren-mode package, but I cannot find it in my archives. >> >> Uwe Brauer >> _______________________________________________ >> Matlab-emacs-discuss mailing list >> Matlab-emacs-discuss@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss >> >
matlab-elecp-patch_PHM
Description: Binary data
_______________________________________________ Matlab-emacs-discuss mailing list Matlab-emacs-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss