From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: commenting trouble Date: Mon, 12 Jan 2009 14:49:30 -0800 (PST) Organization: http://groups.google.com Message-ID: <8f13a023-40ea-4959-b927-862cce3e29ed@v39g2000pro.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1231825489 10269 80.91.229.12 (13 Jan 2009 05:44:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 Jan 2009 05:44:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 13 06:45:58 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LMc69-0001A6-3G for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Jan 2009 06:45:57 +0100 Original-Received: from localhost ([127.0.0.1]:50199 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMc4s-0007zX-K9 for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Jan 2009 00:44:38 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!postnews.google.com!v39g2000pro.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 45 Original-NNTP-Posting-Host: 69.226.219.162 Original-X-Trace: posting.google.com 1231800570 4420 127.0.0.1 (12 Jan 2009 22:49:30 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 12 Jan 2009 22:49:30 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v39g2000pro.googlegroups.com; posting-host=69.226.219.162; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:165953 comp.emacs:97640 X-Mailman-Approved-At: Tue, 13 Jan 2009 00:42:00 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61288 Archived-At: On Jan 9, 11:52 am, Reynaldo 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: =E2=80=A2 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/7186aed0c6f4= b58e 2 emacs developers responded that the current behavior has always been like that and did not consider it not intuitive. Xah =E2=88=91 http://xahlee.org/ =E2=98=84