From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: M-! M-n should fetch filename (Re: FFAP) Date: Mon, 09 Nov 2009 12:36:33 +0200 Organization: JURTA Message-ID: <87bpjcq9z2.fsf_-_@mail.jurta.org> References: <3b31caf90911051613w80af4cu61352a29ce5dcd77@mail.gmail.com> <87vdhoe73d.fsf@mail.jurta.org> <87y6mkb6qr.fsf@mail.jurta.org> <87bpjfiark.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1257763350 26783 80.91.229.12 (9 Nov 2009 10:42:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Nov 2009 10:42:30 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 09 11:42:23 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N7RhW-0004CW-RB for ged-emacs-devel@m.gmane.org; Mon, 09 Nov 2009 11:42:23 +0100 Original-Received: from localhost ([127.0.0.1]:60637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7RhW-0000MG-Dx for ged-emacs-devel@m.gmane.org; Mon, 09 Nov 2009 05:42:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7RcJ-0006rd-6E for emacs-devel@gnu.org; Mon, 09 Nov 2009 05:36:59 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7RcE-0006nr-Ef for emacs-devel@gnu.org; Mon, 09 Nov 2009 05:36:58 -0500 Original-Received: from [199.232.76.173] (port=43393 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7RcD-0006nk-Tt for emacs-devel@gnu.org; Mon, 09 Nov 2009 05:36:54 -0500 Original-Received: from smtp-out1.starman.ee ([85.253.0.3]:39978 helo=mx1.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N7RcD-0006NC-Hh for emacs-devel@gnu.org; Mon, 09 Nov 2009 05:36:53 -0500 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (62.65.208.58.cable.starman.ee [62.65.208.58]) by mx1.starman.ee (Postfix) with ESMTP id 1BCD23F415A; Mon, 9 Nov 2009 12:36:46 +0200 (EET) In-Reply-To: <87bpjfiark.fsf@mail.jurta.org> (Juri Linkov's message of "Fri, 06 Nov 2009 23:19:45 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116742 Archived-At: There is the following etc/TODO item: ** M-! M-n should fetch the buffer-file-name as the default. However, it seems it's already implemented. What is missing is an ability of M-! M-n to fetch the filename as the default in Dired mode using `dired-get-filename'. The patch below implements this. Please note that it doesn't use a guesser based on the filename at point when not in Dired mode. I'm not sure whether it makes sense to get the filename at point as the base for building a command line for `shell-command'. Index: lisp/simple.el =================================================================== RCS file: /sources/emacs/emacs/lisp/simple.el,v retrieving revision 1.1022 diff -c -r1.1022 simple.el *** lisp/simple.el 30 Oct 2009 02:00:30 -0000 1.1022 --- lisp/simple.el 9 Nov 2009 10:31:21 -0000 *************** *** 2136,2143 **** (interactive (list (read-shell-command "Shell command: " nil nil ! (and buffer-file-name ! (file-relative-name buffer-file-name))) current-prefix-arg shell-command-default-error-buffer)) ;; Look for a handler in case default-directory is a remote file name. --- 2152,2163 ---- (interactive (list (read-shell-command "Shell command: " nil nil ! (cond ! ((eq major-mode 'dired-mode) ! (let ((filename (dired-get-filename nil t))) ! (and filename (file-relative-name filename)))) ! (buffer-file-name ! (file-relative-name buffer-file-name)))) current-prefix-arg shell-command-default-error-buffer)) ;; Look for a handler in case default-directory is a remote file name. -- Juri Linkov http://www.jurta.org/emacs/