It’s works on Emacs version 22.1.1+ , provides more reasonable style: how to organize Elisp code more better. You can run it on any platform that Emacs supported with any mode: GUI or Terminal, even you can run multiple Emacs instances with different version on the same machine and at the same time.
- clone More Reasonable Emacs from github
git clone --depth=1 https://github.com/junjiemars/.emacs.d.git ~/.emacs.d
- open Emacs, after Emacs compile all elisp files, then reopen Emacs
- want more functionalities see Cooking section
One more thing, it’s best to remind you: take care, it’s super fast.
I’m a nerd with Emacs, it’s awesome if I can Learn Emacs in less then Ten Years. So, I decided to start from Level One not the Level Zero after read Emacs’ tutorial (C-h t). Emacs is the most powerful editor on the world there is no one of, it’s programmable, elegant and self-documenting, so you can start from Level Zero if you had time may be less than 10 years to read and try Emacs.
After falling in love with Lisp, I know it’s the time to make Emacs being a part of my body and mind, not just open a file, navigating, editing, and save it. The Level One of mine start from this is a Clojure-friendly emacs config, and A reasonable Emacs config. But, those ones neither can suit for my daily use on different machines.
The More Reasonable Emacs strives to be fast, stable and hacker friendly, which can be run on anywhere where Emacs run.
Now, let’s start from the Level Two. And one more thing: teach youself some little Elisp (M-x info).
- Carefully designed: just load what’s your want.
- Adaptive: Can run on any OS, GUI or Terminal, from most recent Emacs’s versions to ancient ones, and one Emacs’s configuration suit for all coexisting Emacs on the same machine.
- Consistent: Whereever and whenever you can play with Emacs always behaves in the same way.
- Awesome style: screenshot
- Stable
- Supper faster
- Emacs 22.1.1+
- Keyboard+
- Linux, whatever GUI or Terminal
- Darwin, whatever GUI or Terminal
- Windows, whatever GUI or Terminal
- Raspberry Pi, Terminal
- No Network
- Docker container
- One machine run multiple Emacs instances with multiple versions in same time
- You are the master of your Emacs, …
- Navigating, finding, grepping in the same way whereever, …
- Org Mode that’s your new life, …
- Reliable programming experiments, C, Lisp, …
- Bash on Windows, …
Just one thing you need to do, clone it (just <500KB) to your HOME directory:
$ git clone --depth=1 https://github.com/junjiemars/.emacs.d.git ~/.emacs.d
First run More Reasonable Emacs, it should automatically do: * byte compile elisp source files. * install packages, if you enabled it and you have a Emacs-24.0+.
After first run More Reasonable Emacs, exit and then reopen Emacs.
On Windows, if you’d Git-Bash
installed but no Emacs, you are lucky, a one line code will do it all
for you and more: fix some Emacs’ issue for you, and you don’t need run
git clone ...
,
instead,
$ HAS_EMACS=1 bash <(curl https://raw.githubusercontent.com/junjiemars/kit/master/win/install-win-kits.sh)
Now, it will works perfectly, but if you want to more control and more features, such as themes, packages, and fonts etc., see next section: cooking
Suppose your Emacs HOME at ~/.emacs.d
and annotated it as emacs-home
.
Your private configuration directory at emacs-home/private/
and I
abbreviate it as (emacs-home* "private/")
. All things under it you can
rename, move, delete.
A magic function (clean-compiled-files)
, all Elisp files should be
compiled, so if meet some trouble, run it and reopen the Emacs.
Directory orgnization:
emacs-home ├── LICENSE ├── README.md ├── config (comment "all stuff here") ├── elpa (comment "installed packages") ├── init.el (comment "Emacs init file") ├── mnemonic.md ├── private (comment "your configuration can put here") │ ├── self-env-spec.el │ ├── self-epilogue.el │ ├── self-package-spec.el │ ├── self-path.el │ ├── self-prologue.el ├── screenshot.md └── theme (comment "themes directory")
Locate your sepc via (emacs-home* "private/self-path.el")
.
;; Run order: :env-spec -> :prelogue -> :package-spec -> :epilogue
;; You can point to your Gited Emacs' configuration repo.
;; Default samples `self-*.el' in `(emacs-home* "private/")' directory.
;; :epilogue run in `after-init-hook'
(def-self-path-ref
:env-spec (emacs-home* "private/self-env-spec.el")
:prologue (comment (emacs-home* "private/self-prologue.el"))
:package-spec (comment (emacs-home* "private/self-package-spec.el"))
:epilogue (comment (emacs-home* "private/self-epilogue.el")))
Easy to switch themes, or try a new one.
The theme’s spec locate in (emacs-home* "private/self-env-spec.el")
(def-self-env-spec
:theme (list :name 'atom-one-dark
:path (emacs-home* "theme/")
:compile nil ;; expert option
:allowed t))
Compiled theme more smooth and more faster if you had already confirmed the theme is secure.
Easy to swtich fonts and CJK characters, or try a new one. The default encoding is UTF-8.
The default font’s spec locate in
(emacs-home* "private/self-env-spec.el")
(def-self-env-spec
:font (list :name (platform-supported-if darwin
"Monaco-14"
(platform-supported-if windows-nt
"Consolas-13"
"DejaVu Sans Mono-12"))
:allowed t))
Any Shell
, copy environment variables, and on any platforms.
exec-path-from-shell has a poor implementation for the same functionalities, it is unstable and slow. But here, We had a builtin one, and more stable and more faster.
The shell spec locate in (emacs-home* "private/self-env-spec.el")
(def-self-env-spec
:shell (list :env-vars `("JAVA_HOME"
"PYTHONPATH"
,(platform-supported-unless windows-nt
(platform-supported-if darwin
"DYLD_LIBRARY_PATH"
"LD_LIBRARY_PATH")))
:interactive-shell (platform-supported-unless darwin t nil)
:exec-path t
:bin-path "/bin/bash"
:allowed t))
The eshell spec locate in (emacs-home* "private/self-env-spec.el")
(def-self-env-spec
:eshell (list :visual-commands '("mtr")
:destroy-buffer-when-process-dies t
:visual-subcommands '(("git" "log"))
:visual-options nil
:allowed t))
The desktop spec locate in (emacs-home* "private/self-env-spec.el")
(def-self-env-spec
:desktop (list :files-not-to-save
".*\.t?gz\\|\.desktop\\|~$\\|\\/ssh[: ]\\|\.elc$"
:buffers-not-to-save "^TAGS\\|\\.log"
:modes-not-to-save
'(dired-mode fundamental-mode rmail-mode)
:restore-eager 8
:allowed t))
Using socks proxy when installing packages or browsing web pages.
The socks spec locate in (emacs-home* "private/self-env-spec.el")
(def-self-env-spec
:socks (list :port 32000
:server "127.0.0.1"
:version 5
:allowed nil))
If :allowed t
, url-gateway-method
should be switch to 'socks
when
Emacs initializing. After Emacs initialization, you can toggle-socks!
and no matter :allowed
is t
or nil
.
Don’t tell me use-package,
it’s trying to redefine Emacs. Here you can find more simpler and faster
way to implement almost functionalities that use-pacakge
does.
There are two types of packages: basic*(just like Emacs’ builtin) and
*user defined. To disable user defined packages in
(def-self-path-ref)
, disable both basic and user defined packages
can be done in (def-self-env-spec)
.
(def-self-env-spec
:package (list :remove-unused nil
:allowed nil)
:cond
: decide whether to install:packages
or compile:compile
:packages
: a list of package names or tar file names:compile
: a list of files that should be compiled only or be loaded after be compiled
The default package spec locate in
(emacs-home* "private/self-package-spec.el")
(def-self-package-spec
(list
:cond (executable-find% "latex")
:packages '(auctex cdlatex))
(list
:cond (and (version-supported-p <= 24.4)
(executable-find% "java"))
:packages '(cider
clojure-mode
clojure-mode-extra-font-locking)
:compile `(,(compile-unit (emacs-home* "config/use-cider.el") t)
,(compile-unit (emacs-home* "config/use-cider-autoload.el"))))
(list
:cond (and (version-supported-p <= 24.4)
(executable-find% "docker"))
:packages '(dockerfile-mode
docker-tramp))
(list
:cond (executable-find% "erlc")
:packages '(erlang))
(list
:cond (and (executable-find% "erlc")
(executable-find% "lfe"))
:packages '(lfe-mode)
:compile `(,(compile-unit (emacs-home* "config/use-lfe-autoload.el"))))
(list
:cond (and (terminal-supported-p t)
(platform-supported-unless darwin t)
(version-supported-p <= 25.1))
:packages '(ereader))
(list
:cond (and (version-supported-p <= 24.4)
(executable-find% "git"))
:packages '(magit)
:compile `(,(compile-unit (emacs-home* "config/use-magit-autoload.el"))))
(list
:cond (and (version-supported-p <= 23.2)
(or (executable-find% "racket")
(executable-find% "chicken")))
:packages '(geiser))
(list
:cond (or (executable-find% "sbcl"))
:packages '(slime)
:compile `(,(compile-unit (emacs-home* "config/use-slime.el"))
,(compile-unit (emacs-home* "config/use-slime-autoload.el")))))
Avoiding a war.
(def-self-env-spec
:edit (list :tab-with 2
:auto-save-default nil
:allowed t)
- Check Emacs configurations:
- M: system-configuration-options
- M: system-configuration-features
- M: features
- M: (clean-compiled-files) then exit and reopen Emacs.
- Check
*Compilation-Log*
buffer, then do #2. - Disable the problematic item in
(emacs-home* "private/self-path.el")
, then do #2.