unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: lisa-asket@perso.be
Cc: help-gnu-emacs@gnu.org
Subject: Re: Menu functionality
Date: Sat, 10 Jul 2021 20:44:15 +0300	[thread overview]
Message-ID: <YOncb1//4GLZ020E@protected.localdomain> (raw)
In-Reply-To: <ea-mime-60e93739-2b76-65cecb83@www-7.mailo.com>

* 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	other threads:[~2021-07-10 17:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09 11:55 Menu functionality lisa-asket
2021-07-09 12:14 ` tomas
2021-07-09 23:25   ` lisa-asket
2021-07-10  2:47     ` Jean Louis
2021-07-10  3:09       ` lisa-asket
2021-07-10  3:48         ` lisa-asket
2021-07-10  4:07           ` lisa-asket
2021-07-10  4:14           ` Jean Louis
2021-07-10  4:36             ` lisa-asket
2021-07-10  4:39             ` lisa-asket
2021-07-10  4:56               ` Jean Louis
2021-07-10  5:06                 ` lisa-asket
2021-07-10  5:41                   ` Jean Louis
2021-07-10  5:52                     ` Beauty of Emacs Lisp Jean Louis
2021-07-10  6:17                       ` Christopher Dimech
2021-07-10  5:59                     ` Menu functionality lisa-asket
2021-07-10 17:44                       ` Jean Louis [this message]
2021-07-10 19:21                         ` lisa-asket

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YOncb1//4GLZ020E@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=lisa-asket@perso.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).