[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] better isearch support for complex input methods
From: |
Kenichi Handa |
Subject: |
Re: [PATCH] better isearch support for complex input methods |
Date: |
Tue, 3 Apr 2001 13:40:29 +0900 (JST) |
User-agent: |
SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.0.101 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) |
Karl Fogel <address@hidden> writes:
> This patch adds a new binding to isearch mode, C-o, which grabs one
> letter at a time from the buffer and adds it to the search string.
I surely like this feature. Actually, it's in my todo list.
> Here's why this is useful:
> Until recently, there was no point having a special keybinding for
> this in isearch mode, because it would almost always have been just as
> easy to type the letter itself, as to type a special binding to grab
> the letter.
> However, with modern input methods (such as `chinese-tonepy'), typing
> a letter can be an involved process. In fact, in Chinese language
> environments, what Emacs thinks of as a single letter is often
> conceptually a whole word, i.e., one ideograph. It's very useful to
> be able to grab one ideograph at a time from the buffer and add it to
> the search string.
> Currently, if one uses C-w in isearch in Chinese text, it grabs to the
> next punctuation mark or end of line. This is usually not what the
> user wanted -- it's much more likely that they want to grab one
> Chinese character at a time.
> This patch binds C-o to a new function `isearch-yank-letter'. C-o
> seemed like a key unlikely to be often used for exiting isearch.
> There may be a better binding I haven't thought of, though.
> -Karl
> 2001-04-02 Karl Fogel <address@hidden>
> * isearch.el (isearch-mode-map): Bind C-o in isearch to yank the
> next letter from the buffer into the search string.
> (isearch-yank-internal): New helper function, contains common
> internals of next three.
> (isearch-yank-letter): New function.
> (isearch-yank-word): Implement using isearch-yank-internal.
> (isearch-yank-line): Implement using isearch-yank-internal.
> Index: isearch.el
> ===================================================================
> RCS file: /cvs/emacs/lisp/isearch.el,v
> retrieving revision 1.188
> diff -u -r1.188 isearch.el
> --- isearch.el 2001/02/05 17:13:28 1.188
> +++ isearch.el 2001/04/03 00:20:57
> @@ -286,6 +286,7 @@
> (define-key map " " 'isearch-whitespace-chars)
> (define-key map [?\S-\ ] 'isearch-whitespace-chars)
> + (define-key map "\C-o" 'isearch-yank-letter)
> (define-key map "\C-w" 'isearch-yank-word)
> (define-key map "\C-y" 'isearch-yank-line)
> @@ -1057,24 +1058,32 @@
> (isearch-yank-x-selection)
> (mouse-yank-at-click click arg))))
> -(defun isearch-yank-word ()
> - "Pull next word from buffer into search string."
> - (interactive)
> +(defun isearch-yank-internal (jumpform)
> + "Pull the text from point to the point reached by JUMPFORM.
> +JUMPFORM is a lambda expression that takes no arguments and returns a
> +buffer position, possibly having moved point to that position. For
> +example, it might move point forward by a word and return point, or it
> +might return the position of the end of the line."
> (isearch-yank-string
> (save-excursion
> (and (not isearch-forward) isearch-other-end
> (goto-char isearch-other-end))
> - (buffer-substring-no-properties
> - (point) (progn (forward-word 1) (point))))))
> + (buffer-substring-no-properties (point) (funcall jumpform)))))
> +(defun isearch-yank-letter ()
> + "Pull next letter from buffer into search string."
> + (interactive)
> + (isearch-yank-internal (lambda () (forward-char 1) (point))))
> +
> +(defun isearch-yank-word ()
> + "Pull next word from buffer into search string."
> + (interactive)
> + (isearch-yank-internal (lambda () (forward-word 1) (point))))
> +
> (defun isearch-yank-line ()
> "Pull rest of line from buffer into search string."
> (interactive)
> - (isearch-yank-string
> - (save-excursion
> - (and (not isearch-forward) isearch-other-end
> - (goto-char isearch-other-end))
> - (buffer-substring-no-properties (point) (line-end-position)))))
> + (isearch-yank-internal (lambda () (line-end-position))))
> (defun isearch-search-and-update ()
> _______________________________________________
> Emacs-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/emacs-devel
- Re: [PATCH] better isearch support for complex input methods, (continued)
- Re: [PATCH] better isearch support for complex input methods, Miles Bader, 2001/04/03
- Re: [PATCH] better isearch support for complex input methods, Stefan Monnier, 2001/04/03
- Re: [PATCH] better isearch support for complex input methods, Miles Bader, 2001/04/03
- Re: [PATCH] better isearch support for complex input methods, Eli Zaretskii, 2001/04/04
- Re: [PATCH] better isearch support for complex input methods, Karl Fogel, 2001/04/04
- Re: [PATCH] better isearch support for complex input methods, Gerd Moellmann, 2001/04/05
- Re: [PATCH] better isearch support for complex input methods, Karl Fogel, 2001/04/06
- Re: [PATCH] better isearch support for complex input methods, Gerd Moellmann, 2001/04/06
- Re: [PATCH] better isearch support for complex input methods,
Kenichi Handa <=
- Re: [PATCH] better isearch support for complex input methods, Kenichi Handa, 2001/04/03
- Re: [PATCH] better isearch support for complex input methods, Kenichi Handa, 2001/04/23