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: Re: Minibuffer default values list Date: Mon, 19 Nov 2007 02:48:33 +0200 Organization: JURTA Message-ID: <87hcjjkrgy.fsf@jurta.org> References: <87zlycuhrd.fsf@jurta.org> <87hckbecc0.fsf@jurta.org> <87prygxtot.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1195433996 27528 80.91.229.12 (19 Nov 2007 00:59:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Nov 2007 00:59:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 19 02:00:01 2007 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 1ItuzY-00035e-8j for ged-emacs-devel@m.gmane.org; Mon, 19 Nov 2007 02:00:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ItuzK-0000yj-Os for ged-emacs-devel@m.gmane.org; Sun, 18 Nov 2007 19:59:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ItuzH-0000xJ-82 for emacs-devel@gnu.org; Sun, 18 Nov 2007 19:59:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ItuzG-0000wp-R9 for emacs-devel@gnu.org; Sun, 18 Nov 2007 19:59:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ItuzG-0000wm-Kc for emacs-devel@gnu.org; Sun, 18 Nov 2007 19:59:42 -0500 Original-Received: from relay03.kiev.sovam.com ([62.64.120.201]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ItuzB-0000BF-14; Sun, 18 Nov 2007 19:59:37 -0500 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay03.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1Ituz6-00030T-Gf; Mon, 19 Nov 2007 02:59:34 +0200 In-Reply-To: (Richard Stallman's message of "Mon, 12 Nov 2007 00:59:15 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-Scanner-Signature: 362d5034abbfed611c52a2913ea5ff69 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1801 [Nov 18 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 19 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) 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:83597 Archived-At: There is the following etc/TODO item that could be implemented now: ** M-! M-n should fetch the buffer-file-name as the default. I think in addition to the file name it will be useful add a list of commands extracted from mailcap to the "future history" list where a filename placeholder is replaced with the buffer-file-name. This will help the user to select one of predefined commands by using M-n and run it on the current buffer's file. Below is a first implementation that has one drawback: it uses a new function dired-read-shell-command-default from dired. I think this function should be generalized and moved to simple.el. Index: lisp/simple.el =================================================================== RCS file: /sources/emacs/emacs/lisp/simple.el,v retrieving revision 1.889 diff -c -r1.889 simple.el *** lisp/simple.el 15 Nov 2007 16:42:43 -0000 1.889 --- lisp/simple.el 19 Nov 2007 00:48:12 -0000 *************** *** 1962,1969 **** In an interactive call, the variable `shell-command-default-error-buffer' specifies the value of ERROR-BUFFER." ! (interactive (list (read-from-minibuffer "Shell command: " ! nil nil nil 'shell-command-history) current-prefix-arg shell-command-default-error-buffer)) ;; Look for a handler in case default-directory is a remote file name. --- 1962,1979 ---- In an interactive call, the variable `shell-command-default-error-buffer' specifies the value of ERROR-BUFFER." ! (interactive (list (read-from-minibuffer ! "Shell command: " ! nil nil nil 'shell-command-history ! (if buffer-file-name ! (let* ((filename (file-relative-name buffer-file-name)) ! (defaults (dired-read-shell-command-default ! (list filename)))) ! (cons filename ! (mapcar (lambda (command) ! (replace-regexp-in-string ! "?" filename command nil t)) ! defaults))))) 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/