all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Disable menu bar mode
@ 2017-12-14  1:55 Rusi
  2017-12-14  2:30 ` Emanuel Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Rusi @ 2017-12-14  1:55 UTC (permalink / raw)
  To: help-gnu-emacs

Doc for menu-bar-mode says (among other things):

| If called from Lisp, enable Menu Bar mode if ARG is omitted or nil.

That this seems backwards is one thing

The other is that neither of these seem to work (ie turn off menu-bar)

(menu-bar-mode t)
(menu-bar-mode nil)

This does:

(menu-bar-mode 0)

Can someone confirm?


Emacs version 25.1.1


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

* Re: Disable menu bar mode
  2017-12-14  1:55 Disable menu bar mode Rusi
@ 2017-12-14  2:30 ` Emanuel Berg
  2017-12-14  2:38 ` Emanuel Berg
  2017-12-18 21:39 ` B. T. Raven
  2 siblings, 0 replies; 13+ messages in thread
From: Emanuel Berg @ 2017-12-14  2:30 UTC (permalink / raw)
  To: help-gnu-emacs

Rusi wrote:

> Doc for menu-bar-mode says (among other
> things):
>
> | If called from Lisp, enable Menu Bar mode
> | if ARG is omitted or nil.
>
> That this seems backwards is one thing

The whole doc string says:

    With a prefix argument ARG, enable Menu Bar
    mode if ARG is positive, and disable it
    otherwise. If called from Lisp, enable Menu
    Bar mode if ARG is omitted or nil.

The rules are the same for Lisp and interactive
use what I can see:

(menu-bar-mode)       ; omitted      -> on
(menu-bar-mode  nil)  ; nil          -> on
(menu-bar-mode  t)    ; positive     -> on
(menu-bar-mode  1)    ; ... etc.
(menu-bar-mode  0)    ; nonpositive  -> OFF
(menu-bar-mode -1)    ; ... etc.

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

* Re: Disable menu bar mode
  2017-12-14  1:55 Disable menu bar mode Rusi
  2017-12-14  2:30 ` Emanuel Berg
@ 2017-12-14  2:38 ` Emanuel Berg
  2017-12-14  2:49   ` Kaushal Modi
       [not found]   ` <mailman.5687.1513219781.27995.help-gnu-emacs@gnu.org>
  2017-12-18 21:39 ` B. T. Raven
  2 siblings, 2 replies; 13+ messages in thread
From: Emanuel Berg @ 2017-12-14  2:38 UTC (permalink / raw)
  To: help-gnu-emacs

Rusi wrote:

> | If called from Lisp, enable Menu Bar mode
> | if ARG is omitted or nil.
>
> That this seems backwards is one thing

Use this so you don't have to bother with the
confusing argument:

    (defun toggle-menu-bar-mode ()
      (interactive)
      (menu-bar-mode (when menu-bar-mode 0)) )

I got it from Two-Edge [1], pretty clever, the
old joker...

[1] http://elfquest.wikia.com/wiki/Two-Edge

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

* Re: Disable menu bar mode
  2017-12-14  2:38 ` Emanuel Berg
@ 2017-12-14  2:49   ` Kaushal Modi
       [not found]   ` <mailman.5687.1513219781.27995.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Kaushal Modi @ 2017-12-14  2:49 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

On Wed, Dec 13, 2017 at 9:40 PM Emanuel Berg <moasen@zoho.com> wrote:

> Use this so you don't have to bother with the
> confusing argument:
>
>     (defun toggle-menu-bar-mode ()
> ..
>

menu-bar-mode is a minor mode.

So you do just M-x menu-bar-mode to toggle it.

Below applies to all minor modes (should say almost all, since it's still
possible someone hacked together an unconventional minor mode).

In Elisp:

To enable, pass a positive arg.
To disable, pass a negative arg.
-- 

Kaushal Modi


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

* Re: Disable menu bar mode
       [not found]   ` <mailman.5687.1513219781.27995.help-gnu-emacs@gnu.org>
@ 2017-12-14  3:11     ` Emanuel Berg
  2017-12-14  5:13       ` Kaushal Modi
       [not found]       ` <mailman.5689.1513228434.27995.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Emanuel Berg @ 2017-12-14  3:11 UTC (permalink / raw)
  To: help-gnu-emacs

Kaushal Modi wrote:

> menu-bar-mode is a minor mode.
>
> So you do just M-x menu-bar-mode to toggle it

Well, you menu bar users should know :)

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

* Re: Disable menu bar mode
  2017-12-14  3:11     ` Emanuel Berg
@ 2017-12-14  5:13       ` Kaushal Modi
       [not found]       ` <mailman.5689.1513228434.27995.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Kaushal Modi @ 2017-12-14  5:13 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

On Wed, Dec 13, 2017 at 10:15 PM Emanuel Berg <moasen@zoho.com> wrote:

> Kaushal Modi wrote:
>
> > menu-bar-mode is a minor mode.
> >
> > So you do just M-x menu-bar-mode to toggle it
>
> Well, you menu bar users should know :)
>

Well, I don't use menu bars.

Even if I had come across an unknown mode, say smart-ass-mode, I could
first of all easily guess that it's either a major mode or a minor mode. If
I need to call it interactively or toggle then it's most likely a minor
mode.

But there is no need to guess..By calling M-x xref-find-definitions (bound
by default to M-.) with point on "smart-ass-mode" (in emacs-lisp-mode
buffer), I can directly jump to the elisp definition and figure out what it
actually is.

So I did that with menu-bar-mode, and M-. jumped to:

(define-minor-mode menu-bar-mode
  "Toggle display of a menu bar on each frame (Menu Bar mode).
With a prefix argument ARG, enable Menu Bar mode if ARG is
positive, and disable it otherwise.  If called from Lisp, enable
Menu Bar mode if ARG is omitted or nil.
...

And then (emacs) Minor Modes node in the emacs manual talks about using M-x
MINOR-MODE to toggle that mode.
-- 

Kaushal Modi


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

* Re: Disable menu bar mode
       [not found]       ` <mailman.5689.1513228434.27995.help-gnu-emacs@gnu.org>
@ 2017-12-14  5:42         ` Emanuel Berg
  2017-12-14 14:37           ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Emanuel Berg @ 2017-12-14  5:42 UTC (permalink / raw)
  To: help-gnu-emacs

Kaushal Modi wrote:

>> Well, you menu bar users should know :)
>
> Well, I don't use menu bars.
>
> Even if I had come across an unknown mode,
> say smart-ass-mode, I could first of all
> easily guess that it's either a major mode or
> a minor mode. If I need to call it
> interactively or toggle then it's most likely
> a minor mode.
>
> But there is no need to guess..By calling M-x
> xref-find-definitions (bound by default to M-.)
> with point on "smart-ass-mode" (in
> emacs-lisp-mode buffer), I can directly jump to
> the elisp definition and figure out what it
> actually is.

Does that make you a smart ass as well?

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

* Re: Disable menu bar mode
  2017-12-14  5:42         ` Emanuel Berg
@ 2017-12-14 14:37           ` Stefan Monnier
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2017-12-14 14:37 UTC (permalink / raw)
  To: help-gnu-emacs

> Does that make you a smart ass as well?

Only while the mode is enabled, obviously,


        Stefan




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

* Re: Disable menu bar mode
  2017-12-14  1:55 Disable menu bar mode Rusi
  2017-12-14  2:30 ` Emanuel Berg
  2017-12-14  2:38 ` Emanuel Berg
@ 2017-12-18 21:39 ` B. T. Raven
  2017-12-19  1:45   ` Rusi
  2 siblings, 1 reply; 13+ messages in thread
From: B. T. Raven @ 2017-12-18 21:39 UTC (permalink / raw)
  To: help-gnu-emacs

On 12/13/2017 7:55 PM, Rusi wrote:
> Doc for menu-bar-mode says (among other things):
> 
> | If called from Lisp, enable Menu Bar mode if ARG is omitted or nil.
> 
> That this seems backwards is one thing
> 
> The other is that neither of these seem to work (ie turn off menu-bar)
> 
> (menu-bar-mode t)
> (menu-bar-mode nil)
> 
> This does:
> 
> (menu-bar-mode 0)
> 
> Can someone confirm?
> 
> 
> Emacs version 25.1.1
> 

On 25.3 it seems to be working as advertised.

"
(menu-bar-mode &optional ARG)

Toggle display of a menu bar on each frame (Menu Bar mode).
With a prefix argument ARG, enable Menu Bar mode if ARG is
positive, and disable it otherwise.  If called from Lisp, enable
Menu Bar mode if ARG is omitted or nil.
"


You can turn it off with menubar > options > show/hide and then on by 
evaluating (menu-bar-mode [nil])
or
M-x menu-bar-mode

(menu-bar-mode 0) evaluated turns it off because 0 is not positive.

Ed


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

* Re: Disable menu bar mode
  2017-12-18 21:39 ` B. T. Raven
@ 2017-12-19  1:45   ` Rusi
  2017-12-19  2:37     ` Emanuel Berg
                       ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Rusi @ 2017-12-19  1:45 UTC (permalink / raw)
  To: help-gnu-emacs

On Tuesday, December 19, 2017 at 3:10:46 AM UTC+5:30, B. T. Raven wrote:
> On 12/13/2017 7:55 PM, Rusi wrote:
> > Doc for menu-bar-mode says (among other things):
> > 
> > | If called from Lisp, enable Menu Bar mode if ARG is omitted or nil.
> > 
> > That this seems backwards is one thing
> > 
> > The other is that neither of these seem to work (ie turn off menu-bar)
> > 
> > (menu-bar-mode t)
> > (menu-bar-mode nil)
> > 
> > This does:
> > 
> > (menu-bar-mode 0)
> > 
> > Can someone confirm?
> > 
> > 
> > Emacs version 25.1.1
> > 
> 
> On 25.3 it seems to be working as advertised.
> 
> "
> (menu-bar-mode &optional ARG)
> 
> Toggle display of a menu bar on each frame (Menu Bar mode).
> With a prefix argument ARG, enable Menu Bar mode if ARG is
> positive, and disable it otherwise.  If called from Lisp, enable
> Menu Bar mode if ARG is omitted or nil.
> "
> 
> 
> You can turn it off with menubar > options > show/hide and then on by 
> evaluating (menu-bar-mode [nil])
> or
> M-x menu-bar-mode
> 
> (menu-bar-mode 0) evaluated turns it off because 0 is not positive.
> 
> Ed

My init has
(scroll-bar-mode 0)
(tool-bar-mode 0)
(setq inhibit-startup-message t)
(setq initial-scratch-message nil)
;(fringe-mode 1)
;(menu-bar-mode 0)

Has been so for years…

[The menu-bar-mode was probably commented out after I started using org mode]

IOW the complaint is with the confusing and incomplete documentation:
«nil = true (turn on)?? So what is false then?»


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

* Re: Disable menu bar mode
  2017-12-19  1:45   ` Rusi
@ 2017-12-19  2:37     ` Emanuel Berg
  2017-12-19  2:37     ` Drew Adams
       [not found]     ` <mailman.5961.1513651377.27995.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Emanuel Berg @ 2017-12-19  2:37 UTC (permalink / raw)
  To: help-gnu-emacs

Rusi wrote:

> My init has (scroll-bar-mode 0)
> (tool-bar-mode 0) (setq
> inhibit-startup-message t) (setq
> initial-scratch-message nil) ;(fringe-mode 1)
> ;(menu-bar-mode 0)
>
> Has been so for years…
>
> [The menu-bar-mode was probably commented out
> after I started using org mode]
>
> IOW the complaint is with the confusing and
> incomplete documentation: «nil = true (turn
> on)?? So what is false then?»

What's with the angle bracket quotes? Here is
what the docstring to `scroll-bar-mode'
actually say:

    With a prefix argument ARG, enable Scroll
    Bar mode if ARG is positive, and disable it
    otherwise. If called from Lisp, enable the
    mode if ARG is omitted or nil.

It is the last sentence that perhaps is missing
"If called from Lisp *the same rule applies but
it is also possible* to enable the mode if ARG
is omitted or nil.

As it stands, it sounds like in Lips, there is
another set of rules altogether, and you are
left in the dark as how to *disable* it...

But Rusi seems to be upset about something
else, quoting fictitious documentation?

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

* RE: Disable menu bar mode
  2017-12-19  1:45   ` Rusi
  2017-12-19  2:37     ` Emanuel Berg
@ 2017-12-19  2:37     ` Drew Adams
       [not found]     ` <mailman.5961.1513651377.27995.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Drew Adams @ 2017-12-19  2:37 UTC (permalink / raw)
  To: Rusi, help-gnu-emacs

> IOW the complaint is with the confusing and incomplete
> documentation: «nil = true (turn on)?? So what is false then?»

This question comes up every so often.  It's a natural
one, in part because the doc strings for particular
minor modes sometimes suck, er, are less than perfect.

Doc strings of regular minor-mode commands (e.g., modes
defined with `define-minor-mode') should describe the
behavior, which is essentially the same for all such
modes.  And the doc strings should say clearly that the
command is, in fact, a minor-mode command.

Whether this gets done manually or partly automatically
(e.g. by `define-minor-mode'), it needs to be done.

The doc of macro `define-minor-mode', itself, is quite
good.  Unfortunately, an "end user" of a minor-mode
command is not necessarily going to consult the doc
for the macro that created the command ;-).

The doc string for the command itself needs to have
the info about it. This should be a no-brainer, I
think.  But the fact is that there is a fair amount
to say, and for whatever reasons, sometimes it is
omitted.

There have been a bunch of bugs filed about this
general problem.  Sometimes things do get improved.
Here are a couple such bug reports:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25428
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29497
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20462



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

* Re: Disable menu bar mode
       [not found]     ` <mailman.5961.1513651377.27995.help-gnu-emacs@gnu.org>
@ 2017-12-19 13:52       ` Rusi
  0 siblings, 0 replies; 13+ messages in thread
From: Rusi @ 2017-12-19 13:52 UTC (permalink / raw)
  To: help-gnu-emacs

On Tuesday, December 19, 2017 at 8:12:59 AM UTC+5:30, Drew Adams wrote:
> > IOW the complaint is with the confusing and incomplete
> > documentation: «nil = true (turn on)?? So what is false then?»
> 
> This question comes up every so often.  It's a natural
> one, in part because the doc strings for particular
> minor modes sometimes suck, er, are less than perfect.

My — quite unschooled — analysis of the situation is this:
There is a pun in Lisp: nil  can mean boolean False or the empty list
And in cases like this the pun gets particularly infelicitous.

> 
> Doc strings of regular minor-mode commands (e.g., modes
> defined with `define-minor-mode') should describe the
> behavior, which is essentially the same for all such
> modes.  And the doc strings should say clearly that the
> command is, in fact, a minor-mode command.
> 
> Whether this gets done manually or partly automatically
> (e.g. by `define-minor-mode'), it needs to be done.
> 
> The doc of macro `define-minor-mode', itself, is quite
> good.  Unfortunately, an "end user" of a minor-mode
> command is not necessarily going to consult the doc
> for the macro that created the command ;-).
> 
> The doc string for the command itself needs to have
> the info about it. This should be a no-brainer, I
> think.  But the fact is that there is a fair amount
> to say, and for whatever reasons, sometimes it is
> omitted.
> 
> There have been a bunch of bugs filed about this
> general problem.  Sometimes things do get improved.
> Here are a couple such bug reports:
> 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25428
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29497
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20462

Thanks for that list.
If its helpful I can file a (doc)bug report… if someone who is likely to attend
to it indicates that its worth attending to.

[Yeah Yeah I know that the work that the emacs-devs do is many orders of 
magnitude more than the work of filing a bug-report!
Its also true that my attempts are usually less than successful so I like
to check that others also see it as a bug]


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

end of thread, other threads:[~2017-12-19 13:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-14  1:55 Disable menu bar mode Rusi
2017-12-14  2:30 ` Emanuel Berg
2017-12-14  2:38 ` Emanuel Berg
2017-12-14  2:49   ` Kaushal Modi
     [not found]   ` <mailman.5687.1513219781.27995.help-gnu-emacs@gnu.org>
2017-12-14  3:11     ` Emanuel Berg
2017-12-14  5:13       ` Kaushal Modi
     [not found]       ` <mailman.5689.1513228434.27995.help-gnu-emacs@gnu.org>
2017-12-14  5:42         ` Emanuel Berg
2017-12-14 14:37           ` Stefan Monnier
2017-12-18 21:39 ` B. T. Raven
2017-12-19  1:45   ` Rusi
2017-12-19  2:37     ` Emanuel Berg
2017-12-19  2:37     ` Drew Adams
     [not found]     ` <mailman.5961.1513651377.27995.help-gnu-emacs@gnu.org>
2017-12-19 13:52       ` Rusi

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.