* how to use 'easy-menu'?
@ 2014-11-28 15:04 Sharon Kimble
2014-11-28 15:43 ` Drew Adams
2014-11-28 23:03 ` Michael Heerdegen
0 siblings, 2 replies; 5+ messages in thread
From: Sharon Kimble @ 2014-11-28 15:04 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 2699 bytes --]
I have an easy-menu menu that works under org-mode, but I would now
like to use it emacs-wide, i.e. have it available when I’m using latex,
or a shell-script, anywhere really. This is the beginning of the
script -
--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp
(easy-menu-add-item ;; console
nil nil
(easy-menu-create-menu
"Mine"
'("Misc" ;; submenu
["Wrap Text" auto-fill-mode]
["List packages for update" paradox-list-packages]
["Get colours" list-colors-display]
["Delete this file" delete-this-file]
["? stack-overflow" howdoi-query]
["shell" shell]
["password-vault" password-vault]
["Start org-mode" org-mode]
["insert drawer" org-insert-property-drawer]
["new buffer" xah-new-empty-buffer]
["w3m open new site" w3m-open-site]
["w3m buffer to org-style" w3m-get-buffer-with-org-style]
["new latex" fc-insert-latex-skeleton]
["cleanup buffer" buffer-cleanup]
["toggle page lines" linum-mode]
)
'("Clock" ;; submenu
["In" org-clock-in]
["Out" org-clock-out]
["Resolve" org-resolve-clocks]
["Goto" org-clock-goto]
)
))
#+END_SRC
--8<---------------cut here---------------end--------------->8---
But when its tangled it just comes back with
╭────
│easy-menu-add-item: Wrong number of arguments: (2 . 2), 3
╰────
I've tried googling for it with zero success. I've looked at the
code in "easymenu.el" but I can't see where its called.
But this same script works when called -
--8<---------------cut here---------------start------------->8---
(easy-menu-add-item ;; console
nil nil
(easy-menu-create-menu
"Theme"
'(["1) Dark - Goldenrod" (tj-load-theme 'goldenrod) :active t]
["2) Dark - Darkest midnight" (tj-load-theme 'darkest-midnight) :active t]
["3) Dark - soft-morning" (tj-load-theme 'soft-morning) :active t]
["4) Light - darkest-dawn" (tj-load-theme 'darkest-dawn) :active t]
["5) Light - Wheat" (tj-load-theme 'wheat) :active t]
["6) Dark - Smyx" (tj-load-theme 'smyx) :active t]
["7) Light - monokai" (tj-load-theme 'monokai) :active t]
["8) Dark - dark-emacs" (tj-load-theme 'dark-emacs) :active t]
)))
--8<---------------cut here---------------end--------------->8---
and it shows emacs-wise. How do I get the first menu working
properly please?
Thanks
Sharon.
--
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.5, emacs 24.4.1.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: how to use 'easy-menu'?
2014-11-28 15:04 how to use 'easy-menu'? Sharon Kimble
@ 2014-11-28 15:43 ` Drew Adams
2014-11-29 14:11 ` Sharon Kimble
2014-11-28 23:03 ` Michael Heerdegen
1 sibling, 1 reply; 5+ messages in thread
From: Drew Adams @ 2014-11-28 15:43 UTC (permalink / raw)
To: Sharon Kimble, help-gnu-emacs
> I have an easy-menu menu that works under org-mode, but I would now
> like to use it emacs-wide, i.e. have it available when I’m using
> latex, or a shell-script, anywhere really.
I don't have an answer for you. But after you get the answer, if
you think that is was understandable that you were not able to
find it easily by consulting the doc, then consider reporting a
doc-improvement request: `M-x report-emacs-bug', explaining what
was missing or confusing to you.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to use 'easy-menu'?
2014-11-28 15:04 how to use 'easy-menu'? Sharon Kimble
2014-11-28 15:43 ` Drew Adams
@ 2014-11-28 23:03 ` Michael Heerdegen
2014-11-29 13:56 ` Sharon Kimble
1 sibling, 1 reply; 5+ messages in thread
From: Michael Heerdegen @ 2014-11-28 23:03 UTC (permalink / raw)
To: help-gnu-emacs
Sharon Kimble <boudiccas@skimble.plus.com> writes:
> #+BEGIN_SRC emacs-lisp
> (easy-menu-add-item ;; console
> nil nil
> (easy-menu-create-menu
> "Mine"
> '("Misc" ;; submenu
> ["Wrap Text" auto-fill-mode]
> ["List packages for update" paradox-list-packages]
> ["Get colours" list-colors-display]
> ["Delete this file" delete-this-file]
> ["? stack-overflow" howdoi-query]
> ["shell" shell]
> ["password-vault" password-vault]
> ["Start org-mode" org-mode]
> ["insert drawer" org-insert-property-drawer]
> ["new buffer" xah-new-empty-buffer]
> ["w3m open new site" w3m-open-site]
> ["w3m buffer to org-style" w3m-get-buffer-with-org-style]
> ["new latex" fc-insert-latex-skeleton]
> ["cleanup buffer" buffer-cleanup]
> ["toggle page lines" linum-mode]
> )
> '("Clock" ;; submenu
> ["In" org-clock-in]
> ["Out" org-clock-out]
> ["Resolve" org-resolve-clocks]
> ["Goto" org-clock-goto]
> )
> ))
> #+END_SRC
>
> ╭────
> │easy-menu-add-item: Wrong number of arguments: (2 . 2), 3
> ╰────
Is that really the correct error message? Because when I try it,
easy-menu-create-menu raises the error. Which is expected, because
easy-menu-create-menu only accepts two args, but you call it with 3.
Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to use 'easy-menu'?
2014-11-28 23:03 ` Michael Heerdegen
@ 2014-11-29 13:56 ` Sharon Kimble
0 siblings, 0 replies; 5+ messages in thread
From: Sharon Kimble @ 2014-11-29 13:56 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1895 bytes --]
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Sharon Kimble <boudiccas@skimble.plus.com> writes:
>
>> #+BEGIN_SRC emacs-lisp
>> (easy-menu-add-item ;; console
>> nil nil
>> (easy-menu-create-menu
>> "Mine"
>> '("Misc" ;; submenu
>> ["Wrap Text" auto-fill-mode]
>> ["List packages for update" paradox-list-packages]
>> ["Get colours" list-colors-display]
>> ["Delete this file" delete-this-file]
>> ["? stack-overflow" howdoi-query]
>> ["shell" shell]
>> ["password-vault" password-vault]
>> ["Start org-mode" org-mode]
>> ["insert drawer" org-insert-property-drawer]
>> ["new buffer" xah-new-empty-buffer]
>> ["w3m open new site" w3m-open-site]
>> ["w3m buffer to org-style" w3m-get-buffer-with-org-style]
>> ["new latex" fc-insert-latex-skeleton]
>> ["cleanup buffer" buffer-cleanup]
>> ["toggle page lines" linum-mode]
>> )
>> '("Clock" ;; submenu
>> ["In" org-clock-in]
>> ["Out" org-clock-out]
>> ["Resolve" org-resolve-clocks]
>> ["Goto" org-clock-goto]
>> )
>> ))
>> #+END_SRC
>>
>
>> ╭────
>> │easy-menu-add-item: Wrong number of arguments: (2 . 2), 3
>> ╰────
>
> Is that really the correct error message? Because when I try it,
> easy-menu-create-menu raises the error. Which is expected, because
> easy-menu-create-menu only accepts two args, but you call it with 3.
>
> Michael.
Thanks Michael, and that is what it said. From much investigation
this morning I've found that it was objecting to "nil nil", remove
that and its hunky-dory again.
Sharon.
--
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.5, emacs 24.4.1.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to use 'easy-menu'?
2014-11-28 15:43 ` Drew Adams
@ 2014-11-29 14:11 ` Sharon Kimble
0 siblings, 0 replies; 5+ messages in thread
From: Sharon Kimble @ 2014-11-29 14:11 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 5252 bytes --]
Drew Adams <drew.adams@oracle.com> writes:
>> I have an easy-menu menu that works under org-mode, but I would now
>> like to use it emacs-wide, i.e. have it available when I’m using
>> latex, or a shell-script, anywhere really.
>
> I don't have an answer for you. But after you get the answer, if
> you think that is was understandable that you were not able to
> find it easily by consulting the doc, then consider reporting a
> doc-improvement request: `M-x report-emacs-bug', explaining what
> was missing or confusing to you.
Thanks Drew, I've partially solved it. This is now my working actual
working code -
--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp
(easy-menu-define sk-menu global-map "menu"
'("Mono"
("Misc" ;; submenu
["Wrap Text" auto-fill-mode]
["List packages for update" paradox-list-packages]
["Get colours" list-colors-display]
["Delete this file" delete-this-file]
["? stack-overflow" howdoi-query]
["shell" shell]
["password-vault" password-vault]
["Start org-mode" org-mode]
["insert drawer" org-insert-property-drawer]
["new buffer" xah-new-empty-buffer]
["w3m open new site" w3m-open-site]
["w3m buffer to org-style" w3m-get-buffer-with-org-style]
["new latex" fc-insert-latex-skeleton]
["cleanup buffer" buffer-cleanup]
["toggle page lines" linum-mode]
)
("Clock" ;; submenu
["In" org-clock-in]
["Out" org-clock-out]
["Resolve" org-resolve-clocks]
["Goto" org-clock-goto]
)
("Agenda" ;; submenu
["Regular View" org-agenda-list]
["Show Agenda" org-agenda]
)
("Org2blog" ;; submenu
["New entry" org2blog/wp-new-entry]
["Push draft" org2blog/wp-post-buffer]
["Publish" org2blog/wp-post-buffer-and-publish]
)
("Words" ;; submenu
["dictionary" words-dictionary]
["thesaurus" words-thesaurus]
["google" words-google]
["wikipedia search" wikipedia-search]
)
))
(easy-menu-add-item nil '("Tools") sk-menu "Mono")
#+END_SRC
--8<---------------cut here---------------end--------------->8---
This now shows as below, and also added on to the "Tools" menu at
the very bottom, plus it is now global! When it shows in the menu
list of items, clumsily put, I mean in this continuance -
"Mono,Imenu,Org,etc" , but *always* at the extreme left. I haven't
yet found a way of positioning it better, although the second
easymenu is always close to the "current mode||common menus" divide.
--8<---------------cut here---------------start------------->8---
Mono
|- Misc
|- Clock
|- Agenda
|- Org2blog
|- Words
--8<---------------cut here---------------end--------------->8---
The other type of menu that 'easymenu' can create takes the form of
a long list where you can choose one item, but this one *cannot*
have nested menus.
This is the one that handles my theme choice with this as the code -
--8<---------------cut here---------------start------------->8---
(add-to-list 'custom-theme-load-path
(file-name-as-directory
"/home/boudiccas/git/replace-colorthemes"))
(add-to-list 'custom-theme-load-path "/home/boudiccas/.emacs.d/themes")
(add-to-list 'custom-theme-load-path "/home/boudiccas/.emacs.d/elpa")
;; set up a variable and initialize it
(defvar tj-current-theme 'flatui "Current Color Theme")
;; Install the default scheme
(load-theme tj-current-theme t)
;; Function to first disable current theme, then create
;; and install a new one
(defun tj-load-theme (new-theme)
"Disable existing themes before loading new theme"
(interactive)
(disable-theme tj-current-theme)
(setq tj-current-theme new-theme)
(load-theme tj-current-theme))
;; Example menu
(easy-menu-add-item ;; console
nil nil
(easy-menu-create-menu
"Theme"
'(["1) Dark - Goldenrod" (tj-load-theme 'goldenrod) :active t]
["2) Dark - Darkest midnight" (tj-load-theme 'darkest-midnight) :active t]
["3) Dark - soft-morning" (tj-load-theme 'soft-morning) :active t]
["4) Light - darkest-dawn" (tj-load-theme 'darkest-dawn) :active t]
["5) Light - Wheat" (tj-load-theme 'wheat) :active t]
["6) Dark - Smyx" (tj-load-theme 'smyx) :active t]
["7) Light - monokai" (tj-load-theme 'monokai) :active t]
["8) Dark - dark-emacs" (tj-load-theme 'dark-emacs) :active t]
["9) Dark - pok-wob" (tj-load-theme 'pok-wob) :active t]
["10) clues" (tj-load-theme 'clues) :active t]
["11) soft-stone" (tj-load-theme 'soft-stone) :active t]
)))
#+end_src
--8<---------------cut here---------------end--------------->8---
But this one cannot have nested items/sections, it just has a
straight list.
I would love to be proved wrong in both of these cases, i.e., the
straight list + nested items/sections, and the positioning of the
nested list.
Sharon.
--
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.5, emacs 24.4.1.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-29 14:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-28 15:04 how to use 'easy-menu'? Sharon Kimble
2014-11-28 15:43 ` Drew Adams
2014-11-29 14:11 ` Sharon Kimble
2014-11-28 23:03 ` Michael Heerdegen
2014-11-29 13:56 ` Sharon Kimble
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).