help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: commenting trouble


From: Xah Lee
Subject: Re: commenting trouble
Date: Mon, 12 Jan 2009 14:49:30 -0800 (PST)
User-agent: G2/1.0

On Jan 9, 11:52 am, Reynaldo <reynaldo...@gmail.com> wrote:
> Hello,
>
> Recently I wrote this (my first lines of Emacs Lisp)
>
> (defun comentar (&optional beg end)
>   (interactive "r")
>   (save-excursion
>     (if (and beg end)
>     (comment-region beg end)
>       (let ((beg (progn
>            (beginning-of-line)
>            (point)))
>         (end (progn
>            (end-of-line)
>            (point))))
>     (comment-region beg end)))))
>
> And my purpose was to use the same function to comment a line without
> having to select a region, or comment a region (selecting it, of course)
> but it doesn't work as expected.
> ...

I have writen exactly that.

See:

• How To Write A Emacs Command For Comment Handling
  http://xahlee.org/emacs/elisp_comment_command.html

I sent a bug report to gnu emacs official list, about how comment-dwim
does not comment out the current line when there's no selection. I
think it is not intuitive.

Bug #1286
http://groups.google.com/group/gnu.emacs.bug/browse_frm/thread/7186aed0c6f4b58e

2 emacs developers responded that the current behavior has always been
like that and did not consider it not intuitive.

  Xah
∑ http://xahlee.org/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]