[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A user menu in the wrong position
On 2007-01-31, Katsumi Yamaoka said:
>>>>>> In [emacs-w3m : No.09152] Leo wrote:
>
>> I have defined a menu to display in global menu map as follows.
>
>> ,----
>>| (easy-menu-define sdl:user-utils-menu nil "User utilities menu."
>>| '("Add-On"
>>| ["BBDB" bbdb :visible (fboundp 'bbdb)]
>>| ["W3M" w3m :visible (fboundp 'w3m)]
>>| ["Slime" slime :visible (fboundp 'slime)]))
>>| (define-key-after
>>| (lookup-key global-map [menu-bar])
>>| [user-utils]
>>| (cons "Utils" sdl:user-utils-menu))
>> `----
>
>> In w3m, this menu will be place after the "Help" menu while in all
>> other modes it is placed after "Tools" menu. I am wondering if w3m is
>> doing something funny.
>
> It is because the value of the `menu-bar-final-items' variable[1]
> is modified in emacs-w3m buffers locally in order to place the
> w3m menu at the forefront of the menu bar.
To be honest, I don't know why are those menus being placed in the
front. Besides it breaks the convention of what other modes are doing.
Anyone else think it is a good idea to make emacs-w3m following this
convention?
> You can customize it as follows:
>
> (add-hook
> 'w3m-mode-hook
> (lambda nil
> (let ((item 'tools) ;; Place the `user-utils' menu after this.
> (items (delq 'user-utils (copy-sequence menu-bar-final-items))))
> (setq menu-bar-final-items
> (append
> (nreverse (cons 'user-utils (memq item (reverse items))))
> (cdr (memq item items)))))))
>
> [1] If you want to know the value, you'd better evaluate the
> following form in the *scratch* buffer:
>
> (with-current-buffer "*w3m*"
> menu-bar-final-items)
>
> Regards,
>
>
--
Leo <sdl.web AT gmail.com> (GPG Key: 9283AA3F)