Updated some paths, fixed some code style, added back some shortcuts

Updated some paths after the Emacs configuration directory was moved

Some variables in my dotspacemacs were renamed in order to follow the
Spacemacs coding style with a ~//~ used for marking private variables,
and I prefixed their name with ~dotspacemacs-~ in order to avoid any
collision with other packages or configuration I write.

Added back M-« and M-» in order to fix the M-< and M-> shortcuts issue
with the bépo layout.
This commit is contained in:
Lucien Cartier-Tilet 2020-02-16 23:51:17 +01:00
parent 3e841fa0b2
commit b115f6cd8c
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
2 changed files with 39 additions and 33 deletions

View File

@ -4,31 +4,31 @@
This function is called at the very beginning of Spacemacs startup,
before layer configuration.
It should only modify the values of Spacemacs settings."
(setq phundrak/src-dir (concat (getenv "HOME") "/.emacs.d/private/")
phundrak/gnus-uc (concat (getenv "HOME") "/.gnus.el")
phundrak/src (concat (getenv "HOME") "/org/config/spacemacs.org")
phundrak/si (concat phundrak/src-dir "spacemacs-init.el")
phundrak/sl (concat phundrak/src-dir "spacemacs-layers.el")
phundrak/uc (concat phundrak/src-dir "user-config.el")
phundrak/ui (concat phundrak/src-dir "user-init.el"))
(when (or (file-newer-than-file-p phundrak/src phundrak/si)
(file-newer-than-file-p phundrak/src phundrak/sl)
(file-newer-than-file-p phundrak/src phundrak/ui)
(file-newer-than-file-p phundrak/src phundrak/uc)
(file-newer-than-file-p phundrak/src phundrak/gnus-uc))
(setq phundrak//dotspacemacs-src-dir (concat (getenv "HOME") "/.config/emacs/private/")
phundrak//dotspacemacs-gc (concat (getenv "HOME") "/.gnus.el")
phundrak//dotspacemacs-src (concat (getenv "HOME") "/org/config/spacemacs.org")
phundrak//dotspacemacs-si (concat phundrak//dotspacemacs-src-dir "spacemacs-init.el")
phundrak//dotspacemacs-sl (concat phundrak//dotspacemacs-src-dir "spacemacs-layers.el")
phundrak//dotspacemacs-uc (concat phundrak//dotspacemacs-src-dir "user-config.el")
phundrak//dotspacemacs-ui (concat phundrak//dotspacemacs-src-dir "user-init.el"))
(when (or (file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-si)
(file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-sl)
(file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-ui)
(file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-uc)
(file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-gc))
(princ "Exporting new Emacs configuration from spacemacs.org through org-babel...")
(call-process
(concat invocation-directory invocation-name)
nil nil t
"-q" "--batch" "--eval" "(require 'ob-tangle)"
"--eval" (format "(org-babel-tangle-file \"%s\")" phundrak/src))
"--eval" (format "(org-babel-tangle-file \"%s\")" phundrak//dotspacemacs-src))
(princ "done"))
(load-file phundrak/si))
(load-file phundrak//dotspacemacs-si))
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(load-file phundrak/sl))
(load-file phundrak//dotspacemacs-sl))
(defun dotspacemacs/user-env ()
"Environment variables setup.
@ -44,7 +44,7 @@ This function is called immediately after `dotspacemacs/init', before layer
configuration.
It is mostly for variables that should be set before packages are loaded.
If you are unsure, try setting them in `dotspacemacs/user-config' first."
(load-file phundrak/ui))
(load-file phundrak//dotspacemacs-ui))
(defun dotspacemacs/user-load ()
"Library to load while dumping.
@ -59,7 +59,7 @@ This function is called at the very end of Spacemacs startup, after layer
configuration.
Put your configuration code here, except for variables that should be set
before packages are loaded."
(load-file phundrak/uc))
(load-file phundrak//dotspacemacs-uc))
;; Do not write anything past this comment. This is where Emacs will

View File

@ -135,7 +135,7 @@
* Spacemacs layers and packages
:PROPERTIES:
:header-args:emacs-lisp: :comments link :tangle ~/.emacs.d/private/spacemacs-layers.el :exports code
:header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/spacemacs-layers.el :exports code
:CUSTOM_ID: h-9d9869e0-4672-419c-bf37-3d3ae1b7c0aa
:END:
Here will be our layer configuration set. Everything here is set with a
@ -646,7 +646,7 @@
* Init
:PROPERTIES:
:CUSTOM_ID: h-3f3c8a0b-56cd-4be6-b019-3ba6f1e24f96
:header-args:emacs-lisp: :comments link :tangle ~/.emacs.d/private/spacemacs-init.el :exports code
:header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/spacemacs-init.el :exports code
:END:
The ~dotspacemacs/init~ function is the one called at the very begining of the
Spacemacs startup, before any kind of configuration, including the layer
@ -687,7 +687,7 @@
should be added when invoking Emacs 27.1 executable from the command line,
for instance:
#+BEGIN_SRC sh :tangle no :exports code
./emacs --dump-file=~/.emacs.d/.cache/dumps/spacemacs.pdmp
./emacs --dump-file=~/.config/emacs/.cache/dumps/spacemacs.pdmp
#+END_SRC
The default value of this variable is ="spacemacs.pdmp"=.
#+BEGIN_SRC emacs-lisp
@ -1202,7 +1202,7 @@
You can also set a custom emacs server socket location. If the value is
~nil~, Emacs will use whatever the Emacs default is, otherwise a directory
path like ="~/.emacs.d/server"=. It has no effect if
path like ="~/.config/emacs/server"=. It has no effect if
~dotspacemacs-enable-server~ is ~nil~.
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-server-socket-dir nil)
@ -1263,13 +1263,13 @@
* User Initialization
:PROPERTIES:
:CUSTOM_ID: h-e297b9be-9b0d-4c2d-bb6e-402f0d00be0d
:header-args:emacs-lisp: :comments link :tangle ~/.emacs.d/private/user-init.el :exports code
:header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/user-init.el :exports code
:END:
While Emacs and especially Spacemacs loads, I want it to initialize some
elements and load some packages. First of all, I want it to load my private
Emacs config file:
#+BEGIN_SRC emacs-lisp
(load "~/.emacs.d/private/private_emacs.el")
(load "~/.config/emacs/private/private_emacs.el")
#+END_SRC
Then, I want a couple of requires:
@ -1308,7 +1308,7 @@
* User Configuration
:PROPERTIES:
:CUSTOM_ID: h-7a36d3a0-8bb6-4d9d-9402-eadbc49fef32
:header-args:emacs-lisp: :comments link :tangle ~/.emacs.d/private/user-config.el :exports code
:header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/user-config.el :exports code
:END:
** ASM configuration
:PROPERTIES:
@ -2688,11 +2688,17 @@
:PROPERTIES:
:CUSTOM_ID: h-f193126f-abc1-4287-aa70-4f2080d2ef8f
:END:
As you will see, I defined A LOT of custom shortcuts. All of them are
As you will see, I defined a LOT of custom shortcuts. Most of them are
Spacemacs shortcuts, defined in a way they can be used seamlessly with Evil.
First of all, these shortcuts all begin with ~o~, which is a prefix reserved
for user-defined shortcuts so they wont conflict with any package. Lets
declare it like so.
Only two shortcuts are defined the vanilla way for Emacs:
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "M-»") 'end-of-buffer)
(global-set-key (kbd "M-«") 'beginning-of-buffer)
#+END_SRC
Spacemacs shortcuts all begin with ~o~, which is a prefix reserved for
user-defined shortcuts so they wont conflict with any package. Lets declare
it like so.
#+BEGIN_SRC emacs-lisp
(spacemacs/declare-prefix "o" "custom")
#+END_SRC
@ -2704,16 +2710,16 @@
Before some more specialized categories, I have two commands which dont fit
into any other category that I sometime use:
#+BEGIN_SRC emacs-lisp
(spacemacs/declare-prefix "oB" "byte-compile .emacs.d")
(spacemacs/declare-prefix "oB" "byte-compile ~/.config/emacs")
(spacemacs/declare-prefix "or" "external command")
(spacemacs/set-leader-keys
"oB" (lambda () (byte-recompile-directory (expand-file-name "~/.emacs.d") 0))
"oB" (lambda () (byte-recompile-directory (expand-file-name "~/.config/emacs") 0))
"or" 'helm-run-external-command)
#+END_SRC
~oB~ byte-compiles every ~.el~ file located in the =~/.emacs.d/= directory —
it can be useful in case of package upgrade and an old ~.elc~ file still
loads instead of an uncompiled but newer ~.el~ file.
~oB~ byte-compiles every ~.el~ file located in the =~/.config/emacs/=
directory — it can be useful in case of package upgrade and an old ~.elc~
file still loads instead of an uncompiled but newer ~.el~ file.
~or~ on the other hand invokes an external comand the same way [[https://wiki.archlinux.org/index.php/Dmenu][dmenu]] would.