1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-25 19:11:56 +00:00

(keep-lines-read-args, occur-read-primary-args):

Use a list of default values for DEFAULT arg of read-from-minibuffer.
This commit is contained in:
Juri Linkov 2007-11-16 01:20:20 +00:00
parent 2f8a5963f2
commit 7dc5b46da5
2 changed files with 48 additions and 20 deletions

View File

@ -1,3 +1,14 @@
2007-11-16 Juri Linkov <juri@jurta.org>
* 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 <monnier@iro.umontreal.ca> 2007-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
* doc-view.el (doc-view-ghostscript-options): Remove resolution arg. * doc-view.el (doc-view-ghostscript-options): Remove resolution arg.

View File

@ -533,9 +533,20 @@ which will run faster and will not set the mark or print anything."
"Read arguments for `keep-lines' and friends. "Read arguments for `keep-lines' and friends.
Prompt for a regexp with PROMPT. Prompt for a regexp with PROMPT.
Value is a list, (REGEXP)." Value is a list, (REGEXP)."
(list (read-from-minibuffer prompt nil nil nil (let* ((default (list
'regexp-history nil t) (regexp-quote
nil nil t)) (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) (defun keep-lines (regexp &optional rstart rend interactive)
"Delete all lines except those containing matches for REGEXP. "Delete all lines except those containing matches for REGEXP.
@ -938,23 +949,29 @@ which means to discard all text properties."
(nreverse result)))) (nreverse result))))
(defun occur-read-primary-args () (defun occur-read-primary-args ()
(list (let* ((default (car regexp-history)) (let* ((default
(input (list (and transient-mark-mode mark-active
(read-from-minibuffer (regexp-quote
(if default (buffer-substring-no-properties
(format "List lines matching regexp (default %s): " (region-beginning) (region-end))))
(query-replace-descr default)) (regexp-quote
"List lines matching regexp: ") (or (funcall
nil (or find-tag-default-function
nil (get major-mode 'find-tag-default-function)
nil 'find-tag-default))
'regexp-history ""))
default))) (car regexp-search-ring)
(if (equal input "") (regexp-quote (or (car search-ring) ""))
default (car (symbol-value
input)) query-replace-from-history-variable))))
(when current-prefix-arg (default (delete-dups (delq nil (delete "" default))))
(prefix-numeric-value current-prefix-arg)))) (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) (defun occur-rename-buffer (&optional unique-p interactive-p)
"Rename the current *Occur* buffer to *Occur: original-buffer-name*. "Rename the current *Occur* buffer to *Occur: original-buffer-name*.