General, minor reformatting across the board

And an offering of blood to our great lord Byte Compiler-sama.
This commit is contained in:
Henrik Lissner 2019-07-21 23:31:42 +02:00
parent 3595ff62ee
commit 060ede0e2e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
30 changed files with 125 additions and 112 deletions

View file

@ -50,7 +50,7 @@ Runs `doom-reload-hook' afterwards."
(message "Finished!"))
;;;###autoload
(defun doom/reload-autoloads (&optional force-p)
(defun doom/reload-autoloads (&optional _force-p)
"Reload only `doom-autoload-file' and `doom-package-autoload-file'.
This is much faster and safer than `doom/reload', but not as comprehensive. This
@ -60,6 +60,7 @@ not reload your private config.
It is useful to only pull in changes performed by 'doom refresh' on the command
line."
(interactive "P")
;; TODO regenerate autoloads
(doom-initialize-autoloads doom-autoload-file)
(doom-initialize-autoloads doom-package-autoload-file))

View file

@ -43,7 +43,7 @@ ready to be pasted in a bug report on github."
(elc-files . ,(length (doom-files-in `(,@doom-modules-dirs
,doom-core-dir
,doom-private-dir)
:type 'files :match "\\.elc$" :sort nil)))
:type 'files :match "\\.elc$")))
(modules ,@(or (cl-loop with cat = nil
for key being the hash-keys of doom-modules
if (or (not cat) (not (eq cat (car key))))

View file

@ -53,7 +53,7 @@
;;
;; Commands
;;; Commands
;;;###autoload
(defun doom/delete-this-file (&optional path force-p)

View file

@ -184,13 +184,11 @@ transformative logic."
(defmacro format! (message &rest args)
"An alternative to `format' that understands (color ...) and converts them
into faces or ANSI codes depending on the type of sesssion we're in."
(declare (debug t))
`(doom--format (format ,@(doom--format-apply `(,message ,@args)))))
;;;###autoload
(defmacro print-group! (&rest body)
"Indents any `print!' or `format!' output within BODY."
(declare (debug t))
`(let ((doom-format-indent (+ 2 doom-format-indent)))
,@body))
@ -206,7 +204,6 @@ Can be colored using (color ...) blocks:
(print! (green \"Great %s!\") \"success\")
Uses faces in interactive sessions and ANSI codes otherwise."
(declare (debug t))
`(doom--format-print (format! ,message ,@args)))
;;;###autoload
@ -214,18 +211,15 @@ Uses faces in interactive sessions and ANSI codes otherwise."
"Like `insert'; the last argument must be format arguments for MESSAGE.
\(fn MESSAGE... ARGS)"
(declare (debug t))
`(insert (format! (concat ,message ,@(butlast args))
,@(car (last args)))))
;;;###autoload
(defmacro error! (message &rest args)
"Like `error', but with the power of `format!'."
(declare (debug t))
`(error (format! ,message ,@args)))
;;;###autoload
(defmacro user-error! (message &rest args)
"Like `user-error', but with the power of `format!'."
(declare (debug t))
`(user-error (format! ,message ,@args)))

View file

@ -121,6 +121,7 @@ selection of all minor-modes, active or not."
;;
;;; Documentation commands
(defvar org-agenda-files)
(defun doom--org-headings (files &optional depth include-files)
"TODO"
(require 'org)
@ -155,6 +156,7 @@ selection of all minor-modes, active or not."
(mapc #'kill-buffer org-agenda-new-buffers)
(setq org-agenda-new-buffers nil))))
(defvar ivy-sort-functions-alist)
;;;###autoload
(defun doom-completing-read-org-headings (prompt files &optional depth include-files initial-input)
"TODO"
@ -197,8 +199,7 @@ selection of all minor-modes, active or not."
"Find in News: "
(nreverse (doom-files-in (expand-file-name "news" doom-docs-dir)
:match "/[0-9]"
:relative-to doom-docs-dir
:sort t))
:relative-to doom-docs-dir))
nil t initial-input))
;;;###autoload

View file

@ -262,8 +262,7 @@ ones."
(doom-files-in doom-modules-dir
:depth 2
:full t
:match "/packages\\.el$"
:sort nil))
:match "/packages\\.el$"))
(cl-loop for key being the hash-keys of doom-modules
for path = (doom-module-path (car key) (cdr key) "packages.el")
for doom--current-module = key

View file

@ -1,5 +1,11 @@
;;; core/autoload/sessions.el -*- lexical-binding: t; -*-
(defvar desktop-base-file-name)
(defvar desktop-dirname)
(defvar desktop-restore-eager)
(defvar desktop-file-modtime)
;;
;;; Helpers

View file

@ -186,9 +186,10 @@ Respects `require-final-newline'."
(setq indent-tabs-mode (not indent-tabs-mode))
(message "Indent style changed to %s" (if indent-tabs-mode "tabs" "spaces")))
(defvar editorconfig-lisp-use-default-indent)
;;;###autoload
(defun doom/set-indent-width (width)
"Change the indentation width of the current buffer."
"Change the indentation size to WIDTH of the current buffer."
(interactive
(list (if (integerp current-prefix-arg)
current-prefix-arg

View file

@ -185,9 +185,9 @@ module. This does not include your byte-compiled, third party packages.'"
with success = nil
for path
in (append (doom-glob doom-emacs-dir "*.elc")
(doom-files-in doom-private-dir :match "\\.elc$" :depth 1 :sort nil)
(doom-files-in doom-core-dir :match "\\.elc$" :sort nil)
(doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4 :sort nil))
(doom-files-in doom-private-dir :match "\\.elc$" :depth 1)
(doom-files-in doom-core-dir :match "\\.elc$")
(doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4))
if (file-exists-p path)
do (delete-file path)
and do (print! (success "Deleted %s") (relpath path))

View file

@ -101,7 +101,7 @@ successfully sets indent_style/indent_size.")
(def-package! recentf
;; Keep track of recently opened files
:defer-incrementally (easymenu tree-widget timer)
:defer-incrementally easymenu tree-widget timer
:after-call after-find-file
:commands recentf-open-files
:config
@ -143,7 +143,7 @@ successfully sets indent_style/indent_size.")
(def-package! savehist
;; persist variables across sessions
:defer-incrementally (custom)
:defer-incrementally custom
:after-call post-command-hook
:config
(setq savehist-file (concat doom-cache-dir "savehist")
@ -163,7 +163,7 @@ successfully sets indent_style/indent_size.")
(def-package! saveplace
;; persistent point location in buffers
:after-call (after-find-file dired-initial-position-hook)
:after-call after-find-file dired-initial-position-hook
:config
(setq save-place-file (concat doom-cache-dir "saveplace")
save-place-forget-unreadable-files t
@ -177,7 +177,7 @@ successfully sets indent_style/indent_size.")
(def-package! server
:when (display-graphic-p)
:after-call (pre-command-hook after-find-file focus-out-hook)
:after-call pre-command-hook after-find-file focus-out-hook
:init
(when-let (name (getenv "EMACS_SERVER_NAME"))
(setq server-name name))
@ -190,7 +190,7 @@ successfully sets indent_style/indent_size.")
;;; Packages
(def-package! better-jumper
:after-call (pre-command-hook)
:after-call pre-command-hook
:init
(global-set-key [remap evil-jump-forward] #'better-jumper-jump-forward)
(global-set-key [remap evil-jump-backward] #'better-jumper-jump-backward)
@ -312,8 +312,8 @@ successfully sets indent_style/indent_size.")
(def-package! smartparens
;; Auto-close delimiters and blocks as you type. It's more powerful than that,
;; but that is all Doom uses it for.
:after-call (doom-switch-buffer-hook after-find-file)
:commands (sp-pair sp-local-pair sp-with-modes sp-point-in-comment sp-point-in-string)
:after-call doom-switch-buffer-hook after-find-file
:commands sp-pair sp-local-pair sp-with-modes sp-point-in-comment sp-point-in-string
:config
(require 'smartparens-config)
(setq sp-highlight-pair-overlay nil
@ -345,13 +345,13 @@ successfully sets indent_style/indent_size.")
(def-package! so-long
:after-call (after-find-file)
:after-call after-find-file
:config (global-so-long-mode +1))
(def-package! undo-tree
;; Branching & persistent undo
:after-call (doom-switch-buffer-hook after-find-file)
:after-call doom-switch-buffer-hook after-find-file
:config
(setq undo-tree-auto-save-history nil ; disable because unstable
;; undo-in-region is known to cause undo history corruption, which can
@ -378,11 +378,10 @@ successfully sets indent_style/indent_size.")
(def-package! ws-butler
;; a less intrusive `delete-trailing-whitespaces' on save
:after-call (after-find-file)
:after-call after-find-file
:config
(setq ws-butler-global-exempt-modes
(append ws-butler-global-exempt-modes
'(special-mode comint-mode term-mode eshell-mode)))
(appendq! ws-butler-global-exempt-modes
'(special-mode comint-mode term-mode eshell-mode))
(ws-butler-global-mode))
(provide 'core-editor)

View file

@ -74,7 +74,7 @@ If any hook returns non-nil, all hooks after it are ignored.")
;;; General + leader/localleader keys
(use-package general
:config
:init
;; Convenience aliases
(defalias 'define-key! #'general-def)
(defalias 'unmap! #'general-unbind))

View file

@ -193,7 +193,6 @@ at the values with which this function was called."
&key
filter
map
sort ; TODO Allow a function for custom sorting?
(full t)
(follow-symlinks t)
(type 'files)

View file

@ -22,7 +22,7 @@ Emacs.")
;;; Packages
(def-package! projectile
:after-call (after-find-file dired-before-readin-hook minibuffer-setup-hook)
:after-call after-find-file dired-before-readin-hook minibuffer-setup-hook
:commands (projectile-project-root
projectile-project-name
projectile-project-p
@ -149,7 +149,7 @@ the command instead."
;;
;; Project-based minor modes
;;; Project-based minor modes
(defvar doom-project-hook nil
"Hook run when a project is enabled. The name of the project's mode and its

View file

@ -418,14 +418,14 @@ treat Emacs as a non-application window."
(def-package! winner
;; undo/redo changes to Emacs' window layout
:after-call (after-find-file doom-switch-window-hook)
:after-call after-find-file doom-switch-window-hook
:preface (defvar winner-dont-bind-my-keys t)
:config (winner-mode +1)) ; I'll bind keys myself
(def-package! paren
;; highlight matching delimiters
:after-call (after-find-file doom-switch-buffer-hook)
:after-call after-find-file doom-switch-buffer-hook
:config
(setq show-paren-delay 0.1
show-paren-highlight-openparen t
@ -448,8 +448,12 @@ treat Emacs as a non-application window."
;;; Third party packages
(def-package! all-the-icons
:commands (all-the-icons-octicon all-the-icons-faicon all-the-icons-fileicon
all-the-icons-wicon all-the-icons-material all-the-icons-alltheicon)
:commands (all-the-icons-octicon
all-the-icons-faicon
all-the-icons-fileicon
all-the-icons-wicon
all-the-icons-material
all-the-icons-alltheicon)
:init
(def-advice! doom--disable-all-the-icons-in-tty-a (orig-fn &rest args)
"all-the-icons doesn't work in the terminal, so we \"disable\" them."

View file

@ -500,6 +500,9 @@ to least)."
load-path doom--initial-load-path
process-environment doom--initial-process-environment)
(require 'core-lib)
(require 'core-modules)
;; `doom-autoload-file' tells Emacs where to load all its functions from.
;; This includes everything in core/autoload/*.el and autoload files in
;; enabled modules.
@ -530,26 +533,24 @@ to least)."
;; Load shell environment
(when (and (not noninteractive)
(file-exists-p doom-env-file))
(doom-load-env-vars doom-env-file)))
;; In case we want to use package.el's API
(with-eval-after-load 'package
(require 'core-packages))
;; Or straight interactively
(with-eval-after-load 'straight
(require 'core-packages)
(doom-initialize-packages)))
(doom-load-env-vars doom-env-file))))
;;
;;; Bootstrap Doom
(add-to-list 'load-path doom-core-dir)
(require 'core-lib)
(require 'core-modules)
(if noninteractive (require 'core-cli))
(doom-initialize noninteractive)
(unless noninteractive
;; In case we want to use package.el's API
(with-eval-after-load 'package
(require 'core-packages))
;; Or straight interactively
(with-eval-after-load 'straight
(require 'core-packages)
(doom-initialize-packages))
(if noninteractive
(require 'core-cli)
(add-hook 'window-setup-hook #'doom-display-benchmark-h)
(require 'core-keybinds)
(require 'core-ui)