From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: Extend Dired to Call a Function on a File? Date: Wed, 12 Oct 2016 13:12:27 -0700 (PDT) Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1476303190 5802 195.159.176.226 (12 Oct 2016 20:13:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 12 Oct 2016 20:13:10 +0000 (UTC) To: Brendan Leber , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 12 22:13:06 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1buPtg-0000gT-5K for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Oct 2016 22:13:04 +0200 Original-Received: from localhost ([::1]:35559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buPte-00066y-Sq for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Oct 2016 16:13:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buPtG-00066s-Au for help-gnu-emacs@gnu.org; Wed, 12 Oct 2016 16:12:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buPtB-0006iY-5r for help-gnu-emacs@gnu.org; Wed, 12 Oct 2016 16:12:37 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:17773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buPtA-0006iT-V0 for help-gnu-emacs@gnu.org; Wed, 12 Oct 2016 16:12:33 -0400 Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u9CKCTdN017397 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 Oct 2016 20:12:29 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.14.4) with ESMTP id u9CKCSE3010376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 Oct 2016 20:12:29 GMT Original-Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u9CKCSFs031225; Wed, 12 Oct 2016 20:12:28 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] X-Source-IP: userv0021.oracle.com [156.151.31.71] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 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:111514 Archived-At: > I have a function I've used to work on files that right now I call > manually with M-x my-shiny-function RET my-shiny.file. This works > great for the one off file. Yet I usually have to process batches of > files in a given directory. Being able to add a key binding to dired > would be awesome as I'm already using dired on the directory to rename > files and such. >=20 > I know enough elisp to add the key binding and write the function, I > think. The place I'm stuck is getting the file name as the first > argument to the function when the binding is pressed. Can anyone > share some pointers to make this happen? Not quite sure what you are asking. You can of course use `M-!' to act on the marked files using a shell command. But I guess you are asking about mapping a Lisp function over files. If you are asking about Dired then presumably you are talking about acting on the marked files (else, why Dired?). If so, and if you use Dired+, then you can use `@', which is bound to command `diredp-do-apply-function', to apply a Lisp function to each of the marked files. And you can, similarly, use `M-+ @', which is bound to `diredp-do-apply-function-recursive', to do the same thing for the marked files and the files in marked subdirs, for any number of Dired buffers for descendent directories. https://www.emacswiki.org/emacs/DiredPlus