help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: which one to use: custom-set-variables, customize-set-variable, or c


From: Lele Gaifax
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]