[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: don't understand setq-default
From: |
Jean Louis |
Subject: |
Re: don't understand setq-default |
Date: |
Mon, 19 Apr 2021 09:44:08 +0300 |
User-agent: |
Mutt/2.0.6 (2021-03-06) |
* Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> [2021-04-19 01:29]:
> Jean Louis wrote:
>
> > Here is how I have defined a buffer local variable:
> >
> > (defvar-local rcd-tabulated-marked-items nil
> > "Collects IDs for tabulated list modes")
> > (put 'rcd-tabulated-marked-items 'permanent-local t)
>
> Oh, great! No, didn't find/have any `defvar-local', good, for
> me that is, I'm sure it's good for something but to me it
> just isn't my style. And my style confirms it, even!
>
> But... from that code above it looks you set it to local
> twice, first by defvar-local, then by setting the
> permanent-local property to t?
>
> permanent-local, sounds like the default.
There is in manual what it is:
(info "(elisp) Creating Buffer-Local")
A buffer-local variable is “permanent” if the variable name (a
symbol) has a ‘permanent-local’ property that is non-‘nil’. Such
variables are unaffected by ‘kill-all-local-variables’, and their local
bindings are therefore not cleared by changing major modes. Permanent
locals are appropriate for data pertaining to where the file came from
or how to save it, rather than with how to edit the contents.
As I am using the variable to extend the tabulated-list-mode, I have
been following the example and explanation in file `tabulated-list.el'
as below:
;; The reason `tabulated-list-format' and other variables are
;; permanent-local is to make it convenient to switch to a different
;; major mode, switch back, and have the original Tabulated List data
;; still valid. See, for example, ebuff-menu.el.
That may happen sometimes.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
- Re: don't understand setq-default, (continued)
- Re: don't understand setq-default, Omar Polo, 2021/04/18
- Re: don't understand setq-default, Emanuel Berg, 2021/04/18
- Re: don't understand setq-default, Emanuel Berg, 2021/04/18
- Re: don't understand setq-default, Emanuel Berg, 2021/04/18
- Re: don't understand setq-default, Omar Polo, 2021/04/19
- Re: don't understand setq-default, Emanuel Berg, 2021/04/19
- Re: don't understand setq-default, Thibaut Verron, 2021/04/19
- Re: don't understand setq-default, Emanuel Berg, 2021/04/19
- Re: don't understand setq-default, Jean Louis, 2021/04/18
- Re: don't understand setq-default, Emanuel Berg, 2021/04/18
- Re: don't understand setq-default,
Jean Louis <=
- Re: don't understand setq-default, Emanuel Berg, 2021/04/19
- Re: don't understand setq-default, Emanuel Berg, 2021/04/18
- Re: don't understand setq-default, Jean Louis, 2021/04/19
- Re: don't understand setq-default, Emanuel Berg, 2021/04/19
- Rounding percentages... was setq-default, Jean Louis, 2021/04/20
- Re: Rounding percentages... was setq-default, Emanuel Berg, 2021/04/29
Re: don't understand setq-default, Jean Louis, 2021/04/18