From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ivan Sokolov Newsgroups: gmane.emacs.bugs Subject: bug#64531: [PATCH v2] Add new command vc-dir-copy-filename-as-kill Date: Tue, 08 Aug 2023 16:44:56 +0300 Message-ID: <87bkfhy7fr.fsf_-_@ya.ru> References: <87bkgmq1ra.fsf@ya.ru> <83jzvadabq.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25514"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64531@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 08 15:46:40 2023 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 1qTN2l-0006P8-Rf for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Aug 2023 15:46:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTN2X-0000sM-BS; Tue, 08 Aug 2023 09:46:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qTN2G-0000jT-3F for bug-gnu-emacs@gnu.org; Tue, 08 Aug 2023 09:46:18 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTN2A-0006q3-9X for bug-gnu-emacs@gnu.org; Tue, 08 Aug 2023 09:46:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qTN29-0003Or-Tp for bug-gnu-emacs@gnu.org; Tue, 08 Aug 2023 09:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Sokolov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Aug 2023 13:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64531 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 64531-submit@debbugs.gnu.org id=B64531.169150232313020 (code B ref 64531); Tue, 08 Aug 2023 13:46:01 +0000 Original-Received: (at 64531) by debbugs.gnu.org; 8 Aug 2023 13:45:23 +0000 Original-Received: from localhost ([127.0.0.1]:35684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qTN1W-0003Nw-SU for submit@debbugs.gnu.org; Tue, 08 Aug 2023 09:45:23 -0400 Original-Received: from forward500b.mail.yandex.net ([178.154.239.144]:60254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qTN1T-0003Nk-KP for 64531@debbugs.gnu.org; Tue, 08 Aug 2023 09:45:21 -0400 Original-Received: from mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c20c:0:640:509d:0]) by forward500b.mail.yandex.net (Yandex) with ESMTP id 796735E5FD; Tue, 8 Aug 2023 16:45:17 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id GjY0Cb3WsqM0-E2w7NDOO; Tue, 08 Aug 2023 16:45:17 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ya.ru; s=mail; t=1691502317; bh=uPOYi6PsbKwx4ghBnqhfBzSqtTUb+t+45Epp3bXVhRE=; h=Message-ID:Date:Cc:In-Reply-To:Subject:References:To:From; b=rEYqzsQNKJTqLhhh9Qm5hIrmF6x0LVRSu+7eLeY+LgidJijHGblLrWkQzwjvobPHe dlYPtW4gadD1Qvx7NXnnt4zXEUAC0r70FrNluubcc+cXXb8yl5iSYWqETFX22yhUGW fPeDM7LbFGh6Zt/Y2cicpT9rfqpGprkdn4lK/GnU= Authentication-Results: mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net; dkim=pass header.i=@ya.ru In-Reply-To: <83jzvadabq.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Jul 2023 12:25:13 +0300") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:266960 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > However, new commands should be called out in NEWS, and commands that > are important enough should also be mentioned in the user manual. Added entry in NEWS, but not in the user manual, there is no such for vc-dir afaik. >> +(defun vc-dir-copy-filename-as-kill (&optional absolutep) >> + "Copy names of marked files (or file under cursor) into the kill ring. > > This sentence is too general: it doesn't mention VC Dir, although > AFAIU it is specific to vc-dir. Fixed. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=v2-0001-Add-new-command-vc-dir-copy-filename-as-kill.patch >From 88cb2e3407adf0245bc15a88896e1cd611d559c8 Mon Sep 17 00:00:00 2001 From: Ivan Sokolov Date: Tue, 11 Jul 2023 18:19:57 +0300 Subject: [PATCH v2] Add new command vc-dir-copy-filename-as-kill * lisp/vc/vc-dir.el (vc-dir-copy-filename-as-kill): New command. (vc-dir-mode-map): Bind vc-dir-copy-filename-as-kill to `w'. --- etc/NEWS | 3 +++ lisp/vc/vc-dir.el | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 1a86c9e55e2..da3672e068b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -154,6 +154,9 @@ This is a string or a list of strings that specifies the Git log switches for shortlogs, such as the one produced by 'C-x v L'. 'vc-git-log-switches' is no longer used for shortlogs. +*** New command 'vc-dir-copy-filename-as-kill'. +This works like 'dired-copy-filename-as-kill' but in vc-dir buffers. + ** Diff Mode +++ diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 53d58870b32..dc25467a3e9 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -353,6 +353,7 @@ See `run-hooks'." (define-key map (kbd "M-s a C-s") #'vc-dir-isearch) (define-key map (kbd "M-s a M-C-s") #'vc-dir-isearch-regexp) (define-key map "G" #'vc-dir-ignore) + (define-key map "w" #'vc-dir-copy-filename-as-kill) (let ((branch-map (make-sparse-keymap))) (define-key map "b" branch-map) @@ -930,6 +931,23 @@ system." (interactive) (view-file (vc-dir-current-file))) +(defun vc-dir-copy-filename-as-kill (&optional absolutep) + "Copy filenames from the `vc-dir' buffer into the kill ring. +If there are marked files, copy their names, otherwise copy the +file at point. Names will be separated by a space, each will be +quoted using `shell-quote-argument'. If ABSOLUTEP use absolute +names, otherwise names are relative to the `default-directory'." + (interactive "P") + (let ((files (or (vc-dir-marked-files) + (list (vc-dir-current-file))))) + (unless absolutep + (setq files (mapcar #'file-relative-name files))) + (let ((string (mapconcat #'shell-quote-argument files " "))) + (if (eq last-command 'kill-region) + (kill-append string nil) + (kill-new string)) + (message "%s" string)))) + (defun vc-dir-isearch () "Search for a string through all marked buffers using Isearch." (interactive) -- 2.41.0 --=-=-=--