M-x uncomment-region not sufficient.

Bug #55415 reported by JohGro
8
Affects Status Importance Assigned to Milestone
haskell-mode (Debian)
Fix Released
Unknown
haskell-mode (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

M-x uncomment-region is not inverse of M-x comment-region

Reproduce
1) Write some haskell code in emacs.
2) Mark a region of code
3) use M-x comment-region
4) Code now has "-- " (3 characters) prepended to each line
5) mark same region
6) use M-x uncomment-region
7) only "--" (2 characters) was removed at beginning of each line and code now begins with a space
8) Use tab cutton to autoindent the line. This says current indentation (initial space) is "sole indentation"

Note: The indentation arrived at after (7) is apparently wrong because ghci gets a parse error on that line, that is avoided by removing the initial space.

Suggestion: If line begins with "-- ", then uncomment-region should remove all three characters, otherwise only "--".

For the indentation in step (8) I know too little to have an opinion on what behaviour is desirable.

Thanks

Johan

Revision history for this message
In , Isaac Potoczny-Jones (ijones-syntaxpolice) wrote : 229468

tags 229468 +upstream

Revision history for this message
In , Isaac Potoczny-Jones (ijones-syntaxpolice) wrote : forwarded upstream

forwarded 229468 Simon Marlow <email address hidden>

Revision history for this message
In , Isaac Potoczny-Jones (ijones-syntaxpolice) wrote : retitle

retitle 46115 haskell-mode mistreats string literals containing comments, keywords, etc.
retitle 229468 haskell-mode: uncomment region broken for (GNU) Emacs
tags 46115 +upstream
tags 51821 +upstream
tags 229468 +upstream

Revision history for this message
In , Stefan Monnier (monnier) wrote : haskell-mode: uncomment region broken for Emacs

AFAIK this is a bug in Emacs-21's newcomment.el which is fixed in the
upcoming Emacs-22.

        Stefan "Maintainer of both haskell-mode and newcomment.el"

Revision history for this message
JohGro (johan-gronqvist) wrote :

M-x uncomment-region is not inverse of M-x comment-region

Reproduce
1) Write some haskell code in emacs.
2) Mark a region of code
3) use M-x comment-region
4) Code now has "-- " (3 characters) prepended to each line
5) mark same region
6) use M-x uncomment-region
7) only "--" (2 characters) was removed at beginning of each line and code now begins with a space
8) Use tab cutton to autoindent the line. This says current indentation (initial space) is "sole indentation"

Note: The indentation arrived at after (7) is apparently wrong because ghci gets a parse error on that line, that is avoided by removing the initial space.

Suggestion: If line begins with "-- ", then uncomment-region should remove all three characters, otherwise only "--".

For the indentation in step (8) I know too little to have an opinion on what behaviour is desirable.

Thanks

Johan

Lothar Braun (typecast)
Changed in haskell-mode:
status: Unconfirmed → Confirmed
Changed in haskell-mode:
status: Unknown → Confirmed
Changed in haskell-mode (Debian):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.