* FW: On the Printing Problem
@ 2006-11-01 6:00 Herbert Euler
2006-11-02 21:54 ` Drew Adams
0 siblings, 1 reply; 2+ messages in thread
From: Herbert Euler @ 2006-11-01 6:00 UTC (permalink / raw)
Cc: viniciusjl, rms, drew.adams
>From: Vinicius Jose Latorre <viniciusjl@ig.com.br>
>To: Herbert Euler <herberteuler@hotmail.com>
>CC: rms@gnu.org, emacs-devel@gnu.org
>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.
I tried that, the evaluation of (pr-update-menus t) failed again.
Below is what I wrote to Drew.
Regards,
Guanpeng Xu
>From: "Herbert Euler" <herberteuler@hotmail.com>
>To: drew.adams@oracle.com
>CC: herberteuler@hotmail.com
>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/
>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: On the Printing Problem
2006-11-01 6:00 FW: On the Printing Problem Herbert Euler
@ 2006-11-02 21:54 ` Drew Adams
0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2006-11-02 21:54 UTC (permalink / raw)
Cc: viniciusjl, rms
> >From: Vinicius Jose Latorre <viniciusjl@ig.com.br>
> >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.
Yes, there seems to be a bug there.
> Herber Euler wrote:
> I tried that, the evaluation of (pr-update-menus t) failed again.
>
> Below is what I wrote to Drew.
> >...
> >Please take a look at (info "(elisp) Remapping Commands").
As I replied to Herbert off list, Icicles does also use command remapping,
where appropriate. There is no equivalent of the OLDMAP arg to
substitute-key-definition for command remapping, and that is what is used
here. Icicles simply creates another keymap that has a particular entry in
the File menu. Whether Icicles adds that menu item to menu File (in the
minor-mode map) using substitute-key-definition or some other way is
irrelevant. This is not a problem with Icicles.
The problem occurs because printing.el runs into that minor-mode map, not
the global-map, when trying to look something up in submenu File > Print. It
should not make any assumptions about which minor-mode and local keymaps
might exist when it tries to look up submenu File > Print. It cannot simply
add the Print submenu to only the global map and then traverse each active
keymap (global-map last) expecting submenu Print to be found under menu File
for each map. It should look only in the keymap(s) where it actually added
submenu Print. If it added Print to the File menu of all existing maps, then
it could look in all existing maps. (I don't claim that it should add Print
to File in all maps; I claim only that it should not look for Print where it
has never placed Print.)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-02 21:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-01 6:00 FW: On the Printing Problem Herbert Euler
2006-11-02 21:54 ` Drew Adams
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.