bugGNU Octave - Bugs: bug #52695, Uncomment should work with any...


bug #52695: Uncomment should work with any kind of comment

Submitted by:  Marshall <marsian>
Submitted on:  Tue 19 Dec 2017 06:07:36 PM UTC  
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  Torsten <ttl>
Originator Name:  Marsian Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Thu 04 Jan 2018 11:55:42 PM UTC, comment #13:

That works great! Thanks!

Marshall <marsian>
Thu 04 Jan 2018 08:27:51 PM UTC, comment #12:

I've tested the change and it works as advertised. I've not thought too much about minimal or extraneous key-sequencing, but it's a nice feature. Torsten may fine-tune as desired or based on later feedback at a later time.

Dan Sebald <sebald>
Thu 04 Jan 2018 05:30:18 PM UTC, comment #11:

Has this been tested? Can issue report be closed?

Rik <rik5>
Project Administrator
Fri 29 Dec 2017 09:39:11 PM UTC, comment #10:

Storing the last comment string as suggested in comment #8 is provided by changeset

Torsten <ttl>
Project MemberIn charge of this item.
Fri 29 Dec 2017 07:56:45 PM UTC, comment #9:

Good point! I'll fix that.

Torsten <ttl>
Project MemberIn charge of this item.
Fri 29 Dec 2017 05:19:17 PM UTC, comment #8:

I've tried the quick comment change option. I like the feature of being able to type in the desired comment. This works well for me.

It looks like the selection of alternate comment is based on the default comment. Would it be possible to remember the last entered comment? It seems that it would be slightly easier to use that way because the default comment is already available via Ctl-R, so Ctl-alt-R would most likely be used for a non-default comment, and that one would be most likely to re-use the alternate comment typed last.

Marshall <marsian>
Thu 28 Dec 2017 08:49:22 PM UTC, comment #7:

I have pushed changeset
which provides the missing possibility to temporarily select another comment string. Instead of radio buttons for pre-selected strings, a text field allows arbitrary strings, which is provides more flexibility.

Torsten <ttl>
Project MemberIn charge of this item.
Thu 28 Dec 2017 08:02:42 PM UTC, comment #6:

Those changes work for me. A quick way to change the comment type would still be nice, like as in comment #4, though I noticed I could leave the preferences window open and change and apply the comment type there to get something that worked to 'quickly' change between comment types.

Marshall <marsian>
Wed 27 Dec 2017 08:09:59 PM UTC, comment #5:

provides the ability to consider multiple uncommenting strings when uncommenting a text.

The possibility for temporarily selecting another comment string as proposed by Dan will follow.

Torsten <ttl>
Project MemberIn charge of this item.
Tue 19 Dec 2017 10:58:01 PM UTC, comment #4:

The original poster wrote:

(It would also be nice if there were a separate test-comment-command that could create %! type comments, but maybe that's better for a different feature request)

I see that

[BTW, note that in the submenu in which the above appears, there are three entries with the U shortcut key selection.]

Another thing that could be done to address the above would be a new code sequence

in which the Ctrl+Alt+R will pop up a dialog box with a radio button list (or some similar construct) having

and once a person clicks the choice, it's that comment character that is selected.

So, one could do Ctrl+R to get their favorite comment character (% or whatever preference set up) and then to get %! it would be a slightly slower process of Ctrl+Alt+R and a few down-arrow keystrokes and ENTER. A radio button, drop-down list, etc. should all have close to the same sort of action as far as keyboard input goes.

Dan Sebald <sebald>
Tue 19 Dec 2017 09:45:36 PM UTC, comment #3:

Good idea (original post and the preference entry). I will take care of it.

Torsten <ttl>
Project MemberIn charge of this item.
Tue 19 Dec 2017 06:50:06 PM UTC, comment #2:

I like your suggestion to add %! as a "test comment". Especially to be able to uncomment test blocks.

Note that there's an easy workaround by just commenting in matlab style twice, select the test lines and then search/replace %% by %! in the selection, or %! by "" (empty).

Philip Nienhuis <philipnienhuis>
Project Member
Tue 19 Dec 2017 06:40:09 PM UTC, comment #1:

Could have a preference entry for

in which only one radio button is selectable. And then also

in which multiple radio buttons are selectable.

This comment/uncomment character only applies to the first non-whitespace character of a line, correct?

Dan Sebald <sebald>
Tue 19 Dec 2017 06:07:36 PM UTC, original submission:

In the new dev version, there is an editor preference for setting the desired comment symbol to insert (%, #, or ##). Uncomment works only with the selected comment option. I think the uncomment command should work with any type of comment. As a bonus it could also work with %! which is found in the tests. (It would also be nice if there were a separate test-comment-command that could create %! type comments, but maybe that's better for a different feature request).

This is useful for working with code that may not have the preferred commenting style, and where I might want to uncomment large blocks of code (or tests).

At a minimum I think uncommenting should work with both % and #, whether or not it works with ## (which is just # twice) or %!.

As a possible counter-argument, I can see the value of not having uncommenting working with both # and %, maybe to allow the non-default comment to be a permanent-comment that persists in a large section of commented code with valid non-code comments. If that is a desirable feature I would recommend adding another uncomment-all command so that either simple uncomment could be used (only un-commenting the default), and/or uncommenting independent of the option. I'm not sure which key-commands I'd suggest, maybe leaving it blank for optional assignment, since I have re-assigned some of the key commands from the octave defaults anyways.

Marshall <marsian>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by marsian (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-01-05 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2017-12-27 ttl StatusNone => Ready For Test
    2017-12-19 ttl Assigned toNone => ttl
        Operating SystemMicrosoft Windows => Any

    Back to the top

    Powered by Savane 3.3