diff options
author | Tassilo Horn <tsdh@gnu.org> | 2019-09-22 11:02:39 +0200 |
---|---|---|
committer | Tassilo Horn <tsdh@gnu.org> | 2019-09-22 11:02:39 +0200 |
commit | af0642a4cb220f33a43d1380be085bc0b7134bb8 (patch) | |
tree | e3b1b57bc42e712c77bd55fc4fc722cf93fe6c66 /lisp/isearch.el | |
parent | 8992bc7d1b7e7babbf2899b5c45e84b486f504e6 (diff) | |
parent | 37a4233a366797360c2f4f475591a3406586bcfb (diff) | |
download | emacs-scratch/tsdh-vc-list-files.tar.gz |
Merge remote-tracking branch 'origin/master' into scratch/tsdh-vc-list-filesscratch/tsdh-vc-list-files
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r-- | lisp/isearch.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 30f7fc7254c..9401e8c06d3 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -514,6 +514,9 @@ This is like `describe-bindings', but displays only Isearch keys." (define-key map [isearch-yank-kill] '(menu-item "Current kill" isearch-yank-kill :help "Append current kill to search string")) + (define-key map [isearch-yank-until-char] + '(menu-item "Until char..." isearch-yank-until-char + :help "Yank from point to specified character into search string")) (define-key map [isearch-yank-line] '(menu-item "Rest of line" isearch-yank-line :help "Yank the rest of the current line on search string")) @@ -705,6 +708,7 @@ This is like `describe-bindings', but displays only Isearch keys." (define-key map "\M-\C-d" 'isearch-del-char) (define-key map "\M-\C-y" 'isearch-yank-char) (define-key map "\C-y" 'isearch-yank-kill) + (define-key map "\M-\C-z" 'isearch-yank-until-char) (define-key map "\M-s\C-e" 'isearch-yank-line) (define-key map "\M-s\M-<" 'isearch-beginning-of-buffer) @@ -998,6 +1002,8 @@ Type \\[isearch-yank-word-or-char] to yank next word or character in buffer Type \\[isearch-del-char] to delete character from end of search string. Type \\[isearch-yank-char] to yank char from buffer onto end of search\ string and search for it. +Type \\[isearch-yank-until-char] to yank from point until the next instance of a + specified character onto end of search string and search for it. Type \\[isearch-yank-line] to yank rest of line onto end of search string\ and search for it. Type \\[isearch-yank-kill] to yank the last string of killed text. @@ -2562,6 +2568,23 @@ If optional ARG is non-nil, pull in the next ARG words." (interactive "p") (isearch-yank-internal (lambda () (forward-word arg) (point)))) +(defun isearch-yank-until-char (char) + "Pull everything until next instance of CHAR from buffer into search string. +Interactively, prompt for CHAR. +This is often useful for keyboard macros, for example in programming +languages or markup languages in which CHAR marks a token boundary." + (interactive "cYank until character: ") + (isearch-yank-internal + (lambda () (let ((inhibit-field-text-motion t)) + (condition-case nil + (progn + (search-forward (char-to-string char)) + (forward-char -1)) + (search-failed + (message "`%c' not found" char) + (sit-for 2))) + (point))))) + (defun isearch-yank-line (&optional arg) "Pull rest of line from buffer into search string. If optional ARG is non-nil, yank the next ARG lines." |