* Getting the operational value of a buffer variable
@ 2022-12-02 1:07 Heime
2022-12-02 2:33 ` Emanuel Berg
2022-12-02 2:52 ` [External] : " Drew Adams
0 siblings, 2 replies; 5+ messages in thread
From: Heime @ 2022-12-02 1:07 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
I want to get the operational value of a buffer variable. If the buffer has a local value, one
cannot use the default-value implementation. And if the local value in nil, I have to get the
default-value.
Would like a robust implementation that would not miss anything.
(defun operational-value (variable)
"Get the operational value of a buffer variable."
(cond
((equal (buffer-local-value variable) (default-value variable))
(buffer-local-value variable))
((equal (buffer-local-value variable) nil)
(default-value variable)) ))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Getting the operational value of a buffer variable
2022-12-02 1:07 Getting the operational value of a buffer variable Heime
@ 2022-12-02 2:33 ` Emanuel Berg
2022-12-02 2:52 ` [External] : " Drew Adams
1 sibling, 0 replies; 5+ messages in thread
From: Emanuel Berg @ 2022-12-02 2:33 UTC (permalink / raw)
To: help-gnu-emacs
Heime wrote:
> I want to get the operational value of a buffer variable.
> If the buffer has a local value, one cannot use the
> default-value implementation. And if the local value in nil,
> I have to get the default-value.
>
> Would like a robust implementation that would not
> miss anything.
Just use/evaluate the variable name to find out what it is, it
isn't two things at once, relax.
Local always wins over global, and that's the way it should
be, cmp. the Vietnam war ...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [External] : Getting the operational value of a buffer variable
2022-12-02 1:07 Getting the operational value of a buffer variable Heime
2022-12-02 2:33 ` Emanuel Berg
@ 2022-12-02 2:52 ` Drew Adams
2022-12-02 13:25 ` Heime
1 sibling, 1 reply; 5+ messages in thread
From: Drew Adams @ 2022-12-02 2:52 UTC (permalink / raw)
To: Heime, 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'
[-- Attachment #1: Type: text/plain, Size: 551 bytes --]
> I want to get the operational value of a buffer
> variable. If the buffer has a local value, one
> cannot use the default-value implementation.
> And if the local value in nil, I have to get the
^^^^^^^^^^^^^^^^^^^^^^^^^
> default-value.
You said this in your previous mail, and I meant to
correct it. It's not at all about the buffer-local
value being `nil'. `nil' is a legitimate value.
It's about whether the variable _has_ a buffer-local
value. If it has a buffer-local value of `nil' then
it has a buffer-local value.
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13360 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [External] : Getting the operational value of a buffer variable
2022-12-02 2:52 ` [External] : " Drew Adams
@ 2022-12-02 13:25 ` Heime
2022-12-02 22:00 ` Heime
0 siblings, 1 reply; 5+ messages in thread
From: Heime @ 2022-12-02 13:25 UTC (permalink / raw)
To: Drew Adams; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'
------- Original Message -------
On Friday, December 2nd, 2022 at 2:52 AM, Drew Adams <drew.adams@oracle.com> wrote:
> > I want to get the operational value of a buffer
> > variable. If the buffer has a local value, one
> > cannot use the default-value implementation.
> > And if the local value in nil, I have to get the
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^
>
> > default-value.
>
>
> You said this in your previous mail, and I meant to
> correct it. It's not at all about the buffer-local
> value being `nil'.` nil' is a legitimate value.
>
> It's about whether the variable has a buffer-local
> value. If it has a buffer-local value of `nil' then
> it has a buffer-local value.
Thank you for pointing things out. I want to remove the mode-line
on all visible buffers, then toggle them back and forth.
Currently, I have the following function, but this only works for the current buffer.
(defvar-local ramona-mode-line nil
"Switch for mode-line display.")
(defun ramona-mode-line-toggle ()
"Turns the mode-line display on or off."
(interactive)
(if ramona-mode-line
(setq mode-line-format ramona-mode-line
ramona-mode-line nil)
(setq ramona-mode-line mode-line-format
mode-line-format nil)
(force-mode-line-update t))
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [External] : Getting the operational value of a buffer variable
2022-12-02 13:25 ` Heime
@ 2022-12-02 22:00 ` Heime
0 siblings, 0 replies; 5+ messages in thread
From: Heime @ 2022-12-02 22:00 UTC (permalink / raw)
To: Heime; +Cc: Drew Adams, 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'
------- Original Message -------
On Friday, December 2nd, 2022 at 1:25 PM, Heime <heimeborgia@protonmail.com> wrote:
> ------- Original Message -------
> On Friday, December 2nd, 2022 at 2:52 AM, Drew Adams drew.adams@oracle.com wrote:
>
>
>
> > > I want to get the operational value of a buffer
> > > variable. If the buffer has a local value, one
> > > cannot use the default-value implementation.
> > > And if the local value in nil, I have to get the
> >
> > ^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> > > default-value.
> >
> > You said this in your previous mail, and I meant to
> > correct it. It's not at all about the buffer-local
> > value being `nil'.` nil' is a legitimate value.
> >
> > It's about whether the variable has a buffer-local
> > value. If it has a buffer-local value of `nil' then
> > it has a buffer-local value.
Is there a need to store the local value in order to redisplay the original mode-line again?
I would like to be able to remove the mode-line and display it again. Not just for the
current buffer, but for all visible buffers when the frame is split into multiple windows.
> Thank you for pointing things out. I want to remove the mode-line
> on all visible buffers, then toggle them back and forth.
>
> Currently, I have the following function, but this only works for the current buffer.
>
> (defvar-local ramona-mode-line nil
> "Switch for mode-line display.")
>
> (defun ramona-mode-line-toggle ()
> "Turns the mode-line display on or off."
>
> (interactive)
>
> (if ramona-mode-line
>
> (setq mode-line-format ramona-mode-line
> ramona-mode-line nil)
>
> (setq ramona-mode-line mode-line-format
> mode-line-format nil)
>
> (force-mode-line-update t))
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-12-02 22:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-02 1:07 Getting the operational value of a buffer variable Heime
2022-12-02 2:33 ` Emanuel Berg
2022-12-02 2:52 ` [External] : " Drew Adams
2022-12-02 13:25 ` Heime
2022-12-02 22:00 ` Heime
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.