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

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

Re: Emacs Modular Configuration: the preferable way.


From: Arthur Miller
Subject: Re: Emacs Modular Configuration: the preferable way.
Date: Mon, 21 Jun 2021 12:14:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Hongyi Zhao wrote:
>
>> I noticed the following instructions/tools for Emacs modular
>> configuration:
>>
>> https://www.emacswiki.org/emacs/DotEmacsModular
>> https://www.emacswiki.org/emacs/DotEmacsStructuring
>> https://github.com/emacs-jp/init-loader
>>
>> There are so many ways to do this. What's the
>> preferable way?
>
> My personal favorite is the method below, I don't know if
> that's mentioned on any of your links.
>
> Note that every file is mentioned explicitly, that means if
> you are to search for an error (say do the so-called binary
> search) you don't have to comment in and out code that might
> have comments, headers, footers, and so on, instead you just
> comment out one or more filenames, and when the bug or
> misfeature is localized, it is as easy to enable them again.
>
> (let*((emacs-dir "~/.emacs.d")
>       (lisp-dir  (format "%s/lisp"       emacs-dir))
>       (init-dir  (format "%s/emacs-init" emacs-dir))
>       (erc-dir   (format "%s/erc"        init-dir))
>       (gnus-dir  (format "%s/gnus"       init-dir))
>       (ide-dir   (format "%s/ide"        init-dir))
>       (w3m-dir   (format "%s/w3m"        init-dir))

Isn't it better to use path formatting function instead of string
formatting to ensure platform indepent paths and such? Something like
this:

(let ((etc (expand-file-name "etc" user-emacs-directory)))
             (unless (file-directory-p etc)
               (make-directory etc))
             (setq show-paren-style 'expression

             .....
              
              backup-directory-alist `(("." . ,etc))
              custom-file (expand-file-name "emacs-custom.el" etc)
              abbrev-file-name (expand-file-name "abbrevs.el" etc)
              bookmark-default-file (expand-file-name "bookmarks" etc)))


https://github.com/amno1/.emacs.d/blob/main/init.org



reply via email to

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