Package: emacs;
Reported by: Juri Linkov <juri <at> jurta.org>
Date: Thu, 6 Jun 2013 06:40:03 UTC
Severity: wishlist
Tags: patch
Done: Juri Linkov <juri <at> jurta.org>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Juri Linkov <juri <at> jurta.org> To: 14563 <at> debbugs.gnu.org Subject: bug#14563: Add prefix arg to more isearch commands Date: Thu, 06 Jun 2013 09:30:40 +0300
Severity: wishlist Tags: patch Since bug#9706 to allow a prefix arg pass to isearch commands is done now more isearch commands can support prefix args. bug#10614 and bug#10638 deals with adding a prefix arg to `isearch-repeat-forward' and `isearch-repeat-backward'. And the following patch adds a prefix arg to `isearch-quote-char' (to use the same args as in `quoted-insert'), `isearch-printing-char' (to use the same args as in `insert-char'), `isearch-process-search-char' and `isearch-process-search-multibyte-characters': === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-06-05 20:57:09 +0000 +++ lisp/isearch.el 2013-06-06 06:28:07 +0000 @@ -2381,9 +2585,11 @@ (defun isearch-other-meta-char (&optiona (t;; otherwise nil (isearch-process-search-string key key))))) -(defun isearch-quote-char () - "Quote special characters for incremental search." - (interactive) +(defun isearch-quote-char (&optional count) + "Quote special characters for incremental search. +With argument, add COUNT copies of the character." + (interactive "p") (let ((char (read-quoted-char (isearch-message t)))) ;; Assume character codes 0200 - 0377 stand for characters in some ;; single-byte character set, and convert them to Emacs @@ -2391,24 +2597,27 @@ (defun isearch-quote-char () (if (and isearch-regexp isearch-regexp-lax-whitespace (= char ?\s)) (if (subregexp-context-p isearch-string (length isearch-string)) (isearch-process-search-string "[ ]" " ") - (isearch-process-search-char char)) + (isearch-process-search-char char count)) (and enable-multibyte-characters (>= char ?\200) (<= char ?\377) (setq char (unibyte-char-to-multibyte char))) - (isearch-process-search-char char)))) + (isearch-process-search-char char count)))) -(defun isearch-printing-char () - "Add this ordinary printing character to the search string and search." - (interactive) - (let ((char last-command-event)) +(defun isearch-printing-char (&optional char count) + "Add this ordinary printing CHAR to the search string and search. +With argument, add COUNT copies of the character." + (interactive (list last-command-event + (prefix-numeric-value current-prefix-arg))) + (let ((char (or char last-command-event))) (if (= char ?\S-\ ) (setq char ?\s)) (if current-input-method - (isearch-process-search-multibyte-characters char) - (isearch-process-search-char char)))) + (isearch-process-search-multibyte-characters char count) + (isearch-process-search-char char count)))) -(defun isearch-process-search-char (char) +(defun isearch-process-search-char (char &optional count) ;; * and ? are special in regexps when not preceded by \. ;; } and | are special in regexps when preceded by \. ;; Nothing special for + because it matches at least once. @@ -2417,12 +2627,15 @@ (defun isearch-process-search-char (char ((eq char ?\}) (isearch-fallback t t)) ((eq char ?|) (isearch-fallback t nil t))) - ;; Append the char to the search string, update the message and re-search. - (isearch-process-search-string - (char-to-string char) - (if (>= char ?\200) - (char-to-string char) - (isearch-text-char-description char)))) + ;; Append the char(s) to the search string, + ;; update the message and re-search. + (let* ((string (if (and (integerp count) (> count 1)) + (make-string count char) + (char-to-string char))) + (message (if (>= char ?\200) + string + (mapconcat 'isearch-text-char-description string "")))) + (isearch-process-search-string string message))) (defun isearch-process-search-string (string message) (setq isearch-string (concat isearch-string string) === modified file 'lisp/international/isearch-x.el' --- lisp/international/isearch-x.el 2013-01-01 09:11:05 +0000 +++ lisp/international/isearch-x.el 2013-06-06 06:29:51 +0000 @@ -94,7 +94,7 @@ (defun isearch-with-input-method () (exit-minibuffer))) ;;;###autoload -(defun isearch-process-search-multibyte-characters (last-char) +(defun isearch-process-search-multibyte-characters (last-char &optional count) (if (eq this-command 'isearch-printing-char) (let ((overriding-terminal-local-map nil) (prompt (isearch-message-prefix)) @@ -136,8 +136,11 @@ (defun isearch-process-search-multibyte- (if (and str (> (length str) 0)) (let ((unread-command-events nil)) - (isearch-process-search-string str str)) + (if (and (integerp count) (> count 1)) + (let ((strs (mapconcat 'identity (make-list count str) ""))) + (isearch-process-search-string strs strs)) + (isearch-process-search-string str str))) (isearch-update))) - (isearch-process-search-char last-char))) + (isearch-process-search-char last-char count))) ;;; isearch-x.el ends here
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.