From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.help Subject: Re: Is Elisp really that slow? Date: Wed, 15 May 2019 21:38:33 +0200 Message-ID: <20190515193833.7n5aiogfwx4jjkzr@Ergus> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="115295"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: help-gnu-emacs@gnu.org, Stefan Monnier To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 15 21:39:16 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 1hQzkB-000Tsf-P0 for geh-help-gnu-emacs@m.gmane.org; Wed, 15 May 2019 21:39:16 +0200 Original-Received: from localhost ([127.0.0.1]:41538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQzkA-0006Fz-Ht for geh-help-gnu-emacs@m.gmane.org; Wed, 15 May 2019 15:39:14 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQzjk-0006E5-Q4 for help-gnu-emacs@gnu.org; Wed, 15 May 2019 15:38:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQzjj-0005hW-KC for help-gnu-emacs@gnu.org; Wed, 15 May 2019 15:38:48 -0400 Original-Received: from sonic313-21.consmr.mail.ir2.yahoo.com ([77.238.179.188]:33913) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQzjh-0005dE-9c for help-gnu-emacs@gnu.org; Wed, 15 May 2019 15:38:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1557949122; bh=w/97/+ycAnEOIzVZNy/6as/EhBDkW/HnJDdrXjiGGmc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=GIFD5QkpL1dO6PALhYKFPCUEkqtLcRfxV8ejx6Oel0EGQQBuzQJ8Ota+dCSyW9DV8jAaGJStJ3cohABo1oqu3VGD4OuZT6oqfKB3OnbG+sgAvigbQ8Udib8CoqCLtK/1DG2VmMaDa4ClNv8rOLeUZcBerI2lBfRNGP283N5JRS3kzVQv/AQv/naoyykDgc4iiC1MNQL01G/uUPNsORS9vEAPqdnSwOOSwgfxHXNYPiMkBDB6iRBEqZUmXWWSIYB/rCmHPo8IRbaf4FzP4LKZdwRhTUcX57thzS7+s3R8UXsd8R/XNASo2WOkSZuvKna3iN9mkhcz/xNQ5bIp1Oab3g== X-YMail-OSG: LarjXb8VM1leLoimOqhBdywSPPmuJsOv9H0r.0VhItgT9k0WCEHE6veBWOvmtG3 ZmlxSmpabjjlgr5AZ2BXM9Pzi39pcAdb.l29zbRvfDwCq_d8CA8dl00UZn5657zqe7aKYd5ck8wB dQs9U0PD9LwgZHLgO86iM5c9MFRqUlqWc3oTc4XALo_ycQ87K4B8yzN0kPvT23ImdE7lAExyOSQA zFebDSaYRVSG4FBLP_nF7u1yMTVx6br0DMptoBRfpV6QdTRaAuLpuokQNvnQLQhngsP5OFoIUXlA vP7cM.XjecRzC0BchcR4HvlSqowdQqY4U2kioN5_dtYaFRztxY6EutFW_UDINaq3_dRxKLDtJy6P tHHjkRrAR5gLGrXdMOYs0cnWYIUtGM.C_KIyuG2.2zqViPqu1o8QuvDA7iT1irTrUyqaRGVgkvxU g.2unuGLT8YzAy_l6os6fb0YXkElMZGiSZhIXREUmlOR8R_C8bwrP7cCAsPu5bDtVtCAcskE7tG5 F6KLLSKhS4pPoZW5DK4Em7P0Jgcaj90BwBXugaCpgv8ThCaugKW7gsmbsQKhE1NjiXbGx3FfvaYe n67c_o2iS5avmVkvFLm8nYTCavsdhwVUUIafU.9fY6foMyUUePVYey2Ctr8W_h4Encpo7nAT0vns e1Y.0CAtbMlS6XQnVlFpegwOQ_fMeReE5D792HbVCcwBqmwIHIH.pOvKDIPbESscWbAMOxnyCnWK 3XoI8f0TaiWfQtZaeKNcaWhyDPaMPhJPt8y9ZbxDT3klKU5Dm_vkk4aW7dDi.jS4HZT1gFuFl2Ii OdAzDqZ3AibFVnSdKx1ZBxy.ewXaVdSxM__DiinQjR Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Wed, 15 May 2019 19:38:42 +0000 Original-Received: from 2.152.205.184.dyn.user.ono.com (EHLO Ergus) ([2.152.205.184]) by smtp424.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 1a205cb3d747e183f8707ad44f75894c; Wed, 15 May 2019 19:38:38 +0000 (UTC) Content-Disposition: inline In-Reply-To: <9f750259-44f6-4d39-b01c-db440e8d8782@default> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 77.238.179.188 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:120412 Archived-At: On Wed, May 15, 2019 at 10:29:42AM -0700, Drew Adams wrote: >> > And, as already mentioned, comment-dwim is not an >> > alternative to comment-region. They do different >> > things. >> >> I beg to differ. > >And your begged difference, which presumably shows >that they do NOT do different things, is what? ;-) > >I have nothing special to say here about `C-c C-c' >or `cc-mode'. But I will say 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. > 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. But now there will come another user saying that the dwim version is better... we will never agree in anything this way. >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))) > 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.