makefile: reload running Emacs after tasks + refactor
This commit is contained in:
parent
9a126a1274
commit
f1208e9179
4 changed files with 64 additions and 49 deletions
8
Makefile
8
Makefile
|
@ -4,18 +4,22 @@ all: install update autoloads
|
||||||
|
|
||||||
install: init.el
|
install: init.el
|
||||||
@$(EMACS) --batch -l core/core.el -f 'doom/packages-install'
|
@$(EMACS) --batch -l core/core.el -f 'doom/packages-install'
|
||||||
|
@$(EMACSCLIENT) -e '(doom/reload)' >/dev/null 2>&1 || true
|
||||||
|
|
||||||
update: init.el
|
update: init.el
|
||||||
@$(EMACS) --batch -l core/core.el -f 'doom/packages-update'
|
@$(EMACS) --batch -l core/core.el -f 'doom/packages-update'
|
||||||
|
@$(EMACSCLIENT) -e '(doom/reload)' >/dev/null 2>&1 || true
|
||||||
|
|
||||||
clean: init.el
|
clean: init.el
|
||||||
@$(EMACS) --batch -l core/core.el -f 'doom/packages-autoremove'
|
@$(EMACS) --batch -l core/core.el -f 'doom/packages-autoremove'
|
||||||
|
@$(EMACSCLIENT) -e '(doom/reload)' >/dev/null 2>&1 || true
|
||||||
|
|
||||||
autoloads: init.el
|
autoloads: init.el
|
||||||
@$(EMACS) --batch -l core/core.el -f 'doom/refresh-autoloads'
|
@$(EMACS) --batch -l init.el -f 'doom/refresh-autoloads'
|
||||||
|
@$(EMACSCLIENT) -e '(doom/reload)' >/dev/null 2>&1 || true
|
||||||
|
|
||||||
compile: init.el clean-elc
|
compile: init.el clean-elc
|
||||||
@$(EMACS) --batch -l core/core.el -f 'doom/byte-compile'
|
@$(EMACS) --batch -l init.el -f 'doom/byte-compile'
|
||||||
|
|
||||||
compile-all: init.el clean-elc
|
compile-all: init.el clean-elc
|
||||||
@$(EMACS) --batch -l core/core.el --eval '(doom/byte-compile t)'
|
@$(EMACS) --batch -l core/core.el --eval '(doom/byte-compile t)'
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
select-enable-clipboard t
|
select-enable-clipboard t
|
||||||
select-enable-primary t)
|
select-enable-primary t)
|
||||||
|
|
||||||
(let ((inhibit-message t))
|
(unless noninteractive
|
||||||
;; Save point across sessions
|
;; Save point across sessions
|
||||||
(require 'saveplace)
|
(require 'saveplace)
|
||||||
(setq save-place-file (concat doom-cache-dir "saveplace")
|
(setq save-place-file (concat doom-cache-dir "saveplace")
|
||||||
|
@ -50,8 +50,7 @@
|
||||||
(require 'savehist)
|
(require 'savehist)
|
||||||
(setq savehist-file (concat doom-cache-dir "savehist")
|
(setq savehist-file (concat doom-cache-dir "savehist")
|
||||||
savehist-save-minibuffer-history t
|
savehist-save-minibuffer-history t
|
||||||
savehist-additional-variables
|
savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
|
||||||
'(kill-ring search-ring regexp-search-ring))
|
|
||||||
(savehist-mode 1)
|
(savehist-mode 1)
|
||||||
|
|
||||||
;; Remove text-property cruft from history
|
;; Remove text-property cruft from history
|
||||||
|
@ -76,7 +75,7 @@
|
||||||
recentf-max-saved-items 250
|
recentf-max-saved-items 250
|
||||||
recentf-auto-cleanup 600
|
recentf-auto-cleanup 600
|
||||||
recentf-filename-handlers '(abbreviate-file-name))
|
recentf-filename-handlers '(abbreviate-file-name))
|
||||||
(recentf-mode 1)
|
(quiet! (recentf-mode 1))
|
||||||
|
|
||||||
;; Ediff
|
;; Ediff
|
||||||
(add-hook! ediff-load
|
(add-hook! ediff-load
|
||||||
|
@ -131,8 +130,8 @@
|
||||||
'css-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
|
'css-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
|
||||||
(sp-local-pair '(sh-mode markdown-mode) "`" nil
|
(sp-local-pair '(sh-mode markdown-mode) "`" nil
|
||||||
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||||
(sp-with-modes '(xml-mode nxml-mode php-mode)
|
(sp-local-pair '(xml-mode nxml-mode php-mode)
|
||||||
(sp-local-pair "<!--" "-->" :post-handlers '(("| " "SPC")))))
|
"<!--" "-->" :post-handlers '(("| " "SPC"))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -191,7 +190,7 @@
|
||||||
(package! wgrep
|
(package! wgrep
|
||||||
:commands (wgrep-setup wgrep-change-to-wgrep-mode)
|
:commands (wgrep-setup wgrep-change-to-wgrep-mode)
|
||||||
:config
|
:config
|
||||||
(def-popup! ("^\\*ivy-occur counsel-ag" :size 25 :select t :regexp t))
|
(set! :popup ("^\\*ivy-occur counsel-ag" :size 25 :select t :regexp t))
|
||||||
(setq wgrep-auto-save-buffer t)
|
(setq wgrep-auto-save-buffer t)
|
||||||
(advice-add 'wgrep-abort-changes :after 'doom/popup-close)
|
(advice-add 'wgrep-abort-changes :after 'doom/popup-close)
|
||||||
(advice-add 'wgrep-finish-edit :after 'doom/popup-close))
|
(advice-add 'wgrep-finish-edit :after 'doom/popup-close))
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
(require 'dash)
|
(require 'dash)
|
||||||
(require 'f)
|
(require 'f)
|
||||||
(require 's)
|
(require 's)
|
||||||
|
(eval-when-compile (require 'cl-lib))
|
||||||
|
|
||||||
(package! anaphora
|
(package! anaphora
|
||||||
:commands (awhen aif acond awhile))
|
:commands (awhen aif acond awhile))
|
||||||
|
@ -44,6 +45,13 @@ during compilation."
|
||||||
'with-no-warnings)
|
'with-no-warnings)
|
||||||
(with-eval-after-load ',feature ,@forms)))
|
(with-eval-after-load ',feature ,@forms)))
|
||||||
|
|
||||||
|
(defmacro quiet! (&rest forms)
|
||||||
|
"Run FORMS without making any noise (no messages)."
|
||||||
|
`(cl-letf (((symbol-function 'load-file) (lambda (file) (load file nil t)))
|
||||||
|
((symbol-function 'message) (lambda (&rest _)))
|
||||||
|
(inhibit-message t))
|
||||||
|
,@forms))
|
||||||
|
|
||||||
(defmacro add-hook! (hook &rest func-or-forms)
|
(defmacro add-hook! (hook &rest func-or-forms)
|
||||||
"A convenience macro for `add-hook'.
|
"A convenience macro for `add-hook'.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
;;; core-packages.el
|
;;; core-packages.el
|
||||||
|
;;
|
||||||
;; Emacs package management is opinionated. Unfortunately, so am I. So I
|
;; Emacs package management is opinionated. Unfortunately, so am I. So I
|
||||||
;; combined `use-package`, quelpa and package.el to manage my plugins.
|
;; combined `use-package', `quelpa' and package.el to manage my plugins.
|
||||||
;;
|
;;
|
||||||
;; Why all the trouble? Because:
|
;; Why all the trouble? Because:
|
||||||
;; 1. Scriptability: I want my plugins managable from the command line (as well
|
;; 1. Scriptability: I want my plugins managable from the command line (as well
|
||||||
|
@ -57,7 +57,7 @@ if you have byte-compiled your configuration (as intended).")
|
||||||
quelpa-dir (expand-file-name "quelpa" doom-packages-dir)
|
quelpa-dir (expand-file-name "quelpa" doom-packages-dir)
|
||||||
;; ssh, no tears. Only compiling.
|
;; ssh, no tears. Only compiling.
|
||||||
byte-compile-warnings
|
byte-compile-warnings
|
||||||
'(unresolved callargs obsolete noruntime cl-functions make-local constants suspicious))
|
'(redefine callargs obsolete cl-functions interactive-only mapcar constants suspicious))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -143,12 +143,16 @@ avoided to speed up startup."
|
||||||
(and load-file-name (f-dirname load-file-name))
|
(and load-file-name (f-dirname load-file-name))
|
||||||
(and buffer-file-name (f-dirname buffer-file-name))
|
(and buffer-file-name (f-dirname buffer-file-name))
|
||||||
default-directory
|
default-directory
|
||||||
|
(and (bound-and-true-p byte-compile-current-file)
|
||||||
|
(f-dirname byte-compile-current-file))
|
||||||
(error "__DIR__ is unset")))
|
(error "__DIR__ is unset")))
|
||||||
|
|
||||||
(defun __FILE__ ()
|
(defun __FILE__ ()
|
||||||
(or __FILE__
|
(or __FILE__
|
||||||
load-file-name
|
load-file-name
|
||||||
buffer-file-name
|
buffer-file-name
|
||||||
|
(and (bound-and-true-p byte-compile-current-file)
|
||||||
|
byte-compile-current-file)
|
||||||
(error "__FILE__ is unset")))
|
(error "__FILE__ is unset")))
|
||||||
|
|
||||||
(defmacro use-package! (name &rest plist)
|
(defmacro use-package! (name &rest plist)
|
||||||
|
@ -237,34 +241,37 @@ Examples:
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defun doom/reload ()
|
(defun doom/reload ()
|
||||||
"Reload `load-path' by reinitializing package.el. Run this if you ran update
|
"Reload `load-path', `doom-enabled-modules' and `doom-packages' by
|
||||||
or delete packages from outside of Emacs."
|
reinitializing doom and parsing config files for `package!' and `doom!' calls.
|
||||||
|
There are few reasons to use this."
|
||||||
(interactive)
|
(interactive)
|
||||||
(doom-initialize t)
|
(doom-initialize t)
|
||||||
|
(doom-read-packages t)
|
||||||
|
(doom-initialize-autoloads)
|
||||||
(message "Reloaded %s packages" (length package-alist)))
|
(message "Reloaded %s packages" (length package-alist)))
|
||||||
|
|
||||||
(defun doom/refresh-autoloads ()
|
(defun doom/refresh-autoloads ()
|
||||||
"Refreshes the autoloads.el file, which tells Emacs where to find all the
|
"Refreshes the autoloads.el file, which tells Emacs where to find all the
|
||||||
autoloaded functions in the modules you use or among the core libraries.
|
autoloaded functions in the modules you use or among the core libraries, e.g.
|
||||||
|
core/autoload/*.el.
|
||||||
|
|
||||||
In modules, checks for modules/*/autoload.el and modules/*/autoload/*.el.
|
In modules, checks modules/*/autoload.el and modules/*/autoload/*.el.
|
||||||
|
|
||||||
Rerun this whenever you modify your init.el (or use `make autoloads` from the
|
Rerun this whenever init.el is modified. You can also use `make autoloads` from
|
||||||
command line)."
|
the commandline."
|
||||||
(interactive)
|
(interactive)
|
||||||
(doom-read-packages nil t)
|
(let ((generated-autoload-file doom-autoload-file)
|
||||||
(let ((generated-autoload-file (concat doom-local-dir "autoloads.el"))
|
autoload-files)
|
||||||
(autoload-files
|
(setq autoload-files
|
||||||
(append (-flatten (mapcar (lambda (dir)
|
(append (-flatten (--map (let ((auto-dir (f-expand "autoload" it))
|
||||||
(let ((auto-dir (f-expand "autoload" dir))
|
(auto-file (f-expand "autoload.el" it)))
|
||||||
(auto-file (f-expand "autoload.el" dir)))
|
(cond ((f-directory-p auto-dir)
|
||||||
(cond ((f-directory-p auto-dir)
|
(f-glob "*.el" auto-dir))
|
||||||
(f-glob "*.el" auto-dir))
|
((f-exists-p auto-file)
|
||||||
((f-exists-p auto-file)
|
auto-file)))
|
||||||
auto-file))))
|
|
||||||
(--map (doom-module-path (car it) (cdr it))
|
(--map (doom-module-path (car it) (cdr it))
|
||||||
doom-enabled-modules)))
|
doom-enabled-modules)))
|
||||||
(f-glob "autoload/*.el" doom-core-dir))))
|
(f-glob "autoload/*.el" doom-core-dir)))
|
||||||
(when (f-exists-p generated-autoload-file)
|
(when (f-exists-p generated-autoload-file)
|
||||||
(f-delete generated-autoload-file)
|
(f-delete generated-autoload-file)
|
||||||
(message "Deleted old autoloads.el"))
|
(message "Deleted old autoloads.el"))
|
||||||
|
@ -276,27 +283,25 @@ command line)."
|
||||||
(eval-buffer))
|
(eval-buffer))
|
||||||
(message "Done!")))
|
(message "Done!")))
|
||||||
|
|
||||||
(defun doom/byte-compile (&optional comprehensive-p)
|
(defun doom/byte-compile (&optional simple-p)
|
||||||
"Byte (re)compile the important files in your emacs configuration (i.e.
|
"Byte (re)compile the important files in your emacs configuration (init.el &
|
||||||
init.el, core/*.el and modules/*/*/config.el) DOOM Emacs was designed to benefit
|
core/*.el). DOOM Emacs was designed to benefit from this.
|
||||||
a lot from this.
|
|
||||||
|
|
||||||
If COMPREHENSIVE-P is non-nil, then compile modules/*/*/*.el (except for
|
If SIMPLE-P is nil, also byte-compile modules/*/*/*.el (except for packages.el).
|
||||||
packages.el files) -- this will likely take a long time."
|
There should be a measurable benefit from this, but it may take a while."
|
||||||
(interactive)
|
(interactive)
|
||||||
(doom-read-packages)
|
(let ((targets
|
||||||
(let ((targets (append
|
(append (list (f-expand "init.el" doom-emacs-dir)
|
||||||
(list (f-expand "init.el" doom-emacs-dir)
|
(f-expand "core.el" doom-core-dir))
|
||||||
(f-expand "core.el" doom-core-dir))
|
(f-glob "core-*.el" doom-core-dir)
|
||||||
(f-glob "core-*.el" doom-core-dir)
|
(unless simple-p
|
||||||
(-flatten
|
(-flatten
|
||||||
(--map (f--entries (doom-module-path (car it) (cdr it))
|
(--map (f--entries (doom-module-path (car it) (cdr it))
|
||||||
(and (f-ext-p it "el")
|
(and (f-ext-p it "el")
|
||||||
(or comprehensive-p
|
(or (string= (f-base it) "config")
|
||||||
(string= (f-base it) "config")
|
(string-prefix-p "+" (f-base it))))
|
||||||
(string-prefix-p "+" (f-base it))))
|
t)
|
||||||
t)
|
doom-enabled-modules)))))
|
||||||
doom-enabled-modules))))
|
|
||||||
(n 0)
|
(n 0)
|
||||||
results)
|
results)
|
||||||
(dolist (file targets)
|
(dolist (file targets)
|
||||||
|
@ -353,7 +358,6 @@ packages.el files) -- this will likely take a long time."
|
||||||
(setq forms (append forms plist)))
|
(setq forms (append forms plist)))
|
||||||
forms))
|
forms))
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun doom-read-packages (&optional force-p nopackages)
|
(defun doom-read-packages (&optional force-p nopackages)
|
||||||
"Parses your Emacs config to keep track of packages declared with `package!'
|
"Parses your Emacs config to keep track of packages declared with `package!'
|
||||||
in `doom-packages' and enabled modules in `doom-enabled-modules'."
|
in `doom-packages' and enabled modules in `doom-enabled-modules'."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue