all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Juri Linkov'" <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: RE: Why is `C-x 8' limited to Latin-1 for search?
Date: Mon, 10 Dec 2012 06:24:24 -0800	[thread overview]
Message-ID: <9CE95F039B2A4295BA1273CD98924B43@us.oracle.com> (raw)
In-Reply-To: <8738ze4jid.fsf@mail.jurta.org>

> To avoid code duplication, a new macro could be created
> with a name like `with-isearch-paused' and the body from 
> `isearch-edit-string' except the part that changes
> `isearch-new-string' and `isearch-new-message'.
> It could be used in a new command with a name like 
> `isearch-insert-char-by-name'.

FWIW, I did that yesterday in my own code (isearch+.el).
If Emacs adds this or similar then I won't need to do that. 

I named the macro `isearchp-use-new-search-string' and the new command
`isearchp-read-unicode-char'.  I bind `isearchp-read-unicode-char' to `C-x 8
RET' in `isearch-mode-map' and `insert-char' to `C-x 8 RET' in
`minibuffer-local-isearch-map'.

The macro is passed a sexp that is evaluated to produce the new search string.
So for `isearchp-read-unicode-char', this is the call:

(defun isearchp-read-unicode-char ()
    (interactive)
    (isearchp-use-new-search-string
     (concat isearch-string
             (string
              (read-char-by-name
                "Unicode (name or hex): ")))))

And for `isearch-edit-string' the sexp passed is just the current
`read-from-minibuffer' sexp.

But I don't know what you mean by "except the part that changes
`isearch-new-string' and `isearch-new-message'.  I do change both, to reflect
the added char.  No doubt you had a slightly different macro in mind.  Anyway,
FWIW, the code I used is here:
http://www.emacswiki.org/emacs-en/download/isearch%2b.el

Something else to consider perhaps is whether another (perhaps additional),
shorter key sequence should be bound for this.  My thinking was that `C-x 8 RET'
is enough, since (a) it is what users will remember for this, and (b) reading
the char name is anyway an interruption/slowdown, so it would not help much to
introduce the reading with a quick key sequence.

Another possibility, which I used at first but abandoned, would be to not bind
`enable-recursive-minibuffers' to non-nil systematically in the macro, but to
bind it to a value passed as an additional (optional) parameter.  For my use, at
least, I decided this was not necessary/useful - I just bind it to t.

HTH.




  reply	other threads:[~2012-12-10 14:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-09  4:52 Why is `C-x 8' limited to Latin-1 for search? Drew Adams
2012-12-09  5:33 ` Drew Adams
2012-12-10  7:46   ` Juri Linkov
2012-12-10 14:24     ` Drew Adams [this message]
2012-12-10 21:57       ` Juri Linkov
2012-12-11  0:11         ` Drew Adams
2012-12-10  7:45 ` Juri Linkov
2012-12-10 14:44   ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9CE95F039B2A4295BA1273CD98924B43@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.