From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.devel Subject: Re: master 6362f65474: Add new command `duplicate-line' Date: Fri, 17 Jun 2022 23:14:14 +0530 Message-ID: <87ilozrxqp.fsf@gmail.com> References: <165548727183.24473.6170306052807994962@vcs2.savannah.gnu.org> <20220617173432.17B6FC00BAF@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21614"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 18 07:52:17 2022 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 1o2RNZ-0005RY-Bs for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Jun 2022 07:52:17 +0200 Original-Received: from localhost ([::1]:56850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o2RNX-0003fR-JY for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Jun 2022 01:52:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2G1D-0007i9-Rv for emacs-devel@gnu.org; Fri, 17 Jun 2022 13:44:27 -0400 Original-Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:43686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o2G1C-0002TA-9I for emacs-devel@gnu.org; Fri, 17 Jun 2022 13:44:27 -0400 Original-Received: by mail-pj1-x1043.google.com with SMTP id y13-20020a17090a154d00b001eaaa3b9b8dso4767529pja.2 for ; Fri, 17 Jun 2022 10:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:mail-followup-to:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=ju6GfO41PkT9kTTr8vydkN60cD8fxiJhaAmb6J2n9iE=; b=olY/t8Z6e/DeYvA4WD88loKM0jLLYCf6dh8naU4UgLFlRhPFBCD0WgWkCuK200cQf0 LoakkncOXKDfQU2CqIJ76UxmB5TkUKSyDMwhzwOncfJ81CGlGgHe6cfvvT+ItYHH5YhL BeC+Yn8T16piDEed01lepgX3yRL45braaHSlO/rxLRUe0AhqK/rf93iKMG6atUj9RF3q kjwgRx1qZ5dNrxwItze5tM4ZysYFUhnxV7e9xboMKf9NkJ6RLxr9c0YY9mpjZYwYXSkF bF6sfZx/ohUDgDJyBDqNTw6V8SHKZ9LCQ7GgUf8od3JxsH+NJCYQALkCjHnqpWyQIvoq nZ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:mail-followup-to :date:in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=ju6GfO41PkT9kTTr8vydkN60cD8fxiJhaAmb6J2n9iE=; b=4mSfcd47vxt5QMJOJBXXhg49/hKv5Nj+dkWrobzyeusZBNeTxGYYIM/W0rGKbW9r/N v6KgcXVh3LuHGnwsw2+/J+6ZFKwENJm1TRq1WNMRzr0eeMR5QyPProf2OZygU+8+VT6n wd/o049NxuV7y5vV2nttxxm1i0y3dtiBfJajO3lSL36Ti/VmsdpKNIMOBhwnOHFKRfYo hrm1aVFBWQ2Qr6wC5Et5b2BBDcEZqs/zggarhc3lhVSLr/FBhTKKyGfgTSN2x2ES+cUP wmNhYWXvHrXMWvlhl1vrYELUXwRiA3Qdbo9vPG5xA8s0AoN4DbjPqaRSfOIWoTSa8JMY gN+A== X-Gm-Message-State: AJIora/u4Q9AuMnuDXCLuN8AT+tOfosp0f3PHcXkKELwJ8YrlkiTdJ43 4t6Wx+zZ7V7cw2Sn/3s0BIKCiBXMD38= X-Google-Smtp-Source: AGRyM1uazdBLJTfx6M1KE0nV2rB6ftxmp4yEFEDDCJdxewRwsrn2nispbXwpsL66TKazzxvMQGZq/A== X-Received: by 2002:a17:90b:503:b0:1e2:f129:5135 with SMTP id r3-20020a17090b050300b001e2f1295135mr11684921pjz.22.1655487863847; Fri, 17 Jun 2022 10:44:23 -0700 (PDT) Original-Received: from localhost ([49.204.133.192]) by smtp.gmail.com with ESMTPSA id mr11-20020a17090b238b00b001cd4989fec6sm5779084pjb.18.2022.06.17.10.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 10:44:23 -0700 (PDT) Mail-Followup-To: emacs-devel@gnu.org, Lars Ingebrigtsen In-Reply-To: <20220617173432.17B6FC00BAF@vcs2.savannah.gnu.org> (Lars Ingebrigtsen's message of "Fri, 17 Jun 2022 13:34:31 -0400 (EDT)") Received-SPF: pass client-ip=2607:f8b0:4864:20::1043; envelope-from=visuweshm@gmail.com; helo=mail-pj1-x1043.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 18 Jun 2022 01:42:56 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:291331 Archived-At: [=E0=AE=B5=E0=AF=86=E0=AE=B3=E0=AF=8D=E0=AE=B3=E0=AE=BF =E0=AE=9C=E0=AF=82= =E0=AE=A9=E0=AF=8D 17, 2022 13:34] Lars Ingebrigtsen wrote: > branch: master > commit 6362f65474bad81c1d57b9b603c65686a0dd853e > Author: Lars Ingebrigtsen > Commit: Lars Ingebrigtsen > > Add new command `duplicate-line' >=20=20=20=20=20 > * lisp/misc.el (copy-from-above-command): Mention it. > (duplicate-line): New command (bug#46621). > --- > etc/NEWS | 4 ++++ > lisp/misc.el | 17 ++++++++++++++++- > 2 files changed, 20 insertions(+), 1 deletion(-) > > diff --git a/etc/NEWS b/etc/NEWS > index 3b9515c2d4..d27c18f4ec 100644 > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -298,6 +298,10 @@ startup. Previously, these functions ignored > > * Changes in Emacs 29.1 >=20=20 > +--- > +** New command 'duplicate-line'. > +This command duplicates the current line the specified number of times. > + > --- > ** Files with the '.eld' extension are now visited in 'lisp-data-mode'. >=20=20 > diff --git a/lisp/misc.el b/lisp/misc.el > index 0bb8ee6c7b..88932681c1 100644 > --- a/lisp/misc.el > +++ b/lisp/misc.el > @@ -33,7 +33,9 @@ > "Copy characters from previous nonblank line, starting just above poin= t. > Copy ARG characters, but not past the end of that line. > If no argument given, copy the entire rest of the line. > -The characters copied are inserted in the buffer before point." > +The characters copied are inserted in the buffer before point. > + > +Also see the `copy-line' command." Shouldn't this be `duplicate-line'? > (interactive "P") > (let ((cc (current-column)) > n > @@ -61,6 +63,19 @@ The characters copied are inserted in the buffer befor= e point." > (+ n (point))))))) > (insert string))) >=20=20 > +;;;###autoload > +(defun duplicate-line (&optional n) > + "Duplicate the current line N times. > +Also see the `copy-from-above-command' command." > + (interactive "p") > + (let ((line (buffer-substring (line-beginning-position) (line-end-posi= tion)))) > + (save-excursion > + (forward-line 1) > + (unless (bolp) > + (insert "\n")) > + (dotimes (_ n) > + (insert line "\n"))))) > + > ;; Variation of `zap-to-char'. >=20=20 > ;;;###autoload