From: John W Higgins <wishdev@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: emacs configuration
Date: Thu, 30 Sep 2021 09:38:25 -0700 [thread overview]
Message-ID: <CAPhAwGxw7OyF7Uq=OU8GCmiS_W=gWTgvR4HyebEaV6vka5XBWg@mail.gmail.com> (raw)
In-Reply-To: <alpine.NEB.2.23.451.2109301111050.29751@panix1.panix.com>
Good Morning,
On Thu, Sep 30, 2021 at 8:44 AM Jude DaShiell <jdashiel@panix.com> wrote:
> Has emacs got something like an #include directive that can be used as it
> is in C? If so, it might be worth using it to tidy up my .emacs file.
>
>
This is what I've used for years - I'm sure it's not elegant or anything
else - but it's served me well.
First I use a ~/.emacs.d/init.el file as opposed to a ~/.emacs file - they
are equivalent[1].
;; Starting point is that load-file-name returns the name of the current
file - so again for me this is ~/.emacs.d/init.el as opposed to ~/.emacs
;; Setup the config dir
(setq dev-emacs-init-file load-file-name)
(setq dev-emacs-config-dir
(file-name-directory dev-emacs-init-file))
;; We now have dev-emacs-config-dir with ~/.emacs.d stored
;; Setup 'init' folder
(setq dev-init-dir
(expand-file-name "init" dev-emacs-config-dir))
;; Now we have dev-init-dir with ~/.emacs.d/init
;; Load all the custom files inside the init dir
;; This loads any file under the ~/.emacs.d/init folder with a file name of
000_blah.el in numerical order.
;; i.e. 001_blah.el loads before 001_foo.el or 002_blah.el
(if (file-exists-p dev-init-dir)
(setq init-files (directory-files dev-init-dir t
"[0-9][0-9][0-9]_.*.el$")))
(dolist (file init-files)
(load file))
;; This allows me to have as many files as my brain feels is appropriate.
John
P.S. I'm very certain I copied this from somewhere at some point. I have no
idea where or when however :)
[1] - https://www.emacswiki.org/emacs/DotEmacsDotD
next prev parent reply other threads:[~2021-09-30 16:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 15:13 emacs configuration Jude DaShiell
2021-09-30 15:56 ` tomas
2021-09-30 16:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30 15:57 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30 17:32 ` 2QdxY4RzWzUUiLuE
2021-09-30 21:49 ` Jean Louis
2021-09-30 22:11 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-01 20:34 ` Jean Louis
2021-09-30 16:03 ` 2QdxY4RzWzUUiLuE
2021-09-30 16:38 ` John W Higgins [this message]
[not found] <mailman.1033485728.6848.help-gnu-emacs@gnu.org>
2002-10-01 20:45 ` Emacs configuration Jesper Harder
-- strict thread matches above, loose matches on Subject: below --
2002-10-01 15:21 arthur.chereau
[not found] <mailman.1033477527.28155.help-gnu-emacs@gnu.org>
2002-10-01 14:09 ` Jesper Harder
2002-10-01 13:04 arthur.chereau
[not found] <mailman.1033377809.21117.help-gnu-emacs@gnu.org>
2002-09-30 17:01 ` Jesper Harder
2002-09-30 17:02 ` Kevin Rodgers
2002-10-01 6:04 ` Evgeny Roubinchtein
2002-10-01 14:57 ` Stefan Monnier <foo@acm.com>
2002-09-30 9:22 arthur.chereau
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='CAPhAwGxw7OyF7Uq=OU8GCmiS_W=gWTgvR4HyebEaV6vka5XBWg@mail.gmail.com' \
--to=wishdev@gmail.com \
--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).