From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#24982: 24.5; way to let Elisp reader ignore unreadable #(...) constructs Date: Sat, 22 Aug 2020 15:44:02 -0700 (PDT) Message-ID: <29a39702-e355-4b00-9805-53f098bc1d40@default> References: <87tuwuh4mj.fsf@gnus.org> <947a8471-8f34-40a9-852c-dc3a0997f9dc@default> <87pn7ih2y9.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32065"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 24982@debbugs.gnu.org, Stefan Kangas To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 23 00:45:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1k9cG5-0008EC-VH for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Aug 2020 00:45:10 +0200 Original-Received: from localhost ([::1]:57764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9cG4-0008A9-Ji for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Aug 2020 18:45:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9cFy-00089v-Bd for bug-gnu-emacs@gnu.org; Sat, 22 Aug 2020 18:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40161) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9cFy-0002t4-2X for bug-gnu-emacs@gnu.org; Sat, 22 Aug 2020 18:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k9cFx-0004eM-UL for bug-gnu-emacs@gnu.org; Sat, 22 Aug 2020 18:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Aug 2020 22:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24982 X-GNU-PR-Package: emacs Original-Received: via spool by 24982-submit@debbugs.gnu.org id=B24982.159813625517803 (code B ref 24982); Sat, 22 Aug 2020 22:45:01 +0000 Original-Received: (at 24982) by debbugs.gnu.org; 22 Aug 2020 22:44:15 +0000 Original-Received: from localhost ([127.0.0.1]:51707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k9cFC-0004d5-V7 for submit@debbugs.gnu.org; Sat, 22 Aug 2020 18:44:15 -0400 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:59328) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k9cFB-0004cs-I7 for 24982@debbugs.gnu.org; Sat, 22 Aug 2020 18:44:13 -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 07MMgmPu016773; Sat, 22 Aug 2020 22:44: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=z8gOu1c2rx39J0fklPVgfrS6cdf2aBLvAT3mxspGwG4=; b=FVSkBVr2fyEdjlDA75Xsh8s2XGjDtI2XyXSVPLjq1YZm+CzFyQAbAjbuPhwAvIOAQYi3 Garw3+mtRbFrV25m4CpxXTKjo6+X5/uywJfJEZCUNCtkbJqGOe99LyRVOUEFpOTwFCFM YgaMDetOzamzphucbIJl16zqAujZ+Ce4UPWs/Gx/RE9XRtsCWnZ+JC8308B1A1s/PDSW aDkcdbe348uPAhEgdbA3aHDZQXsKzteJKEZiX0KojcnoP8VKrMDmImTtH9RCXyL+RBbp 3wXgRFHnGX1psuf9eylOBlq7KSuwGythLUFQUI+jZZpAQo7vDlcR4+A6sytz3+0qOHHE pg== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 332uak9pkf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 22 Aug 2020 22:44:06 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 07MMhwNv020437; Sat, 22 Aug 2020 22:44:06 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 332u614rth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 22 Aug 2020 22:44:06 +0000 Original-Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 07MMi3YO008219; Sat, 22 Aug 2020 22:44:03 GMT In-Reply-To: <87pn7ih2y9.fsf@gnus.org> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5044.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9721 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008220253 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9721 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008220253 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:186008 Archived-At: You bring up a few things. I'll comment only about commenting. ;-) > I couldn't quite remember whether the Common Lisp #| |# was balanced, > but it is, which is nice. That is, you can write > #| foo #| bar |# zot |# > and the first |# doesn't end the first #|. Yes, CL block commenting is fully nestable and unnestable. (IMO, that's really the point/advantage of block commenting.) > I'm not an expert on the Emacs Lisp reader, but poking at it at bit, it > seems like adding support for #| |# should be trivial: It's just a new > comment syntax, really, so we just have to count #|'s and discard the > input. Possibly; dunno. [Aside: I think it would be great if Elisp had reader macros - give Lisp programs control over the Lisp reader.] =20 > So ... What's the use case? Well, I think it's handy > when developing. If I'm in the middle of a function > (foo) > (bar) > (and-here-i'm-adding-some-new-stuff-that's-not-finished > ... > ) > (zot) >=20 > and I'm testing stuff, and I decide to take out the stuff I'm > writing... Emacs doesn't really handle that well. I usually end up > deleting the sexp, and hoping that the kill ring is big enough to hold > it until I need it again, or slapping a (when nil ...) around it, which > is unsatisfactory, because that changes the indentation. >=20 > Just being able to do: > (foo) > (bar) > #| > (and-here-i'm-adding-some-new-stuff-that's-not-finished > ... > ) > |# > (zot) >=20 > would be nice. And then the stuff I'm working on doesn't even have to > be syntactically correct. Yes. Well, we do have such a feature, but we don't have it by just inserting paired delimiters. We have it with `comment-region' (and similar). How so? Plain `C-u' UNcomments/unnests a given comment level. One difference, besides the paired-delimiter one (but which follows from it), is that you can't do it with the same effect in-line. Another is that because a single `;' comments to eol, syntactically there's no essential difference among `;', `;;', `;;;', etc. And yet the commenting and UNcommenting of `comment-region' give you the additional control of how many `;' to work with. E.g., you can "uncomment" by N `;', which may uncomment some code and leave other code commented (which had M>N `;'). But that's also what makes `comment-region' and its `C-u' give you block-commenting behavior. That's how I use `comment-region' - for block commenting and uncommenting - unnesting a block of commented code. And it's why I use `M-;' (`comment-dwim') ONLY for a comment after a line of code. I don't use it to comment the region as a block comment. Its behavior when the region consists only of comments is different from its region behavior otherwise. And I don't want that. ___ Actually, instead of `comment-region' for block commenting I use this, which is the same except it comments/uncomments whole lines. (defun comment-region-lines (beg end &optional arg) (interactive "*r\nP") (when (> beg end) (setq beg (prog1 end (setq end beg)))) (let ((bol (save-excursion (goto-char beg) (line-beginning-position))) (eol (save-excursion (goto-char end) (if (bolp) (point) (line-end-position))))) (comment-region bol eol arg)))