From b1f2be0016b4d6f74d0b4c82691ec80501712576 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Wed, 23 Dec 2020 01:54:07 +0100 Subject: [PATCH] [Emacs] Remove w3m layer, compile configuration files when exported The w3m layer is now removed as I did not use it at all. The conlanging layer is moved to ~/fromGIT/emacs-packages and now a symlink points to its new location. This is done in order to prevent Emacs from compiling its .el files when recompiling its configuration files. Configuration files are now compiled when emacs.org is tangled by Emacs itself or if the .el files are newer than the .elc files. TODO: find a way to natively compile and load these files instead of just byte-compile them if native compilation is available --- .config/emacs/private/conlanging | 2 +- .config/emacs/private/w3m | 1 - .gitmodules | 5 +---- .spacemacs | 29 ++++++++++++++++------------- fromGIT/emacs-packages/conlanging | 1 + org/config/emacs.org | 28 +++++++++++++++------------- 6 files changed, 34 insertions(+), 32 deletions(-) mode change 160000 => 120000 .config/emacs/private/conlanging delete mode 160000 .config/emacs/private/w3m create mode 160000 fromGIT/emacs-packages/conlanging diff --git a/.config/emacs/private/conlanging b/.config/emacs/private/conlanging deleted file mode 160000 index 15ae526..0000000 --- a/.config/emacs/private/conlanging +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 15ae526299b4274948dcd62a0829fec631024dd9 diff --git a/.config/emacs/private/conlanging b/.config/emacs/private/conlanging new file mode 120000 index 0000000..7a635f7 --- /dev/null +++ b/.config/emacs/private/conlanging @@ -0,0 +1 @@ +/home/phundrak/fromGIT/emacs-packages/conlanging \ No newline at end of file diff --git a/.config/emacs/private/w3m b/.config/emacs/private/w3m deleted file mode 160000 index df38ad9..0000000 --- a/.config/emacs/private/w3m +++ /dev/null @@ -1 +0,0 @@ -Subproject commit df38ad925491e57bfc8db1bcde2fb032c5d2e35c diff --git a/.gitmodules b/.gitmodules index c4b92a4..3e4142b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,11 +2,8 @@ path = .config/tmux url = https://github.com/gpakosz/.tmux.git [submodule ".config/emacs/private/conlanging"] - path = .config/emacs/private/conlanging + path = fromGIT/emacs-packages/conlanging url = https://labs.phundrak.com/phundrak/conlang-layer -[submodule ".config/emacs/private/w3m"] - path = .config/emacs/private/w3m - url = https://github.com/venmos/w3m-layer.git [submodule ".mozilla/firefox/lruehqec.default/chrome"] path = .mozilla/firefox/lruehqec.default/chrome url = git@labs.phundrak.com:phundrak/blurredfox-nord.git diff --git a/.spacemacs b/.spacemacs index c03ab58..acb93bf 100644 --- a/.spacemacs +++ b/.spacemacs @@ -6,14 +6,14 @@ before layer configuration. It should only modify the values of Spacemacs settings." (setq phundrak//dotspacemacs-src-dir "~/.config/emacs/private/" phundrak//dotspacemacs-src "~/org/config/emacs.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)) + phundrak//dotspacemacs-si (concat phundrak//dotspacemacs-src-dir "spacemacs-init") + phundrak//dotspacemacs-sl (concat phundrak//dotspacemacs-src-dir "spacemacs-layers") + phundrak//dotspacemacs-uc (concat phundrak//dotspacemacs-src-dir "user-config") + phundrak//dotspacemacs-ui (concat phundrak//dotspacemacs-src-dir "user-init")) + (when (or (file-newer-than-file-p phundrak//dotspacemacs-src (concat phundrak//dotspacemacs-si ".el")) + (file-newer-than-file-p phundrak//dotspacemacs-src (concat phundrak//dotspacemacs-sl ".el")) + (file-newer-than-file-p phundrak//dotspacemacs-src (concat phundrak//dotspacemacs-ui ".el")) + (file-newer-than-file-p phundrak//dotspacemacs-src (concat phundrak//dotspacemacs-uc ".el"))) (message "Exporting new Emacs configuration from spacemacs.org through org-babel...") (with-temp-buffer (shell-command (format "emacs -Q --batch %s %s %s" @@ -22,13 +22,16 @@ It should only modify the values of Spacemacs settings." (format "--eval '(org-babel-tangle-file \"%s\")'" phundrak//dotspacemacs-src)) (current-buffer))) - (message "done")) - (load-file phundrak//dotspacemacs-si)) + (message "Exporting new Emacs configuration from spacemacs.org through org-babel...done") + (with-temp-buffer + (byte-recompile-directory phundrak//dotspacemacs-src-dir + 0 t))) + (load phundrak//dotspacemacs-si)) (defun dotspacemacs/layers () "Layer configuration: This function should only modify configuration layer settings." - (load-file phundrak//dotspacemacs-sl)) + (load phundrak//dotspacemacs-sl)) (defun dotspacemacs/user-env () "Environment variables setup. @@ -44,7 +47,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//dotspacemacs-ui)) + (load phundrak//dotspacemacs-ui)) (defun dotspacemacs/user-load () "Library to load while dumping. @@ -59,7 +62,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//dotspacemacs-uc)) + (load phundrak//dotspacemacs-uc)) ;; Do not write anything past this comment. This is where Emacs will diff --git a/fromGIT/emacs-packages/conlanging b/fromGIT/emacs-packages/conlanging new file mode 160000 index 0000000..15ae526 --- /dev/null +++ b/fromGIT/emacs-packages/conlanging @@ -0,0 +1 @@ +Subproject commit 15ae526299b4274948dcd62a0829fec631024dd9 diff --git a/org/config/emacs.org b/org/config/emacs.org index 66e6d06..d2c4c81 100644 --- a/org/config/emacs.org +++ b/org/config/emacs.org @@ -80,6 +80,7 @@ With the variable ~dotspacemacs-additional-packages~, it is possible to install | outorg | edit comments as Org-mode buffers | | pinentry | enter a GPG password from Emacs | | s | The long lost Emacs string manipulation library. | +| sicp | Texinfo version of the [[https://mitpress.mit.edu/sites/default/files/sicp/index.html][SICP]] | | visual-fill-column | allow the use of ~fill-column~ in ~visual-line-mode~ | | wrap-region | easily wrap region with delimiters | | wttrin | weather in Emacs | @@ -510,9 +511,9 @@ Unfortunately, I have to write Swift code for one of my university courses, so h :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Custom_layers-69473533 :END: -Lastly, two custom layers have been enabled: a w3m layer, and my custom layers for conlanging tools. +Lastly, one custom layers have been enabled: my custom layers for conlanging tools. #+BEGIN_SRC emacs-lisp -conlanging w3m +conlanging #+END_SRC # Don’t delete this code block, it wraps the layers @@ -1563,7 +1564,7 @@ When I’m in Eshell, sometimes I wish to open multiple files at once in Emacs. (defadvice find-file (around find-files activate) "Also find all files within a list of files. This even works recursively." (if (listp filename) - (loop for f in filename do (find-file f wildcards)) + (cl-loop for f in filename do (find-file f wildcards)) ad-do-it)) #+END_SRC @@ -1639,7 +1640,7 @@ The banner for Eshell will collect some system information and display them grac - How full are its mountpoints Some of these information can be grabbed directly from Emacs built-in functions, but some others need to be retrieved manually. Let’s first get into it with the mounted partitions for which we’ll define a structure: #+BEGIN_SRC emacs-lisp - (defstruct phundrak/mounted-partitions + (cl-defstruct phundrak/mounted-partitions "Object representing a mounted partition found in the system" path size used percent) #+END_SRC @@ -3085,8 +3086,8 @@ Now, let’s declare the following keybindings: :END: A couple of keybindings will be added to Dired. The first one is the opening parenthesis which will enable or disable ~dired-hide-details-mode~. On the other hand, a closing parenthesis will show git information in the current Dired buffer. #+BEGIN_SRC emacs-lisp - (evil-define-key 'normal dired-mode-map "(" 'dired-hide-details-mode) - (evil-define-key 'normal dired-mode-map ")" 'dired-git-info-mode) + (define-key dired-mode-map (kbd "(") 'dired-hide-details-mode) + (define-key dired-mode-map (kbd ")") 'dired-git-info-mode) #+END_SRC Something I use from time to time is ~S-F1~ for opening dired in my ~$HOME~ directory. For that, I simply did the following: @@ -3096,9 +3097,9 @@ Something I use from time to time is ~S-F1~ for opening dired in my ~$HOME~ dire A couple of other useful utilities, sach as opening all marked files, sorting files, opening them externally and renaming them, are also bound to a simple key press: #+BEGIN_SRC emacs-lisp - (evil-define-key 'normal dired-mode-map "f" 'phundrak/open-marked-files) - (evil-define-key 'normal dired-mode-map "F" 'xah/open-in-external-app) - (evil-define-key 'normal dired-mode-map "s" 'xah/dired-sort) + (define-key dired-mode-map (kbd "f") 'phundrak/open-marked-files) + (define-key dired-mode-map (kbd "F") 'xah/open-in-external-app) + (define-key dired-mode-map (kbd "s") 'xah/dired-sort) #+END_SRC *** Files @@ -3130,10 +3131,11 @@ Just to make it easier to launch it, I’ll declare a shortcut for launching tet Apparently, no evil keybindings are set for Tetris. Let’s declare them (adapted to the bépo layout): #+BEGIN_SRC emacs-lisp - (evil-define-key 'emacs tetris-mode-map "c" 'tetris-move-left) - (evil-define-key 'emacs tetris-mode-map "t" 'tetris-move-down) - (evil-define-key 'emacs tetris-mode-map "s" 'tetris-rotate-prev) - (evil-define-key 'emacs tetris-mode-map "r" 'tetris-move-right) + (require 'tetris) + (define-key tetris-mode-map (kbd "c") 'tetris-move-left) + (define-key tetris-mode-map (kbd "t") 'tetris-move-down) + (define-key tetris-mode-map (kbd "s") 'tetris-rotate-prev) + (define-key tetris-mode-map (kbd "r") 'tetris-move-right) #+END_SRC *** Multiple cursors