From: Juri Linkov Date: Thu, 1 Jul 2004 10:01:32 +0000 (+0000) Subject: (query-replace-interactive): Change type from boolean X-Git-Tag: ttn-vms-21-2-B4~5582 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0ec4febda2d72e79bd90ab25bada4f8b34f4ab54;p=emacs.git (query-replace-interactive): Change type from boolean to choice. Add value `initial'. (query-replace-read-args): Handle value `initial' of query-replace-interactive. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 90b17f7a14f..fc5217a1991 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,22 @@ +2004-07-01 Juri Linkov + + * isearch.el (isearch-mode-map): Bind C-M-w to isearch-del-char, + C-M-y to isearch-yank-char. Bind M-% to isearch-query-replace, + C-M-% to isearch-query-replace-regexp. + (minibuffer-local-isearch-map): Add arrow key bindings. + Bind C-f to isearch-yank-char-in-minibuffer. + (isearch-forward): Doc fix. + (isearch-edit-string): Doc fix. + (isearch-query-replace, isearch-query-replace-regexp): New funs. + (isearch-del-char): Add optional arg. Set isearch-yank-flag to t. + (isearch-yank-char): Add optional arg. + (isearch-yank-char-in-minibuffer): New fun. + + * replace.el (query-replace-interactive): Change type from boolean + to choice. Add value `initial'. + (query-replace-read-args): Handle value `initial' of + query-replace-interactive. + 2004-06-29 Kim F. Storm * progmodes/gdb-ui.el (breakpoint-enabled-bitmap-face) diff --git a/lisp/replace.el b/lisp/replace.el index c2305cdecc6..cac4470c9cd 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -38,8 +38,12 @@ (defcustom query-replace-interactive nil "Non-nil means `query-replace' uses the last search string. -That becomes the \"string to replace\"." - :type 'boolean +That becomes the \"string to replace\". +If value is `initial', the last search string is inserted into +the minibuffer as an initial value for \"string to replace\"." + :type '(choice (const :tag "Off" nil) + (const :tag "Initial content" initial) + (other :tag "Use default value" t)) :group 'matching) (defcustom query-replace-from-history-variable 'query-replace-history @@ -70,16 +74,20 @@ strings or patterns." (unless noerror (barf-if-buffer-read-only)) (let (from to) - (if query-replace-interactive - (setq from (car (if regexp-flag regexp-search-ring search-ring))) + (if (and query-replace-interactive + (not (eq query-replace-interactive 'initial))) + (setq from (car (if regexp-flag regexp-search-ring search-ring))) ;; The save-excursion here is in case the user marks and copies ;; a region in order to specify the minibuffer input. ;; That should not clobber the region for the query-replace itself. (save-excursion - (setq from (read-from-minibuffer (format "%s: " string) - nil nil nil - query-replace-from-history-variable - nil t))) + (setq from (read-from-minibuffer + (format "%s: " string) + (if (eq query-replace-interactive 'initial) + (car (if regexp-flag regexp-search-ring search-ring))) + nil nil + query-replace-from-history-variable + nil t))) ;; Warn if user types \n or \t, but don't reject the input. (and regexp-flag (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from) @@ -92,9 +100,10 @@ strings or patterns." (sit-for 2)))) (save-excursion - (setq to (read-from-minibuffer (format "%s %s with: " string from) - nil nil nil - query-replace-to-history-variable from t))) + (setq to (read-from-minibuffer + (format "%s %s with: " string from) + nil nil nil + query-replace-to-history-variable from t))) (when (and regexp-flag (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to)) (let (pos list char)