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, 03 Dec 2007 02:34:55 +0200 Organization: JURTA Message-ID: <87ir3gljd3.fsf_-_@jurta.org> References: <87zlycuhrd.fsf@jurta.org> <87hckbecc0.fsf@jurta.org> <87prygxtot.fsf@jurta.org> <87hcjjkrgy.fsf@jurta.org> <87ir3u9r5s.fsf@jurta.org> <87myt3zk65.fsf@jurta.org> <87y7cmh026.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 1196642520 12807 80.91.229.12 (3 Dec 2007 00:42:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Dec 2007 00:42:00 +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 Dec 03 01:42:07 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 1IyzNt-0004ni-Ff for ged-emacs-devel@m.gmane.org; Mon, 03 Dec 2007 01:42:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IyzNd-0003C4-5N for ged-emacs-devel@m.gmane.org; Sun, 02 Dec 2007 19:41:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IyzN3-0002eb-9N for emacs-devel@gnu.org; Sun, 02 Dec 2007 19:41:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IyzN1-0002dL-Gf for emacs-devel@gnu.org; Sun, 02 Dec 2007 19:41:12 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IyzN1-0002dG-Ac for emacs-devel@gnu.org; Sun, 02 Dec 2007 19:41:11 -0500 Original-Received: from relay01.kiev.sovam.com ([62.64.120.200]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IyzMv-0007yi-LC; Sun, 02 Dec 2007 19:41:06 -0500 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay01.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1IyzMq-000BdV-Lm; Mon, 03 Dec 2007 02:41:03 +0200 In-Reply-To: (Richard Stallman's message of "Sun, 02 Dec 2007 16:27:17 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-Scanner-Signature: 88d0fd334128e7d5bb9b9ebe4fef9048 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 1838 [Dec 01 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.8-5.1 (or MacOS X 10.2-10.3) 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:84519 Archived-At: > The "pre-hook" should be a single function, not a hook, > and ideally should only run when trying to move into the future, > for the reasons I gave. In the patch below I added a new one-function variable `minibuffer-default-set-function' run before `goto-history-element' reads the value of `minibuffer-default' when moving into the future. Note that `shell-command' still depends on dired, but this can be avoided by moving `dired-read-shell-command-default' to mailcap.el. Also I added another dependence on dired, and I think for a good reason: when M-! is typed in the dired buffer, then it gets the dired file under point and provides its commands to the list of future values. 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 3 Dec 2007 00:34:45 -0000 *************** *** 1298,1307 **** --- 1298,1316 ---- (defvar minibuffer-temporary-goal-position nil) + (defvar minibuffer-default-set-function nil + "*Function run by `goto-history-element' before using `minibuffer-default'. + This is useful to dynamically set the value of `minibuffer-default' + before `goto-history-element' reads it when moves into the future.") + (defun goto-history-element (nabs) "Puts element of the minibuffer history in the minibuffer. The argument NABS specifies the absolute history position." (interactive "p") + (when (and (functionp minibuffer-default-set-function) + (< nabs (if (stringp minibuffer-default) -1 0))) + (setq minibuffer-default (funcall minibuffer-default-set-function) + minibuffer-default-set-function nil)) (let ((minimum (if minibuffer-default (- (if (listp minibuffer-default) (length minibuffer-default) *************** *** 1962,1971 **** 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. (let ((handler (find-file-name-handler (directory-file-name default-directory) --- 1972,1991 ---- In an interactive call, the variable `shell-command-default-error-buffer' specifies the value of ERROR-BUFFER." ! (interactive ! (let* ((filename ! (cond (buffer-file-name (file-relative-name buffer-file-name)) ! ((eq major-mode 'dired-mode) (dired-get-filename t)))) ! (default filename) ! (minibuffer-default-set-function ! (lambda () ! (if filename ! (cons filename ! (dired-read-shell-command-default (list filename))))))) ! (list (read-from-minibuffer "Shell command: " nil nil nil ! 'shell-command-history default) ! current-prefix-arg ! shell-command-default-error-buffer))) ;; Look for a handler in case default-directory is a remote file name. (let ((handler (find-file-name-handler (directory-file-name default-directory) Index: lisp/dired-aux.el =================================================================== RCS file: /sources/emacs/emacs/lisp/dired-aux.el,v retrieving revision 1.160 diff -c -r1.160 dired-aux.el *** lisp/dired-aux.el 22 Nov 2007 13:49:34 -0000 1.160 --- lisp/dired-aux.el 3 Dec 2007 00:34:48 -0000 *************** *** 517,528 **** ;;ARG is the prefix arg and may be used to indicate in the prompt which ;; files are affected. ;;This is an extra function so that you can redefine it, e.g., to use gmhist." ! (dired-mark-pop-up ! nil 'shell files ! (function read-string) ! (format prompt (dired-mark-prompt arg files)) ! nil 'shell-command-history ! (dired-read-shell-command-default files))) ;; The in-background argument is only needed in Emacs 18 where ;; shell-command doesn't understand an appended ampersand `&'. --- 517,529 ---- ;;ARG is the prefix arg and may be used to indicate in the prompt which ;; files are affected. ;;This is an extra function so that you can redefine it, e.g., to use gmhist." ! (let ((minibuffer-default-set-function ! (lambda () (dired-read-shell-command-default files)))) ! (dired-mark-pop-up ! nil 'shell files ! (function read-string) ! (format prompt (dired-mark-prompt arg files)) ! nil 'shell-command-history))) ;; The in-background argument is only needed in Emacs 18 where ;; shell-command doesn't understand an appended ampersand `&'. -- Juri Linkov http://www.jurta.org/emacs/