unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: storm@cua.dk (Kim F. Storm),
	rms@gnu.org, monnier+gnu/emacs@RUM.cs.yale.edu,
	emacs-devel@gnu.org
Subject: Re: What happened to the key-menu patch?
Date: Tue, 09 Jul 2002 09:58:47 -0400	[thread overview]
Message-ID: <200207091358.g69Dwlr26999@rum.cs.yale.edu> (raw)
In-Reply-To: buofzyt9yiq.fsf@mcspd15.ucom.lsi.nec.co.jp

> I guess we should add a `map-keymap' for xemacs compatibility.

I don't think it's just for compatibility but also because it makes sense.

> sure if it's worth it to add a `dobindings' macro or not.

Agreed.  There's already a `loop' macro for it in CL.

>      key-description list' is, but it's something like (meta control x).
>      I guess this is a canonical format for key names in xemacs, but it
>      doesn't appear to be so in emacs, so I'm not sure how that argument
>      should be handled (perhaps just punt, and pass whatever's stored in
>      the keymap).

I don't think we should try to re-create the XEmacs (meta control x) form
from our M-C-x symbols.  We could provide an additional compatibility layer
on top of it, if it proves useful/necessary later on.

>  (2) How are menu entries handled with this?  I'm not sure whether xemacs
>      even stores menus in keymaps or not (it's somewhat hard to tell,
>      since keyaps are an opaque type in xemacs, and just calling
>      map-keymap doesn't yield anything obvious).  We could just pass the
>      whole menu entry (e.g., (menu-item ...)) as the first argument, and
>      perhaps extract the binding and pass it as the second arg, or even
>      pass something else for that.

XEmacs' keymap do not contain menu entries (of toolbar entries
for that matter).  As for how we should treat them, I think we should
not do anything special with them: i.e. `function' will be called
with key `menu-bar' and with the corresponding sub-keymap as the binding.

> affect the usual case (unless you're Stephan).
                                          ^^ f  (couldn't resist)

I have appended my current code.  It has several shortcomings, especially
the ugly "use integers to specify hard-coded C functions".  Also there
is the issue of eliminating/merging duplicate bindings, which I think
XEmacs' code punts on by declaring that `map-keymap' does not look at
the keymap's parent(s).
As you can see, the code is tentative and not ready for prime-time.
I only show it to give an idea of what I'm thinking of.


	Stefan


extern void menu_bar_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
static void (*map_keymap_functions[])
     P_ ((Lisp_Object, Lisp_Object, Lisp_Object))
     = { menu_bar_item };

static void
map_keymap_item (closure, key, val)
     Lisp_Object closure, key, val;
{
  Lisp_Object fun = XCAR (closure);
  Lisp_Object args = XCDR (closure);
  if (EQ (val, Qt))
    val = Qnil;
  if (NATNUMP (fun))
    map_keymap_functions[XFASTINT (fun)](args, key, val);
  else
    call3 (fun, args, key, val);
}

static void
map_keymap_char_table_item (closure, key, val)
     Lisp_Object closure, key, val;
{
  if (!NILP (val))
    map_keymap_item (closure, key, val);
}

/* Call CLOSURE for every binding in MAP.
   CLOSURE is a cons cell of the form (FUN . ARGS).
   FUN is called with three arguments: FUN (ARGS, KEY, BINDING).
   If FUN is an integer, it denotes the index of the function to
   use from `map_keymap_functions'.  */
void
map_keymap (closure, map, autoload)
     Lisp_Object map, closure;
     int autoload;
{
  struct gcpro gcpro1, gcpro2, gcpro3;
  Lisp_Object tail;

  GCPRO3 (map, closure, tail);
  map = get_keymap (map, 1, autoload);
  for (tail = (CONSP (map) && EQ (Qkeymap, XCAR (map))) ? XCDR (map) : map;
       CONSP (tail) || (tail = get_keymap (tail, 0, autoload), CONSP (tail));
       tail = XCDR (tail))
    {
      Lisp_Object binding = XCAR (tail);
      
      if (CONSP (binding))
	map_keymap_item (closure, XCAR (binding), XCDR (binding));
      else if (VECTORP (binding))
	{
	  /* Loop over the char values represented in the vector.  */
	  int len = ASIZE (binding);
	  int c;
	  abort();
	  for (c = 0; c < len; c++)
	    {
	      Lisp_Object character;
	      XSETFASTINT (character, c);
	      map_keymap_item (closure, character, AREF (binding, c));
	    }
	}
      else if (CHAR_TABLE_P (binding))
	{
	  Lisp_Object indices[3];
	  map_char_table (map_keymap_char_table_item,
			  Qnil, binding, closure, 0, indices);
	}
    }
  UNGCPRO;
}

  reply	other threads:[~2002-07-09 13:58 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200205050534.g455YfF01634@aztec.santafe.edu>
2002-05-05 22:02 ` Assignment of misc packages for emacs Kim F. Storm
2002-05-06 23:07   ` Alex Schroeder
2002-05-08  1:16     ` Miles Bader
2002-05-08  1:47       ` Stefan Monnier
2002-05-09  2:45       ` Richard Stallman
2002-05-07 14:08   ` Kai Großjohann
2002-05-08 13:58     ` Richard Stallman
2002-05-08  1:31   ` Miles Bader
2002-05-08  6:23     ` Thien-Thi Nguyen
2002-05-14 19:41   ` Richard Stallman
2002-05-14 19:41   ` Richard Stallman
2002-05-14 23:44     ` Kim F. Storm
2002-05-15  1:08       ` Miles Bader
2002-05-15 21:37         ` Kim F. Storm
2002-05-16  1:19           ` Miles Bader
2002-05-17 19:29           ` Richard Stallman
2002-05-17 21:42             ` Kim F. Storm
2002-05-17 19:29           ` Richard Stallman
2002-05-17 21:31             ` Kim F. Storm
2002-05-16  7:22         ` Richard Stallman
2002-05-16 23:41           ` Kim F. Storm
2002-05-15  4:51       ` Eli Zaretskii
2002-05-15  8:41         ` Andreas Schwab
2002-05-15 10:20           ` Eli Zaretskii
2002-05-15 11:08             ` Andreas Schwab
2002-05-15 21:41         ` Kim F. Storm
2002-05-15 19:27       ` Stefan Monnier
2002-05-15 20:37         ` Andreas Schwab
2002-05-16 23:39         ` Kim F. Storm
2002-05-16 22:49           ` Stefan Monnier
2002-05-17  6:27             ` Eli Zaretskii
2002-05-17  7:10               ` Miles Bader
2002-05-17  9:21                 ` Andreas Schwab
2002-05-17 11:13                   ` Miles Bader
2002-05-17  9:40                 ` Eli Zaretskii
2002-05-17 11:15                   ` Miles Bader
2002-05-17 10:47             ` Kim F. Storm
2002-05-17 10:08               ` Stefan Monnier
2002-05-17 11:20                 ` Miles Bader
2002-05-17 12:07                 ` Kim F. Storm
2002-05-17 11:28                   ` Miles Bader
2002-05-18 18:48             ` Richard Stallman
2002-05-18 21:39               ` Kim F. Storm
2002-05-19 19:40                 ` Richard Stallman
2002-05-18 22:37               ` Stefan Monnier
2002-05-19 19:40                 ` Richard Stallman
2002-05-16 23:07           ` Miles Bader
2002-05-18 18:48             ` Richard Stallman
2002-05-19 11:57             ` Miles Bader
2002-05-19 14:41               ` Stefan Monnier
2002-05-19 15:12                 ` Miles Bader
2002-05-20  6:38                 ` Miles Bader
2002-05-20  9:57                   ` Alex Schroeder
2002-05-20 10:06                   ` Kai Großjohann
2002-05-20 21:34                   ` Richard Stallman
2002-05-21  9:54                     ` Mario Lang
2002-05-21 10:23                       ` Miles Bader
2002-05-22 22:29                       ` Richard Stallman
2002-05-21 10:20                     ` Miles Bader
2002-05-22 22:27                       ` Richard Stallman
2002-05-23  7:08                         ` Miles Bader
2002-05-23 16:49                           ` Mario Lang
2002-05-23 22:21                             ` Miles Bader
2002-06-04 17:27                         ` Miles Bader
2002-06-05 14:42                           ` Stefan Monnier
2002-06-06  1:07                             ` Miles Bader
2002-06-06  1:37                               ` Stefan Monnier
2002-06-06  1:46                                 ` Miles Bader
2002-06-06  7:57                                 ` Miles Bader
2002-06-07  0:45                                   ` Richard Stallman
2002-06-07  0:45                               ` Richard Stallman
2002-06-05 23:10                           ` Kim F. Storm
2002-06-06  1:09                             ` Miles Bader
2002-06-06  1:24                           ` Miles Bader
2002-06-07  0:45                             ` Richard Stallman
2002-06-07 23:26                               ` Kim F. Storm
2002-06-08  1:09                                 ` Miles Bader
2002-06-08 19:15                                 ` Richard Stallman
2002-06-06 12:04                           ` Richard Stallman
2002-06-06 12:41                             ` Miles Bader
2002-06-06 13:37                               ` Stefan Monnier
2002-06-06 13:45                                 ` Miles Bader
2002-06-07 23:23                               ` Richard Stallman
2002-06-08  4:06                                 ` Miles Bader
2002-06-09 15:19                                   ` Richard Stallman
2002-06-10 14:35                                   ` Stefan Monnier
2002-06-11 19:25                                     ` Richard Stallman
2002-07-07 22:46                           ` What happened to the key-menu patch? Kim F. Storm
2002-07-09  7:00                             ` Miles Bader
2002-07-09 13:58                               ` Stefan Monnier [this message]
2002-07-10  2:43                                 ` Miles Bader
2002-07-10 18:12                                   ` Stefan Monnier
2002-07-10 10:43                                 ` Richard Stallman
2002-07-11 17:13                                   ` Stefan Monnier
2002-07-12 17:37                                     ` Richard Stallman
2002-07-12 18:07                                       ` Stefan Monnier
2002-07-13 14:20                                         ` Richard Stallman
2002-07-13 17:37                                           ` Stefan Monnier
2002-07-15  1:09                                             ` Richard Stallman
2002-07-09 18:51                               ` Richard Stallman
2002-07-10  2:45                                 ` Miles Bader
2002-07-10 19:20                                   ` Richard Stallman
2002-05-20 14:48               ` Assignment of misc packages for emacs Richard Stallman
2002-05-18 18:48           ` Richard Stallman
2002-05-18 20:07             ` Kim F. Storm
2002-05-19 19:40               ` Richard Stallman
2002-05-16  7:21       ` Richard Stallman
2002-05-16  7:21       ` Richard Stallman
2002-05-15  7:44     ` D. Goel

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=200207091358.g69Dwlr26999@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    --cc=storm@cua.dk \
    /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).