From: Juri Linkov Date: Fri, 16 Nov 2007 01:20:20 +0000 (+0000) Subject: (keep-lines-read-args, occur-read-primary-args): X-Git-Tag: emacs-pretest-23.0.90~9706 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7dc5b46da516e81dbf6208b3d52c94cfff648009;p=emacs.git (keep-lines-read-args, occur-read-primary-args): Use a list of default values for DEFAULT arg of read-from-minibuffer. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4b333ca8ab8..93fe154e313 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2007-11-16 Juri Linkov + + * dired-aux.el (dired-read-shell-command-default): New function. + (dired-read-shell-command): Use its return value for DEFAULT arg. + + * replace.el (keep-lines-read-args, occur-read-primary-args): + Use a list of default values for DEFAULT arg of read-from-minibuffer. + + * man.el (Man-heading-regexp): Add 0-9. + (Man-first-heading-regexp): Remove leading space [ \t]* before NAME. + 2007-11-15 Stefan Monnier * doc-view.el (doc-view-ghostscript-options): Remove resolution arg. diff --git a/lisp/replace.el b/lisp/replace.el index 7876f9bb47c..8e02ee3b347 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -533,9 +533,20 @@ which will run faster and will not set the mark or print anything." "Read arguments for `keep-lines' and friends. Prompt for a regexp with PROMPT. Value is a list, (REGEXP)." - (list (read-from-minibuffer prompt nil nil nil - 'regexp-history nil t) - nil nil t)) + (let* ((default (list + (regexp-quote + (or (funcall (or find-tag-default-function + (get major-mode 'find-tag-default-function) + 'find-tag-default)) + "")) + (car regexp-search-ring) + (regexp-quote (or (car search-ring) "")) + (car (symbol-value + query-replace-from-history-variable)))) + (default (delete-dups (delq nil (delete "" default))))) + (list (read-from-minibuffer prompt nil nil nil + 'regexp-history default t) + nil nil t))) (defun keep-lines (regexp &optional rstart rend interactive) "Delete all lines except those containing matches for REGEXP. @@ -938,23 +949,29 @@ which means to discard all text properties." (nreverse result)))) (defun occur-read-primary-args () - (list (let* ((default (car regexp-history)) - (input - (read-from-minibuffer - (if default - (format "List lines matching regexp (default %s): " - (query-replace-descr default)) - "List lines matching regexp: ") - nil - nil - nil - 'regexp-history - default))) - (if (equal input "") - default - input)) - (when current-prefix-arg - (prefix-numeric-value current-prefix-arg)))) + (let* ((default + (list (and transient-mark-mode mark-active + (regexp-quote + (buffer-substring-no-properties + (region-beginning) (region-end)))) + (regexp-quote + (or (funcall + (or find-tag-default-function + (get major-mode 'find-tag-default-function) + 'find-tag-default)) + "")) + (car regexp-search-ring) + (regexp-quote (or (car search-ring) "")) + (car (symbol-value + query-replace-from-history-variable)))) + (default (delete-dups (delq nil (delete "" default)))) + (input + (read-from-minibuffer + "List lines matching regexp: " + nil nil nil 'regexp-history default))) + (list input + (when current-prefix-arg + (prefix-numeric-value current-prefix-arg))))) (defun occur-rename-buffer (&optional unique-p interactive-p) "Rename the current *Occur* buffer to *Occur: original-buffer-name*.