Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] single-line comment request
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: malc <malc@p...>
Subject: Re: [Caml-list] single-line comment request
On Tue, 8 Apr 2003, Damien wrote:

> On Tue, 8 Apr 2003 17:56:05 +0500 Nickolay Semyonov-Kolchin wrote:
> > Hi,
> hello
>
> > I really want single-line comment in Ocaml. Peter Weis (sorry, if I
> > typed name wrong) several time ago said that "there is no suitable
> > character for single line comment". Why don't use double '#'? I.e.
> > '##'. ## Single line comment
> > let _ = ## Another single line comment
> > ...
> maybe some emacs/vi guru could write a shortcut that [un]comment a
> single line...
> I am not used to Lisp, but I guess it shouldn't be difficult.

(defun caml-comment-till-end-of-line (&optional arg)
  (interactive "P")
  (save-excursion
    (if (looking-at search-whitespace-regexp)
        (re-search-forward search-whitespace-regexp))
    (comment-region (point) (progn (end-of-line) (point)) arg)))

(global-set-key [(alt ?\;)] 'caml-comment-till-end-of-line)

C-;     - comment
C-u C-; - reverse

-- 
mailto:malc@pulsesoft.com

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners