From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: Just a thought about comment-line Date: Sun, 31 May 2020 11:05:55 -0700 (PDT) Message-ID: References: <306c7cf5-6cfc-436e-a902-8ad4560b32d1@default> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="39831"; mail-complaints-to="usenet@ciao.gmane.io" Cc: PEDRO ANDRES ARANDA GUTIERREZ , emacs-devel@gnu.org, Yuri Khan To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 31 20:07:20 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jfSMi-000AGZ-AL for ged-emacs-devel@m.gmane-mx.org; Sun, 31 May 2020 20:07:20 +0200 Original-Received: from localhost ([::1]:37172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfSMh-00064C-B5 for ged-emacs-devel@m.gmane-mx.org; Sun, 31 May 2020 14:07:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfSLc-0005dW-GC for emacs-devel@gnu.org; Sun, 31 May 2020 14:06:13 -0400 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:34268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfSLZ-0003ag-0V for emacs-devel@gnu.org; Sun, 31 May 2020 14:06:11 -0400 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04VI2KnH192149; Sun, 31 May 2020 18:06:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=JGiG7Ins4Iir2OGRFkaP71dKtC6YHUIokKIjyWM5/ZE=; b=wBD3aXh3NoWI+Jk9F+5QITB3T8l6gtEXqYAvN3LHZXb19cGz9gh/5prcPYBq8VFMve5p bUX7+5A/ZknuE4FkO+yP/0Pan6+LA5yiZEb/cTYtw+6UunKPOIsVgwToKDnWRMWstbrI LavS2c9SMhXAVR6ORA2xGmFjV8gfkZmNXsifdQoyFwQEDIWTH1l25XRee1ltYEbsPqa3 22GB+bVPeyXmdM6xlxLPr3DYRP66ieeBHxCVkpxm85IR8vq8nLFYbVQQX3tZXlVtcAZH LibzmRRzaNhPqrIcxWv8oMEwAa8xd/34OKlIzMagXew25OihdEIRtzakXzBEuAOJ9GeO Sw== Original-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 31bfekure4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 31 May 2020 18:06:06 +0000 Original-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04VI36j5035429; Sun, 31 May 2020 18:06:05 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 31c1dubhx9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 31 May 2020 18:06:05 +0000 Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 04VI5wYk015751; Sun, 31 May 2020 18:05:59 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5005.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9638 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005310145 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9638 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 phishscore=0 clxscore=1015 impostorscore=0 adultscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005310145 Received-SPF: pass client-ip=141.146.126.78; envelope-from=drew.adams@oracle.com; helo=aserp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/31 12:39:18 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251691 Archived-At: > > For block commenting, `comment-dwim' doesn't let > > you nest and unnest a given level of commenting, >=20 > It automatically decides whether to comment or to uncomment, indeed. Precisely. It's a compromise, and not a great one (IMO). Better to have two commands, one for block commenting and the other for end-of-line commenting. > > and control the number of comment chars used, etc. >=20 > Hmm... works for me. At least `C-u 5 M-;` seems to correctly use 5 `#` > chars to comment the region when used in a Makefile. Yes. But it can't provide comment-block nesting, because it UNcomments any selected lines that are already commented, instead of adding a level of commenting for them.=20 IMO, `comment-dwim' doesn't provide good behavior for block commenting because it tries to do too much conditionally. I count 10 different behaviors for it, from the doc string (if, unless, else, else, if, if, else, else, if, else). IF what you happen to want, when you hit that one key (M-;), happens to coincide with what the designer of that command thought you should want, THEN it fits, for that occurrence. It's not just that it has to correctly guess what you mean. It's also that _you_ have to guess what it's guessing you mean. ;-) (OK, using all combinations of its conditional behavior often enough might give you finger familiarity. In that case, the only problem is that it doesn't offer some commenting behaviors.) As for most everything, the strength of a DWIM command is also its weakness. It tells you what you want, instead of making you or letting you say just what you want. When it guesses what you want correctly it can be handy. But too often it doesn't really let you say, and thus get, what you want. If Elisp, like Common Lisp, had a second comment syntax for block commenting, i.e., so-called "balanced" comment macro-char syntax (#|...|#), then the behavior you'd want for that is pretty much what command `comment-region-lines' provides. It's handy for commenting-out and uncommenting blocks of code, which can involve nested blocks. https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node191.html#SECTION00261400= 0000000000000 > >> FWIW I agree with you: a region that ends at the physical start of > >> line, before indentation, should not be considered to include that > >> line. > > FWIW, I too agree about this. >=20 > Right, as a general rule, the LF char belongs to the line that it > terminates, so a position at BOL is really "between lines". > Of course, that would require a special case when START=3DEND=3DBOL. That special case is what `comment-region-lines' handles. It just does this: (comment-region BOL EOL PREFIX-ARG).