For Programmers: Free Programming Magazines  


Home > Archive > Scheme > April 2006 > uncomment-region problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author uncomment-region problem
gento

2006-04-20, 4:04 am

I'm using "GNU Emacs 21.2.1 (i686-pc-cygwin, X toolkit) of 2004-03-22
on cm-test"
and working on a scheme file "test.scm" which contains the lines

(display " hello 1" outport)
; (display " hello 2" outport)
(display " hello 3" outport)


If I run M-x comment-region on the above region I get


; (display " hello 1" outport)
; ; (display " hello 2" outport)
; (display " hello 3" outport)


The execution of M-x uncomment-region on the above region yields


(display " hello 1" outport)
(display " hello 2" outport)
(display " hello 3" outport)


whereas I would like to have


(display " hello 1" outport)
; (display " hello 2" outport)
(display " hello 3" outport)


I think this behaviour is related to the emacs scheme mode, since it
doesn't occur with files with no extension.

I appreciate any help

rsheridan6@gmail.com

2006-04-20, 8:05 am


gento wrote:
> I'm using "GNU Emacs 21.2.1 (i686-pc-cygwin, X toolkit) of 2004-03-22
> on cm-test"
> and working on a scheme file "test.scm" which contains the lines
>
> (display " hello 1" outport)
> ; (display " hello 2" outport)
> (display " hello 3" outport)
>
>
> If I run M-x comment-region on the above region I get
>
>
> ; (display " hello 1" outport)
> ; ; (display " hello 2" outport)
> ; (display " hello 3" outport)
>
>
> The execution of M-x uncomment-region on the above region yields
>
>
> (display " hello 1" outport)
> (display " hello 2" outport)
> (display " hello 3" outport)
>
>
> whereas I would like to have
>
>
> (display " hello 1" outport)
> ; (display " hello 2" outport)
> (display " hello 3" outport)
>


I have this in my scheme-mode-hook:

(setq comment-start ";;")

so that comment-region and uncomment-region both use two semicolons,
and I don't have this problem. Using ";;" also has the advantage that
Emacs will indent code in your comments properly.

BTW, you could have used M-; (comment-dwim) instead of M-x
[un]comment-region.

Pascal Bourguignon

2006-04-20, 8:05 am

"gento" <gento_distefano@hotmail.com> writes:

> I'm using "GNU Emacs 21.2.1 (i686-pc-cygwin, X toolkit) of 2004-03-22
> on cm-test"
> and working on a scheme file "test.scm" which contains the lines
>
> (display " hello 1" outport)
> ; (display " hello 2" outport)
> (display " hello 3" outport)
>
>
> If I run M-x comment-region on the above region I get
>
>
> ; (display " hello 1" outport)
> ; ; (display " hello 2" outport)
> ; (display " hello 3" outport)
>


In my emacs "22.0.50.1", comment-region produces:

;; (display " hello 1" outport)
;; ; (display " hello 2" outport)
;; (display " hello 3" outport)

And uncomment-region reverts to the original.
Even with emacs -q test.scm


--
__Pascal Bourguignon__ http://www.informatimago.com/

ADVISORY: There is an extremely small but nonzero chance that,
through a process known as "tunneling," this product may
spontaneously disappear from its present location and reappear at
any random place in the universe, including your neighbor's
domicile. The manufacturer will not be responsible for any damages
or inconveniences that may result.
gento

2006-04-20, 8:05 am

thank you very much for your suggestion, I run M-: (setq comment-start
";;") and everything
worked fine.
I'm new at emacs and I don't know how to modify the scheme-mode-hook as
you recommend,
could you give me a hint?

Pascal Bourguignon

2006-04-20, 8:05 am

"gento" <gento_distefano@hotmail.com> writes:
> thank you very much for your suggestion, I run M-: (setq comment-start
> ";;") and everything
> worked fine.
> I'm new at emacs and I don't know how to modify the scheme-mode-hook as
> you recommend,
> could you give me a hint?


Add:

(require 'cl)
(push (lambda () (setf comment-start ";;")) scheme-mode-hook)

in your ~/.emacs

(In my emacs 22, comment-start is left to its default ";" and it still works).

--
__Pascal Bourguignon__ http://www.informatimago.com/

CAUTION: The mass of this product contains the energy equivalent of
85 million tons of TNT per net ounce of weight.
gento

2006-04-20, 7:06 pm

thank you pascal

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com