From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: Is Elisp really that slow? Date: Wed, 15 May 2019 12:53:43 -0700 (PDT) Message-ID: References: <20190514235412.kncazq45szlum2gr@Ergus> <46f308ff-5a70-8ccc-310b-48167088ff5a@yandex.ru> <87woirsvdb.fsf@telefonica.net> <87sgtfsswd.fsf@telefonica.net> <76f6370c-e8b7-bc59-634c-c48ea7af7f70@yandex.ru> <87lfz7sqb9.fsf@telefonica.net> <9f750259-44f6-4d39-b01c-db440e8d8782@default> <20190515193833.7n5aiogfwx4jjkzr@Ergus> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="177700"; mail-complaints-to="usenet@blaine.gmane.org" Cc: help-gnu-emacs@gnu.org, Stefan Monnier To: Ergus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 15 21:54:12 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQzyd-000k7g-TK for geh-help-gnu-emacs@m.gmane.org; Wed, 15 May 2019 21:54:12 +0200 Original-Received: from localhost ([127.0.0.1]:41662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQzyc-00015n-Ld for geh-help-gnu-emacs@m.gmane.org; Wed, 15 May 2019 15:54:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQzyN-00013h-QU for help-gnu-emacs@gnu.org; Wed, 15 May 2019 15:53:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQzyM-0006aM-Ma for help-gnu-emacs@gnu.org; Wed, 15 May 2019 15:53:55 -0400 Original-Received: from userp2130.oracle.com ([156.151.31.86]:45044) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hQzyL-0006XZ-00 for help-gnu-emacs@gnu.org; Wed, 15 May 2019 15:53:54 -0400 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4FJYud1040558; Wed, 15 May 2019 19:53:46 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-2018-07-02; bh=4ba291Tjf6i6oXY9/m3SyRpwgURJKWkO7iwtofLESXc=; b=AKdqj4l8WmTR4KZqhVNaDS5HftXmzWh6uDe/4fGjSRpGzlQ3y88gJCCQy5c6RQq6bc8w 6MlON4F3pjBKFZTuk+nLUjWg4Lhv+cho5Yd1taFDeQeS4JGCLNDn1vLwHDjAvj9R9XrA tNVXYaWW6uKysd7JfQ45r0nSO86dudqLI33WxKaD6e0bHIGT2xSF0c/UF8KCdn57Igp9 fN8xKWf3xaiBDpFtAEUOFgijfZTR4tMmk8EhEuVCW5EQRmxFkQV524kz6NbyWXbgUEZ/ Olr1gnK1ZBMHTKsnKYmgylMWET+HTvDNggTqKH7SWRx2Jj/JNSbntr69eRz0qJwnkcB8 2Q== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2sdntty6ve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 May 2019 19:53:46 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4FJrM4q147449; Wed, 15 May 2019 19:53:45 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2sgp32kcqt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 May 2019 19:53:45 +0000 Original-Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x4FJriVq022916; Wed, 15 May 2019 19:53:44 GMT In-Reply-To: <20190515193833.7n5aiogfwx4jjkzr@Ergus> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4849.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9258 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=18 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=742 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905150119 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9258 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=18 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=769 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905150119 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.86 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:120415 Archived-At: > >I agree with Oscar that `comment-dwim' and `comment-region' > >have different behaviors - so neither is a substitute > >for the other. > > > >In particular, `comment-region' lets you also > >uncomment, including unnest, comments. >=20 > To no waste bindings we could just modify comment-region to accept > negative prefix to uncomment. So C-- M-; uncoments region, and M-; > comments it.=20 I don't get your point. `comment-region' already uncomments, with plain `C-u'. > But now there will come another user saying that the dwim > version is better... we will never agree in anything this way. The point was that both `M-;' and `comment-region' are useful, and that neither substitutes for the other. It doesn't matter which one someone think is "better". They're both available. > >I use both, and I bind each to a short key sequence. > > > >More precisely, I leave `comment-dwim' on `M-;' > >and I bind `C-x C-;' to a command similar to > >`comment-region' but that I find more useful: > >`comment-region-lines'. It comments/uncomments > >whole lines. > > > >(So it too differs from `comment-region' - so it > >too is not an exact "replacement".) > > > >As for key bindings: > > > >Although I haven't bothered to change the binding of > >`M-;', I think it's a shame and a waste to sacrifice > >such a nice, short, _repeatable_ key sequence for a > >command that does _nothing_ when you repeat it. > > > >Far better to use `M-;' for some command that keeps > >doing something when repeated (just hold down `M-;'). > >That's what Emacs should do eventually, IMHO. No > >urgency, but someday, when we find a really useful > >repeatable command... > > > >As for `comment-dwim': Since I use `C-x C-;' > >(`comment-region-lines') for block commenting and > >uncommenting, I never really use `M-;' for anything > >other than an end-of-line comment. > > > >`M-;' used to be bound to a command that did only > >that: `indent-for-comment'. And since that's all > >I really use `M-;' for, the rest of `comment-dwim' > >is, yes, wasted and replaceable by `comment-region' > >or my `comment-region-line'. `M-;' for eol comment, > >`C-x C-;' for commenting/uncommenting lines. > > > >(defun comment-region-lines (beg end &optional arg) > > "Like `comment-region', but comment/uncomment whole lines." > > (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))) >=20 > This is the king of features I would really support. Enable line or > region by default. There is a package for that in melpa y find very > useful. I proposed it long ago to emacs-devel. Other, similar commands were also discussed. Emacs-devel decided not to go there (by adding such a command or by giving it - or even `comment-region' - a binding by default). Apparently it was thought that `M-;' is sufficient. Giving something a DWIM name makes it universally useful, I guess. ;-) Well, `comment-region' still does have a "key" binding in vanilla Emacs (at least in some modes), but not a _keyboard_ key binding: comment-region is on