Merge branch 'develop' of https://github.com/hlissner/doom-emacs into develop

This commit is contained in:
teesloane 2017-12-06 10:01:22 -05:00
commit ee611ca8af
11 changed files with 86 additions and 67 deletions

View file

@ -162,18 +162,17 @@ compilation."
"Run FORMS without making any noise."
`(if doom-debug-mode
(progn ,@forms)
(fset 'doom--old-write-region-fn (symbol-function 'write-region))
(cl-letf ((standard-output (lambda (&rest _)))
(let ((old-fn (symbol-function 'write-region)))
(cl-letf* ((standard-output (lambda (&rest _)))
((symbol-function 'load-file) (lambda (file) (load file nil t)))
((symbol-function 'message) (lambda (&rest _)))
((symbol-function 'write-region)
(lambda (start end filename &optional append visit lockname mustbenew)
(unless visit (setq visit 'no-message))
(doom--old-write-region-fn
start end filename append visit lockname mustbenew)))
(funcall old-fn start end filename append visit lockname mustbenew)))
(inhibit-message t)
(save-silently t))
,@forms)))
,@forms))))
(defvar doom--transient-counter 0)
(defmacro add-transient-hook! (hook &rest forms)

View file

@ -68,7 +68,7 @@ package's name as a symbol, and whose CDR is the plist supplied to its
`package!' declaration. Set by `doom-initialize-packages'.")
(defvar doom-core-packages
'(persistent-soft quelpa use-package async)
'(persistent-soft use-package quelpa)
"A list of packages that must be installed (and will be auto-installed if
missing) and shouldn't be deleted.")
@ -92,16 +92,22 @@ base by `doom!' and for calculating how many packages exist.")
(defvar doom--refreshed-p nil)
(setq load-prefer-newer (or noninteractive doom-debug-mode)
package--init-file-ensured t
(setq package--init-file-ensured t
package-user-dir (expand-file-name "elpa" doom-packages-dir)
package-enable-at-startup nil
package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/"))
("melpa" . "https://melpa.org/packages/")
("melpa-stable" . "https://stable.melpa.org/packages/"))
;; I omit Marmalade because its packages are manually submitted rather
;; than pulled, so packages are often out of date with upstream.
;; Don't gamble with these packages. Only retrieve stable versions. Quelpa
;; is omitted because it isn't on melpa-stable.
package-pinned-packages
'((use-package . "melpa-stable")
(persistent-soft . "melpa-stable"))
;; security settings
gnutls-verify-error (not (getenv "INSECURE")) ; you shouldn't use this
tls-checktrust gnutls-verify-error
@ -152,9 +158,9 @@ startup."
(package-refresh-contents)
(setq doom--refreshed-p t)
(package-initialize t)))
;; We could let `package-initialize' fill `load-path', but it costs precious
;; milliseconds and does other stuff I don't need (like load autoload
;; files). My premature optimization quota isn't filled yet.
;; We could let `package-initialize' fill `load-path', but it does more than
;; that alone (like load autoload files). If you want something prematurely
;; optimizated right, ya gotta do it yourself.
;;
;; Also, in some edge cases involving package initialization during a
;; non-interactive session, `package-initialize' fails to fill `load-path'.
@ -408,13 +414,17 @@ The module is only loaded once. If RELOAD-P is non-nil, load it again."
(when (or reload-p (not loaded-p))
(unless loaded-p
(doom-module-enable module submodule flags))
(let ((module-path (doom-module-path module submodule)))
(if (file-directory-p module-path)
`(condition-case-unless-debug ex
(load! config ,(doom-module-path module submodule) t)
(load! config ,module-path t)
('error
(lwarn 'doom-modules :error
"%s in '%s %s' -> %s"
(car ex) ,module ',submodule
(error-message-string ex)))))))
(error-message-string ex))))
(lwarn 'doom-modules :warning "Couldn't find module '%s %s'"
module submodule))))))
(defmacro featurep! (module &optional submodule flag)
"A convenience macro wrapper for `doom-module-loaded-p'. It is evaluated at
@ -495,8 +505,10 @@ loads MODULE SUBMODULE's packages.el file."
"Returns the value of the ;;;###if predicate form in FILE."
(with-temp-buffer
(insert-file-contents-literally file nil 0 256)
(if (re-search-forward "^;;;###if " nil t)
(eval (sexp-at-point))
(if (and (re-search-forward "^;;;###if " nil t)
(<= (line-number-at-pos) 3))
(let ((load-file-name file))
(eval (sexp-at-point)))
t)))
(defun doom-packages--async-run (fn)
@ -544,9 +556,8 @@ This should be run whenever init.el or an autoload file is modified. Running
;; This function must not use autoloaded functions or external dependencies.
;; It must assume nothing is set up!
(if (not noninteractive)
;; This is done "asynchroniously" to protect the current session's state.
;; This is because `doom-initialize-packages' rereads your emacs config,
;; which has side effects.
;; This is done in another instance to protect the current session's
;; state. `doom-initialize-packages' will have side effects otherwise.
(and (doom-packages--async-run 'doom//reload-autoloads)
(load doom-autoload-file))
(doom-initialize-packages)
@ -556,22 +567,21 @@ This should be run whenever init.el or an autoload file is modified. Running
(dolist (path (doom-module-paths))
(let ((auto-dir (expand-file-name "autoload" path))
(auto-file (expand-file-name "autoload.el" path)))
(when (and (file-exists-p auto-file)
(doom-packages--read-if-cookies auto-file))
(when (file-exists-p auto-file)
(push auto-file targets))
(when (file-directory-p auto-dir)
(dolist (file (file-expand-wildcards (expand-file-name "*.el" auto-dir) t))
;; Make evil*.el autoload files a special case; don't load
;; them unless evil is enabled.
(when (doom-packages--read-if-cookies file)
(push file targets))))))
(dolist (file (directory-files-recursively auto-dir "\\.el$"))
(push file targets)))))
(when (file-exists-p doom-autoload-file)
(delete-file doom-autoload-file)
(message "Deleted old autoloads.el"))
(dolist (file (reverse targets))
(message (if (update-file-autoloads file nil doom-autoload-file)
"Nothing in %s"
"Scanned %s")
(message (cond ((not (doom-packages--read-if-cookies file))
"Ignoring %s")
((update-file-autoloads file nil doom-autoload-file)
"Nothing in %s")
(t
"Scanned %s"))
(file-relative-name file doom-emacs-dir)))
(let ((buf (get-file-buffer doom-autoload-file))
current-sexp)
@ -616,9 +626,8 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
(recompile-p (or recompile-p
(and (member "-r" (cdr argv)) t))))
(if (not noninteractive)
;; This is done "asynchroniously" to protect the current session's
;; state. This is because `doom-initialize-packages' rereads your emacs
;; config, which has side effects.
;; This is done in another instance to protect the current session's
;; state. `doom-initialize-packages' will have side effects otherwise.
(doom-packages--async-run 'doom//byte-compile)
(let ((total-ok 0)
(total-fail 0)

View file

@ -46,6 +46,9 @@ that was/were open in `doom-popup-history'.")
when their associated popup windows are closed, despite their :autokill
property.")
(defvar doom-popup-mode-map (make-sparse-keymap)
"Active keymap in popup windows.")
(def-setting! :popup (&rest rules)
"Prepend a new popup rule to `shackle-rules' (see for format details).
@ -133,8 +136,7 @@ recognized by DOOM's popup system. They are:
(dolist (param `(popup ,@doom-popup-window-parameters))
(push (cons param 'writable) window-persistent-parameters))
(defvar doom-popup-mode-map
(let ((map (make-sparse-keymap)))
(let ((map doom-popup-mode-map))
(define-key map [escape] #'doom/popup-close-maybe)
(define-key map (kbd "ESC") #'doom/popup-close-maybe)
(define-key map [remap quit-window] #'doom/popup-close-maybe)
@ -144,9 +146,7 @@ recognized by DOOM's popup system. They are:
(define-key map [remap split-window-horizontally] #'ignore)
(define-key map [remap split-window-vertically] #'ignore)
(define-key map [remap mouse-split-window-horizontally] #'ignore)
(define-key map [remap mouse-split-window-vertically] #'ignore)
map)
"Active keymap in popup windows."))
(define-key map [remap mouse-split-window-vertically] #'ignore)))
;;

View file

@ -304,12 +304,19 @@ local value, whether or not it's permanent-local. Therefore, we cycle
global-hl-line-sticky-flag nil)
(after! evil
(defvar-local doom-buffer-hl-line-mode nil)
;; Disable `hl-line' in evil-visual mode (temporarily). `hl-line' can make
;; the selection region harder to see while in evil visual mode.
(defun doom|disable-hl-line () (hl-line-mode -1))
(defun doom|disable-hl-line ()
(when hl-line-mode
(setq doom-buffer-hl-line-mode t)
(hl-line-mode -1)))
(defun doom|enable-hl-line-maybe ()
(if doom-buffer-hl-line-mode (hl-line-mode +1)))
(add-hook 'evil-visual-state-entry-hook #'doom|disable-hl-line)
(add-hook 'evil-visual-state-exit-hook #'hl-line-mode)))
(add-hook 'evil-visual-state-exit-hook #'doom|enable-hl-line-maybe)))
;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk
;; languages like Lisp.

View file

@ -94,6 +94,7 @@ melodramatic ex-vimmer disappointed with the text-editor status quo."
enable-recursive-minibuffers nil
debug-on-error (and (not noninteractive) doom-debug-mode)
idle-update-delay 2 ; update ui less often
load-prefer-newer (or noninteractive doom-debug-mode)
;; keep the point out of the minibuffer
minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
;; History & backup settings (save nothing, that's what git is for)

View file

@ -4,6 +4,7 @@
;; core packages
(package! s)
(package! f)
(package! async)
;; core-os.el
;; In case this config is shared across multiple computers (like mine is), let's

View file

@ -0,0 +1,4 @@
;;; lang/nix/config.el -*- lexical-binding: t; -*-
(def-package! nix-mode
:mode "\\.nix$")

View file

@ -170,7 +170,7 @@
:v "r" #'+eval:repl)
(:desc "file" :prefix "f"
:desc "File file" :n "." #'find-file
:desc "Find file" :n "." #'find-file
:desc "Sudo find file" :n ">" #'doom/sudo-find-file
:desc "Find file in project" :n "/" #'projectile-find-file
:desc "Find file from here" :n "?" #'counsel-file-jump

View file

@ -67,10 +67,6 @@ redefines its keys every time `eshell-mode' is enabled."
[remap +workspace/close-window-or-workspace] #'eshell-life-is-too-much))
(add-hook 'eshell-mode-hook #'+eshell|init-keymap)
(add-hook! eshell-mode
(add-hook 'evil-insert-state-exit-hook #'hl-line-mode nil t)
(add-hook 'evil-insert-state-entry-hook (lambda () (hl-line-mode -1)) nil t))
;; Aliases
(setq eshell-command-aliases-list
'(("q" "exit")

View file

@ -9,6 +9,8 @@
(advice-add #'recenter :around #'+doom*blink-cursor-maybe)
(after! evil
(advice-add #'evil--jumps-jump :after #'+doom/blink-cursor)
(advice-add #'evil-window-top :after #'+doom/blink-cursor)
(advice-add #'evil-window-middle :after #'+doom/blink-cursor)
(advice-add #'evil-window-bottom :after #'+doom/blink-cursor)))

View file

@ -7,7 +7,7 @@
(defun +unicode|init-fonts (&optional frame)
"Initialize `unicode-fonts', if in a GUI session."
(when (display-graphic-p frame)
(when (and frame (display-graphic-p frame))
(with-selected-frame frame
(require 'unicode-fonts)
;; NOTE will impact startup time on first run