all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Remove Org and Tbl from menubar for derived mode
@ 2013-09-13 12:28 Christian Wittern
  2013-09-13 12:44 ` Carsten Dominik
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Christian Wittern @ 2013-09-13 12:28 UTC (permalink / raw)
  To: Org Mode Mailing List

Hi there,

I am developing a mode derived from org for special editing and browsing 
purposes.  I will add my own menu to the menubar and would like to remove 
the menus added by org, "Org" and "Tbl", in order not to confuse my users, 
who will be Emacs newbies in most cases.
I tried several things like

(define-key org-mode-map [menu-bar Org] nil)
or
(define-key global-map [menu-bar Org] nil)
and some other combinations of this line of thought, but nothing succeeded 
in removing the stuff.

I wonder if anybody here has any advice?

All the best and thanks in advance,

Christian

-- 
Christian Wittern, Kyoto

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

* Re: Remove Org and Tbl from menubar for derived mode
  2013-09-13 12:28 Remove Org and Tbl from menubar for derived mode Christian Wittern
@ 2013-09-13 12:44 ` Carsten Dominik
  2013-09-14  0:43   ` Suvayu Ali
  2013-09-14  0:44   ` Suvayu Ali
  2013-09-13 13:09 ` Thorsten Jolitz
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Carsten Dominik @ 2013-09-13 12:44 UTC (permalink / raw)
  To: Christian Wittern; +Cc: Org Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 952 bytes --]


On Sep 13, 2013, at 2:28 PM, Christian Wittern <cwittern@gmail.com> wrote:

> Hi there,
> 
> I am developing a mode derived from org for special editing and browsing purposes.  I will add my own menu to the menubar and would like to remove the menus added by org, "Org" and "Tbl", in order not to confuse my users, who will be Emacs newbies in most cases.
> I tried several things like
> 
> (define-key org-mode-map [menu-bar Org] nil)
> or
> (define-key global-map [menu-bar Org] nil)
> and some other combinations of this line of thought, but nothing succeeded in removing the stuff.
> 
> I wonder if anybody here has any advice?

Interesting question, and I do not know the answer.  Only that you certainly should not change the org-mode-map, because such changes would have effects in all Org mode buffers.

- Carsten

> 
> All the best and thanks in advance,
> 
> Christian
> 
> -- 
> Christian Wittern, Kyoto
> 
> 


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

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

* Re: Remove Org and Tbl from menubar for derived mode
  2013-09-13 12:28 Remove Org and Tbl from menubar for derived mode Christian Wittern
  2013-09-13 12:44 ` Carsten Dominik
@ 2013-09-13 13:09 ` Thorsten Jolitz
  2013-09-13 23:36   ` Christian Wittern
  2013-09-14  4:42 ` Nick Dokos
  2013-09-14  4:42 ` Jambunathan K
  3 siblings, 1 reply; 9+ messages in thread
From: Thorsten Jolitz @ 2013-09-13 13:09 UTC (permalink / raw)
  To: emacs-orgmode

Christian Wittern <cwittern@gmail.com> writes:

> I wonder if anybody here has any advice?

Not really an advice, just a hint: doesn't org-mode itself use easy-menu
to remove outline from the menu bar?

,---------------------------------------------------------------
| 9 matches for "easy-menu" in buffer: org.el
|    5312:        (easy-menu-remove outline-mode-menu-heading)
|    5313:        (easy-menu-remove outline-mode-menu-show)
|    5314:        (easy-menu-remove outline-mode-menu-hide))
|    5320:  (easy-menu-add org-org-menu)
|    5321:  (easy-menu-add org-tbl-menu)
|   20675:(easy-menu-define org-tbl-menu org-mode-map "Tbl menu"
|   20735:(easy-menu-define org-org-menu org-mode-map "Org menu"
|   21006:        (easy-menu-change
|   21096:        (easy-menu-change
`---------------------------------------------------------------

-- 
cheers,
Thorsten

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

* Re: Remove Org and Tbl from menubar for derived mode
  2013-09-13 13:09 ` Thorsten Jolitz
@ 2013-09-13 23:36   ` Christian Wittern
  0 siblings, 0 replies; 9+ messages in thread
From: Christian Wittern @ 2013-09-13 23:36 UTC (permalink / raw)
  To: emacs-orgmode

On 2013-09-13 22:09, Thorsten Jolitz wrote:
> 9 matches for "easy-menu" in buffer: org.el
> |    5312:        (easy-menu-remove outline-mode-menu-heading)
> |    5313:        (easy-menu-remove outline-mode-menu-show)
> |    5314:        (easy-menu-remove outline-mode-menu-hide))
Yeah, I have seen that.  The problem is the way easy-menu-remove is defined:

easy-menu-remove is an alias for `ignore' in `easymenu.el'.

And the docstring explains:
<quote>
Remove MENU from the current menu bar.
Contrary to XEmacs, this is a nop on Emacs since menus are automatically
(de)activated when the corresponding keymap is (de)activated.
</quote>

In addition to that, it seems that this is not removing the top-level menu, 
but some of the sub-menu entries (... if I understand this correctly...).

And, as Carsten reminded me, what I do *not* want to do is de-activate 
org-mode's keymap:-)

So still wondering...

Christian

-- 
Christian Wittern, Kyoto

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

* Re: Remove Org and Tbl from menubar for derived mode
  2013-09-13 12:44 ` Carsten Dominik
@ 2013-09-14  0:43   ` Suvayu Ali
  2013-09-14  0:44   ` Suvayu Ali
  1 sibling, 0 replies; 9+ messages in thread
From: Suvayu Ali @ 2013-09-14  0:43 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Christian Wittern, Org Mode Mailing List

Hi,

On Fri, Sep 13, 2013 at 02:44:31PM +0200, Carsten Dominik wrote:
> On Sep 13, 2013, at 2:28 PM, Christian Wittern <cwittern@gmail.com> wrote:
> 
> > I am developing a mode derived from org for special editing and
> > browsing purposes.  I will add my own menu to the menubar and would
> > like to remove the menus added by org, "Org" and "Tbl", in order not
> > to confuse my users, who will be Emacs newbies in most cases.  I
> > tried several things like
> > 
> > (define-key org-mode-map [menu-bar Org] nil)
> > or
> > (define-key global-map [menu-bar Org] nil)
> > and some other combinations of this line of thought, but nothing
> > succeeded in removing the stuff.
> > 
> > I wonder if anybody here has any advice?
> 
> Interesting question, and I do not know the answer.  Only that you
> certainly should not change the org-mode-map, because such changes
> would have effects in all Org mode buffers.

I have never defined menus, but a quick look tells me you use
define-key.  If that is correct, then can't you just redefine the Org
and Tbl menu to nil?  I believe if you do that with regular key
sequences, any existing bindings get removed.

Just a thought.

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Remove Org and Tbl from menubar for derived mode
  2013-09-13 12:44 ` Carsten Dominik
  2013-09-14  0:43   ` Suvayu Ali
@ 2013-09-14  0:44   ` Suvayu Ali
  1 sibling, 0 replies; 9+ messages in thread
From: Suvayu Ali @ 2013-09-14  0:44 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Christian Wittern, Org Mode Mailing List

> On Sep 13, 2013, at 2:28 PM, Christian Wittern <cwittern@gmail.com> wrote:
> > 
> > (define-key org-mode-map [menu-bar Org] nil)

Oops, Christian already tried that!  I guess it's time for me to go to
bed :-p.

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Remove Org and Tbl from menubar for derived mode
  2013-09-13 12:28 Remove Org and Tbl from menubar for derived mode Christian Wittern
  2013-09-13 12:44 ` Carsten Dominik
  2013-09-13 13:09 ` Thorsten Jolitz
@ 2013-09-14  4:42 ` Nick Dokos
  2013-09-14  4:42 ` Jambunathan K
  3 siblings, 0 replies; 9+ messages in thread
From: Nick Dokos @ 2013-09-14  4:42 UTC (permalink / raw)
  To: emacs-orgmode

Christian Wittern <cwittern@gmail.com> writes:

> Hi there,
>
> I am developing a mode derived from org for special editing and
> browsing purposes.  I will add my own menu to the menubar and would
> like to remove the menus added by org, "Org" and "Tbl", in order not
> to confuse my users, who will be Emacs newbies in most cases.
> I tried several things like
>
> (define-key org-mode-map [menu-bar Org] nil)
> or
> (define-key global-map [menu-bar Org] nil)
> and some other combinations of this line of thought, but nothing
> succeeded in removing the stuff.
>
> I wonder if anybody here has any advice?
>
> All the best and thanks in advance,
>

The elisp manual says (sec. 22.17.5, "The Menu Bar"):

,----
|    A local keymap can cancel a menu bar item made by the global keymap
| by rebinding the same fake function key with `undefined' as the
| binding.  For example, this is how Dired suppresses the `Edit' menu bar
| item:
| 
|      (define-key dired-mode-map [menu-bar edit] 'undefined)
`----

-- 
Nick

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

* Re: Remove Org and Tbl from menubar for derived mode
  2013-09-13 12:28 Remove Org and Tbl from menubar for derived mode Christian Wittern
                   ` (2 preceding siblings ...)
  2013-09-14  4:42 ` Nick Dokos
@ 2013-09-14  4:42 ` Jambunathan K
  2013-09-16  1:24   ` Christian Wittern
  3 siblings, 1 reply; 9+ messages in thread
From: Jambunathan K @ 2013-09-14  4:42 UTC (permalink / raw)
  To: Christian Wittern; +Cc: Org Mode Mailing List

Christian Wittern <cwittern@gmail.com> writes:

> I am developing a mode derived from org for special editing and
> browsing purposes.  I will add my own menu to the menubar and would
> like to remove the menus added by org, "Org" and "Tbl", in order not
> to confuse my users

Try this

    (add-hook 'org-mode-hook
              (lambda nil
                (local-unset-key [menu-bar Org])))

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

* Re: Remove Org and Tbl from menubar for derived mode
  2013-09-14  4:42 ` Jambunathan K
@ 2013-09-16  1:24   ` Christian Wittern
  0 siblings, 0 replies; 9+ messages in thread
From: Christian Wittern @ 2013-09-16  1:24 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Org Mode Mailing List

On 2013-09-14 13:42 , Jambunathan K wrote:
>      (add-hook 'org-mode-hook
>                (lambda nil
>                  (local-unset-key [menu-bar Org])))
Thanks, if I do this for my derived mode, it does exactly what I need!

Christian

-- 
Christian Wittern, Kyoto

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

end of thread, other threads:[~2013-09-16  1:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-13 12:28 Remove Org and Tbl from menubar for derived mode Christian Wittern
2013-09-13 12:44 ` Carsten Dominik
2013-09-14  0:43   ` Suvayu Ali
2013-09-14  0:44   ` Suvayu Ali
2013-09-13 13:09 ` Thorsten Jolitz
2013-09-13 23:36   ` Christian Wittern
2013-09-14  4:42 ` Nick Dokos
2013-09-14  4:42 ` Jambunathan K
2013-09-16  1:24   ` Christian Wittern

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.