From: Eric L. <eri...@gm...> - 2024-11-19 22:08:55
|
Hi all, I missed the discussions about the new matlab-sections.el that was added to matlab-mode recently. I like the idea, thanks Nidish for working on it. I spent a little time trying it out and wanted to share a few thoughts: * matlab-sections-break-face no longer inherits from font-lock-comment-face. Why is that? My %% comments really stand out now that they aren't comment colored. I could customize, but it seems like comments should color as comments. * Not everyone has a functional super-key. I'm using Windows/cygwin and the windows key does Windows stuff. :( Emacs guidelines says that C-<punctuation> is reserved as a prefix for minor modes. While inconvenient to type, using C-% as a prefix for matlab-sections (that start with %) as a backup prefix could be handy. Thanks Eric |
From: John C. <ci...@ma...> - 2024-11-20 16:36:26
|
Yes, it's a good feature when working with scripts. The key binding is an issue I see too, though when using VNC. Sometimes the super key isn't passed through. It's also common for the windows super key to not work on Windows, see https://answers.microsoft.com/en-us/windows/forum/all/windows-key-not-working/0c796f79-0aa8-466e-ab44-802005d1791b which gives 8 methods for fixing that. I've hit this in the past. What about: (define-key map (kbd "C-c C-<down>") #'matlab-sections-forward-section) (define-key map (kbd "C-C C-<up>") #'matlab-sections-backward-section) (define-key map (kbd "C-C C-<left>") #'matlab-sections-beginning-of-section) (define-key map (kbd "C-C C-<right>") #'matlab-sections-end-of-section) (define-key map (kbd "C-c M-<up>") #'matlab-sections-move-section-up) (define-key map (kbd "C-c M-<down>") #'matlab-sections-move-section-down) (define-key map (kbd "C-c M-<return>") #'matlab-sections-run-till-point) (define-key map (kbd "C-c C-SPC") #'matlab-sections-mark-section) Eric - another issue is that there are many files, including files shipped with MATLAB such as matlab/toolbox/matlab/uitools/uitools/msgbox.m which have %% characters that aren't sections and we get odd bolding as shown below. We also see odd bolding when %% are used and there are functions in the script. Nidish and I have been discussing this in https://github.com/mathworks/Emacs-MATLAB-Mode/issues/14. Maybe you have some thoughts on how to improve this? If we had better semantic understanding in matlab-sections.el, perhaps we could better understand where the sections are? function varargout=msgbox(varargin) %MSGBOX Message box. % msgbox(Message) creates a message box that automatically wraps % Message to fit an appropriately sized Figure. Message is a string % vector, string matrix or cell array. % <snip> %%%%%%%%%%%%%%%%%%%% %%% Nargin Check %%% %%%%%%%%%%%%%%%%%%%% narginchk(1,6); nargoutchk(0,1); %check for support in deployed web apps matlab.ui.internal.NotSupportedInWebAppServer('msgbox'); ________________________________ From: Eric Ludlam <eri...@gm...> Sent: Tuesday, November 19, 2024 5:08 PM To: matlab-emacs-discuss <mat...@li...> Subject: [Matlab-emacs-discuss] matlab-sections.el Hi all, I missed the discussions about the new matlab-sections.el that was added to matlab-mode recently. I like the idea, thanks Nidish for working on it. I spent a little time trying it out and wanted to share a few thoughts: * matlab-sections-break-face no longer inherits from font-lock-comment-face. Why is that? My %% comments really stand out now that they aren't comment colored. I could customize, but it seems like comments should color as comments. * Not everyone has a functional super-key. I'm using Windows/cygwin and the windows key does Windows stuff. :( Emacs guidelines says that C-<punctuation> is reserved as a prefix for minor modes. While inconvenient to type, using C-% as a prefix for matlab-sections (that start with %) as a backup prefix could be handy. Thanks Eric |
From: Uwe B. <ou...@ma...> - 2024-11-20 17:05:53
Attachments:
smime.p7s
|
>>> "JCvM" == John Ciolfi via Matlab-emacs-discuss <mat...@li...> writes: > Yes, it's a good feature when working with scripts. > The key binding is an issue I see too, though when using VNC. > Sometimes the super key isn't passed through. It's also common for the > windows super key to not work on Windows, see > https://answers.microsoft.com/en-us/windows/forum/all/windows-key-not-working/0c796f79-0aa8-466e-ab44-802005d1791b > which gives 8 methods for fixing that. I've hit this in the past. > What about: > (define-key map (kbd "C-c C-<down>") #'matlab-sections-forward-section) > (define-key map (kbd "C-C C-<up>") #'matlab-sections-backward-section) > (define-key map (kbd "C-C C-<left>") #'matlab-sections-beginning-of-section) > (define-key map (kbd "C-C C-<right>") #'matlab-sections-end-of-section) > (define-key map (kbd "C-c M-<up>") #'matlab-sections-move-section-up) > (define-key map (kbd "C-c M-<down>") #'matlab-sections-move-section-down) > (define-key map (kbd "C-c M-<return>") #'matlab-sections-run-till-point) > (define-key map (kbd "C-c C-SPC") #'matlab-sections-mark-section) Do you mean: in addition to the current keybinding setting or replacing the current keybinding? If the current keybinding is problematic for Linux users, can't we distinguish between the two or say OS. 1. MacOS: darwin 2. Linux: gnu/linux 3. MS, windows-nt Like (if (eq system-type 'darwin) ; something for OS X if true ; optional something if not ) -- I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel I strongly condemn Putin's war of aggression against Ukraine. I support to deliver weapons to Ukraine's military. I support the EU and NATO membership of Ukraine. |
From: John C. <ci...@ma...> - 2024-11-20 19:28:46
|
Hi I think we could keep the current settings for those that don't have issues with the super key. We could also have the C-c C-<ITEM> key binding witch is similar to the current settings. I'm not sure which is better using C-c C-<ITEM> or C-% <ITEM>? Both seem reasonable to me. We should probably have the super key bindings be "2nd" because it doesn't work in several cases. Windows can loose access to the super key, in cases it doesn't exist on Linux, and Mac doesn't have a super key. Thanks ________________________________ From: Uwe Brauer Sent: Wednesday, November 20, 2024 12:05 PM To: John Ciolfi via Matlab-emacs-discuss Cc: Eric Ludlam; John Ciolfi Subject: Re: [Matlab-emacs-discuss] matlab-sections.el >>> "JCvM" == John Ciolfi via Matlab-emacs-discuss <mat...@li...> writes: > Yes, it's a good feature when working with scripts. > The key binding is an issue I see too, though when using VNC. > Sometimes the super key isn't passed through. It's also common for the > windows super key to not work on Windows, see > https://answers.microsoft.com/en-us/windows/forum/all/windows-key-not-working/0c796f79-0aa8-466e-ab44-802005d1791b > which gives 8 methods for fixing that. I've hit this in the past. > What about: > (define-key map (kbd "C-c C-<down>") #'matlab-sections-forward-section) > (define-key map (kbd "C-C C-<up>") #'matlab-sections-backward-section) > (define-key map (kbd "C-C C-<left>") #'matlab-sections-beginning-of-section) > (define-key map (kbd "C-C C-<right>") #'matlab-sections-end-of-section) > (define-key map (kbd "C-c M-<up>") #'matlab-sections-move-section-up) > (define-key map (kbd "C-c M-<down>") #'matlab-sections-move-section-down) > (define-key map (kbd "C-c M-<return>") #'matlab-sections-run-till-point) > (define-key map (kbd "C-c C-SPC") #'matlab-sections-mark-section) Do you mean: in addition to the current keybinding setting or replacing the current keybinding? If the current keybinding is problematic for Linux users, can't we distinguish between the two or say OS. 1. MacOS: darwin 2. Linux: gnu/linux 3. MS, windows-nt Like (if (eq system-type 'darwin) ; something for OS X if true ; optional something if not ) -- I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel I strongly condemn Putin's war of aggression against Ukraine. I support to deliver weapons to Ukraine's military. I support the EU and NATO membership of Ukraine. |
From: Eric L. <eri...@gm...> - 2024-11-20 19:55:28
|
Thanks for the feedback. I was proposing adding a 2nd set of bindings. For folks with super-key, the current bindings will be faster. More obscure bindings won't get in their way. As for C-c % vs C-c C-<key> - the Elisp manual is pretty specific saying that C-<punctuation> is reserved for minor modes (excluding ; : { and } ). I picked % out of a hat since it is a comment character. As for the bolding effect, that is an overlay in matlab-sections, and if you turn off sections mode, then it goes away. Sections mode just happens to have also adopted the face used for %% comments. It would be easy to change the defface in sections to inherit from `font-lock-comment-face' and fix general font locking. I lost track of where the actual font lock usage of it is, but the defface should be near the font-lock regexps. As for auto-choosing when to enable detection of sections to avoid bolding in functions 'matlab-guess-script-type' already detects the basics of what is needed. It could just not add its post-command-hook if not in a script. Sections would then also need to watch when this value changes and reset itself - typically when one goes from an empty file to one with a function decl in it. I'll go look in that other thread too. Thanks for pointing it out. I hadn't realized how much I missed b/c the emails are getting binned in a weird place for me when I rearranged my mailing list subscriptions. Eric On Wed, Nov 20, 2024 at 2:28 PM John Ciolfi <ci...@ma...> wrote: > Hi > > I think we could keep the current settings for those that don't have > issues with the super key. We could also have the C-c C-<ITEM> key binding > witch is similar to the current settings. > > I'm not sure which is better using C-c C-<ITEM> or C-% <ITEM>? Both seem > reasonable to me. > > We should probably have the super key bindings be "2nd" because it doesn't > work in several cases. Windows can loose access to the super key, in cases > it doesn't exist on Linux, and Mac doesn't have a super key. > > Thanks > > > ------------------------------ > *From:* Uwe Brauer > *Sent:* Wednesday, November 20, 2024 12:05 PM > *To:* John Ciolfi via Matlab-emacs-discuss > *Cc:* Eric Ludlam; John Ciolfi > *Subject:* Re: [Matlab-emacs-discuss] matlab-sections.el > > >>> "JCvM" == John Ciolfi via Matlab-emacs-discuss < > mat...@li...> writes: > > > Yes, it's a good feature when working with scripts. > > The key binding is an issue I see too, though when using VNC. > > Sometimes the super key isn't passed through. It's also common for the > > windows super key to not work on Windows, see > > > https://answers.microsoft.com/en-us/windows/forum/all/windows-key-not-working/0c796f79-0aa8-466e-ab44-802005d1791b > > which gives 8 methods for fixing that. I've hit this in the past. > > > What about: > > > (define-key map (kbd "C-c C-<down>") > #'matlab-sections-forward-section) > > (define-key map (kbd "C-C C-<up>") > #'matlab-sections-backward-section) > > (define-key map (kbd "C-C C-<left>") > #'matlab-sections-beginning-of-section) > > (define-key map (kbd "C-C C-<right>") > #'matlab-sections-end-of-section) > > (define-key map (kbd "C-c M-<up>") #'matlab-sections-move-section-up) > > (define-key map (kbd "C-c M-<down>") > #'matlab-sections-move-section-down) > > (define-key map (kbd "C-c M-<return>") > #'matlab-sections-run-till-point) > > (define-key map (kbd "C-c C-SPC") #'matlab-sections-mark-section) > > > Do you mean: in addition to the current keybinding setting or replacing > the current keybinding? > > > If the current keybinding is problematic for Linux users, can't we > distinguish between the two or say OS. > > > 1. MacOS: darwin > > 2. Linux: gnu/linux > > 3. MS, windows-nt > Like > > (if (eq system-type 'darwin) > ; something for OS X if true > ; optional something if not > ) > -- > I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel > I strongly condemn Putin's war of aggression against Ukraine. > I support to deliver weapons to Ukraine's military. > I support the EU and NATO membership of Ukraine. > > |
From: Uwe B. <ou...@ma...> - 2024-11-20 20:10:47
Attachments:
smime.p7s
|
>>> "EL" == Eric Ludlam <eri...@gm...> writes: > Thanks for the feedback. > I was proposing adding a 2nd set of bindings. For folks with super-key, > the current bindings will be faster. More obscure bindings won't get in > their way. > As for C-c % vs C-c C-<key> - the Elisp manual is pretty specific saying > that C-<punctuation> is reserved for minor modes (excluding ; : { and } ). > I picked % out of a hat since it is a comment character. > As for the bolding effect, that is an overlay in matlab-sections, and if > you turn off sections mode, then it goes away. Sections mode just happens > to have also adopted the face used for %% comments. It would be easy to > change the defface in sections to inherit from `font-lock-comment-face' and > fix general font locking. I lost track of where the actual font lock usage > of it is, but the defface should be near the font-lock regexps. Well I just started to use the new section features on a more regular base, and I still am not sure whether I like is or prefer to tweak a bit the setting. > As for auto-choosing when to enable detection of sections to avoid bolding > in functions 'matlab-guess-script-type' already detects the basics of what > is needed. It could just not add its post-command-hook if not in a > script. Sections would then also need to watch when this value changes and > reset itself - typically when one goes from an empty file to one with a > function decl in it. > I'll go look in that other thread too. Thanks for pointing it out. I > hadn't realized how much I missed b/c the emails are getting binned in a > weird place for me when I rearranged my mailing list subscriptions. Well now, we mostly use issues, not that I am a huge fan, but I can see its benefits, and I also managed to configure magit/forge so that I can access them from within Emacs which is a big plus. Uwe -- I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel I strongly condemn Putin's war of aggression against Ukraine. I support to deliver weapons to Ukraine's military. I support the EU and NATO membership of Ukraine. |
From: Eric L. <eri...@gm...> - 2024-11-25 20:43:03
|
I found the github issue about matlab-sections and the highlighting issue, and added a patch there that should both resolve the issue, and make it easier to add new features unique to different types of MATLAB files. Eric On Wed, Nov 20, 2024 at 3:10 PM Uwe Brauer <ou...@ma...> wrote: > >>> "EL" == Eric Ludlam <eri...@gm...> writes: > > > Thanks for the feedback. > > I was proposing adding a 2nd set of bindings. For folks with super-key, > > the current bindings will be faster. More obscure bindings won't get in > > their way. > > > As for C-c % vs C-c C-<key> - the Elisp manual is pretty specific saying > > that C-<punctuation> is reserved for minor modes (excluding ; : { and } > ). > > I picked % out of a hat since it is a comment character. > > > As for the bolding effect, that is an overlay in matlab-sections, and if > > you turn off sections mode, then it goes away. Sections mode just > happens > > to have also adopted the face used for %% comments. It would be easy to > > change the defface in sections to inherit from `font-lock-comment-face' > and > > fix general font locking. I lost track of where the actual font lock > usage > > of it is, but the defface should be near the font-lock regexps. > > Well I just started to use the new section features on a more regular > base, and I still am not sure whether I like is or prefer to tweak a bit > the setting. > > > As for auto-choosing when to enable detection of sections to avoid > bolding > > in functions 'matlab-guess-script-type' already detects the basics of > what > > is needed. It could just not add its post-command-hook if not in a > > script. Sections would then also need to watch when this value changes > and > > reset itself - typically when one goes from an empty file to one with a > > function decl in it. > > > I'll go look in that other thread too. Thanks for pointing it out. I > > hadn't realized how much I missed b/c the emails are getting binned in a > > weird place for me when I rearranged my mailing list subscriptions. > > Well now, we mostly use issues, not that I am a huge fan, but I can see its > benefits, and I also managed to configure magit/forge so that I can > access them from within Emacs which is a big plus. > > Uwe > -- > I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel > I strongly condemn Putin's war of aggression against Ukraine. > I support to deliver weapons to Ukraine's military. > I support the EU and NATO membership of Ukraine. > > |
From: Uwe B. <ou...@ma...> - 2024-11-20 21:00:05
Attachments:
smime.p7s
|
>>> "JC" == John Ciolfi <ci...@ma...> writes: > --_000_mn2pr05mb6766aec9347374bef65023cbd1212mn2pr05mb6766namp_ > Content-type: text/plain; charset="windows-1252" > Content-transfer-encoding: quoted-printable > Hi > I think we could keep the current settings for those that don't have issues= > with the super key. We could also have the C-c C-<ITEM> key binding witch = > is similar to the current settings. > I'm not sure which is better using C-c C-<ITEM> or C-% <ITEM>? Both seem re= > asonable to me. > We should probably have the super key bindings be "2nd" because it doesn't = > work in several cases. Windows can loose access to the super key, in cases = > it doesn't exist on Linux, and Mac doesn't have a super key. Well, indeed Mac does have a super key, but emacs compiled for Mac has. 😉 That is you can configure your emacs so that there is a super key. If needed I can provide the details (I also have a Mac Air, that I use for teaching). > Thanks > ________________________________ > From: Uwe Brauer > Sent: Wednesday, November 20, 2024 12:05 PM > To: John Ciolfi via Matlab-emacs-discuss > Cc: Eric Ludlam; John Ciolfi > Subject: Re: [Matlab-emacs-discuss] matlab-sections.el >>> "JCvM" =3D=3D John Ciolfi via Matlab-emacs-discuss <matlab-emacs-discus= > s...@li...> writes: >> Yes, it's a good feature when working with scripts. >> The key binding is an issue I see too, though when using VNC. >> Sometimes the super key isn't passed through. It's also common for the >> windows super key to not work on Windows, see >> https://answers.microsoft.com/en-us/windows/forum/all/windows-key-not-wor= > king/0c796f79-0aa8-466e-ab44-802005d1791b >> which gives 8 methods for fixing that. I've hit this in the past. >> What about: >> (define-key map (kbd "C-c C-<down>") #'matlab-sections-forward-sectio= > n) >> (define-key map (kbd "C-C C-<up>") #'matlab-sections-backward-section= > ) >> (define-key map (kbd "C-C C-<left>") #'matlab-sections-beginning-of-s= > ection) >> (define-key map (kbd "C-C C-<right>") #'matlab-sections-end-of-sectio= > n) >> (define-key map (kbd "C-c M-<up>") #'matlab-sections-move-section-up) >> (define-key map (kbd "C-c M-<down>") #'matlab-sections-move-section-d= > own) >> (define-key map (kbd "C-c M-<return>") #'matlab-sections-run-till-poi= > nt) >> (define-key map (kbd "C-c C-SPC") #'matlab-sections-mark-section) > Do you mean: in addition to the current keybinding setting or replacing > the current keybinding? > If the current keybinding is problematic for Linux users, can't we > distinguish between the two or say OS. > 1. MacOS: darwin > 2. Linux: gnu/linux > 3. MS, windows-nt > Like > (if (eq system-type 'darwin) > ; something for OS X if true > ; optional something if not > ) -- I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel I strongly condemn Putin's war of aggression against Ukraine. I support to deliver weapons to Ukraine's military. I support the EU and NATO membership of Ukraine. |