From: Emre Sevinc
Subject: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <87hdnbjus1.fsf@bilgi.edu.tr>
I've just started to use SLIME in GNU Emacs and kissed
ilisp goodbye. I have a minor annoyance, I couldn't find
how to comment out (and undo this operation) a few
lines. I've looked at SLIME menu in Emacs, I've searched
keybindigns using C-h b but I was not able to do that. It was very easy
with ilisp package, there was a menu entry and it also
told me the keyboard bindings for commenting/uncommenting
lines of Lisp code.

Any tips will be appreciated.

Regards,


-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr

From: Surendra Singhi
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <coa2tk$sg$1@news.asu.edu>
Emre Sevinc wrote:
> I've just started to use SLIME in GNU Emacs and kissed
> ilisp goodbye. I have a minor annoyance, I couldn't find
> how to comment out (and undo this operation) a few
> lines. I've looked at SLIME menu in Emacs, I've searched
> keybindigns using C-h b but I was not able to do that. It was very easy
> with ilisp package, there was a menu entry and it also
> told me the keyboard bindings for commenting/uncommenting
> lines of Lisp code.
> 
> Any tips will be appreciated.
> 
> Regards,
> 
> 
There is no default keybinding for commenting code.
In xemacs you can select the region and then execute the command comment 
region.

M-x comment-region

It is provided by xemacs lisp, slime doesn't needs to implement it.

I guess it must be there in emacs. If you want you can associate a 
shortcut with it in your .init file or .emacs file

Also if you want to know the key-binding for certain command then

C-h w comment-region (or whatever command you are looking for)

may help you.

If you have more questions about slime then gmane.lisp.slime.devel or

···········@common-lisp.net will be the best place to ask.

-- 
Surendra Singhi

www.public.asu.edu/~sksinghi
From: ·········@gmail.com
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <1101587855.892581.131990@f14g2000cwb.googlegroups.com>
The rectangle commands work just fine (although they aren't quite as
convenient), and they're good stuff to learn for other reasons.
Specifically, you want C-x r t and C-x r k to insert and delete
comments, respectively. Read the emacs manual for more information.
From: Gabor Melis
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <fb0fb805.0411271353.4a38e6f5@posting.google.com>
Emre Sevinc <·····@bilgi.edu.tr> wrote in message news:<··············@bilgi.edu.tr>...
> I've just started to use SLIME in GNU Emacs and kissed
> ilisp goodbye. I have a minor annoyance, I couldn't find
> how to comment out (and undo this operation) a few
> lines. I've looked at SLIME menu in Emacs, I've searched
> keybindigns using C-h b but I was not able to do that. It was very easy
> with ilisp package, there was a menu entry and it also
> told me the keyboard bindings for commenting/uncommenting
> lines of Lisp code.
> 
> Any tips will be appreciated.
> 
> Regards,

M-; runs the command comment-dwim
   which is an interactive compiled Lisp function in `newcomment'.
(comment-dwim ARG)

Call the comment command you want (Do What I Mean).
If the region is active and `transient-mark-mode' is on, call
  `comment-region' (unless it only consists of comments, in which
  case it calls `uncomment-region').
Else, if the current line is empty, insert a comment and indent it.
Else if a prefix ARG is specified, call `comment-kill'.
Else, call `comment-indent'.

Cheers, Gabor
From: Pascal Bourguignon
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <87k6s7gypx.fsf@thalassa.informatimago.com>
Emre Sevinc <·····@bilgi.edu.tr> writes:

> I've just started to use SLIME in GNU Emacs and kissed
> ilisp goodbye. I have a minor annoyance, I couldn't find
> how to comment out (and undo this operation) a few
> lines. I've looked at SLIME menu in Emacs, I've searched
> keybindigns using C-h b but I was not able to do that. It was very easy
> with ilisp package, there was a menu entry and it also
> told me the keyboard bindings for commenting/uncommenting
> lines of Lisp code.
> 
> Any tips will be appreciated.

The standard emacs commands: M-x comment-region RET and M-x
uncomment-region RET still work.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.
From: Peter Seibel
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <m3sm6vgu9z.fsf@javamonkey.com>
Emre Sevinc <·····@bilgi.edu.tr> writes:

> I've just started to use SLIME in GNU Emacs and kissed ilisp
> goodbye. I have a minor annoyance, I couldn't find how to comment
> out (and undo this operation) a few lines. I've looked at SLIME menu
> in Emacs, I've searched keybindigns using C-h b but I was not able
> to do that. It was very easy with ilisp package, there was a menu
> entry and it also told me the keyboard bindings for
> commenting/uncommenting lines of Lisp code.
>
> Any tips will be appreciated.

Also note that commenting out several lines is less common in Common
Lisp than in ALGOLish languages because you can comment out distinct
forms with #+(or). E.g. if you have:

  (defun foo (x y z)
    (dotimes (i 20)
      (stuff i)
      (case x
        (a (blah))
        (b (bar)))
      (more-stuff y z)))

And you want to comment out the CASE you can just add this:


  (defun foo (x y z)
    (dotimes (i 20)
      (stuff i)
      #+(or)(case x
        (a (blah))
        (b (bar)))
      (more-stuff y z)))

which will cause the CASE form to be skipped by the reader.

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp
From: Emre Sevinc
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <87vfbri676.fsf@bilgi.edu.tr>
Peter Seibel <·····@javamonkey.com> writes:

> And you want to comment out the CASE you can just add this:
>
>
>   (defun foo (x y z)
>     (dotimes (i 20)
>       (stuff i)
>       #+(or)(case x
>         (a (blah))
>         (b (bar)))
>       (more-stuff y z)))
>
> which will cause the CASE form to be skipped by the reader.

Very interesting! This is the first time I see
that kind of commenting, I guess you should definitely
write about that in your "Practical Lisp", being able
to comment out blocks of code by simply marking the 
beginning is not something programmers like me can laugh at
and take lightly ;-)

I've tried the above template to get some experience,
I can see the whole "case" is commented out by
using #+ but I was not able to comment out (dotimes ...
in a similar fashion, sbcl complained that I've done
something wrong.

Also thanks to Pascal and Surendra for showing
me the general way of commenting/uncommenting. 

-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: Peter Seibel
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <m3oehjgltu.fsf@javamonkey.com>
Emre Sevinc <·····@bilgi.edu.tr> writes:

> Peter Seibel <·····@javamonkey.com> writes:
>
>> And you want to comment out the CASE you can just add this:
>>
>>
>>   (defun foo (x y z)
>>     (dotimes (i 20)
>>       (stuff i)
>>       #+(or)(case x
>>         (a (blah))
>>         (b (bar)))
>>       (more-stuff y z)))
>>
>> which will cause the CASE form to be skipped by the reader.
>
> Very interesting! This is the first time I see
> that kind of commenting, I guess you should definitely
> write about that in your "Practical Lisp", being able
> to comment out blocks of code by simply marking the 
> beginning is not something programmers like me can laugh at
> and take lightly ;-)
>
> I've tried the above template to get some experience,
> I can see the whole "case" is commented out by
> using #+ but I was not able to comment out (dotimes ...
> in a similar fashion, sbcl complained that I've done
> something wrong.

Hmmm. It ought to work: #+(or) causes the reader to skip the next
s-expression. Can you post the exact code SBCL complained about and
the error message?

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp
From: Emre Sevinc
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <87llcnhxru.fsf@bilgi.edu.tr>
Peter Seibel <·····@javamonkey.com> writes:

> From: Peter Seibel <·····@javamonkey.com>
> Subject: Re: How to comment (and uncomment) blocks in SLIME
> Newsgroups: comp.lang.lisp
> Date: Sat, 27 Nov 2004 18:59:09 GMT
> Organization: SBC http://yahoo.sbc.com
>
> Emre Sevinc <·····@bilgi.edu.tr> writes:
>
>> Peter Seibel <·····@javamonkey.com> writes:
>>
>>> And you want to comment out the CASE you can just add this:
>>>
>>>
>>>   (defun foo (x y z)
>>>     (dotimes (i 20)
>>>       (stuff i)
>>>       #+(or)(case x
>>>         (a (blah))
>>>         (b (bar)))
>>>       (more-stuff y z)))
>>>
>>> which will cause the CASE form to be skipped by the reader.
>>
>> Very interesting! This is the first time I see
>> that kind of commenting, I guess you should definitely
>> write about that in your "Practical Lisp", being able
>> to comment out blocks of code by simply marking the 
>> beginning is not something programmers like me can laugh at
>> and take lightly ;-)
>>
>> I've tried the above template to get some experience,
>> I can see the whole "case" is commented out by
>> using #+ but I was not able to comment out (dotimes ...
>> in a similar fashion, sbcl complained that I've done
>> something wrong.
>
> Hmmm. It ought to work: #+(or) causes the reader to skip the next
> s-expression. Can you post the exact code SBCL complained about and
> the error message?

Ooops! :o I beg your pardon, I misunderstood; I took it as only "#+",
of course when I did the right thing by putting "#+(or)" it did
what it should do and ignored the whole (dotimes ... ).




-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: Harald Hanche-Olsen
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <pcou0ragsz6.fsf@shuttle.math.ntnu.no>
+ Peter Seibel <·····@javamonkey.com>:

| [...] you can comment out distinct forms with #+(or).

As a matter of style, I much prefer #-(and).
#+(or) looks much too, uh, positive, if you get my drift.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
  than thinking does: but it deprives us of whatever chance there is
  of getting closer to the truth.  -- C.P. Snow
From: Marco Baringer
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <m21xeeyvf0.fsf@bese.it>
Harald Hanche-Olsen <······@math.ntnu.no> writes:

> + Peter Seibel <·····@javamonkey.com>:
>
> | [...] you can comment out distinct forms with #+(or).
>
> As a matter of style, I much prefer #-(and).
> #+(or) looks much too, uh, positive, if you get my drift.

i would also suggest #+comment (and make sure you don't have :comment
on *features*).

-- 
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
     -Leonard Cohen
From: Luis Oliveira
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <3m2p72-jsi.ln1@netman.ath.cx>
Peter Seibel skribis:
> Also note that commenting out several lines is less common in Common
> Lisp than in ALGOLish languages because you can comment out distinct
> forms with #+(or).

Why not #+nil ? It seems to be more intuitive for me.

-- 
Luís Oliveira                                         Lisp is the red pill.
Reply-To: luismbo (@) netcabo (.) pt         -- John Fraser, comp.lang.lisp
Equipa Portuguesa do Translation Project
http://www2.iro.umontreal.ca/~pinard/po/registry.cgi?team=pt
From: Harald Hanche-Olsen
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <pcou0ram2ff.fsf@shuttle.math.ntnu.no>
+ Luis Oliveira <·············@deadspam.com>:

| Peter Seibel skribis:
| > Also note that commenting out several lines is less common in Common
| > Lisp than in ALGOLish languages because you can comment out distinct
| > forms with #+(or).
| 
| Why not #+nil ? It seems to be more intuitive for me.

The advantage of using #+(or) or #-(and) is that it always works, no
matter what might be in *features*.  We may consider it silly to add
nil - or comment - to *features*, but how can you be sure that no one
will ever do it?

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
  than thinking does: but it deprives us of whatever chance there is
  of getting closer to the truth.  -- C.P. Snow
From: Andreas Eder
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <m3act2asma.fsf@banff.eder.de>
Harald Hanche-Olsen <······@math.ntnu.no> writes:

> The advantage of using #+(or) or #-(and) is that it always works, no
> matter what might be in *features*.  We may consider it silly to add
> nil - or comment - to *features*, but how can you be sure that no one
> will ever do it?

You can be almost sure, that somebody has already done it, since once
upon a time, there was a lisp called NIL (new implementation of
lisp). And I'm pretty sure there was :nil on the feature list.

Andreas
-- 
Wherever I lay my .emacs, there's my $HOME.
From: Peter Seibel
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <m3mzx1q0d9.fsf@javamonkey.com>
Luis Oliveira <·············@deadspam.com> writes:

> Peter Seibel skribis:
>> Also note that commenting out several lines is less common in Common
>> Lisp than in ALGOLish languages because you can comment out distinct
>> forms with #+(or).
>
> Why not #+nil ? It seems to be more intuitive for me.

Because there's no guarantee that someone hasn't pushed NIL on
*features*. Which is of course somewhat pedantic. But there it is.

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp
From: Christophe Rhodes
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <sqis7pre6r.fsf@cam.ac.uk>
Luis Oliveira <·············@deadspam.com> writes:

> Peter Seibel skribis:
>> Also note that commenting out several lines is less common in Common
>> Lisp than in ALGOLish languages because you can comment out distinct
>> forms with #+(or).
>
> Why not #+nil ? It seems to be more intuitive for me.

Because #+nil refers to the keyword feature :NIL, and someone calling
their implementation "the New Implementation of Lisp" would quite
legitimately have that keyword on *FEATURES*.  Forms preceded with
#+(or), on the other hand, will never be read in.

Christophe
From: Thomas F. Burdick
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <xcvbrdhlpak.fsf@conquest.OCF.Berkeley.EDU>
Christophe Rhodes <·····@cam.ac.uk> writes:

> Luis Oliveira <·············@deadspam.com> writes:
> 
> > Peter Seibel skribis:
> >> Also note that commenting out several lines is less common in Common
> >> Lisp than in ALGOLish languages because you can comment out distinct
> >> forms with #+(or).
> >
> > Why not #+nil ? It seems to be more intuitive for me.
> 
> Because #+nil refers to the keyword feature :NIL, and someone calling
> their implementation "the New Implementation of Lisp" would quite
> legitimately have that keyword on *FEATURES*.  Forms preceded with
> #+(or), on the other hand, will never be read in.

And while all of this is true, and I myself use #+(or) to comment out
forms, I got a kick out of seeing this message of Dan Barlow's in the
asdf source:

  #+nil
  (error "The author of this file habitually uses #+nil to comment out forms.  But
   don't worry, it was unlikely to work in the New Implementation of Lisp anyway")
From: Carl Shapiro
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <ouyr7mdhb2u.fsf@panix3.panix.com>
···@conquest.OCF.Berkeley.EDU (Thomas F. Burdick) writes:

> And while all of this is true, and I myself use #+(or) to comment out
> forms, I got a kick out of seeing this message of Dan Barlow's in the
> asdf source:

This must be a bad habbit picked up from C-like languages where a
logical false object is used for the unconditionally exclusion of
source lines from macroexpansion.  I don't think its usage was ever
common practice.  Most code I have seen uses the escape #+ignore to
exclude expressions.
From: Luis Oliveira
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <mnfq72-ofk.ln1@netman.ath.cx>
Thomas F. Burdick skribis:
> And while all of this is true, and I myself use #+(or) to comment out
> forms, I got a kick out of seeing this message of Dan Barlow's in the
> asdf source:
> 
>  #+nil
>  (error "The author of this file habitually uses #+nil to comment out forms.  But
>   don't worry, it was unlikely to work in the New Implementation of Lisp anyway")

I had seen a couple of "#+nil"s (eg: in araneida's sources and recently in this
tutorial: http://constantly.at/lisp/ui.html) and I had never seen a #+(or) so I
assumed #+nil was ok.

Thanks for your answers!

-- 
Luís Oliveira
Reply-To: luismbo (@) netcabo (.) pt
Equipa Portuguesa do Translation Project
http://www2.iro.umontreal.ca/~pinard/po/registry.cgi?team=pt
From: Nikodemus Siivola
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <coesld$hofnv$1@midnight.cs.hut.fi>
Christophe Rhodes <·····@cam.ac.uk> wrote:

> Because #+nil refers to the keyword feature :NIL, and someone calling
> their implementation "the New Implementation of Lisp" would quite
> legitimately have that keyword on *FEATURES*.  Forms preceded with
> #+(or), on the other hand, will never be read in.

...and if one doesn't like the look of #+(or) there is always
#+#:whatever as an equally safe option. ;-)

Cheers,

 -- Nikodemus
From: Bill Clementson
Subject: Re: How to comment (and uncomment) blocks in SLIME
Date: 
Message-ID: <1b3ac8a3.0411271617.47667f18@posting.google.com>
Emre Sevinc <·····@bilgi.edu.tr> wrote in message news:<··············@bilgi.edu.tr>...
> I've just started to use SLIME in GNU Emacs and kissed
> ilisp goodbye. I have a minor annoyance, I couldn't find
> how to comment out (and undo this operation) a few
> lines. I've looked at SLIME menu in Emacs, I've searched
> keybindigns using C-h b but I was not able to do that. It was very easy
> with ilisp package, there was a menu entry and it also
> told me the keyboard bindings for commenting/uncommenting
> lines of Lisp code.

I see that a number of others have commented (pun intended) on
different options. One option that has not been mentioned though is
slime-insert-balanced-comments. It is not bound to any key binding by
default in slime (I bind it to "C-c ;" in my .emacs file). I use it
quite frequently to comment out sexp's. Here's the description of the
function:

 "Insert a set of balanced comments around the s-expression containing
the point.  If this command is invoked repeatedly (without any other
command occurring between invocations), the comment progressively
moves outward over enclosing expressions. If invoked with a positive
prefix argument, the s-expression arg expressions out is enclosed in a
set of balanced comments."

Hope you find it useful.

--
Bill Clementson