all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* About Package using a menu
@ 2022-10-17 23:15 Heime via Users list for the GNU Emacs text editor
  2022-10-17 23:21 ` Emanuel Berg
  0 siblings, 1 reply; 18+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2022-10-17 23:15 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Been going through the settings for menus, sub-menus and menu-items.

Would like to make a menu called Xepty with an "About Xepty". The result would be as
happens with (Help > About Emacs) and (Help > About Gnu). A dedicated buffer shows up
with xepty-about being shown.

(defvar xepty-about "Xepty is Free Software.")
(define-key-after global-map

[menu-bar xepty]

(cons "Xepty" (make-sparse-keymap "Xepty"))

'tools)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: About Package using a menu
  2022-10-17 23:15 About Package using a menu Heime via Users list for the GNU Emacs text editor
@ 2022-10-17 23:21 ` Emanuel Berg
  2022-10-18 10:52   ` Heime
  2022-10-18 11:02   ` Christopher Dimech
  0 siblings, 2 replies; 18+ messages in thread
From: Emanuel Berg @ 2022-10-17 23:21 UTC (permalink / raw)
  To: help-gnu-emacs

Heime via Users list for the GNU Emacs text editor wrote:

> Been going through the settings for menus, sub-menus and
> menu-items.

That's OK. Real programmers don't use them, but they are okay
to program ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: About Package using a menu
  2022-10-17 23:21 ` Emanuel Berg
@ 2022-10-18 10:52   ` Heime
  2022-10-18 11:02   ` Christopher Dimech
  1 sibling, 0 replies; 18+ messages in thread
From: Heime @ 2022-10-18 10:52 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

------- Original Message -------
On Monday, October 17th, 2022 at 11:21 PM, Emanuel Berg <incal@dataswamp.org> wrote:


> Heime via Users list for the GNU Emacs text editor wrote:
> 
> > Been going through the settings for menus, sub-menus and
> > menu-items.
> 
> 
> That's OK. Real programmers don't use them, but they are okay
> to program ...

Yes, but a genius does what is needed.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: About Package using a menu
  2022-10-17 23:21 ` Emanuel Berg
  2022-10-18 10:52   ` Heime
@ 2022-10-18 11:02   ` Christopher Dimech
  2022-10-18 15:37     ` [External] : " Drew Adams
  1 sibling, 1 reply; 18+ messages in thread
From: Christopher Dimech @ 2022-10-18 11:02 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs


> Sent: Tuesday, October 18, 2022 at 11:21 AM
> From: "Emanuel Berg" <incal@dataswamp.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: About Package using a menu
>
> Heime via Users list for the GNU Emacs text editor wrote:
>
> > Been going through the settings for menus, sub-menus and
> > menu-items.
>
> That's OK. Real programmers don't use them, but they are okay
> to program ...

Is easy-menu-define the only way to make submenus?



^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [External] : Re: About Package using a menu
  2022-10-18 11:02   ` Christopher Dimech
@ 2022-10-18 15:37     ` Drew Adams
  2022-10-18 17:32       ` Heime
  0 siblings, 1 reply; 18+ messages in thread
From: Drew Adams @ 2022-10-18 15:37 UTC (permalink / raw)
  To: Christopher Dimech, Emanuel Berg; +Cc: help-gnu-emacs@gnu.org

> Is easy-menu-define the only way to make submenus?

No, of course not.  The Elisp manual has a chapter
that tells you all about defining menus: in node
"Defining Menus":

https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Menus.html

Easy menu isn't even _mentioned_ in that chapter.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [External] : Re: About Package using a menu
  2022-10-18 15:37     ` [External] : " Drew Adams
@ 2022-10-18 17:32       ` Heime
  2022-10-18 18:14         ` Drew Adams
  0 siblings, 1 reply; 18+ messages in thread
From: Heime @ 2022-10-18 17:32 UTC (permalink / raw)
  To: Drew Adams; +Cc: Christopher Dimech, Emanuel Berg, help-gnu-emacs@gnu.org

------- Original Message -------
On Tuesday, October 18th, 2022 at 3:37 PM, Drew Adams <drew.adams@oracle.com> wrote:


> > Is easy-menu-define the only way to make submenus?
> 
> 
> No, of course not. The Elisp manual has a chapter
> that tells you all about defining menus: in node
> "Defining Menus":
> 
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Menus.html
> 
> Easy menu isn't even mentioned in that chapter.

Have been playing with constructing a "Xepty menu" with a "Daphne submenu",  
but how do I make it to display?

;; Make a Daphne submenu

(defvar daphne-menu (make-sparse-keymap "Xepty"))

(define-key daphne-menu [tags-repl-continue]
  '(menu-item "Continue Replace" multifile-continue
              :help "Continue last tags replace operation"))

(define-key daphne-menu [tags-repl]
  '(menu-item "Replace in tagged files" tags-query-replace
              :help "Interactively replace a regexp in all tagged files"))

(define-key daphne-menu [separator-replace-tags]
  '(menu-item "--"))

(define-key daphne-menu [Xepty]
  (list 'menu-item "Xepty" daphne-menu))

;; Make a Xepty menu

(define-key global-map [xepty-menu words]
  (cons "Xepty" (make-sparse-keymap "Xepty")))

;; Define specific subcommands in this menu.
(define-key global-map [xepty-menu words forward]
  '("Forward word" . forward-word))

(define-key global-map [xepty-menu words backward]
  '("Backward word" . backward-word))

(define-key global-map [C-S-down-mouse-1]
   xepty-menu)






^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [External] : Re: About Package using a menu
  2022-10-18 17:32       ` Heime
@ 2022-10-18 18:14         ` Drew Adams
  2022-10-18 19:12           ` Heime
  2022-10-18 20:14           ` Heime
  0 siblings, 2 replies; 18+ messages in thread
From: Drew Adams @ 2022-10-18 18:14 UTC (permalink / raw)
  To: Heime; +Cc: Christopher Dimech, Emanuel Berg, help-gnu-emacs@gnu.org

> Have been playing with constructing a "Xepty menu" with a "Daphne submenu",
> but how do I make it to display?

Keep reading.

Node Menu Keymaps has everything you need.
Node Menu Example shows you an example.
Etc.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [External] : Re: About Package using a menu
  2022-10-18 18:14         ` Drew Adams
@ 2022-10-18 19:12           ` Heime
  2022-10-18 19:31             ` Heime
  2022-10-18 20:35             ` Drew Adams
  2022-10-18 20:14           ` Heime
  1 sibling, 2 replies; 18+ messages in thread
From: Heime @ 2022-10-18 19:12 UTC (permalink / raw)
  To: Drew Adams; +Cc: Christopher Dimech, Emanuel Berg, help-gnu-emacs@gnu.org






Sent with Proton Mail secure email.

------- Original Message -------
On Tuesday, October 18th, 2022 at 6:14 PM, Drew Adams <drew.adams@oracle.com> wrote:


> > Have been playing with constructing a "Xepty menu" with a "Daphne submenu",
> > but how do I make it to display?
> 
> 
> Keep reading.
> 
> Node Menu Keymaps has everything you need.
> Node Menu Example shows you an example.
> Etc.

My problem is about understanding how to make a new parent menu.  The example assumes 
that the parent menu (menu-bar-edit-menu) already exists. 




^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [External] : Re: About Package using a menu
  2022-10-18 19:12           ` Heime
@ 2022-10-18 19:31             ` Heime
  2022-10-19  5:33               ` Jean Louis
  2022-10-18 20:35             ` Drew Adams
  1 sibling, 1 reply; 18+ messages in thread
From: Heime @ 2022-10-18 19:31 UTC (permalink / raw)
  To: Heime; +Cc: Drew Adams, Christopher Dimech, Emanuel Berg,
	help-gnu-emacs@gnu.org


------- Original Message -------
On Tuesday, October 18th, 2022 at 7:12 PM, Heime <heimeborgia@protonmail.com> wrote:

> ------- Original Message -------
> On Tuesday, October 18th, 2022 at 6:14 PM, Drew Adams drew.adams@oracle.com wrote:
> 
> > > Have been playing with constructing a "Xepty menu" with a "Daphne submenu",
> > > but how do I make it to display?
> > 
> > Keep reading.
> > 
> > Node Menu Keymaps has everything you need.
> > Node Menu Example shows you an example.
> > Etc.

This is how make parent "xepty-menu, then add "daphne-menu" as submenu.

(define-key global-map [xepty-menu words]
  (cons "Xepty" (make-sparse-keymap "Xepty")))

(define-key xepty-menu [Daphne]
  (list 'menu-item "Daphne" daphne-menu))




^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [External] : Re: About Package using a menu
  2022-10-18 18:14         ` Drew Adams
  2022-10-18 19:12           ` Heime
@ 2022-10-18 20:14           ` Heime
  2022-10-18 20:35             ` Drew Adams
  1 sibling, 1 reply; 18+ messages in thread
From: Heime @ 2022-10-18 20:14 UTC (permalink / raw)
  To: Drew Adams; +Cc: Christopher Dimech, Emanuel Berg, help-gnu-emacs@gnu.org






Sent with Proton Mail secure email.

------- Original Message -------
On Tuesday, October 18th, 2022 at 6:14 PM, Drew Adams <drew.adams@oracle.com> wrote:


> > Have been playing with constructing a "Xepty menu" with a "Daphne submenu",
> > but how do I make it to display?
> 
> 
> Keep reading.
> 
> Node Menu Keymaps has everything you need.
> Node Menu Example shows you an example.
> Etc.

Have managed to display a parent menu.  Would you holp a bit on how to insert a submenu?

Here is the making of a parent menu "xepty-menu".

(defvar xepty-menu (make-sparse-keymap "xepty"))

(define-key-after global-map [menu-bar xepty-menu]
  (cons "Xepty" (make-sparse-keymap "xepty"))
  'tools )

--------------------

Here I want to make submenu "daphne-menu"

(define-key daphne-menu [xepty-menu]
  '(menu-item "Continue Replace" multifile-continue
              :help "Continue last tags replace operation"))
(define-key daphne-menu [xepty-menu]
  '(menu-item "Replace in tagged files" tags-query-replace
              :help "Interactively replace a regexp in all tagged files"))
(define-key daphne-menu [xepty-menu]
  '(menu-item "--"))

----------------------------

How can I add submenu daphne-menu in the following?

(define-key global-map [menu-bar xepty-menu daphne]
  '("Next Line" . next-line))





^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [External] : Re: About Package using a menu
  2022-10-18 19:12           ` Heime
  2022-10-18 19:31             ` Heime
@ 2022-10-18 20:35             ` Drew Adams
  1 sibling, 0 replies; 18+ messages in thread
From: Drew Adams @ 2022-10-18 20:35 UTC (permalink / raw)
  To: Heime; +Cc: Christopher Dimech, Emanuel Berg, help-gnu-emacs@gnu.org

> > > Have been playing with constructing a "Xepty menu" with a "Daphne
> submenu",
> > > but how do I make it to display?
> >
> >
> > Keep reading.
> >
> > Node Menu Keymaps has everything you need.
> > Node Menu Example shows you an example.
> > Etc.
> 
> My problem is about understanding how to make a new parent menu.  The example
> assumes that the parent menu (menu-bar-edit-menu) already exists.

1. You can pop up a menu; it need not have a parent.

   Pretty much anywhere you can use a keymap you can use
   a menu.

   As the (entire) text of node Menu Keymaps tells you:

    "A keymap can operate as a menu as well as defining
     bindings for keyboard keys and mouse buttons.  Menus
     are usually actuated with the mouse, but they can
     function with the keyboard also.  If a menu keymap
     is active for the next input event, that activates
     the keyboard menu feature."

2. You can use an existing menu as parent, or create one.

Keep reading.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [External] : Re: About Package using a menu
  2022-10-18 20:14           ` Heime
@ 2022-10-18 20:35             ` Drew Adams
  2022-10-18 20:56               ` Heime
  2022-10-18 21:23               ` RE: [External] : " Christopher Dimech
  0 siblings, 2 replies; 18+ messages in thread
From: Drew Adams @ 2022-10-18 20:35 UTC (permalink / raw)
  To: Heime; +Cc: Christopher Dimech, Emanuel Berg, help-gnu-emacs@gnu.org

> Have managed to display a parent menu.
> Would you holp a bit on how to insert a submenu?

Nope; sorry, too busy.  Hopefully someone else will
pitch in.  Or maybe you'll find the answer yourself
first, as you did for your other questions (e.g.,
how to display a parent menu).

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [External] : Re: About Package using a menu
  2022-10-18 20:35             ` Drew Adams
@ 2022-10-18 20:56               ` Heime
  2022-10-18 21:23               ` RE: [External] : " Christopher Dimech
  1 sibling, 0 replies; 18+ messages in thread
From: Heime @ 2022-10-18 20:56 UTC (permalink / raw)
  To: Drew Adams; +Cc: Christopher Dimech, Emanuel Berg, help-gnu-emacs@gnu.org

------- Original Message -------
On Tuesday, October 18th, 2022 at 8:35 PM, Drew Adams <drew.adams@oracle.com> wrote:


> > Have managed to display a parent menu.
> > Would you holp a bit on how to insert a submenu?
> 
> 
> Nope; sorry, too busy. Hopefully someone else will
> pitch in. Or maybe you'll find the answer yourself
> first, as you did for your other questions (e.g.,
> how to display a parent menu).

Life's not easy.  Can't even trust programmers.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: RE: [External] :  About Package using a menu
  2022-10-18 20:35             ` Drew Adams
  2022-10-18 20:56               ` Heime
@ 2022-10-18 21:23               ` Christopher Dimech
  1 sibling, 0 replies; 18+ messages in thread
From: Christopher Dimech @ 2022-10-18 21:23 UTC (permalink / raw)
  To: Drew Adams; +Cc: Heime, Emanuel Berg, help-gnu-emacs@gnu.org

> Sent: Wednesday, October 19, 2022 at 8:35 AM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: "Heime" <heimeborgia@protonmail.com>
> Cc: "Christopher Dimech" <dimech@gmx.com>, "Emanuel Berg" <incal@dataswamp.org>, "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
> Subject: RE: [External] : Re: About Package using a menu
>
> > Have managed to display a parent menu.
> > Would you holp a bit on how to insert a submenu?
>
> Nope; sorry, too busy.  Hopefully someone else will
> pitch in.  Or maybe you'll find the answer yourself
> first, as you did for your other questions (e.g.,
> how to display a parent menu).

Dear Heime,

Here is a submenu that works as you wish.

(defvar xepty-menu (make-sparse-keymap "xepty"))
(defvar daphne-menu (make-sparse-keymap "daphne"))

;; Here is the xepty parent menu

(define-key-after global-map [menu-bar xepty-menu]
  (cons "Xepty" (make-sparse-keymap "xepty")) 'tools)

;; Here you get the daphne submenu

(define-key-after global-map [menu-bar xepty-menu daphne-menu]
  (cons "Daphne" (make-sparse-keymap "daphne")) 'kill-buffer)

;; Here you append function commands in daphne submenu

(define-key global-map [menu-bar xepty-menu daphne-menu bash]
	    '("Bash" . sh-mode))

;; Here you append another function command in daphne submenu

(define-key global-map [menu-bar xepty-menu daphne-menu elisp]
	    '("Emacs Lisp" . emacs-lisp-mode))





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [External] : Re: About Package using a menu
  2022-10-18 19:31             ` Heime
@ 2022-10-19  5:33               ` Jean Louis
  2022-10-19  9:28                 ` Emanuel Berg
  2022-10-19 14:31                 ` Heime
  0 siblings, 2 replies; 18+ messages in thread
From: Jean Louis @ 2022-10-19  5:33 UTC (permalink / raw)
  To: Heime; +Cc: Drew Adams, Christopher Dimech, Emanuel Berg,
	help-gnu-emacs@gnu.org

I just do this:

(easy-menu-define cf-people-menu  global-map "People menu"
  (list "People"
	cf-people-menu-find-people
	cf-people-menu-list-of-people
	cf-people-menu-collaborate
	cf-people-menu-add-new-people
	cf-people-menu-edit-people
	cf-mailing-list-menu
	cf-central-files-menu
	rcd-db-database-maintenance-menu
	))

Then for each of those entries I have:

(defvar cf-people-menu-find-people
  (list "Find people"
	["Find people" cf-people t]
	["Find people by name" cf-people-by-name t]
	["Find people by query" cf-people-search-ts-query t]
	["Find files of person" cf-find-files-of-person t]
	["Find people by description" cf-people-by-description t]))


-- 
Jean

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

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



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [External] : Re: About Package using a menu
  2022-10-19  5:33               ` Jean Louis
@ 2022-10-19  9:28                 ` Emanuel Berg
  2022-10-19 14:31                 ` Heime
  1 sibling, 0 replies; 18+ messages in thread
From: Emanuel Berg @ 2022-10-19  9:28 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

> I just do this:
>
> (easy-menu-define cf-people-menu  global-map "People menu"
>   (list "People"
> 	cf-people-menu-find-people
> 	cf-people-menu-list-of-people
> 	cf-people-menu-collaborate
> 	cf-people-menu-add-new-people
> 	cf-people-menu-edit-people
> 	cf-mailing-list-menu
> 	cf-central-files-menu
> 	rcd-db-database-maintenance-menu
> 	))

`easy-menu-define', are you sure that's a good idea, why don't
you stick to Elisp?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [External] : Re: About Package using a menu
  2022-10-19  5:33               ` Jean Louis
  2022-10-19  9:28                 ` Emanuel Berg
@ 2022-10-19 14:31                 ` Heime
  2022-10-19 20:21                   ` Emanuel Berg
  1 sibling, 1 reply; 18+ messages in thread
From: Heime @ 2022-10-19 14:31 UTC (permalink / raw)
  To: Jean Louis
  Cc: Drew Adams, Christopher Dimech, Emanuel Berg,
	help-gnu-emacs@gnu.org


------- Original Message -------
On Wednesday, October 19th, 2022 at 5:33 AM, Jean Louis <bugs@gnu.support> wrote:


> I just do this:
> 
> (easy-menu-define cf-people-menu global-map "People menu"
> (list "People"
> cf-people-menu-find-people
> cf-people-menu-list-of-people
> cf-people-menu-collaborate
> cf-people-menu-add-new-people
> cf-people-menu-edit-people
> cf-mailing-list-menu
> cf-central-files-menu
> rcd-db-database-maintenance-menu
> ))
> 
> Then for each of those entries I have:
> 
> (defvar cf-people-menu-find-people
> (list "Find people"
> ["Find people" cf-people t]
> ["Find people by name" cf-people-by-name t]
> ["Find people by query" cf-people-search-ts-query t]
> ["Find files of person" cf-find-files-of-person t]
> ["Find people by description" cf-people-by-description t]))

Doing things similarly to your code (calling the defvar using its name), but still get an error.
I am also using submenus.  Can one perhaps do ["Find People" cf-people-menu-find-people t] ?







^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [External] : Re: About Package using a menu
  2022-10-19 14:31                 ` Heime
@ 2022-10-19 20:21                   ` Emanuel Berg
  0 siblings, 0 replies; 18+ messages in thread
From: Emanuel Berg @ 2022-10-19 20:21 UTC (permalink / raw)
  To: help-gnu-emacs

Heime wrote:

> Doing things similarly to your code (calling the defvar
> using its name), but still get an error. I am also using
> submenus. Can one perhaps do ["Find People"
> cf-people-menu-find-people t] ?

1) Write a version that works

2) Expand, if it still works, expand more ...

3) When it doesn't work, post the code here

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-10-19 20:21 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-17 23:15 About Package using a menu Heime via Users list for the GNU Emacs text editor
2022-10-17 23:21 ` Emanuel Berg
2022-10-18 10:52   ` Heime
2022-10-18 11:02   ` Christopher Dimech
2022-10-18 15:37     ` [External] : " Drew Adams
2022-10-18 17:32       ` Heime
2022-10-18 18:14         ` Drew Adams
2022-10-18 19:12           ` Heime
2022-10-18 19:31             ` Heime
2022-10-19  5:33               ` Jean Louis
2022-10-19  9:28                 ` Emanuel Berg
2022-10-19 14:31                 ` Heime
2022-10-19 20:21                   ` Emanuel Berg
2022-10-18 20:35             ` Drew Adams
2022-10-18 20:14           ` Heime
2022-10-18 20:35             ` Drew Adams
2022-10-18 20:56               ` Heime
2022-10-18 21:23               ` RE: [External] : " Christopher Dimech

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.