Skip to content

Commit

Permalink
Minor refactors & comment revision
Browse files Browse the repository at this point in the history
  • Loading branch information
hlissner committed Mar 27, 2021
1 parent e4c4e3f commit ce65645
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 42 deletions.
55 changes: 27 additions & 28 deletions core/autoload/debug.el
Original file line number Diff line number Diff line change
Expand Up @@ -186,29 +186,27 @@ ready to be pasted in a bug report on github."
module)))
'("n/a")))
(packages
,@(or (condition-case e
(mapcar
#'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el")
"package!"))
(error (format "<%S>" e)))
'("n/a")))
,(when-let (unpins (condition-case e
(mapcan #'identity
(mapcar
#'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el")
"unpin!")))
(error (format "<%S>" e))))
(cons 'unpin unpins))
,@(condition-case e
(mapcar
#'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el")
"package!"))
(error (format "<%S>" e))))
(unpin
,@(condition-case e
(mapcan #'identity
(mapcar
#'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el")
"unpin!")))
(error (list (format "<%S>" e)))))
(elpa
,@(or (condition-case e
(progn
(package-initialize)
(cl-loop for (name . _) in package-alist
collect (format "%s" name)))
(error (format "<%S>" e)))
'("n/a")))))))
,@(condition-case e
(progn
(package-initialize)
(cl-loop for (name . _) in package-alist
collect (format "%s" name)))
(error (format "<%S>" e))))))))


;;
Expand Down Expand Up @@ -247,12 +245,13 @@ copies it to your clipboard, ready to be pasted into bug reports!"
(delete-region beg end)
(insert sexp))))))
(dolist (spec info)
(insert! "%11s %s\n"
((car spec)
(if (listp (cdr spec))
(mapconcat (lambda (x) (format "%s" x))
(cdr spec) " ")
(cdr spec))))))
(when (cdr spec)
(insert! "%11s %s\n"
((car spec)
(if (listp (cdr spec))
(mapconcat (lambda (x) (format "%s" x))
(cdr spec) " ")
(cdr spec)))))))
(if (not doom-interactive-p)
(print! (buffer-string))
(with-current-buffer (pop-to-buffer buffer)
Expand Down
5 changes: 3 additions & 2 deletions core/autoload/projects.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;; core/autoload/projects.el -*- lexical-binding: t; -*-

(defvar projectile-project-root nil)
(defvar projectile-project-root)
(defvar projectile-enable-caching)
(defvar projectile-require-project-root)

Expand Down Expand Up @@ -80,7 +80,8 @@ they are absolute."
(defun doom-project-root (&optional dir)
"Return the project root of DIR (defaults to `default-directory').
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-project-root dir)))

Expand Down
17 changes: 9 additions & 8 deletions core/core-editor.el
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,18 @@ or file path may exist now."
revert-without-query (list "."))

;; `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
;; seconds. Too many inotify handles can grind Emacs to a halt if you preform
;; heck out of file watchers _or_ aggressively poll your buffer list every X
;; 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
;; 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
;; user a) saves a file, b) switches to a buffer (or its window), or c) you
;; focus Emacs (after using another program). This way, Emacs only ever has to
;; operate on, at minimum, a single buffer and, at maximum, X buffers, where X
;; is the number of open windows (which is rarely, if ever, over 10).
;; Doom does this lazily instead. i.e. All visible buffers are reverted
;; immediately when a) a file is saved or b) Emacs is refocused (after using
;; another app). Meanwhile, buried buffers are reverted only when they are
;; switched to. This way, Emacs only ever has to operate on, at minimum, a
;; 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 ()
"Auto revert current buffer, if necessary."
(unless (or auto-revert-mode (active-minibuffer-window))
Expand Down
2 changes: 1 addition & 1 deletion modules/editor/evil/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ directives. By default, this only recognizes C directives.")
:textobj "u" #'+evil:inner-url-txtobj #'+evil:outer-url-txtobj
:textobj "x" #'evil-inner-xml-attr #'evil-outer-xml-attr

;; evil-easymotion (see `+evil/easymotion')
;; evil-easymotion
(:after evil-easymotion
:m "gs" evilem-map
(:map evilem-map
Expand Down
6 changes: 3 additions & 3 deletions modules/os/macos/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

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

0 comments on commit ce65645

Please sign in to comment.