unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Lele Gaifax <lele@metapensiero.it>
To: help-gnu-emacs@gnu.org
Subject: Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
Date: Mon, 14 Dec 2015 09:28:37 +0100	[thread overview]
Message-ID: <87vb81wi16.fsf@metapensiero.it> (raw)
In-Reply-To: 1bb3e90b-9e31-4450-aa11-4c475ffd081a@default

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.




      parent reply	other threads:[~2015-12-14  8:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vb81wi16.fsf@metapensiero.it \
    --to=lele@metapensiero.it \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).