[erlang-questions] uncomment in erlang-mode in emacs

June Kim <>
Sat Apr 7 17:37:10 CEST 2007


I found an answer ; however, I am not sure if it is a correct solution.

(defun erlang-uncomment-region (beg end)
  "Uncomment all commented lines in the region."
  (interactive "r")
  (comment-region beg end -1))

As you see the optional arg to comment-region is -1, which means
delete 1 character. It should be -3 instead. Then it works okay. Is
this a bug? I thought erlang-mode is daily used by many erlang
programmers, but how come this bug is still in?

BTW, I found another way to comment and uncomment a region. M-;(which
is general in emacs) does it and it has no such problem as remaining
%s and blanks.


2007/4/8, June Kim <>:
> Sorry. I forgot to add version infos.
>
> GNU Emacs 22.0.95.1 (i386-mingw-nt5.1.2600)
> "Erlang mode version 2.5.2, written by Anders Lindgren"
>
> running on a windows xp sp2 machine.
>
>
>
> 2007/4/8, June Kim <>:
> > I use VIM extensively excep when programming in Erlang. Actually, it
> > is first time for me to seriously using emacs.
> >
> > C-c C-c comments the selected region in erlang-mode. It works all
> > right. However, uncomment, which is C-c C-u, doesn't work properly.
> >
> > Say, the selected region is:
> >
> > a() ->
> >    case b() of
> >        1->
> >            ok;
> >        _ ->
> >            error
> >    end.
> >
> > Now I C-c C-c:
> >
> > %% a() ->
> > %%     case b() of
> > %%      1->
> > %%          ok;
> > %%      _ ->
> > %%          error
> > %%     end.
> >
> > I select the region again and C-c C-u:
> >
> > % a() ->
> > %     case b() of
> > %       1->
> > %           ok;
> > %       _ ->
> > %           error
> > %     end.
> >
> > Oops. There are %s remaining at the start of each line. I do the C-c
> > C-u again in the same region:
> >
> >  a() ->
> >     case b() of
> >        1->
> >            ok;
> >        _ ->
> >            error
> >     end.
> >
> > Oops, again. There are blanks remaining at the start of each line.
> >
> > What's wrong? How are other people commenting and uncommenting their
> > elrang code in emacs?
> >
>



More information about the erlang-questions mailing list