Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: OT: version control of .el files in NT Emacs

7 views
Skip to first unread message

Sivaram Neelakantan

unread,
Sep 10, 2016, 6:03:10 AM9/10/16
to help-gn...@gnu.org
On Fri, Sep 09 2016,Óscar Fuentes wrote:


[snipped 17 lines]

> You probably noticed that you need to adjust the load-path. A robust way
> of doing that is to put in your_el_repo/emacs.el :
>
> (add-to-list 'load-path (file-name-directory load-file-name))
>
> It is also is useful to put this
>
> (setq user-init-file load-file-name)
>
> at the beginning of your emacs.el file in your_el_repo. Look up the
> docstring for the user-init-file variable to see why.
>

How does this help? Because I have just 2 lines in the $HOME/.emacs

(setq user-emacs-directory "c:/gnu/initfiles/.emacs.d/" )
(load-file "c:/gnu/initfiles/.emacs")

And in the c:/gnu/initfiles/.emacs file I hard coded paths like

(load-file "c:/gnu/initfiles/.text_config.el")
(load-file "c:/gnu/initfiles/.ido_config.el")
(load-file "c:/gnu/initfiles/.ac_config.el")
(load-file "c:/gnu/initfiles/.r_ess_config.el")
(load-file "c:/gnu/initfiles/.cygwin_config.el")
(load-file "c:/gnu/initfiles/.uniq_config.el")
(load-file "c:/gnu/initfiles/.smex_config.el")

I get it that .sh_history, .smex_history and other .history*
files used/created by various packages will be still created in
$HOME/.emacs but those are fairly transient stuff aren't they?



sivaram
--


Óscar Fuentes

unread,
Sep 10, 2016, 9:38:52 AM9/10/16
to help-gn...@gnu.org
Sivaram Neelakantan <nsivar...@gmail.com> writes:

>> You probably noticed that you need to adjust the load-path. A robust way
>> of doing that is to put in your_el_repo/emacs.el :
>>
>> (add-to-list 'load-path (file-name-directory load-file-name))
>>
>> It is also is useful to put this
>>
>> (setq user-init-file load-file-name)
>>
>> at the beginning of your emacs.el file in your_el_repo. Look up the
>> docstring for the user-init-file variable to see why.
>>
>
> How does this help? Because I have just 2 lines in the $HOME/.emacs

If you always use absolute paths and don't plan to change them, not
much, other than noise. The lines I suggested makes possible to move
your files to another directory requiring only a change to $HOME/.emacs.

And by not setting user-init-file some features will try to
inspect/modify $HOME/.emacs instead of your_el_repo/emacs.el.

> (setq user-emacs-directory "c:/gnu/initfiles/.emacs.d/" )
> (load-file "c:/gnu/initfiles/.emacs")
>
> And in the c:/gnu/initfiles/.emacs file I hard coded paths like
>
> (load-file "c:/gnu/initfiles/.text_config.el")

Prepending those files with a dot is not a good idea. The dot means that
the files are hidden on most GNU/Linux file browsers and might confuse
some tools on windows, that expect file names to obey the name.extension
format.

Besides, load-file is an interactive function that calls `load'. With
my suggested adjustment to load-path you can simply use

(load "text_config.el")

or simply

(load "text_config")

which will also work if you ever decide to byte-compile your config files.

> I get it that .sh_history, .smex_history and other .history*
> files used/created by various packages will be still created in
> $HOME/.emacs but those are fairly transient stuff aren't they?

Yes, I don't care about those either.

One thing I do is to use a separate file for customizations:

(setq custom-file
(concat (file-name-directory load-file-name) "customizations.el"))
(load custom-file 't)

If you use custom themes you probably want to set custom-theme-directory
too.


Sivaram Neelakantan

unread,
Sep 10, 2016, 6:03:37 PM9/10/16
to help-gn...@gnu.org
On Sat, Sep 10 2016,Óscar Fuentes wrote:


[snipped 17 lines]

> If you always use absolute paths and don't plan to change them, not
> much, other than noise. The lines I suggested makes possible to move
> your files to another directory requiring only a change to $HOME/.emacs.
>
> And by not setting user-init-file some features will try to
> inspect/modify $HOME/.emacs instead of your_el_repo/emacs.el.

OK, then I better fix that.


[snipped 8 lines]

> Prepending those files with a dot is not a good idea. The dot means that
> the files are hidden on most GNU/Linux file browsers and might confuse
> some tools on windows, that expect file names to obey the name.extension
> format.

Yes the naming was deliberate with a . prefix. I didn't want the
files to clutter my $HOME/ in my linux box, so I let it get hidden by
using a . prefix. On Windows, so far, I haven't had any problems as
no other program looks for these kind of files

>
> Besides, load-file is an interactive function that calls `load'. With
> my suggested adjustment to load-path you can simply use
>
> (load "text_config.el")
>
> or simply
>
> (load "text_config")
>
> which will also work if you ever decide to byte-compile your config files.

Thanks for this. I will relook at the load-path suggestion of yours.


[snipped 7 lines]

> One thing I do is to use a separate file for customizations:
>
> (setq custom-file
> (concat (file-name-directory load-file-name) "customizations.el"))
> (load custom-file 't)

Sorry, I'm lost here; could you please give an example of your set up and how
it helps. I broke up my .emacs to manage the customisations for each
mode. How would your example help?

>
> If you use custom themes you probably want to set custom-theme-directory
> too.

Right, will fix this too, as I see this

custom-theme-directory is a variable defined in `custom.el'.
Its value is "~/.emacs.d/"
Original value was
"c:/gnu/initfiles/.emacs.d/"

Thanks

sivaram
--


0 new messages