unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: "Ken Manheimer" <ken.manheimer@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: identifying meta-key bound functions from last-command-char?
Date: Tue, 26 Feb 2008 11:21:18 +0900	[thread overview]
Message-ID: <E1JTpRW-0001Vv-Ty@etlken.m17n.org> (raw)
In-Reply-To: <2cd46e7f0802251630h2cc2ae5di1d77ed3b87611416@mail.gmail.com> (ken.manheimer@gmail.com)

In article <2cd46e7f0802251630h2cc2ae5di1d77ed3b87611416@mail.gmail.com>, "Ken Manheimer" <ken.manheimer@gmail.com> writes:

> [1  <text/plain; ISO-8859-1 (7bit)>]
> in a recent emacs build a technique i've been using to deliberately fetch
> key bindings according to the last-command-char is failing for meta-modified
> keys.  the problem is that, for meta-modified keys,

>   (characterp last-command-char) => nil

> this breaks an approach like:

>   (key-binding (char-to-string last-command-char))

> i need some way to fetch bindings according to last-command-char for a
> special key handler that i use in overlays and, (for example) in
> allout.elallout-hotspot-key-handler, a pre-command-hook function.
> though probably
> overly complicated, it has worked through the released emacs 22.  in the
> recent cvs build (23.0.60), i get an error:

>   wrong-type-argument characterp 134217760

> (that's for "\M- " meta space, but the same things happens for other meta
> keys.)  i'm failing to figure out how to translate the meta-modified key to
> something that i can use for key-binding, and presume i'm missing something
> obvious.  can someone steer me in the right direction?

Unfortunately, I think Emacs doesn't have a clear view about
how to handle an integer which contains a character code and
meta-modifier masks.  Is it a character or not?

I think it's not a character but an event object, so the
above code should be:
  (key-binding (vector last-command-char))

The related problem is when to change, for instance, (' ' |
CTRL_MASK) to '\0'.  Now Emacs signals an error when we type
C-q C-SPC.

---
Kenichi Handa
handa@ni.aist.go.jp




  parent reply	other threads:[~2008-02-26  2:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-26  0:30 identifying meta-key bound functions from last-command-char? Ken Manheimer
2008-02-26  2:07 ` Stefan Monnier
2008-02-26  2:21 ` Kenichi Handa [this message]
2008-02-26  2:33   ` Stefan Monnier
2008-02-26  3:59     ` Kenichi Handa
2008-02-26  4:46       ` Stefan Monnier
2008-02-26  6:08 ` Miles Bader
2008-02-26  6:28   ` Ken Manheimer
2008-02-26 15:13     ` Stefan Monnier
2008-02-26 22:57       ` Ken Manheimer
2008-02-27  2:10         ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=E1JTpRW-0001Vv-Ty@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    --cc=ken.manheimer@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).