[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Function for enabling or disabling emacs bars
From: |
Emanuel Berg |
Subject: |
Re: Function for enabling or disabling emacs bars |
Date: |
Mon, 14 Mar 2022 23:42:56 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
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
Re: Function for enabling or disabling emacs bars, GNU Hacker, 2022/03/14