GNU bug report logs - #6527
C-h b alters key-translation-map (in a bad way)

Previous Next

Package: emacs;

Reported by: David Reitter <david.reitter <at> gmail.com>

Date: Mon, 28 Jun 2010 14:42:02 UTC

Severity: normal

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #22 received at 6527 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Chong Yidong <cyd <at> gnu.org>
Cc: David Reitter <david.reitter <at> gmail.com>, 6527 <at> debbugs.gnu.org
Subject: Re: bug#6527: C-h b autoloads iso-transl and alters
	key-translation-map
Date: Thu, 19 Jul 2012 08:06:32 -0400
> How about something like the following (modulo comment changes and
> fixing the isearch integration)?

I don't much like the idea of hard-coding key-translation-map's parent
like this.

> There's still no facility for cleanly adding/removing a keymap parent.

Then, let's try to fix this problem.
How 'bout:

  (defun add-parent (map new-parent)
    (let ((cur (keymap-parent map)))
      (cond
       ((null cur) (set-keymap-parent map new-parent))
       ((eq cur new-parent))
       ((and (consp cur) (memq new-parent cur)))
       ((implicit-parents-holder-p cur)
        (push new-parent (cdr cur)))
       (t (set-keymap-parent
           map (make-composed-keymap (list new-parent cur)))))))

  (defun remove-parent (map parent)
    (let ((cur (keymap-parent map)))
      (cond
       ((eq cur parent) (set-keymap-parent map nil))
       ((and (consp cur) (memq parent cur))
        (delq parent cur)
        (unless (cdr cur) (set-keymap-parent map nil))))))

The only remaining problem is to define implicit-parents-holder-p
which magically determines if the keymap is one of those that where
implicitly created by add-parent (by calling make-composed-keymap)
or if it's a *real* keymap that belongs to someone else and that we
shouldn't modify.

        
        Stefan




This bug report was last modified 3 years and 262 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.