mathworks / Emacs-MATLAB-Mode

Edit, lint, debug, and run MATLAB in Emacs
GNU General Public License v3.0
9 stars 1 forks source link

matlab-fill-region deletes code #10

Closed JohnC32 closed 1 week ago

JohnC32 commented 1 month ago

Given

function b=foo(a)
% foo
% bar
    b = a * 2
end

Select the two comment lines and run matlab-fill-region (C-c C-q), they will be deleted.

This problem has been there for a while, so perhaps we should delete the matlab-fill-region function because normal M-q (fill-paragraph) works?

ouboub commented 1 month ago

"JC" == John Ciolfi @.***> writes:

Given

function b=foo(a)
% foo
% bar
    b = a * 2
end

Select the two comment lines and run matlab-fill-region (C-c C-q), they will be deleted.

This problem has been there for a while, so perhaps we should delete the matlab-fill-region function because normal M-q (fill-paragraph) works?

Filling causes several problems.

Another one are very very long comments in one line.

And fill paragraph on those lines lead also to a disaster. So please don't replace the current one my fill-paragraph.

There is a branch fill-fix, where Eric proposed some changes I tested them, and one was not bad, but not perfect.

I had the idea to merge this branch at some point, but there have been many changes lately, so I better upgrade that branch before I merge it.

I might try that tomorrow afternoon

-- 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.

JohnC32 commented 1 month ago

Hi

This issue is separate from the fill-paragraph issues (M-q). It would be helpful if you could capture a separate issue on fill-paragraph issues with sample *.m files where M-q does the wrong thing. I recall e-mail threads on this but would need to dig through emails to find them. I believe Eric's branch has issues, so it's probably not worth merging or updating the branch fill-fix. Once we have all the fill-paragraph issues collated, I see about getting together with Eric to fix them. Thanks

ouboub commented 1 month ago

Well the branch fill-fix contains test files and a README file, I can move them into default but that would defy a bit the idea of branches. Let me try to figure out in the afternoon, whether I can update that branch (with respect to default), so that we could work there. I don't mind positing these files in a separate issue, but I feel it is more convenient to have them in a branch. Any thoughts

Uwe

JohnC32 commented 1 month ago

Sure, if you'd like to update the fill-fix branch to have them and be merged with the default tip, then that is even better. Thanks

JohnC32 commented 3 weeks ago

I spoke with Eric and I think we should remove this. C-c C-q is a weird key binding. Though first we should get M-q working for all cases.

JohnC32 commented 2 weeks ago

Commit 864ff8a925a28f8dea04135ef228969bcb8bb301 on the fill-fix branch removes non-standard keybinding and function. When merged into default, we'll close.