From: Vinicius Jose Latorre <address@hidden>
To: Herbert Euler <address@hidden>
CC: address@hidden, address@hidden
Subject: Re: Icicles, Printing and Easy Menu
Date: Wed, 01 Nov 2006 03:08:05 -0200
For some reason the command:
(easy-menu-change '("file") "Print" pr-menu-spec "print-buffer")
has no effect just after step 5.
The command above is correct, but has no effect, that is, "Print" submenu
is not created.
But if after step 5, you do:
5.1 C-h v global-map RET ;; create *Help* buffer in another window
5.2 C-x o ;; switch to *Help* buffer
Now, all works.
From: "Herbert Euler" <address@hidden>
To: address@hidden
CC: address@hidden
Subject: On the Printing Problem
Date: Tue, 31 Oct 2006 11:26:21 +0800
Hello,
Here is my conclusion on the problem arised when I mixed Icicles and
Printing.
This problem is arised because Icicles mode rebinds the key bindings
in a way that is not robust in all aspects. In file
`icicles-mode.el', Icicles mode rebinds many key bindings with
`substitute-key-definition'. Let's see what
`substitute-key-definition' does. As in your mail to the emacs-devel
mailing list, we evaluate some forms:
(defvar foo-map (make-sparse-keymap) "")
==> foo-map
(substitute-key-definition 'find-file
'find-file-literally
foo-map
global-map)
==> nil
foo-map
==> (keymap
(open . find-file-literally)
(menu-bar keymap
(file keymap
(new-file menu-item "Visit New File..."
find-file-literally
([24 6]
. " (C-x C-f)")
:enable
(menu-bar-non-minibuffer-window-p)
:help "Specify a new file's name, to edit
the file")))
(24 keymap
(6 . find-file-literally)))
As you see, `substitute-key-definition' copies the entries that with
`find-file' in their bindings in `global-map' into `foo-map' and
substitutes `find-file' with `find-file-literally'.
Icicles mode copies the entries in `global-map' in the same way.
After that, by enabling Icicles mode, `icicle-mode-map' becomes active
to all of the visible buffers. `icicle-mode-map' is a minor mode
keymap, so it will shadow `global-map'.
When the user invokes `(pr-update-menus t)', Printing tries to update
Emacs' menu with `easy-menu-change'. This will finally cause
`easy-menu-get-map' get invoked. We have found that
`easy-menu-get-map' will pick up all maps but pick the global map
last. Since Icicles mode already shadows the global map with its
`icicle-mode-map', a wrong entry is picked by `easy-menu-get-map', and
so Printing complains. (In fact, `easy-menu-get-map' tries to find
the entry with `menu-bar' first.)
The purpose of `icicle-mode-map' is to rebind key bindings. But there
is another way to do this, without making other packages signaling
errors. Please take a look at (info "(elisp) Remapping Commands").
The other packages that try to provide similar completion features,
such as `ido', accomplish in this way actually. The function
`ido-mode' in file `lisp/ido.el' is an example of using the remapping
feature.
Regards,
Herbert
_________________________________________________________________
Get FREE company branded e-mail accounts and business Web site from
Microsoft Office Live
http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/