help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Menu functionality


From: lisa-asket
Subject: Menu functionality
Date: Sat, 10 Jul 2021 21:21:39 +0200 (CEST)

Is it possible for  easy-menu-define te inject the menu at a particular 
location in the menubar.

Currently the menu is being inserted before the file menu.



From: Jean Louis <bugs@gnu.support>
To: lisa-asket@perso.be
Subject: Re: Menu functionality
Date: 10/07/2021 19:44:15 Europe/Paris
Cc: help-gnu-emacs@gnu.org

* lisa-asket@perso.be <lisa-asket@perso.be> [2021-07-10 08:59]:
> (defun my-easy-menu ()
>   ""
>   (easy-menu-define rupal global-map "Rupal"
>     (list "Rupal"
>       ["Entry Sweep" entry-sweep t]
>       ["Hide Entry"  hide-entry t]
>       ["Show Entry"  show-entry t]
>       ["Hide Body"   hide-body t]
>       ("Sub Menu"
>        ["Texinfo Pdf" texinfo-pdf t]
>        ["Texinfo Htm" texinfo-htm t]) )) )

I have used it even without the `defun', just `easy-menu-define'
alone. This is because when I load specific file then
`easy-menu-define' is invoked and I get the menu. Otherwise if it is
part of special mode it is then invoked in that special mode.

I also define multiple sub-menus this way:

(defvar hyperscope-menu-list-hyperdocuments
(list "List hyperdocuments"
["List action hyperdocuments action" hyperscope-all-actions t]
["List assigned action hyperdocuments" hyperscope-list-assigned-actions t]
["List published hyperdocuments" hyperscope-list-published-hyperdocuments t]
["Actions pending by assignee" hyperscope-hyperdocuments-pending-by-assignee t]
["Latest hyperdocuments" hyperscope-latest-entries t]
["List by rank" hyperscope-by-rank t]
["List user set" hyperscope-list-user-set t]))

(defvar hyperscope-menu-current-hyperdocument
'("Current hyperdocument"
["Show description for hyperdocument" hyperscope-description-show t]
["Duplicate hyperdocument" hyperscope-copy-hyperdocument t]
["Preview HTML" hyperscope-hyperdocument-preview t]
["Open directory" hyperscope-dired t]
["Remove mark" hyperscope-unmark-id t]
["Sort hyperdocuments alphabetically" hyperscope-sort-alphabetically t]
["Go back" hyperscope-go-back t]
["Go back to real parent" hlink-go-to-parent t]))

imagine multiple such as above here.................

then final that integrates them all:

(easy-menu-define hyperscope-menu map "Hyperscope Menu"
(list "Hyperscope"
hyperscope-menu-list-hyperdocuments
hyperscope-menu-current-hyperdocument
hyperscope-menu-find-hyperdocuments
hyperscope-menu-collaborate
hyperscope-menu-add-hyperdocuments
hyperscope-menu-edit-hyperdocument
hyperscope-menu-deleting-hyperdocuments
hyperscope-menu-meta-functions
["About Hyperscope" hyperscope-about t]
["Quit" quit-window t]))

I can say that `easy-menu' truly deserves its easy adjective as when I
compare it to various GUI toolkits that are normally invoked from
Common Lisp or Scheme implementations. A menu in Emacs means much for
the user as it offers quick access, it is helpful as it shows key
bindings, it gives some structure on how user could proceed with
possible actions.

> I think many could learn from this as information en making working
> menus is scant.

I have used just Emasc Lisp manual.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]