aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2013-06-13 23:50:51 +0300
committerJuri Linkov2013-06-13 23:50:51 +0300
commit6e8cfc81e747bef8edd1f5df2c25b6a00c766a03 (patch)
tree1a36136dae923190742997eaf7605cd11d149143
parentc23d55f45b8a326758c4baa3c6e1e980b294f5b6 (diff)
downloademacs-6e8cfc81e747bef8edd1f5df2c25b6a00c766a03.tar.gz
emacs-6e8cfc81e747bef8edd1f5df2c25b6a00c766a03.zip
Add prefix arg to more isearch commands.
* lisp/isearch.el (isearch-yank-word, isearch-yank-line) (isearch-char-by-name, isearch-quote-char) (isearch-printing-char, isearch-process-search-char): Add optional count prefix arg. * lisp/international/isearch-x.el (isearch-process-search-multibyte-characters): Add optional count prefix arg. Fixes: debbugs:14563
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/international/isearch-x.el9
-rw-r--r--lisp/isearch.el74
4 files changed, 64 insertions, 36 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 7e26c2458e8..8bf1d17005e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -296,6 +296,10 @@ and opens overlays with hidden text when `search-invisible' is `open'.
296*** By default, prefix arguments do not now terminate Isearch mode. 296*** By default, prefix arguments do not now terminate Isearch mode.
297Set `isearch-allow-prefix' to nil to restore old behavior. 297Set `isearch-allow-prefix' to nil to restore old behavior.
298 298
299*** More Isearch commands accept prefix arguments, namely
300`isearch-printing-char', `isearch-quote-char', `isearch-yank-word',
301`isearch-yank-line'.
302
299** MH-E has been updated to MH-E version 8.5. 303** MH-E has been updated to MH-E version 8.5.
300See MH-E-NEWS for details. 304See MH-E-NEWS for details.
301 305
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3525568ab2d..974fad3e306 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12013-06-13 Juri Linkov <juri@jurta.org>
2
3 * isearch.el (isearch-yank-word, isearch-yank-line)
4 (isearch-char-by-name, isearch-quote-char)
5 (isearch-printing-char, isearch-process-search-char):
6 Add optional count prefix arg. (Bug#14563)
7
8 * international/isearch-x.el
9 (isearch-process-search-multibyte-characters):
10 Add optional count prefix arg.
11
12013-06-13 Stefan Monnier <monnier@iro.umontreal.ca> 122013-06-13 Stefan Monnier <monnier@iro.umontreal.ca>
2 13
3 * subr.el (internal-push-keymap, internal-pop-keymap): New functions. 14 * subr.el (internal-push-keymap, internal-pop-keymap): New functions.
@@ -4667,7 +4678,7 @@
4667 * progmodes/grep.el (grep-regexp-alist): Use variable grep-match-face 4678 * progmodes/grep.el (grep-regexp-alist): Use variable grep-match-face
4668 instead of hard-coded default face `match'. (Bug#9438) 4679 instead of hard-coded default face `match'. (Bug#9438)
4669 4680
46702012-02-01 Christopher Schmidt <christopher@ch.ristopher.com> 46812013-02-01 Christopher Schmidt <christopher@ch.ristopher.com>
4671 4682
4672 * vc/vc-arch.el (vc-arch-registered): 4683 * vc/vc-arch.el (vc-arch-registered):
4673 * vc/vc-bzr.el (vc-bzr-registered): 4684 * vc/vc-bzr.el (vc-bzr-registered):
diff --git a/lisp/international/isearch-x.el b/lisp/international/isearch-x.el
index 992236ce1ad..37213b95d3e 100644
--- a/lisp/international/isearch-x.el
+++ b/lisp/international/isearch-x.el
@@ -94,7 +94,7 @@
94 (exit-minibuffer))) 94 (exit-minibuffer)))
95 95
96;;;###autoload 96;;;###autoload
97(defun isearch-process-search-multibyte-characters (last-char) 97(defun isearch-process-search-multibyte-characters (last-char &optional count)
98 (if (eq this-command 'isearch-printing-char) 98 (if (eq this-command 'isearch-printing-char)
99 (let ((overriding-terminal-local-map nil) 99 (let ((overriding-terminal-local-map nil)
100 (prompt (isearch-message-prefix)) 100 (prompt (isearch-message-prefix))
@@ -136,8 +136,11 @@
136 136
137 (if (and str (> (length str) 0)) 137 (if (and str (> (length str) 0))
138 (let ((unread-command-events nil)) 138 (let ((unread-command-events nil))
139 (isearch-process-search-string str str)) 139 (if (and (integerp count) (> count 1))
140 (let ((strs (mapconcat 'identity (make-list count str) "")))
141 (isearch-process-search-string strs strs))
142 (isearch-process-search-string str str)))
140 (isearch-update))) 143 (isearch-update)))
141 (isearch-process-search-char last-char))) 144 (isearch-process-search-char last-char count)))
142 145
143;;; isearch-x.el ends here 146;;; isearch-x.el ends here
diff --git a/lisp/isearch.el b/lisp/isearch.el
index d9f8b0891e4..4754f86d5d7 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1919,29 +1919,33 @@ Subword is used when `subword-mode' is activated. "
1919 (forward-word 1)) 1919 (forward-word 1))
1920 (forward-char 1)) (point)))) 1920 (forward-char 1)) (point))))
1921 1921
1922(defun isearch-yank-word () 1922(defun isearch-yank-word (&optional arg)
1923 "Pull next word from buffer into search string." 1923 "Pull next word from buffer into search string."
1924 (interactive) 1924 (interactive "p")
1925 (isearch-yank-internal (lambda () (forward-word 1) (point)))) 1925 (isearch-yank-internal (lambda () (forward-word arg) (point))))
1926 1926
1927(defun isearch-yank-line () 1927(defun isearch-yank-line (&optional arg)
1928 "Pull rest of line from buffer into search string." 1928 "Pull rest of line from buffer into search string."
1929 (interactive) 1929 (interactive "p")
1930 (isearch-yank-internal 1930 (isearch-yank-internal
1931 (lambda () (let ((inhibit-field-text-motion t)) 1931 (lambda () (let ((inhibit-field-text-motion t))
1932 (line-end-position (if (eolp) 2 1)))))) 1932 (line-end-position (if (eolp) (1+ arg) arg))))))
1933 1933
1934(defun isearch-char-by-name () 1934(defun isearch-char-by-name (&optional count)
1935 "Read a character by its Unicode name and add it to the search string. 1935 "Read a character by its Unicode name and add it to the search string.
1936Completion is available like in `read-char-by-name' used by `insert-char'." 1936Completion is available like in `read-char-by-name' used by `insert-char'.
1937 (interactive) 1937With argument, add COUNT copies of the character."
1938 (interactive "p")
1938 (with-isearch-suspended 1939 (with-isearch-suspended
1939 (let ((char (read-char-by-name "Add character to search (Unicode name or hex): "))) 1940 (let ((char (read-char-by-name "Add character to search (Unicode name or hex): ")))
1940 (when char 1941 (when char
1941 (setq isearch-new-string (concat isearch-string (string char)) 1942 (let ((string (if (and (integerp count) (> count 1))
1942 isearch-new-message (concat isearch-message 1943 (make-string count char)
1943 (mapconcat 'isearch-text-char-description 1944 (char-to-string char))))
1944 (string char) ""))))))) 1945 (setq isearch-new-string (concat isearch-string string)
1946 isearch-new-message (concat isearch-message
1947 (mapconcat 'isearch-text-char-description
1948 string ""))))))))
1945 1949
1946(defun isearch-search-and-update () 1950(defun isearch-search-and-update ()
1947 ;; Do the search and update the display. 1951 ;; Do the search and update the display.
@@ -2382,9 +2386,10 @@ Isearch mode."
2382 (t;; otherwise nil 2386 (t;; otherwise nil
2383 (isearch-process-search-string key key))))) 2387 (isearch-process-search-string key key)))))
2384 2388
2385(defun isearch-quote-char () 2389(defun isearch-quote-char (&optional count)
2386 "Quote special characters for incremental search." 2390 "Quote special characters for incremental search.
2387 (interactive) 2391With argument, add COUNT copies of the character."
2392 (interactive "p")
2388 (let ((char (read-quoted-char (isearch-message t)))) 2393 (let ((char (read-quoted-char (isearch-message t))))
2389 ;; Assume character codes 0200 - 0377 stand for characters in some 2394 ;; Assume character codes 0200 - 0377 stand for characters in some
2390 ;; single-byte character set, and convert them to Emacs 2395 ;; single-byte character set, and convert them to Emacs
@@ -2392,24 +2397,26 @@ Isearch mode."
2392 (if (and isearch-regexp isearch-regexp-lax-whitespace (= char ?\s)) 2397 (if (and isearch-regexp isearch-regexp-lax-whitespace (= char ?\s))
2393 (if (subregexp-context-p isearch-string (length isearch-string)) 2398 (if (subregexp-context-p isearch-string (length isearch-string))
2394 (isearch-process-search-string "[ ]" " ") 2399 (isearch-process-search-string "[ ]" " ")
2395 (isearch-process-search-char char)) 2400 (isearch-process-search-char char count))
2396 (and enable-multibyte-characters 2401 (and enable-multibyte-characters
2397 (>= char ?\200) 2402 (>= char ?\200)
2398 (<= char ?\377) 2403 (<= char ?\377)
2399 (setq char (unibyte-char-to-multibyte char))) 2404 (setq char (unibyte-char-to-multibyte char)))
2400 (isearch-process-search-char char)))) 2405 (isearch-process-search-char char count))))
2401 2406
2402(defun isearch-printing-char () 2407(defun isearch-printing-char (&optional char count)
2403 "Add this ordinary printing character to the search string and search." 2408 "Add this ordinary printing CHAR to the search string and search.
2404 (interactive) 2409With argument, add COUNT copies of the character."
2405 (let ((char last-command-event)) 2410 (interactive (list last-command-event
2411 (prefix-numeric-value current-prefix-arg)))
2412 (let ((char (or char last-command-event)))
2406 (if (= char ?\S-\ ) 2413 (if (= char ?\S-\ )
2407 (setq char ?\s)) 2414 (setq char ?\s))
2408 (if current-input-method 2415 (if current-input-method
2409 (isearch-process-search-multibyte-characters char) 2416 (isearch-process-search-multibyte-characters char count)
2410 (isearch-process-search-char char)))) 2417 (isearch-process-search-char char count))))
2411 2418
2412(defun isearch-process-search-char (char) 2419(defun isearch-process-search-char (char &optional count)
2413 ;; * and ? are special in regexps when not preceded by \. 2420 ;; * and ? are special in regexps when not preceded by \.
2414 ;; } and | are special in regexps when preceded by \. 2421 ;; } and | are special in regexps when preceded by \.
2415 ;; Nothing special for + because it matches at least once. 2422 ;; Nothing special for + because it matches at least once.
@@ -2418,12 +2425,15 @@ Isearch mode."
2418 ((eq char ?\}) (isearch-fallback t t)) 2425 ((eq char ?\}) (isearch-fallback t t))
2419 ((eq char ?|) (isearch-fallback t nil t))) 2426 ((eq char ?|) (isearch-fallback t nil t)))
2420 2427
2421 ;; Append the char to the search string, update the message and re-search. 2428 ;; Append the char(s) to the search string,
2422 (isearch-process-search-string 2429 ;; update the message and re-search.
2423 (char-to-string char) 2430 (let* ((string (if (and (integerp count) (> count 1))
2424 (if (>= char ?\200) 2431 (make-string count char)
2425 (char-to-string char) 2432 (char-to-string char)))
2426 (isearch-text-char-description char)))) 2433 (message (if (>= char ?\200)
2434 string
2435 (mapconcat 'isearch-text-char-description string ""))))
2436 (isearch-process-search-string string message)))
2427 2437
2428(defun isearch-process-search-string (string message) 2438(defun isearch-process-search-string (string message)
2429 (setq isearch-string (concat isearch-string string) 2439 (setq isearch-string (concat isearch-string string)