From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add file-ring to dired-aux.el Date: Mon, 21 Oct 2024 12:48:11 +0300 Message-ID: <86plnthjms.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35396"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Justin Fields Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 21 11:49:33 2024 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 1t2p2a-00095m-Rp for ged-emacs-devel@m.gmane-mx.org; Mon, 21 Oct 2024 11:49:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2p1s-0000Qi-4u; Mon, 21 Oct 2024 05:48:48 -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 1t2p1l-0000PD-1t for emacs-devel@gnu.org; Mon, 21 Oct 2024 05:48:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2p1k-0004V1-OC; Mon, 21 Oct 2024 05:48:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GDprLdvNaaEiIpD/+pK3DZLixf9yDzfFDGvVoxsEl4I=; b=T4j9LyCjSI2O 8AKRmHy61RuYA2WMX6AoUUD87ORb/CpoH7VYQADFgawbHiwT3cexxKR2Fohgn28zRHnSn5AYIKAef vsLMB9mFxGp2cEBmA5d1JJoNm6MMvKDbMvD2j71Iu8U+AxTXBtTLTcHu5HuG3QBbc16qZygP2AEBa RCc/PwMQLaMkJHxKxC6sneKqZYHvs7jt5LUvXzNH21qVu5nM1GYx/+TtNaMRiDpHVRBNEKJwaZ9da gj3eD487MPXsThUphJhAfqgOLWBy5BnL++okuDJUKkR0V87L+0IyD1ICTfoqDmCzutFogH7kgf7Wm HprgZ05Ms7cGwASzYjKUfQ==; In-Reply-To: (message from Justin Fields on Mon, 21 Oct 2024 03:11:23 -0500) 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:324704 Archived-At: > From: Justin Fields > Date: Mon, 21 Oct 2024 03:11:23 -0500 > > From ca8f28008aeb95e74a0b5de28445cc25602ab724 Mon Sep 17 00:00:00 2001 > From: Justin Fields > Date: Sun, 20 Oct 2024 22:54:57 -0500 > Subject: [PATCH] Dired-Aux: add file ring to dired Thanks. Some comments below. If someone else has comments, please post them. > +;;; File ring > +(defvar dired-file-ring nil > + "Captured dired files.") Why do you call this a "ring"? AFAICT, it is a simple list, created and used as such. > +(defun dired-file-ring-execute (action action-name file-list) > + "Execute a function to run for every item in the FILE-LIST. The first line of a doc string should preferably mention all of the mandatory arguments. > +Argument ACTION argument to call with `dired-create-files' with as > +its' FILE-CREATOR. This reads awkwardly due to lack of punctuation. Our usual style is to say ACTION is passed to `dired-create-files' as its FILE-CREATOR argument. Same comment for the other arguments. > +Argument ACTION-NAME The name of the action, used for logging. This should say "...for error logging by `dired-create-files'.", so that readers could look up that logging. > + (dired-create-files action action-name file-list > + (lambda (file) (concat default-directory (file-name-nondirectory (directory-file-name file))))) Why does this use 'concat' instead of 'expand-file-name'? > +(defun dired-file-ring-capture () > + "Capture marked Dired files to the file ring." > + (interactive) > + (mapc (lambda (file) (add-to-list 'dired-file-ring file)) (dired-get-marked-files)) > + (message "Captured %s Files. %s files are present in the file ring" (length (dired-get-marked-files)) (length dired-file-ring))) This will say "Captured 1 Files", which is incorrect English. Please use ngettext to do this better. My suggestion is to rephrase this message to say something like %s files now in `file-ring', %s added This makes the message much shorter and easier to understand, IMO. > +(defun dired-file-ring-move () > + "Move the file/s from the file ring to current dir. By "current dir" do you mean default-directory? We don't use the term "current directory" in Emacs because Emacs pretends that each buffer has its own "current directory". > +This action clears the file ring." > + (interactive) > + (dired-file-ring-execute #'rename-file "MOVE" dired-file-ring) > + (dired-file-ring-clear)) What happens with files in subdirectories, e.g., if the user typed 'i' before marking files? Does this command create the corresponding subdirectories in the default-directory when it moves the files? > +(defun dired-file-ring-copy () > + "Copy the file/s from the file ring to current dir." > + (interactive) > + (dired-file-ring-execute #'dired-copy-file "COPY" dired-file-ring)) Same question here. > +(defun dired-file-ring-symlink () > + "Create a symlink for the the file/s from the file ring to current dir." > + (interactive) > + (dired-file-ring-execute #'make-symbolic-link "SYM-LINK" dired-file-ring)) > + > +(defun dired-file-ring-symlink-relative () > + "Create a relative symlink for the the file/s from the file ring to current dir." > + (interactive) > + (dired-file-ring-execute #'dired-make-relative-symlink "RELATIVE SYM-LINK" dired-file-ring)) The doc strings of these two commands should be more explicit regarding which file is the symlink and what will be its target. This feature, when installed, will need a NEWS entry. Finally, to accept a contribution of this size we need you to sign the copyright assignment agreement. Would you like to start this legal paperwork rolling at this time? If yes, I will send you the form to fill and the instructions to go with it.