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

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

bug#54381: 29.0.50; Automatically load custom-file


From: Pedro Andres Aranda Gutierrez
Subject: bug#54381: 29.0.50; Automatically load custom-file
Date: Tue, 15 Mar 2022 08:51:12 +0100

OK, once again, one step back... maybe I'm completely wrong assuming things based on my experience:
My full history step by step:

Background:
My first Emacs experience what on an HP700 where we had a 68020 HW emulator and on a Sun SPARC where we had the schematic capture programs in the 1990... Always trying to have a single sys-independent initialisation infra...

I've been using the variable `custom-file' (defined inside Emacs), setting it to the path of the file where I want my customisation to reside.
After setting this variable, I've used (load custom-file) to load my customisations (if they existed).
I have observed that the optimal place to put this (setq)(load) pair was at the end of my init.el file, because some customisations came from packages I loaded, etc.

Now, I have started encouraging my students to use Emacs and helping them understand the basics of initialisation and customisation.
During this time, I have often been asked why the (setq)(load) pair is needed. The reasoning behind this question mainly being that because `custom-file' is defined in Emacs, it should be assumed that Emacs would react to its being non-nil by loading it.

This question arose always when someone had not placed the (setq)(load) pair at the end of init.el and a weird behaviour was observed.

Corner cases:
I do understand that someone may want to (setq)(load) somewhere in init.el (ie not at the end) and I respect this by loading `custom-file' only once.

I do understand that someone can setq `custom-file' but not load it, because customisations are session specific for this user and can be discarded afterwards or because this user wants to try out things and then integrate some of the customisations into init.el in a more permanent way. This is what custom-file-load-p was included for.

I have tried to integrate all this (but just this) into the patch to make Emacs an infinitesimal more beginner-friendly.

best, /PA

On Mon, 14 Mar 2022 at 18:53, Robert Pluim <rpluim@gmail.com> wrote:
>>>>> On Mon, 14 Mar 2022 17:47:49 +0100, Pedro Andres Aranda Gutierrez <paaguti@gmail.com> said:

    Pedro> Robert > No, I donʼt think that would be a good idea: thereʼs a "custom.el"
    Pedro> in
    Robert> the emacs sources already, and we should indicate somehow that this
    Pedro> is
    Robert> *data*, not code.

    Pedro> Don't follow you here. My customization file '~/.emacs.d/custom.el' is
    Pedro> code, isn't it?

Yes, thereʼs no distinction between code and data in lisp. But your
custom file should only contain `custom-set-variables' and
`custom-set-faces', not any old lisp forms.

Robert
--


--
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

reply via email to

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