Updating dotfiles.

This commit is contained in:
Derek Taylor
2020-09-29 16:28:27 -05:00
parent e8ae19d7ad
commit af5b75ee4d
204 changed files with 1870 additions and 2063 deletions

View File

@@ -179,9 +179,11 @@ If DERIVED-P, test with `derived-mode-p', otherwise use `eq'."
;;;###autoload
(defun doom-visible-buffers (&optional buffer-list)
"Return a list of visible buffers (i.e. not buried)."
(if buffer-list
(cl-remove-if-not #'get-buffer-window buffer-list)
(delete-dups (mapcar #'window-buffer (window-list)))))
(let ((buffers (delete-dups (mapcar #'window-buffer (window-list)))))
(if buffer-list
(cl-delete-if (lambda (b) (memq b buffer-list))
buffers)
(delete-dups buffers))))
;;;###autoload
(defun doom-buried-buffers (&optional buffer-list)

View File

@@ -98,7 +98,7 @@ Runs `doom-reload-hook' afterwards."
;;;###autoload
(defun doom/reload-autoloads ()
"Reload only `doom-autoload-file' and `doom-package-autoload-file'.
"Reload only `doom-autoloads-file' and `doom-package-autoload-file'.
This is much faster and safer than `doom/reload', but not as comprehensive. This
reloads your package and module visibility, but does not install new packages or

View File

@@ -5,26 +5,62 @@
;;;###autoload
(defvar doom-debug-variables
'(doom-debug-p
init-file-debug
debug-on-error
'(debug-on-error
doom-debug-p
garbage-collection-messages
use-package-verbose
jka-compr-verbose
lsp-log-io
gcmh-verbose
magit-refresh-verbose
url-debug)
"A list of variable to toggle on `doom-debug-mode'.")
init-file-debug
jka-compr-verbose
url-debug
use-package-verbose)
"A list of variable to toggle on `doom-debug-mode'.
Each entry can be a variable symbol or a cons cell whose CAR is the variable
symbol and CDR is the value to set it to when `doom-debug-mode' is activated.")
(defvar doom--debug-vars-old-values nil)
(defvar doom--debug-vars-undefined nil)
(defun doom--watch-debug-vars-h (&rest _)
(when-let (bound-vars (cl-remove-if-not #'boundp doom--debug-vars-undefined))
(doom-log "New variables available: %s" bound-vars)
(let ((message-log-max nil))
(doom-debug-mode -1)
(doom-debug-mode +1))))
;;;###autoload
(define-minor-mode doom-debug-mode
"Toggle `debug-on-error' and `doom-debug-p' for verbose logging."
:init-value nil
:global t
(let ((value doom-debug-mode))
(mapc (doom-rpartial #'set value) doom-debug-variables)
(message "Debug mode %s" (if value "on" "off"))))
(let ((enabled doom-debug-mode))
(setq doom--debug-vars-undefined nil)
(dolist (var doom-debug-variables)
(cond ((listp var)
(cl-destructuring-bind (var . val) var
(if (not (boundp var))
(add-to-list 'doom--debug-vars-undefined var)
(set-default
var (if (not enabled)
(alist-get var doom--debug-vars-old-values)
(setf (alist-get var doom--debug-vars-old-values)
(symbol-value var))
val)))))
((if (boundp var)
(set-default var enabled)
(add-to-list 'doom--debug-vars-undefined var)))))
(when (fboundp 'explain-pause-mode)
(explain-pause-mode enabled))
;; Watch for changes in `doom-debug-variables', or when packages load (and
;; potentially define one of `doom-debug-variables'), in case some of them
;; aren't defined when `doom-debug-mode' is first loaded.
(cond (enabled
(add-variable-watcher 'doom-debug-variables #'doom--watch-debug-vars-h)
(add-hook 'after-load-functions #'doom--watch-debug-vars-h))
(t
(remove-variable-watcher 'doom-debug-variables #'doom--watch-debug-vars-h)
(remove-hook 'after-load-functions #'doom--watch-debug-vars-h)))
(message "Debug mode %s" (if enabled "on" "off"))))
;;
@@ -68,35 +104,44 @@
ready to be pasted in a bug report on github."
(require 'vc-git)
(require 'core-packages)
(let ((default-directory doom-emacs-dir)
(doom-modules (doom-module-list)))
(letf! (defun sh (&rest args) (cdr (apply #'doom-call-process args)))
`((emacs
(version . ,emacs-version)
(features ,@system-configuration-features)
(build . ,(format-time-string "%b %d, %Y" emacs-build-time))
(buildopts ,system-configuration-options)
(windowsys . ,(if doom-interactive-p window-system 'batch))
(daemonp . ,(cond ((daemonp) 'daemon)
((and (require 'server)
(server-running-p))
'server-running))))
(doom
(version . ,doom-version)
(build . ,(sh "git" "log" "-1" "--format=%D %h %ci"))
(dir . ,(abbreviate-file-name (file-truename doom-private-dir))))
(system
(type . ,system-type)
(let ((default-directory doom-emacs-dir))
(letf! ((defun sh (&rest args) (cdr (apply #'doom-call-process args)))
(defun abbrev-path (path)
(replace-regexp-in-string
(regexp-quote (user-login-name)) "$USER"
(abbreviate-file-name path))))
`((system
(type . ,system-type)
(config . ,system-configuration)
(shell . ,shell-file-name)
(uname . ,(if IS-WINDOWS
"n/a"
(sh "uname" "-msrv")))
(path . ,(mapcar #'abbreviate-file-name exec-path)))
(config
(envfile
. ,(cond ((file-exists-p doom-env-file) 'envvar-file)
((featurep 'exec-path-from-shell) 'exec-path-from-shell)))
(shell . ,(abbrev-path shell-file-name))
(uname . ,(if IS-WINDOWS "n/a" (sh "uname" "-msrv")))
(path . ,(mapcar #'abbrev-path exec-path)))
(emacs
(dir . ,(abbrev-path (file-truename doom-emacs-dir)))
(version . ,emacs-version)
(build . ,(format-time-string "%b %d, %Y" emacs-build-time))
(buildopts . ,system-configuration-options)
(features . ,system-configuration-features)
(traits . ,(delq
nil (list (if (not doom-interactive-p) 'batch)
(if (daemonp) 'daemon)
(if (and (require 'server)
(server-running-p))
'server-running)
(if (boundp 'chemacs-profiles-path)
'chemacs)
(if (file-exists-p doom-env-file)
'envvar-file)
(if (featurep 'exec-path-from-shell)
'exec-path-from-shell)
(if (file-symlink-p user-emacs-directory)
'symlinked-emacsdir)
(if (file-symlink-p doom-private-dir)
'symlinked-doomdir)))))
(doom
(dir . ,(abbrev-path (file-truename doom-private-dir)))
(version . ,doom-version)
(build . ,(sh "git" "log" "-1" "--format=%D %h %ci"))
(elc-files
. ,(length (doom-files-in `(,@doom-modules-dirs
,doom-core-dir
@@ -110,10 +155,18 @@ ready to be pasted in a bug report on github."
do (setq cat (car key))
and collect cat
collect
(let ((flags (doom-module-get cat (cdr key) :flags)))
(if flags
`(,(cdr key) ,@flags)
(cdr key))))
(let* ((flags (doom-module-get cat (cdr key) :flags))
(path (doom-module-get cat (cdr key) :path))
(module (append (cond ((null path)
(list '&nopath))
((file-in-directory-p path doom-private-dir)
(list '&user)))
(if flags
`(,(cdr key) ,@flags)
(list (cdr key))))))
(if (= (length module) 1)
(car module)
module)))
'("n/a")))
(packages
,@(or (condition-case e
@@ -150,16 +203,10 @@ ready to be pasted in a bug report on github."
"Display the current version of Doom & Emacs, including the current Doom
branch and commit."
(interactive)
(require 'vc-git)
(let ((default-directory doom-core-dir))
(print! "Doom v%s (%s)\nEmacs v%s\nBranch: %s\nBuild date: %s"
(print! "Doom v%s (%s)"
doom-version
(or (vc-git-working-revision doom-core-dir)
"n/a")
emacs-version
(or (vc-git--symbolic-ref doom-core-dir)
"n/a")
(or (cdr (doom-call-process "git" "log" "-1" "--format=%ci"))
(or (cdr (doom-call-process "git" "log" "-1" "--format=%D %h %ci"))
"n/a"))))
;;;###autoload
@@ -190,7 +237,7 @@ markdown and copies it to your clipboard, ready to be pasted into bug reports!"
(insert "<details>\n\n```\n")
(dolist (group info)
(insert! "%-8s%-10s %s\n"
((car group)
((upcase (symbol-name (car group)))
(caadr group)
(cdadr group)))
(dolist (spec (cddr group))

View File

@@ -11,12 +11,9 @@
(csharp-mode :lang csharp)
(clojure-mode :lang clojure)
(clojurescript-mode :lang clojure)
(graphql-mode :lang data)
(toml-mode :lang data)
(json-mode :lang data)
(yaml-mode :lang data)
(json-mode :lang json)
(yaml-mode :lang yaml)
(csv-mode :lang data)
(dhall-mode :lang data)
(erlang-mode :lang erlang)
(elixir-mode :lang elixir)
(elm-mode :lang elm)
@@ -193,7 +190,7 @@ selection of all minor-modes, active or not."
"troubleshooting.org"
"tutorials.org"
"faq.org")
2 t initial-input
3 t initial-input
(mapcar (lambda (x)
(setcar x (concat "Doom Modules > " (car x)))
x)

View File

@@ -106,10 +106,11 @@ in some cases."
(thing
(thing-at-point thing t))
((require 'xref nil t)
;; Eglot defines a dummy for `xref-find-backend', so we need a special
;; case to avoid xref when using eglot. See
;; https://github.com/joaotavora/eglot/issues/503
(if (eq (xref-find-backend) 'eglot)
;; Eglot, nox (a fork of eglot), and elpy implementations for
;; `xref-backend-identifier-at-point' betray the documented purpose of
;; the interface. Eglot/nox return a hardcoded string and elpy prepends
;; the line number to the symbol.
(if (memq (xref-find-backend) '(eglot elpy nox))
(thing-at-point 'symbol t)
;; A little smarter than using `symbol-at-point', though in most
;; cases, xref ends up using `symbol-at-point' anyway.

View File

@@ -113,48 +113,77 @@ See `display-line-numbers' for what these values mean."
(delete-frame))
(save-buffers-kill-emacs)))
(defvar doom--maximize-last-wconf nil)
;;;###autoload
(defun doom/window-maximize-buffer ()
"Close other windows to focus on this one. Activate again to undo this. If the
window changes before then, the undo expires.
Alternatively, use `doom/window-enlargen'."
(interactive)
(setq doom--maximize-last-wconf
(if (and (null (cdr (cl-remove-if #'window-dedicated-p (window-list))))
doom--maximize-last-wconf)
(ignore (set-window-configuration doom--maximize-last-wconf))
(when (and (bound-and-true-p +popup-mode)
(+popup-window-p))
(user-error "Cannot maximize a popup, use `+popup/raise' first or use `doom/window-enlargen' instead"))
(prog1 (current-window-configuration)
(delete-other-windows)))))
(defun doom--enlargened-forget-last-wconf-h ()
(set-frame-parameter nil 'doom--maximize-last-wconf nil)
(set-frame-parameter nil 'doom--enlargen-last-wconf nil)
(remove-hook 'doom-switch-window-hook #'doom--enlargened-forget-last-wconf-h))
(defvar doom--enlargen-last-wconf nil)
;;;###autoload
(defun doom/window-enlargen ()
(defun doom/window-maximize-buffer (&optional arg)
"Close other windows to focus on this one.
Activate again to undo this. If prefix ARG is non-nil, don't restore the last
window configuration and re-maximize the current window. Alternatively, use
`doom/window-enlargen'."
(interactive "P")
(let ((param 'doom--maximize-last-wconf))
(cl-destructuring-bind (window . wconf)
(or (frame-parameter nil param)
(cons nil nil))
(set-frame-parameter
nil param
(if (and (equal window (selected-window))
(not arg)
(null (cdr (cl-remove-if #'window-dedicated-p (window-list))))
wconf)
(ignore
(let ((source-window (selected-window)))
(set-window-configuration wconf)
(when (window-live-p source-window)
(select-window source-window))))
(when (and (bound-and-true-p +popup-mode)
(+popup-window-p))
(user-error "Cannot maximize a popup, use `+popup/raise' first or use `doom/window-enlargen' instead"))
(prog1 (cons (selected-window) (or wconf (current-window-configuration)))
(delete-other-windows)
(add-hook 'doom-switch-window-hook #'doom--enlargened-forget-last-wconf-h)))))))
;;;###autoload
(defun doom/window-enlargen (&optional arg)
"Enlargen the current window to focus on this one. Does not close other
windows (unlike `doom/window-maximize-buffer'). Activate again to undo."
(interactive)
(setq doom--enlargen-last-wconf
(if doom--enlargen-last-wconf
(ignore (set-window-configuration doom--enlargen-last-wconf))
(prog1 (current-window-configuration)
(let* ((window (selected-window))
(dedicated-p (window-dedicated-p window))
(preserved-p (window-parameter window 'window-preserved-size))
(ignore-window-parameters t))
(unwind-protect
(progn
(when dedicated-p
(set-window-dedicated-p window nil))
(when preserved-p
(set-window-parameter window 'window-preserved-size nil))
(maximize-window window))
(set-window-dedicated-p window dedicated-p)
(when preserved-p
(set-window-parameter window 'window-preserved-size preserved-p))))))))
(interactive "P")
(let ((param 'doom--enlargen-last-wconf))
(cl-destructuring-bind (window . wconf)
(or (frame-parameter nil param)
(cons nil nil))
(set-frame-parameter
nil param
(if (and (equal window (selected-window))
(not arg)
wconf)
(ignore
(let ((source-window (selected-window)))
(set-window-configuration wconf)
(when (window-live-p source-window)
(select-window source-window))))
(prog1 (cons (selected-window) (or wconf (current-window-configuration)))
(let* ((window (selected-window))
(dedicated-p (window-dedicated-p window))
(preserved-p (window-parameter window 'window-preserved-size))
(ignore-window-parameters t))
(unwind-protect
(progn
(when dedicated-p
(set-window-dedicated-p window nil))
(when preserved-p
(set-window-parameter window 'window-preserved-size nil))
(maximize-window window))
(set-window-dedicated-p window dedicated-p)
(when preserved-p
(set-window-parameter window 'window-preserved-size preserved-p))
(add-hook 'doom-switch-window-hook #'doom--enlargened-forget-last-wconf-h)))))))))
;;;###autoload
(defun doom/window-maximize-horizontally ()