Minor refactors & comment revision

This commit is contained in:
Henrik Lissner 2021-03-27 18:08:56 -04:00
parent e4c4e3f48c
commit ce65645fb8
5 changed files with 43 additions and 42 deletions

View file

@ -186,29 +186,27 @@ ready to be pasted in a bug report on github."
module))) module)))
'("n/a"))) '("n/a")))
(packages (packages
,@(or (condition-case e ,@(condition-case e
(mapcar (mapcar
#'cdr (doom--collect-forms-in #'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el") (doom-path doom-private-dir "packages.el")
"package!")) "package!"))
(error (format "<%S>" e))) (error (format "<%S>" e))))
'("n/a"))) (unpin
,(when-let (unpins (condition-case e ,@(condition-case e
(mapcan #'identity (mapcan #'identity
(mapcar (mapcar
#'cdr (doom--collect-forms-in #'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el") (doom-path doom-private-dir "packages.el")
"unpin!"))) "unpin!")))
(error (format "<%S>" e)))) (error (list (format "<%S>" e)))))
(cons 'unpin unpins))
(elpa (elpa
,@(or (condition-case e ,@(condition-case e
(progn (progn
(package-initialize) (package-initialize)
(cl-loop for (name . _) in package-alist (cl-loop for (name . _) in package-alist
collect (format "%s" name))) collect (format "%s" name)))
(error (format "<%S>" e))) (error (format "<%S>" e))))))))
'("n/a")))))))
;; ;;
@ -247,12 +245,13 @@ copies it to your clipboard, ready to be pasted into bug reports!"
(delete-region beg end) (delete-region beg end)
(insert sexp)))))) (insert sexp))))))
(dolist (spec info) (dolist (spec info)
(when (cdr spec)
(insert! "%11s %s\n" (insert! "%11s %s\n"
((car spec) ((car spec)
(if (listp (cdr spec)) (if (listp (cdr spec))
(mapconcat (lambda (x) (format "%s" x)) (mapconcat (lambda (x) (format "%s" x))
(cdr spec) " ") (cdr spec) " ")
(cdr spec)))))) (cdr spec)))))))
(if (not doom-interactive-p) (if (not doom-interactive-p)
(print! (buffer-string)) (print! (buffer-string))
(with-current-buffer (pop-to-buffer buffer) (with-current-buffer (pop-to-buffer buffer)

View file

@ -1,6 +1,6 @@
;;; core/autoload/projects.el -*- lexical-binding: t; -*- ;;; core/autoload/projects.el -*- lexical-binding: t; -*-
(defvar projectile-project-root nil) (defvar projectile-project-root)
(defvar projectile-enable-caching) (defvar projectile-enable-caching)
(defvar projectile-require-project-root) (defvar projectile-require-project-root)
@ -80,7 +80,8 @@ they are absolute."
(defun doom-project-root (&optional dir) (defun doom-project-root (&optional dir)
"Return the project root of DIR (defaults to `default-directory'). "Return the project root of DIR (defaults to `default-directory').
Returns nil if not in a project." Returns nil if not in a project."
(let ((projectile-project-root (unless dir projectile-project-root)) (let ((projectile-project-root
(unless dir (bound-and-true-p projectile-project-root)))
projectile-require-project-root) projectile-require-project-root)
(projectile-project-root dir))) (projectile-project-root dir)))

View file

@ -220,17 +220,18 @@ or file path may exist now."
revert-without-query (list ".")) revert-without-query (list "."))
;; `auto-revert-mode' and `global-auto-revert-mode' would, normally, abuse the ;; `auto-revert-mode' and `global-auto-revert-mode' would, normally, abuse the
;; heck out of inotify handles _or_ aggresively poll your buffer list every X ;; heck out of file watchers _or_ aggressively poll your buffer list every X
;; seconds. Too many inotify handles can grind Emacs to a halt if you preform ;; seconds. Too many watchers can grind Emacs to a halt if you preform
;; expensive or batch processes on files outside of Emacs (e.g. their mtime ;; expensive or batch processes on files outside of Emacs (e.g. their mtime
;; changes), and polling your buffer list is terribly inefficient as your ;; changes), and polling your buffer list is terribly inefficient as your
;; buffer list grows into the tens or hundreds. ;; buffer list grows into the hundreds.
;; ;;
;; So Doom uses a different strategy: we lazily auto revert buffers when the ;; Doom does this lazily instead. i.e. All visible buffers are reverted
;; user a) saves a file, b) switches to a buffer (or its window), or c) you ;; immediately when a) a file is saved or b) Emacs is refocused (after using
;; focus Emacs (after using another program). This way, Emacs only ever has to ;; another app). Meanwhile, buried buffers are reverted only when they are
;; operate on, at minimum, a single buffer and, at maximum, X buffers, where X ;; switched to. This way, Emacs only ever has to operate on, at minimum, a
;; is the number of open windows (which is rarely, if ever, over 10). ;; single buffer and, at maximum, ~10 buffers (after all, when do you ever
;; have more than 10 windows in any single frame?).
(defun doom-auto-revert-buffer-h () (defun doom-auto-revert-buffer-h ()
"Auto revert current buffer, if necessary." "Auto revert current buffer, if necessary."
(unless (or auto-revert-mode (active-minibuffer-window)) (unless (or auto-revert-mode (active-minibuffer-window))

View file

@ -567,7 +567,7 @@ directives. By default, this only recognizes C directives.")
:textobj "u" #'+evil:inner-url-txtobj #'+evil:outer-url-txtobj :textobj "u" #'+evil:inner-url-txtobj #'+evil:outer-url-txtobj
:textobj "x" #'evil-inner-xml-attr #'evil-outer-xml-attr :textobj "x" #'evil-inner-xml-attr #'evil-outer-xml-attr
;; evil-easymotion (see `+evil/easymotion') ;; evil-easymotion
(:after evil-easymotion (:after evil-easymotion
:m "gs" evilem-map :m "gs" evilem-map
(:map evilem-map (:map evilem-map

View file

@ -31,9 +31,9 @@
;; HACK On MacOS, disabling the menu bar makes MacOS treat Emacs as a ;; HACK On MacOS, disabling the menu bar makes MacOS treat Emacs as a
;; non-application window -- which means it doesn't automatically capture ;; non-application window -- which means it doesn't automatically capture
;; focus when it is started, among other things. We enable menu-bar-lines ;; focus when it is started, among other things, so enable the menu-bar for
;; there, but we still want it disabled in terminal frames because there it ;; GUI frames, but keep it disabled in terminal frames because there it
;; activates an ugly menu bar. ;; activates an ugly, in-frame menu bar.
(add-hook! '(window-setup-hook after-make-frame-functions) (add-hook! '(window-setup-hook after-make-frame-functions)
(defun doom-init-menu-bar-in-gui-frames-h (&optional frame) (defun doom-init-menu-bar-in-gui-frames-h (&optional frame)
"Re-enable menu-bar-lines in GUI frames." "Re-enable menu-bar-lines in GUI frames."