unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: Minibuffer default values list
Date: Mon, 19 Nov 2007 02:48:33 +0200	[thread overview]
Message-ID: <87hcjjkrgy.fsf@jurta.org> (raw)
In-Reply-To: <E1IrSKJ-0002OL-IZ@fencepost.gnu.org> (Richard Stallman's message of "Mon, 12 Nov 2007 00:59:15 -0500")

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/

  parent reply	other threads:[~2007-11-19  0:48 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22  0:22 Minibuffer default values list Juri Linkov
2007-10-23  7:12 ` Richard Stallman
2007-10-28 10:57   ` Juri Linkov
2007-11-11 23:42     ` Juri Linkov
2007-11-12  5:59       ` Richard Stallman
2007-11-16  1:27         ` Substitute ? in dired without surrounding whitespace (was: Minibuffer default values list) Juri Linkov
2007-11-17 23:30           ` Richard Stallman
2007-11-17 23:57             ` Substitute ? in dired without surrounding whitespace Juri Linkov
2007-11-18 22:46               ` Richard Stallman
2007-11-19  0:48         ` Juri Linkov [this message]
2007-11-22  2:28           ` Minibuffer default values list Richard Stallman
2007-11-22 19:02             ` Juri Linkov
2007-11-23  4:35               ` Richard Stallman
2007-11-24 17:54                 ` Juri Linkov
2007-11-25  3:43                   ` Richard Stallman
2007-11-25 15:18                     ` mb-pos.el (was: Minibuffer default values list) Juri Linkov
2007-12-02 21:27                       ` Richard Stallman
2007-12-03  0:34                         ` Minibuffer default values list Juri Linkov
2007-12-03 18:43                           ` Richard Stallman
2007-11-25 15:19                     ` Subject: mb-depth.el (was: Minibuffer default values list) Juri Linkov
2008-07-31 17:28                       ` Juri Linkov
2008-07-31 18:08                         ` Drew Adams
2008-07-31 18:24                           ` Juanma Barranquero
2008-07-31 18:35                             ` Drew Adams
2008-08-01 12:34                               ` Juanma Barranquero
2008-08-01 16:27                                 ` Drew Adams
2008-08-01 17:09                                   ` mb-depth.el patch Drew Adams
2008-08-04 13:13                                     ` Juanma Barranquero
2007-11-23  4:35               ` Minibuffer default values list Richard Stallman
2007-11-23 15:05                 ` Stefan Monnier
     [not found]                   ` <E1IvwoM-0004oD-AU@fencepost.gnu.org>
     [not found]                     ` <jwvwss5ptqv.fsf-monnier+emacs@gnu.org>
2007-12-03 18:42                       ` Richard Stallman
2007-11-19  0:52         ` Juri Linkov
2007-11-19 19:02           ` Richard Stallman
2007-11-23  0:48             ` Juri Linkov
2007-11-11 23:43 ` Juri Linkov
2007-11-12  5:59   ` Richard Stallman
2007-11-11 23:45 ` Juri Linkov
2007-11-12  5:59   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hcjjkrgy.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).