unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Function for enabling or disabling emacs bars
@ 2022-03-05 15:49 angelomolina--- via Users list for the GNU Emacs text editor
  2022-03-05 16:54 ` [External] : " Drew Adams
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: angelomolina--- via Users list for the GNU Emacs text editor @ 2022-03-05 15:49 UTC (permalink / raw)
  To: Help Gnu Emacs


Would like to have a function that enables or disables emacs bars.  Perhaps using an optional
argument for this?

(defun emacsbars ()
  "Enables or disables Emacs Bars"
  (menu-bar-mode 1)
  (tool-bar-mode 1)
  (scroll-bar-mode 1))


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

* RE: [External] : Function for enabling or disabling emacs bars
  2022-03-05 15:49 Function for enabling or disabling emacs bars angelomolina--- via Users list for the GNU Emacs text editor
@ 2022-03-05 16:54 ` Drew Adams
       [not found] ` <SJ0PR10MB548840473375070E37AF605EF3069@SJ0PR10MB5488.namprd10.prod.outlook.com-MxQ-TzU----2>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2022-03-05 16:54 UTC (permalink / raw)
  To: angelomolina@tutanota.com
  Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

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

Enabling Emacs bars...

Haven't yet come across an Emacs bar.

But I like the idea!  Easily customize crazily
concocted potables, engage the Doctor in deep
bar-room chit-chat,...

So I vote for _enabling_.  With a GPL license,
of course.  That's free for all.
___

No libation without representation!

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13263 bytes --]

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

* RE: [External] : Function for enabling or disabling emacs bars
       [not found] ` <SJ0PR10MB548840473375070E37AF605EF3069@SJ0PR10MB5488.namprd10.prod.outlook.com-MxQ-TzU----2>
@ 2022-03-05 17:14   ` angelomolina--- via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 12+ messages in thread
From: angelomolina--- via Users list for the GNU Emacs text editor @ 2022-03-05 17:14 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'


Mar 5, 2022, 16:54 by drew.adams@oracle.com:

> Enabling Emacs bars...
>
> Haven't yet come across an Emacs bar.
>
I want a function that good to enable all three to value 1, and also to disable all three with value -1.


> But I like the idea!  Easily customize crazily
> concocted potables, engage the Doctor in deep
> bar-room chit-chat,...
>
> So I vote for _enabling_.  With a GPL license,
> of course.  That's free for all.
> ___
>
> No libation without representation!
>



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

* Re: Function for enabling or disabling emacs bars
  2022-03-05 15:49 Function for enabling or disabling emacs bars angelomolina--- via Users list for the GNU Emacs text editor
  2022-03-05 16:54 ` [External] : " Drew Adams
       [not found] ` <SJ0PR10MB548840473375070E37AF605EF3069@SJ0PR10MB5488.namprd10.prod.outlook.com-MxQ-TzU----2>
@ 2022-03-14 15:02 ` GNU Hacker
  2022-03-14 15:20   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2022-03-14 17:40   ` angelomolina--- via Users list for the GNU Emacs text editor
  2022-03-14 22:08 ` GNU Hacker
  3 siblings, 2 replies; 12+ messages in thread
From: GNU Hacker @ 2022-03-14 15:02 UTC (permalink / raw)
  To: angelomolina--- via Users list for the GNU Emacs text editor; +Cc: angelomolina

angelomolina--- via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Would like to have a function that enables or disables emacs bars.  Perhaps using an optional
> argument for this?

> (defun emacsbars ()
>  "Enables or disables Emacs Bars"
>  (menu-bar-mode 1)
>  (tool-bar-mode 1)
>  (scroll-bar-mode 1))

#+begin_src elisp

(defun emacsbars (&optional num)
  "Enables or disables Emacs Bars"
  (interactive "p")
  (menu-bar-mode num)
  (tool-bar-mode num)
  (scroll-bar-mode num))
  
#+end_src

Try with:

M-x emacsbars RET --> show bars

C-u  -1  M-x emacsbars RET --> hide bars

-- 
Emacs Lover.
FSF Member.
Free/Libre Software supporter.
stallmansupport.org - Disinformation succeeds because so many people
care deeply about injustice but do not take the time to check the facts.



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

* Re: Function for enabling or disabling emacs bars
  2022-03-14 15:02 ` GNU Hacker
@ 2022-03-14 15:20   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2022-03-14 17:40   ` angelomolina--- via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 12+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-03-14 15:20 UTC (permalink / raw)
  To: help-gnu-emacs

GNU Hacker wrote:

> (defun emacsbars (&optional num)
>   "Enables or disables Emacs Bars"
>   (interactive "p")
>   (menu-bar-mode num)
>   (tool-bar-mode num)
>   (scroll-bar-mode num))
>
> Try with:
>
> M-x emacsbars RET --> show bars
>
> C-u  -1  M-x emacsbars RET --> hide bars

Or:

(defun bars ()
 (interactive)
 (menu-bar-mode 'toggle)
 (let ((enable (if menu-bar-mode 1 -1)))
   (scroll-bar-mode enable)
   (tool-bar-mode   enable) ))

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




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

* Re: Function for enabling or disabling emacs bars
  2022-03-14 15:02 ` GNU Hacker
  2022-03-14 15:20   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-03-14 17:40   ` angelomolina--- via Users list for the GNU Emacs text editor
  2022-03-14 17:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
                       ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: angelomolina--- via Users list for the GNU Emacs text editor @ 2022-03-14 17:40 UTC (permalink / raw)
  To: GNU Hacker; +Cc: angelomolina--- via Users list for the GNU Emacs text editor


Mar 14, 2022, 15:02 by project@gnuhacker.org:

> angelomolina--- via Users list for the GNU Emacs text editor
> <help-gnu-emacs@gnu.org> writes:
>
>> Would like to have a function that enables or disables emacs bars.  Perhaps using an optional
>> argument for this?
>>
>> (defun emacsbars ()
>>  "Enables or disables Emacs Bars"
>>  (menu-bar-mode 1)
>>  (tool-bar-mode 1)
>>  (scroll-bar-mode 1))
>>
>
> #+begin_src elisp
>
> (defun emacsbars (&optional num)
>  "Enables or disables Emacs Bars"
>  (interactive "p")
>  (menu-bar-mode num)
>  (tool-bar-mode num)
>  (scroll-bar-mode num))
>  
> #+end_src
>
> Try with:
>
> M-x emacsbars RET --> show bars
>
> C-u  -1  M-x emacsbars RET --> hide bars
>

Could I also call it using  (emacsbars  1)  and  (emacsbars  -1)  ?


> -- 
> Emacs Lover.
> FSF Member.
> Free/Libre Software supporter.
> stallmansupport.org - Disinformation succeeds because so many people
> care deeply about injustice but do not take the time to check the facts.
>



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

* Re: Function for enabling or disabling emacs bars
  2022-03-14 17:40   ` angelomolina--- via Users list for the GNU Emacs text editor
@ 2022-03-14 17:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2022-03-14 20:00     ` GNU Hacker
       [not found]     ` <87ilsgi9sq.fsf@gnu.org-My90SEi----2>
  2 siblings, 0 replies; 12+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-03-14 17:55 UTC (permalink / raw)
  To: help-gnu-emacs

angelomolina--- via Users list for the GNU Emacs text editor wrote:

>> (defun emacsbars (&optional num)
>>  "Enables or disables Emacs Bars"
>>  (interactive "p")
>>  (menu-bar-mode num)
>>  (tool-bar-mode num)
>>  (scroll-bar-mode num))
>>  
>> #+end_src
>>
>> Try with:
>>
>> M-x emacsbars RET --> show bars
>>
>> C-u  -1  M-x emacsbars RET --> hide bars
>>
>
> Could I also call it using (emacsbars 1) and
> (emacsbars -1)?

Try it and find out!

But the answer is yes ...

Note that calling it without and argument from Lisp implies
nil which strangely enough implies enable!

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




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

* Re: Function for enabling or disabling emacs bars
  2022-03-14 17:40   ` angelomolina--- via Users list for the GNU Emacs text editor
  2022-03-14 17:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-03-14 20:00     ` GNU Hacker
       [not found]     ` <87ilsgi9sq.fsf@gnu.org-My90SEi----2>
  2 siblings, 0 replies; 12+ messages in thread
From: GNU Hacker @ 2022-03-14 20:00 UTC (permalink / raw)
  To: angelomolina; +Cc: help-gnu-emacs

angelomolina@tutanota.com writes:
> Mar 14, 2022, 15:02 by project@gnuhacker.org:

>>  (defun emacsbars (&optional num)
>>  "Enables or disables Emacs Bars"
>>  (interactive "p")
>>  (menu-bar-mode num)
>>  (tool-bar-mode num)
>>  (scroll-bar-mode num))

>>  Try with:
>>  M-x emacsbars RET --> show bars
>>  C-u -1 M-x emacsbars RET --> hide bars

> Could I also call it using (emacsbars 1) and (emacsbars -1) ?

Yes it also work

-- 
Emacs Lover.
FSF Member.
Free/Libre Software supporter.
stallmansupport.org - Disinformation succeeds because so many people
care deeply about injustice but do not take the time to check the facts.



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

* Re: Function for enabling or disabling emacs bars
       [not found]     ` <87ilsgi9sq.fsf@gnu.org-My90SEi----2>
@ 2022-03-14 20:16       ` angelomolina--- via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 12+ messages in thread
From: angelomolina--- via Users list for the GNU Emacs text editor @ 2022-03-14 20:16 UTC (permalink / raw)
  To: GNU Hacker; +Cc: Help Gnu Emacs


Mar 14, 2022, 20:00 by project@gnuhacker.org:

> angelomolina@tutanota.com writes:
>
>> Mar 14, 2022, 15:02 by project@gnuhacker.org:
>>
>>> (defun emacsbars (&optional num)
>>>  "Enables or disables Emacs Bars"
>>>  (interactive "p")
>>>  (menu-bar-mode num)
>>>  (tool-bar-mode num)
>>>  (scroll-bar-mode num))
>>>
>>> Try with:
>>>  M-x emacsbars RET --> show bars
>>>  C-u -1 M-x emacsbars RET --> hide bars
>>>
>> Could I also call it using (emacsbars 1) and (emacsbars -1) ?
>>
>
> Yes it also work
>
Thank you.  Do you know how to enable a minor-mode globally as I have only made
minor-modes activated with add-hook.



> -- 
> Emacs Lover.
> FSF Member.
> Free/Libre Software supporter.
> stallmansupport.org - Disinformation succeeds because so many people
> care deeply about injustice but do not take the time to check the facts.
>



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

* Re: Function for enabling or disabling emacs bars
  2022-03-05 15:49 Function for enabling or disabling emacs bars angelomolina--- via Users list for the GNU Emacs text editor
                   ` (2 preceding siblings ...)
  2022-03-14 15:02 ` GNU Hacker
@ 2022-03-14 22:08 ` GNU Hacker
  2022-03-14 22:19   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2022-03-14 22:42   ` Emanuel Berg via Users list for the GNU Emacs text editor
  3 siblings, 2 replies; 12+ messages in thread
From: GNU Hacker @ 2022-03-14 22:08 UTC (permalink / raw)
  To: angelomolina--- via Users list for the GNU Emacs text editor; +Cc: angelomolina

angelomolina--- via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Would like to have a function that enables or disables emacs bars.  Perhaps using an optional
> argument for this?

> (defun emacsbars ()
>  "Enables or disables Emacs Bars"
>  (menu-bar-mode 1)
>  (tool-bar-mode 1)
>  (scroll-bar-mode 1))

Other form:

#+begin_src elisp

(defun emacsbars ()
  "Enables or disables Emacs Bars"
  (interactive)
  (menu-bar-mode 'toggle)
  (tool-bar-mode 'toggle)
  (scroll-bar-mode 'toggle))

#+end_src

M-x emacsbars

Try 2 times, is toggle!

-- 
Emacs Lover.
FSF Member.
Free/Libre Software supporter.
stallmansupport.org - Disinformation succeeds because so many people
care deeply about injustice but do not take the time to check the facts.



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

* Re: Function for enabling or disabling emacs bars
  2022-03-14 22:08 ` GNU Hacker
@ 2022-03-14 22:19   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2022-03-14 22:42   ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 12+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-03-14 22:19 UTC (permalink / raw)
  To: help-gnu-emacs

GNU Hacker wrote:

> Other form:
>
> (defun emacsbars ()
>   "Enables or disables Emacs Bars"
>   (interactive)
>   (menu-bar-mode 'toggle)
>   (tool-bar-mode 'toggle)
>   (scroll-bar-mode 'toggle))
>
> M-x emacsbars
>
> Try 2 times, is toggle!

Yeah but now try

(menu-bar-mode  1)
(tool-bar-mode -1)
M-x emacsbars RET

Rats!

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




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

* Re: Function for enabling or disabling emacs bars
  2022-03-14 22:08 ` GNU Hacker
  2022-03-14 22:19   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-03-14 22:42   ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 12+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-03-14 22:42 UTC (permalink / raw)
  To: help-gnu-emacs

Here is an interface that I think is consistent with other
minor mode interfaces that are the same (ha).

(defun bars (&optional arg)
 (interactive (list (or current-prefix-arg 'toggle)))
 (menu-bar-mode arg)
 (let ((enable (if menu-bar-mode 1 -1)))
   (scroll-bar-mode enable)
   (tool-bar-mode   enable) ))

;; Lisp use

;; enable on nil arg, no arg (which implies nil), or if arg is positive

(bars)     ; no arg -> optional arg nil -> enable
(bars nil) ; arg is nil -> enable
(bars 1)   ; arg positive -> enable

;;  disable if arg is negative

(bars -1) ; arg negative -> disable

;; toggle if arg is 'toggle

(bars 'toggle)

;; interactive use

;; M-x bars RET -> toggle (hard-coded interactive default)
;; C-u M-x bars RET -> arg is 4 -> arg positive -> enable
;; C-u -1 M-x bars RET -> arg is -1 -> arg negative -> disable

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




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

end of thread, other threads:[~2022-03-14 22:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-05 15:49 Function for enabling or disabling emacs bars angelomolina--- via Users list for the GNU Emacs text editor
2022-03-05 16:54 ` [External] : " Drew Adams
     [not found] ` <SJ0PR10MB548840473375070E37AF605EF3069@SJ0PR10MB5488.namprd10.prod.outlook.com-MxQ-TzU----2>
2022-03-05 17:14   ` angelomolina--- via Users list for the GNU Emacs text editor
2022-03-14 15:02 ` GNU Hacker
2022-03-14 15:20   ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-14 17:40   ` angelomolina--- via Users list for the GNU Emacs text editor
2022-03-14 17:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-14 20:00     ` GNU Hacker
     [not found]     ` <87ilsgi9sq.fsf@gnu.org-My90SEi----2>
2022-03-14 20:16       ` angelomolina--- via Users list for the GNU Emacs text editor
2022-03-14 22:08 ` GNU Hacker
2022-03-14 22:19   ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-14 22:42   ` Emanuel Berg via Users list for the GNU Emacs text editor

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).