|
From: Eric L. <eri...@gm...> - 2022-05-15 20:19:55
|
Hi Peter,
Sorry, I completely lost track of this thread when it came in.
Thanks for trying out the patch. I'm glad it started working for you!
Regarding your questions:
1) That defvar tells the byte-compiler that variable exists so it
doesn't throw a warning when compiling in batch-mode. You are correct
that it has no other functional value.
2) \\s_ matches symbol characters. This if you type MyVar_' it will
correctly match.
4) Yes, nconc modifies the list. You would need to make a deep copy of
electric-pairs-pairs first before modifying it. Thus, your soln of just
typing in something is good. :)
5) Use 'toggle-debug-on-error' for your first file and see what the
stack says. Hard to speculate otherwise. Run the toggle-debug command
a 2nd time to turn off debugging.
Good Luck
Eric
On 4/28/22 11:24 PM, Peter Mao wrote:
> 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 <eri...@gm...> 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 <ou...@ma...> wrote:
>
> >>> "PM" == Peter Mao <pet...@gm...> 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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss
>
|