all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
@ 2015-11-29 18:47 Alan Schmitt
  2015-11-29 19:19 ` Drew Adams
  0 siblings, 1 reply; 15+ messages in thread
From: Alan Schmitt @ 2015-11-29 18:47 UTC (permalink / raw
  To: help-gnu-emacs

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

Hello,

I recently read a message where, if I read it correctly, it was recommended to
use `customize-set-variable' and `customize-set-value' to change settings in
an init file while playing nice with the custom system. I looked at their
documentation and I have trouble understanding how they differ. I see there is
also `custom-set-variables' which has a different signature.

So my question is: should I use `setq', `customize-set-variable',
`customize-set-value', or `custom-set-variables' to change in my init file
variables that exist in the custom ecosystem?

Thanks,
Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated November 22, 2015, Mauna Loa Obs.): 400.35 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

* RE: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-11-29 18:47 which one to use: custom-set-variables, customize-set-variable, or customize-set-value? Alan Schmitt
@ 2015-11-29 19:19 ` Drew Adams
  2015-11-30  8:52   ` Alan Schmitt
  0 siblings, 1 reply; 15+ messages in thread
From: Drew Adams @ 2015-11-29 19:19 UTC (permalink / raw
  To: Alan Schmitt, help-gnu-emacs

> I recently read a message where, if I read it correctly, it was
> recommended to use `customize-set-variable' and `customize-set-value'
> to change settings in an init file while playing nice with the
> custom system. I looked at their documentation and I have trouble 
> understanding how they differ. I see there is also
> `custom-set-variables' which has a different signature.
> 
> So my question is: should I use `setq', `customize-set-variable',
> `customize-set-value', or `custom-set-variables' to change in my
> init file variables that exist in the custom ecosystem?

Good question!  Here is my understanding, which might not be
100% correct:

1. The `customize-*' functions are also commands.  And they set
only a single variable (option).  `custom-set-variables' is not
a command, and it can set any number of options - it is what
Customize writes to your `custom-file' (or init file).

2. `customize-set-value' does not use the defcustom's :set
function, and it does not set the default value.  It just sets
the current value in the current buffer.  It is like setq,
except that it can be used interactively (it is a command),
and in that case it reads the value according to how such
values are read interactively.  AFAIK, it respects the
defcustom :type (but it does not respect :set).

I agree that the doc is not very clear.  Recently I forgot
that `customize-set-value' does not use the defcustom's :set
function, and I was bitten by the fact that it does not.
It seems odd that it has two, completely independent
differences from `customize-set-variable'.



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

* Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-11-29 19:19 ` Drew Adams
@ 2015-11-30  8:52   ` Alan Schmitt
  2015-11-30 15:20     ` Drew Adams
  0 siblings, 1 reply; 15+ messages in thread
From: Alan Schmitt @ 2015-11-30  8:52 UTC (permalink / raw
  To: Drew Adams; +Cc: help-gnu-emacs

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

Hello Drew,

On 2015-11-29 20:19, Drew Adams <drew.adams@oracle.com> writes:

>> I recently read a message where, if I read it correctly, it was
>> recommended to use `customize-set-variable' and `customize-set-value'
>> to change settings in an init file while playing nice with the
>> custom system. I looked at their documentation and I have trouble 
>> understanding how they differ. I see there is also
>> `custom-set-variables' which has a different signature.
>> 
>> So my question is: should I use `setq', `customize-set-variable',
>> `customize-set-value', or `custom-set-variables' to change in my
>> init file variables that exist in the custom ecosystem?
>
> Good question!  Here is my understanding, which might not be
> 100% correct:

Thank you for the explanation. For the moment I'm sticking with
`customize-set-variable' and I'll see if I get in trouble.

> I agree that the doc is not very clear.  Recently I forgot
> that `customize-set-value' does not use the defcustom's :set
> function, and I was bitten by the fact that it does not.

I'm curious about this: what is the scenario where this can be
a problem?

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated November 22, 2015, Mauna Loa Obs.): 400.35 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

* RE: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-11-30  8:52   ` Alan Schmitt
@ 2015-11-30 15:20     ` Drew Adams
  2015-11-30 15:44       ` Alan Schmitt
  2015-12-11 18:23       ` Lele Gaifax
  0 siblings, 2 replies; 15+ messages in thread
From: Drew Adams @ 2015-11-30 15:20 UTC (permalink / raw
  To: Alan Schmitt; +Cc: help-gnu-emacs

Hi Alan,

> Thank you for the explanation. For the moment I'm sticking with
> `customize-set-variable'

Good choice.

> and I'll see if I get in trouble.

I don't think you can get in trouble that way.

> > I agree that the doc is not very clear.  Recently I forgot
> > that `customize-set-value' does not use the defcustom's :set
> > function, and I was bitten by the fact that it does not.
> 
> I'm curious about this: what is the scenario where this can be
> a problem?

Situations where setting the variable is more complex than just
changing its value, that is, where other changes to the state
of Emacs need to be associated with the change in the variable
value.

If you look at the doc (Elisp manual, node Variable Definitions),
have a look at not only :set but also :initialize, to get an
idea of what can be involved.  You will see, for example, that
there are multiple initialization functions that are predefined,
and they act differently with respect to :set and setting the
value during initialization.  This might give you an idea of
different :set scenarios.

Here is one example of a :set function (from character-fold+.el)
that does something more than just change the value:

(defcustom char-fold-symmetric nil
  "Non-nil means char-fold searching treats equivalent chars the same.
That is, use of any of a set of char-fold equivalent chars in a search
string finds any of them in the text being searched.

If nil then only the \"base\" or \"canonical\" char of the set matches
any of them.  The others match only themselves, even when char-folding
is turned on."
  :set (lambda (sym defs)
         (custom-set-default sym defs)
         (update-char-fold-table))
  :type 'boolean :group 'isearch)

Standard function `custom-set-default' is the usual way to change
the variable's (default) value, so this :set function firt calls
that.  Then it calls a function that changes some other state,
taking the new variable value into account.

HTH.



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

* Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-11-30 15:20     ` Drew Adams
@ 2015-11-30 15:44       ` Alan Schmitt
  2015-12-11 18:23       ` Lele Gaifax
  1 sibling, 0 replies; 15+ messages in thread
From: Alan Schmitt @ 2015-11-30 15:44 UTC (permalink / raw
  To: Drew Adams; +Cc: help-gnu-emacs

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

On 2015-11-30 16:20, Drew Adams <drew.adams@oracle.com> writes:

> Here is one example of a :set function (from character-fold+.el)
> that does something more than just change the value:
>
> (defcustom char-fold-symmetric nil
>   "Non-nil means char-fold searching treats equivalent chars the same.
> That is, use of any of a set of char-fold equivalent chars in a search
> string finds any of them in the text being searched.
>
> If nil then only the \"base\" or \"canonical\" char of the set matches
> any of them.  The others match only themselves, even when char-folding
> is turned on."
>   :set (lambda (sym defs)
>          (custom-set-default sym defs)
>          (update-char-fold-table))
>   :type 'boolean :group 'isearch)
>
> Standard function `custom-set-default' is the usual way to change
> the variable's (default) value, so this :set function firt calls
> that.  Then it calls a function that changes some other state,
> taking the new variable value into account.

Ah, very interesting. Thanks for the explanation.

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated November 29, 2015, Mauna Loa Obs.): 400.37 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

* Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-11-30 15:20     ` Drew Adams
  2015-11-30 15:44       ` Alan Schmitt
@ 2015-12-11 18:23       ` Lele Gaifax
  2015-12-11 18:53         ` Drew Adams
  1 sibling, 1 reply; 15+ messages in thread
From: Lele Gaifax @ 2015-12-11 18:23 UTC (permalink / raw
  To: help-gnu-emacs

Drew Adams <drew.adams@oracle.com> writes:

> Hi Alan,
>
>> Thank you for the explanation. For the moment I'm sticking with
>> `customize-set-variable'
>
> Good choice.

After reading this thread, as well as the referenced
http://permalink.gmane.org/gmane.emacs.bugs/107690, I tried to see if I should
rectify some settings in my own init file. Indeed, I was using `setq' on a
bunch of customizable options...

Given that checking each variable documentation to see the right way to set
its value is error prone, I wrote the following macro and used it in almost
all cases, replacing `setq' and `set-default' in my configuration:

    (defmacro csetq (variable value)
      "Macro to set the value of a variable, possibly a custom user option."
      `(funcall (or (get ',variable 'custom-set)
                    (and (plist-member (symbol-plist ',variable) 'standard-value) 'set-default)
                    'set)
                ',variable ,value))

While it seems working as expected, I like to hear other's opinion: do you see
any problem with this approach?

Thank you,
ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.




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

* RE: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-12-11 18:23       ` Lele Gaifax
@ 2015-12-11 18:53         ` Drew Adams
  2015-12-12  8:31           ` Lele Gaifax
  0 siblings, 1 reply; 15+ messages in thread
From: Drew Adams @ 2015-12-11 18:53 UTC (permalink / raw
  To: Lele Gaifax, help-gnu-emacs

> After reading this thread, as well as the referenced
> http://permalink.gmane.org/gmane.emacs.bugs/107690, I tried to see if I
> should
> rectify some settings in my own init file. Indeed, I was using `setq' on a
> bunch of customizable options...
> 
> Given that checking each variable documentation to see the right way to
> set its value is error prone, I wrote the following macro and used it in
> almost all cases, replacing `setq' and `set-default' in my configuration:
> 
>     (defmacro csetq (variable value)
>       "Macro to set the value of a variable, possibly a custom user
> option."
>       `(funcall (or (get ',variable 'custom-set)
>                     (and (plist-member (symbol-plist ',variable)
> 'standard-value) 'set-default)
>                     'set)
>                 ',variable ,value))
> 
> While it seems working as expected, I like to hear other's opinion: do you
> see any problem with this approach?

You can do that.  But I would advise just using `customize-set-variable'
for a user option, and using `setq' or `setq-default' etc. for non-options.

That is much more readable in your code, IMO.

And no, you do not ever need to "check each variable documentation to
see the right way to set its value".  (And you should anyway not rely
on a variable's documentation for that.)



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

* Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-12-11 18:53         ` Drew Adams
@ 2015-12-12  8:31           ` Lele Gaifax
  2015-12-12 12:09             ` tomas
  2015-12-12 16:11             ` Drew Adams
  0 siblings, 2 replies; 15+ messages in thread
From: Lele Gaifax @ 2015-12-12  8:31 UTC (permalink / raw
  To: help-gnu-emacs

Drew Adams <drew.adams@oracle.com> writes:

>> While it seems working as expected, I like to hear other's opinion: do you
>> see any problem with this approach?
>
> You can do that.  But I would advise just using `customize-set-variable'
> for a user option, and using `setq' or `setq-default' etc. for non-options.
>
> That is much more readable in your code, IMO.

Ok, thanks, I will rethink my step.

> And no, you do not ever need to "check each variable documentation to
> see the right way to set its value".  (And you should anyway not rely
> on a variable's documentation for that.)

How's it that possible? How can then I know when to use `setq', `setq-default'
or `customize-set-variable'?

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.




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

* Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-12-12  8:31           ` Lele Gaifax
@ 2015-12-12 12:09             ` tomas
  2015-12-12 13:31               ` Lele Gaifax
  2015-12-12 16:11             ` Drew Adams
  1 sibling, 1 reply; 15+ messages in thread
From: tomas @ 2015-12-12 12:09 UTC (permalink / raw
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Dec 12, 2015 at 09:31:49AM +0100, Lele Gaifax wrote:
> Drew Adams <drew.adams@oracle.com> writes:
> 
> >> While it seems working as expected, I like to hear other's opinion: do you
> >> see any problem with this approach?
> >
> > You can do that.  But I would advise just using `customize-set-variable'
> > for a user option, and using `setq' or `setq-default' etc. for non-options.
> >
> > That is much more readable in your code, IMO.
> 
> Ok, thanks, I will rethink my step.
> 
> > And no, you do not ever need to "check each variable documentation to
> > see the right way to set its value".  (And you should anyway not rely
> > on a variable's documentation for that.)
> 
> How's it that possible? How can then I know when to use `setq', `setq-default'
> or `customize-set-variable'?

I think Lele has a point here. Imagine some "simple" variable which becomes
later (i.e. in a later Emacs version) a user option. The once "right" code
in the Emacs init file becomes kind-of "wrong".

This makes the idea of a "generic" setq which'd invoke a setter if there is
one somewhat attractive, doesn't it?

OTOH this is only valuable if it becomes a "common idiom"; otherwise the
readability argument Drew advances applies.

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlZsDpUACgkQBcgs9XrR2kY9KQCfc8KZIZsRu0dNby4DRHP5vvGu
3G4AnjqzLdYQkwQ0rZ/rImyWhOzibjSN
=3W0C
-----END PGP SIGNATURE-----



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

* Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-12-12 12:09             ` tomas
@ 2015-12-12 13:31               ` Lele Gaifax
  0 siblings, 0 replies; 15+ messages in thread
From: Lele Gaifax @ 2015-12-12 13:31 UTC (permalink / raw
  To: help-gnu-emacs

<tomas@tuxteam.de> writes:

> I think Lele has a point here. Imagine some "simple" variable which becomes
> later (i.e. in a later Emacs version) a user option. The once "right" code
> in the Emacs init file becomes kind-of "wrong".

Yes, exactly. Or a buffer-local setting, when it would be even more "wrong".

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.




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

* RE: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-12-12  8:31           ` Lele Gaifax
  2015-12-12 12:09             ` tomas
@ 2015-12-12 16:11             ` Drew Adams
  2015-12-13  8:17               ` tomas
  1 sibling, 1 reply; 15+ messages in thread
From: Drew Adams @ 2015-12-12 16:11 UTC (permalink / raw
  To: Lele Gaifax, help-gnu-emacs

> d> And no, you do not ever need to "check each variable documentation to
> d> see the right way to set its value".  (And you should anyway not rely
> d> on a variable's documentation for that.)
> 
> How's it that possible? How can then I know when to use `setq',
> `setq-default' or `customize-set-variable'?

> t> I think Lele has a point here. Imagine some "simple" variable which
> t> becomes later (i.e. in a later Emacs version) a user option. The
> t> once "right" code in the Emacs init file becomes kind-of "wrong".
> 
> Yes, exactly. Or a buffer-local setting, when it would be even more
> "wrong".

Perhaps I misunderstood.  I thought you meant check the doc for a
description of what the :set function does, initialization, etc.

Anyway, what I meant is to not check _only the documentation_.
Check also the definition of the variable.

While the documentation should correctly report whether it is
an option, and whether it might have a buffer-local value, it
is still good, IMO, to check the defvar/defcustom.

As I said, you can certainly do as you suggest.  My suggestion is
to clearly show in your init file how you are setting the value.
Including for different Emacs versions - so you are aware of such
changes when you read your code later.  But it's just a suggestion.





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

* Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-12-12 16:11             ` Drew Adams
@ 2015-12-13  8:17               ` tomas
  2015-12-13 17:32                 ` Drew Adams
  0 siblings, 1 reply; 15+ messages in thread
From: tomas @ 2015-12-13  8:17 UTC (permalink / raw
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Dec 12, 2015 at 08:11:07AM -0800, Drew Adams wrote:
> > d> And no, you do not ever need to "check each variable documentation to
> > d> see the right way to set its value".  (And you should anyway not rely
> > d> on a variable's documentation for that.)
> > 
> > How's it that possible? How can then I know when to use `setq',
> > `setq-default' or `customize-set-variable'?
> 
> > t> I think Lele has a point here. Imagine some "simple" variable which
> > t> becomes later (i.e. in a later Emacs version) a user option. The
> > t> once "right" code in the Emacs init file becomes kind-of "wrong".
> > 
> > Yes, exactly. Or a buffer-local setting, when it would be even more
> > "wrong".
> 
> Perhaps I misunderstood.  I thought you meant check the doc for a
> description of what the :set function does, initialization, etc.
> 
> Anyway, what I meant is to not check _only the documentation_.
> Check also the definition of the variable.
> 
> While the documentation should correctly report whether it is
> an option, and whether it might have a buffer-local value, it
> is still good, IMO, to check the defvar/defcustom.

Definitely agree here.

> As I said, you can certainly do as you suggest.  My suggestion is
> to clearly show in your init file how you are setting the value.
> Including for different Emacs versions - so you are aware of such
> changes when you read your code later.  But it's just a suggestion.

Here I was trying to make a case for some kind of "generic setter"
which knows what the right thing is. Of course, such a generic setter
wouldn't be half as valuable without a context. I wouldn't do it in
my init file as of now, where it's not "usual".

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlZtKX0ACgkQBcgs9XrR2kYrfACeIPsVUb6XeqXhA/7OMGkA72ep
tcsAnjOZg9CkzUfgxWpRY8iHg/FzZj0+
=NHyI
-----END PGP SIGNATURE-----



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

* RE: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-12-13  8:17               ` tomas
@ 2015-12-13 17:32                 ` Drew Adams
  2015-12-14  2:44                   ` B.V. Raghav
  2015-12-14  8:28                   ` Lele Gaifax
  0 siblings, 2 replies; 15+ messages in thread
From: Drew Adams @ 2015-12-13 17:32 UTC (permalink / raw
  To: tomas, help-gnu-emacs

> > As I said, you can certainly do as you suggest.  My suggestion is
> > to clearly show in your init file how you are setting the value.
> > Including for different Emacs versions - so you are aware of such
> > changes when you read your code later.  But it's just a suggestion.
> 
> Here I was trying to make a case for some kind of "generic setter"
> which knows what the right thing is. Of course, such a generic setter
> wouldn't be half as valuable without a context. I wouldn't do it in
> my init file as of now, where it's not "usual".

BTW, maybe I should also have made clear that I think the best
practice, in general, is to use the Customize UI and let it
manage user options and faces, and to force it to do so in a
separate `custom-file' and not in the init file.

While one can call Customize functions (`customize-set-variable')
from Lisp code, my advice is to save that for commands you write
that dynamically manipulate (set and possibly save) options and
faces - as opposed to using such functions in an init file.

(Just one opinion.)



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

* Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-12-13 17:32                 ` Drew Adams
@ 2015-12-14  2:44                   ` B.V. Raghav
  2015-12-14  8:28                   ` Lele Gaifax
  1 sibling, 0 replies; 15+ messages in thread
From: B.V. Raghav @ 2015-12-14  2:44 UTC (permalink / raw
  To: Drew Adams; +Cc: help-gnu-emacs

Drew Adams <drew.adams@oracle.com> writes:

>> > As I said, you can certainly do as you suggest.  My suggestion is
>> > to clearly show in your init file how you are setting the value.
>> > Including for different Emacs versions - so you are aware of such
>> > changes when you read your code later.  But it's just a suggestion.
>> 
>> Here I was trying to make a case for some kind of "generic setter"
>> which knows what the right thing is. Of course, such a generic setter
>> wouldn't be half as valuable without a context. I wouldn't do it in
>> my init file as of now, where it's not "usual".
>
> BTW, maybe I should also have made clear that I think the best
> practice, in general, is to use the Customize UI and let it
> manage user options and faces, and to force it to do so in a
> separate `custom-file' and not in the init file.
>
> While one can call Customize functions (`customize-set-variable')
> from Lisp code, my advice is to save that for commands you write
> that dynamically manipulate (set and possibly save) options and
> faces - as opposed to using such functions in an init file.
>
> (Just one opinion.)

I second that.

-- 
(B.V. Raghav)
Ph.D. Student, Design Programme
Indian Institute of Technology Kanpur

Ph: +91-9450988137



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

* Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
  2015-12-13 17:32                 ` Drew Adams
  2015-12-14  2:44                   ` B.V. Raghav
@ 2015-12-14  8:28                   ` Lele Gaifax
  1 sibling, 0 replies; 15+ messages in thread
From: Lele Gaifax @ 2015-12-14  8:28 UTC (permalink / raw
  To: help-gnu-emacs

Drew Adams <drew.adams@oracle.com> writes:

> BTW, maybe I should also have made clear that I think the best
> practice, in general, is to use the Customize UI and let it
> manage user options and faces, and to force it to do so in a
> separate `custom-file' and not in the init file.

My Emacs customization isn't used just by me, I share it with several friends,
so I prefer to separate the two: one thing is what I (as the "init"
maintainer) decide/propose should be the default setting, another thing is
what the friends (or me, as a user of the "init") actually prefer. This
preference/override may be expressed either as lisp code in the user's
specific file or by her tweaks thru the Customize UI (that go in the same
file, in the usual (customize-set-variables ...) form).

So init.el basically says:

    (setq

     ;; top directory, usually ~/.emacs.d/
     esk/top-dir (file-name-directory (or (buffer-file-name) load-file-name))

     ;; starter kit lisp sources directory
     esk/lisp-dir (concat esk/top-dir "esk/")

     ;; not-yet-packaged-packages directory
     esk/autoload-dir (concat esk/top-dir "elpa-to-submit/")

     ;; directory where user specific stuff go
     esk/user-specific-dir (concat esk/top-dir user-login-name "/")

     ;; directory containing overrides
     esk/overrides-dir (concat esk/top-dir "overrides/")

     ;; user specific configuration file
     esk/user-specific-config (concat esk/top-dir user-login-name))

    ...

    ;; Avoid using TAB as indentation
    (set-local 'indent-tabs-mode nil)

    ;; Do not emit noise
    (setq visible-bell t)

    ;; Many other tweaks
    
    ...
    
    ;; Where emacs will write user custom settings
    (setq custom-file (concat esk/user-specific-config ".el"))

    ;; Load user specific customizations
    (load esk/user-specific-config 'noerror)

I'm used to use "current" Emacs version, compiled weekly from the repository,
while my friends typically use whatever version comes down from their
distribution.

My "csetq" macro goal was to be a safer,-past-and-future-proof shortcut to
initialize those variables: in such use-case, how can I be sure that
`indent-tabs-mode' is still a buffer-local variable, or that `visible-bell'
didn't turn into a custom-setting-with-side-effects?

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.




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

end of thread, other threads:[~2015-12-14  8:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-29 18:47 which one to use: custom-set-variables, customize-set-variable, or customize-set-value? Alan Schmitt
2015-11-29 19:19 ` Drew Adams
2015-11-30  8:52   ` Alan Schmitt
2015-11-30 15:20     ` Drew Adams
2015-11-30 15:44       ` Alan Schmitt
2015-12-11 18:23       ` Lele Gaifax
2015-12-11 18:53         ` Drew Adams
2015-12-12  8:31           ` Lele Gaifax
2015-12-12 12:09             ` tomas
2015-12-12 13:31               ` Lele Gaifax
2015-12-12 16:11             ` Drew Adams
2015-12-13  8:17               ` tomas
2015-12-13 17:32                 ` Drew Adams
2015-12-14  2:44                   ` B.V. Raghav
2015-12-14  8:28                   ` Lele Gaifax

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.