Minor edits.

This commit is contained in:
Derek Taylor
2020-11-05 13:27:52 -06:00
parent 8fbacc6392
commit 35112d3f8c
170 changed files with 1304 additions and 756 deletions

View File

@@ -3,10 +3,6 @@
(defvar doom-bin-dir (concat doom-emacs-dir "bin/"))
(defvar doom-bin (concat doom-bin-dir "doom"))
;;;###autoload
(defvar doom-reload-hook nil
"A list of hooks to run when `doom/reload' is called.")
;;;###autoload
(defvar doom-reloading-p nil
"TODO")
@@ -76,7 +72,7 @@ This is experimental! It will try to do as `bin/doom sync' does, but from within
this Emacs session. i.e. it reload autoloads files (if necessary), reloads your
package list, and lastly, reloads your private config.el.
Runs `doom-reload-hook' afterwards."
Runs `doom-after-reload-hook' afterwards."
(interactive)
(require 'core-cli)
(when (and IS-WINDOWS (file-exists-p doom-env-file))
@@ -86,13 +82,14 @@ Runs `doom-reload-hook' afterwards."
(mapc #'require (cdr doom-incremental-packages))
(doom--if-compile (format "%s sync -e" doom-bin)
(let ((doom-reloading-p t))
(run-hook-wrapped 'doom-before-reload-hook #'doom-try-run-hook)
(doom-initialize 'force)
(with-demoted-errors "PRIVATE CONFIG ERROR: %s"
(general-auto-unbind-keys)
(unwind-protect
(doom-initialize-modules 'force)
(general-auto-unbind-keys t)))
(run-hook-wrapped 'doom-reload-hook #'doom-try-run-hook)
(run-hook-wrapped 'doom-after-reload-hook #'doom-try-run-hook)
(message "Config successfully reloaded!"))
(user-error "Failed to reload your config")))

View File

@@ -12,7 +12,8 @@
init-file-debug
jka-compr-verbose
url-debug
use-package-verbose)
use-package-verbose
(message-log-max . 16384))
"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
@@ -49,8 +50,9 @@ symbol and CDR is the value to set it to when `doom-debug-mode' is activated.")
((if (boundp var)
(set-default var enabled)
(add-to-list 'doom--debug-vars-undefined var)))))
(when (fboundp 'explain-pause-mode)
(explain-pause-mode enabled))
(when (called-interactively-p 'any)
(when (fboundp 'explain-pause-mode)
(explain-pause-mode (if enabled +1 -1))))
;; 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.
@@ -211,16 +213,12 @@ branch and commit."
;;;###autoload
(defun doom/info (&optional raw)
"Collects some debug information about your Emacs session, formats it into
markdown and copies it to your clipboard, ready to be pasted into bug reports!"
"Collects some debug information about your Emacs session, formats it and
copies it to your clipboard, ready to be pasted into bug reports!"
(interactive "P")
(let ((buffer (get-buffer-create "*doom-info*"))
(let ((buffer (get-buffer-create "*doom info*"))
(info (doom-info)))
(with-current-buffer buffer
(or (not doom-interactive-p)
(eq major-mode 'markdown-mode)
(not (fboundp 'markdown-mode))
(markdown-mode))
(erase-buffer)
(if raw
(progn
@@ -234,7 +232,7 @@ markdown and copies it to your clipboard, ready to be pasted into bug reports!"
(let ((sexp (prin1-to-string (sexp-at-point))))
(delete-region beg end)
(insert sexp))))))
(insert "<details>\n\n```\n")
(insert "```\n")
(dolist (group info)
(insert! "%-8s%-10s %s\n"
((upcase (symbol-name (car group)))
@@ -243,12 +241,12 @@ markdown and copies it to your clipboard, ready to be pasted into bug reports!"
(dolist (spec (cddr group))
(insert! (indent 8 "%-10s %s\n")
((car spec) (cdr spec)))))
(insert "```\n</details>"))
(insert "```\n"))
(if (not doom-interactive-p)
(print! (buffer-string))
(switch-to-buffer buffer)
(pop-to-buffer buffer)
(kill-new (buffer-string))
(print! (green "Copied markdown to clipboard"))))))
(print! (green "Copied your doom info to clipboard"))))))
;;;###autoload
(defun doom/am-i-secure ()
@@ -316,14 +314,20 @@ Some items are not supported by the `nsm.el' module."
(with-temp-file file
(prin1 `(progn
(setq noninteractive nil
user-init-file ,file
process-environment ',doom--initial-process-environment
exec-path ',doom--initial-exec-path
init-file-debug t
doom--initial-load-path load-path
load-path ',load-path
package--init-file-ensured t
package-user-dir ,package-user-dir
package-archives ',package-archives
user-emacs-directory ,doom-emacs-dir)
user-emacs-directory ,doom-emacs-dir
comp-deferred-compilation nil
comp-eln-load-path ',(bound-and-true-p comp-eln-load-path)
comp-async-env-modifier-form ',(bound-and-true-p comp-async-env-modifier-form)
comp-deferred-compilation-black-list ',(bound-and-true-p comp-deferred-compilation-black-list))
(with-eval-after-load 'undo-tree
;; undo-tree throws errors because `buffer-undo-tree' isn't
;; correctly initialized
@@ -446,6 +450,21 @@ will be automatically appended to the result."
(interactive)
(browse-url "https://github.com/hlissner/doom-emacs/issues/new/choose"))
;;;###autoload
(defun doom/copy-buffer-contents (buffer-name)
"Copy the contents of BUFFER-NAME to your clipboard."
(interactive
(list (if current-prefix-arg
(completing-read "Select buffer: " (mapcar #'buffer-name (buffer-list)))
(buffer-name (current-buffer)))))
(let ((buffer (get-buffer buffer-name)))
(unless (buffer-live-p buffer)
(user-error "Buffer isn't live"))
(kill-new
(with-current-buffer buffer
(substring-no-properties (buffer-string))))
(message "Contents of %S were copied to the clipboard" buffer-name)))
;;
;;; Profiling

View File

@@ -245,7 +245,7 @@ If FORCE-P, delete without confirmation."
(user-error "Aborted"))
(let ((buf (current-buffer)))
(unwind-protect
(progn (delete-file path) t)
(progn (delete-file path t) t)
(if (file-exists-p path)
(error "Failed to delete %S" short-path)
;; Ensures that windows displaying this buffer will be switched to

View File

@@ -662,6 +662,7 @@ Uses the symbol at point or the current selection, if available."
(doom--help-search
(cl-loop for (file . _) in (cl-remove-if-not #'stringp load-history :key #'car)
for filebase = (file-name-sans-extension file)
if (file-exists-p! (format "%s.el" filebase))
if (file-exists-p! (or (format "%s.el.gz" filebase)
(format "%s.el" filebase)))
collect it)
query "Search loaded files: "))

View File

@@ -98,8 +98,8 @@ If DIR is not a project, it will be indexed (but not cached)."
(error "Directory %S does not exist" dir))
(unless (file-readable-p dir)
(error "Directory %S isn't readable" dir))
(let* ((default-directory (file-truename (expand-file-name dir)))
(projectile-project-root (doom-project-root default-directory))
(let* ((default-directory (file-truename dir))
(projectile-project-root (doom-project-root dir))
(projectile-enable-caching projectile-enable-caching))
(cond ((and projectile-project-root (file-equal-p projectile-project-root default-directory))
(unless (doom-project-p default-directory)
@@ -116,8 +116,8 @@ If DIR is not a project, it will be indexed (but not cached)."
#'projectile-find-file)))
((fboundp 'counsel-file-jump) ; ivy only
(call-interactively #'counsel-file-jump))
((project-current)
(project-find-file-in nil (list default-directory) nil))
((project-current nil dir)
(project-find-file-in nil nil dir))
((fboundp 'helm-find-files)
(call-interactively #'helm-find-files))
((call-interactively #'find-file)))))

View File

@@ -172,7 +172,9 @@ windows (unlike `doom/window-maximize-buffer'). Activate again to undo."
(let* ((window (selected-window))
(dedicated-p (window-dedicated-p window))
(preserved-p (window-parameter window 'window-preserved-size))
(ignore-window-parameters t))
(ignore-window-parameters t)
(window-resize-pixelwise nil)
(frame-resize-pixelwise nil))
(unwind-protect
(progn
(when dedicated-p