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

@ -69,7 +69,7 @@
(setenv "YES" "1") (setenv "YES" "1")
(message "Auto-yes mode on")))) (message "Auto-yes mode on"))))
(or (file-directory-p emacs-dir) (unless (file-directory-p emacs-dir)
(error "%s does not exist" emacs-dir)) (error "%s does not exist" emacs-dir))
;; Bootstrap Doom ;; Bootstrap Doom
@ -82,8 +82,8 @@
(member (car args) '("help" "h"))) (member (car args) '("help" "h")))
(usage)) (usage))
((not args) ((not args)
(message "No command detected, aborting!\n\nRun %s help for documentation." (print! (error "No command detected.\n"))
(file-name-nondirectory load-file-name))) (usage))
((let ((default-directory emacs-dir)) ((let ((default-directory emacs-dir))
(setq argv nil (setq argv nil
noninteractive 'doom) noninteractive 'doom)

View file

@ -50,7 +50,7 @@ Runs `doom-reload-hook' afterwards."
(message "Finished!")) (message "Finished!"))
;;;###autoload ;;;###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'. "Reload only `doom-autoload-file' and `doom-package-autoload-file'.
This is much faster and safer than `doom/reload', but not as comprehensive. This 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 It is useful to only pull in changes performed by 'doom refresh' on the command
line." line."
(interactive "P") (interactive "P")
;; TODO regenerate autoloads
(doom-initialize-autoloads doom-autoload-file) (doom-initialize-autoloads doom-autoload-file)
(doom-initialize-autoloads doom-package-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 (elc-files . ,(length (doom-files-in `(,@doom-modules-dirs
,doom-core-dir ,doom-core-dir
,doom-private-dir) ,doom-private-dir)
:type 'files :match "\\.elc$" :sort nil))) :type 'files :match "\\.elc$")))
(modules ,@(or (cl-loop with cat = nil (modules ,@(or (cl-loop with cat = nil
for key being the hash-keys of doom-modules for key being the hash-keys of doom-modules
if (or (not cat) (not (eq cat (car key)))) if (or (not cat) (not (eq cat (car key))))

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -186,9 +186,10 @@ Respects `require-final-newline'."
(setq indent-tabs-mode (not indent-tabs-mode)) (setq indent-tabs-mode (not indent-tabs-mode))
(message "Indent style changed to %s" (if indent-tabs-mode "tabs" "spaces"))) (message "Indent style changed to %s" (if indent-tabs-mode "tabs" "spaces")))
(defvar editorconfig-lisp-use-default-indent)
;;;###autoload ;;;###autoload
(defun doom/set-indent-width (width) (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 (interactive
(list (if (integerp current-prefix-arg) (list (if (integerp current-prefix-arg)
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 with success = nil
for path for path
in (append (doom-glob doom-emacs-dir "*.elc") in (append (doom-glob doom-emacs-dir "*.elc")
(doom-files-in doom-private-dir :match "\\.elc$" :depth 1 :sort nil) (doom-files-in doom-private-dir :match "\\.elc$" :depth 1)
(doom-files-in doom-core-dir :match "\\.elc$" :sort nil) (doom-files-in doom-core-dir :match "\\.elc$")
(doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4 :sort nil)) (doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4))
if (file-exists-p path) if (file-exists-p path)
do (delete-file path) do (delete-file path)
and do (print! (success "Deleted %s") (relpath path)) and do (print! (success "Deleted %s") (relpath path))

View file

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

View file

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

View file

@ -22,7 +22,7 @@ Emacs.")
;;; Packages ;;; Packages
(def-package! projectile (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 :commands (projectile-project-root
projectile-project-name projectile-project-name
projectile-project-p projectile-project-p
@ -149,7 +149,7 @@ the command instead."
;; ;;
;; Project-based minor modes ;;; Project-based minor modes
(defvar doom-project-hook nil (defvar doom-project-hook nil
"Hook run when a project is enabled. The name of the project's mode and its "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 (def-package! winner
;; undo/redo changes to Emacs' window layout ;; 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) :preface (defvar winner-dont-bind-my-keys t)
:config (winner-mode +1)) ; I'll bind keys myself :config (winner-mode +1)) ; I'll bind keys myself
(def-package! paren (def-package! paren
;; highlight matching delimiters ;; highlight matching delimiters
:after-call (after-find-file doom-switch-buffer-hook) :after-call after-find-file doom-switch-buffer-hook
:config :config
(setq show-paren-delay 0.1 (setq show-paren-delay 0.1
show-paren-highlight-openparen t show-paren-highlight-openparen t
@ -448,8 +448,12 @@ treat Emacs as a non-application window."
;;; Third party packages ;;; Third party packages
(def-package! all-the-icons (def-package! all-the-icons
:commands (all-the-icons-octicon all-the-icons-faicon all-the-icons-fileicon :commands (all-the-icons-octicon
all-the-icons-wicon all-the-icons-material all-the-icons-alltheicon) all-the-icons-faicon
all-the-icons-fileicon
all-the-icons-wicon
all-the-icons-material
all-the-icons-alltheicon)
:init :init
(def-advice! doom--disable-all-the-icons-in-tty-a (orig-fn &rest args) (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." "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 load-path doom--initial-load-path
process-environment doom--initial-process-environment) process-environment doom--initial-process-environment)
(require 'core-lib)
(require 'core-modules)
;; `doom-autoload-file' tells Emacs where to load all its functions from. ;; `doom-autoload-file' tells Emacs where to load all its functions from.
;; This includes everything in core/autoload/*.el and autoload files in ;; This includes everything in core/autoload/*.el and autoload files in
;; enabled modules. ;; enabled modules.
@ -530,26 +533,24 @@ to least)."
;; Load shell environment ;; Load shell environment
(when (and (not noninteractive) (when (and (not noninteractive)
(file-exists-p doom-env-file)) (file-exists-p doom-env-file))
(doom-load-env-vars 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)))
;; ;;
;;; Bootstrap Doom ;;; Bootstrap Doom
(add-to-list 'load-path doom-core-dir)
(require 'core-lib)
(require 'core-modules)
(if noninteractive (require 'core-cli))
(doom-initialize noninteractive) (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) (add-hook 'window-setup-hook #'doom-display-benchmark-h)
(require 'core-keybinds) (require 'core-keybinds)
(require 'core-ui) (require 'core-ui)

View file

@ -1,4 +1,6 @@
;;; init.test.el -- for automated unit tests -*- lexical-binding: t; -*- ;;; init.test.el -*- lexical-binding: t; -*-
;; An init.el for our unit test suites. Do not use this!
(doom! :completion (doom! :completion
company company

View file

@ -1,8 +1,8 @@
;;; completion/company/config.el -*- lexical-binding: t; -*- ;;; completion/company/config.el -*- lexical-binding: t; -*-
(def-package! company (def-package! company
:commands (company-complete-common company-manual-begin company-grab-line) :commands company-complete-common company-manual-begin company-grab-line
:after-call (evil-insert-state-entry-hook evil-emacs-state-entry-hook) :after-call evil-insert-state-entry-hook evil-emacs-state-entry-hook
:init :init
(setq company-minimum-prefix-length 2 (setq company-minimum-prefix-length 2
company-tooltip-limit 14 company-tooltip-limit 14
@ -37,7 +37,6 @@
(def-package! company-tng (def-package! company-tng
:when (featurep! +tng) :when (featurep! +tng)
:defer 2
:after-call post-self-insert-hook :after-call post-self-insert-hook
:config :config
(add-to-list 'company-frontends 'company-tng-frontend) (add-to-list 'company-frontends 'company-tng-frontend)

View file

@ -324,5 +324,5 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(prescient-persist-mode +1)) (prescient-persist-mode +1))
;; Used by `counsel-M-x' ;;;###package amx
(setq amx-save-file (concat doom-cache-dir "amx-items")) (setq amx-save-file (concat doom-cache-dir "amx-items")) ; used by `counsel-M-x'

View file

@ -44,7 +44,7 @@
(user-error "Must be called from a file-visiting buffer")) (user-error "Must be called from a file-visiting buffer"))
(let* ((directory (file-name-directory buffer-file-name)) (let* ((directory (file-name-directory buffer-file-name))
(filename (file-name-nondirectory buffer-file-name)) (filename (file-name-nondirectory buffer-file-name))
(files (doom-files-in directory :depth 0 :sort t :match "/[^._][^/]*$")) (files (doom-files-in directory :depth 0 :match "/[^._][^/]*$"))
(index (cl-position filename files :test #'string=))) (index (cl-position filename files :test #'string=)))
(when (null index) (when (null index)
(user-error "Couldn't find this file in current directory")) (user-error "Couldn't find this file in current directory"))

View file

@ -184,7 +184,7 @@ directives. By default, this only recognizes C directives.")
(def-package! evil-easymotion (def-package! evil-easymotion
:commands (evilem-create evilem-default-keybindings) :commands evilem-create evilem-default-keybindings
:config :config
;; Use evil-search backend, instead of isearch ;; Use evil-search backend, instead of isearch
(evilem-make-motion evilem-motion-search-next #'evil-ex-search-next (evilem-make-motion evilem-motion-search-next #'evil-ex-search-next
@ -199,7 +199,7 @@ directives. By default, this only recognizes C directives.")
(def-package! evil-embrace (def-package! evil-embrace
:commands (embrace-add-pair embrace-add-pair-regexp) :commands embrace-add-pair embrace-add-pair-regexp
:hook (LaTeX-mode . embrace-LaTeX-mode-hook) :hook (LaTeX-mode . embrace-LaTeX-mode-hook)
:hook (org-mode . embrace-org-mode-hook) :hook (org-mode . embrace-org-mode-hook)
:hook ((ruby-mode enh-ruby-mode) . embrace-ruby-mode-hook) :hook ((ruby-mode enh-ruby-mode) . embrace-ruby-mode-hook)
@ -246,8 +246,8 @@ directives. By default, this only recognizes C directives.")
(def-package! evil-escape (def-package! evil-escape
:commands (evil-escape) :commands evil-escape
:after-call (evil-normal-state-exit-hook) :after-call evil-normal-state-exit-hook
:init :init
(setq evil-escape-excluded-states '(normal visual multiedit emacs motion) (setq evil-escape-excluded-states '(normal visual multiedit emacs motion)
evil-escape-excluded-major-modes '(neotree-mode treemacs-mode vterm-mode) evil-escape-excluded-major-modes '(neotree-mode treemacs-mode vterm-mode)
@ -272,8 +272,10 @@ directives. By default, this only recognizes C directives.")
(def-package! evil-snipe (def-package! evil-snipe
:commands (evil-snipe-mode evil-snipe-override-mode :commands (evil-snipe-mode
evil-snipe-local-mode evil-snipe-override-local-mode) evil-snipe-override-mode
evil-snipe-local-mode
evil-snipe-override-local-mode)
:after-call pre-command-hook :after-call pre-command-hook
:init :init
(setq evil-snipe-smart-case t (setq evil-snipe-smart-case t
@ -306,7 +308,7 @@ directives. By default, this only recognizes C directives.")
;; ;;
;; Text object plugins ;;; Text object plugins
(def-package! exato (def-package! exato
:commands (evil-outer-xml-attr evil-inner-xml-attr)) :commands evil-outer-xml-attr evil-inner-xml-attr)

View file

@ -10,7 +10,7 @@
;; ;;
;; Third-party plugins ;;; Third-party plugins
;; `csv-mode' ;; `csv-mode'
(map! :after csv-mode (map! :after csv-mode
@ -37,5 +37,3 @@
(def-project-mode! +data-vagrant-mode (def-project-mode! +data-vagrant-mode
:files ("Vagrantfile")) :files ("Vagrantfile"))

View file

@ -71,6 +71,13 @@ library/userland functions"
(throw 'matcher t))))))) (throw 'matcher t)))))))
nil)) nil))
;; `+emacs-lisp-highlight-vars-and-faces' is a potentially expensive function
;; and should be byte-compiled, no matter what, to ensure it runs as fast as
;; possible:
(unless (byte-code-function-p (symbol-function '+emacs-lisp-highlight-vars-and-faces))
(with-no-warnings
(byte-compile #'+emacs-lisp-highlight-vars-and-faces)))
;;;###autoload ;;;###autoload
(defun +emacs-lisp-lookup-documentation (thing) (defun +emacs-lisp-lookup-documentation (thing)
"Lookup THING with `helpful-variable' if it's a variable, `helpful-callable' "Lookup THING with `helpful-variable' if it's a variable, `helpful-callable'
@ -79,13 +86,6 @@ if it's callable, `apropos' otherwise."
(doom/describe-symbol thing) (doom/describe-symbol thing)
(call-interactively #'doom/describe-symbol))) (call-interactively #'doom/describe-symbol)))
;; `+emacs-lisp-highlight-vars-and-faces' is a potentially expensive function
;; and should be byte-compiled, no matter what, to ensure it runs as fast as
;; possible:
(when (not (byte-code-function-p (symbol-function '+emacs-lisp-highlight-vars-and-faces)))
(with-no-warnings
(byte-compile #'+emacs-lisp-highlight-vars-and-faces)))
;; ;;
;;; Commands ;;; Commands

View file

@ -34,9 +34,6 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
("add-hook" "remove-hook") ("add-hook" "remove-hook")
("add-hook!" "remove-hook!"))) ("add-hook!" "remove-hook!")))
;; TODO
(put 'add-hook 'lisp-indent-function 'defun)
(setq-hook! 'emacs-lisp-mode-hook (setq-hook! 'emacs-lisp-mode-hook
tab-width 2 tab-width 2
;; shorter name in modeline ;; shorter name in modeline
@ -72,7 +69,7 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
;; `emacs-lisp' checker's verbosity. ;; `emacs-lisp' checker's verbosity.
(add-hook 'flycheck-mode-hook #'+emacs-lisp-reduce-flycheck-errors-in-emacs-config-h) (add-hook 'flycheck-mode-hook #'+emacs-lisp-reduce-flycheck-errors-in-emacs-config-h)
;; Special fontification for elisp ;; Special syntax highlighting for elisp...
(font-lock-add-keywords (font-lock-add-keywords
'emacs-lisp-mode 'emacs-lisp-mode
(append `(;; custom Doom cookies (append `(;; custom Doom cookies

View file

@ -36,8 +36,9 @@
:interpreter "node" :interpreter "node"
:commands js2-line-break :commands js2-line-break
:config :config
(setq js2-skip-preprocessor-directives t (setq js-chain-indent t
js-chain-indent t ;; Don't mishighlight shebang lines
js2-skip-preprocessor-directives t
;; let flycheck handle this ;; let flycheck handle this
js2-mode-show-parse-errors nil js2-mode-show-parse-errors nil
js2-mode-show-strict-warnings nil js2-mode-show-strict-warnings nil

View file

@ -270,14 +270,16 @@ Some commands of interest:
+ `+org-attach/file' + `+org-attach/file'
+ `+org-attach/url' + `+org-attach/url'
+ `+org-attach/sync'" + `+org-attach/sync'"
(setq org-attach-directory (expand-file-name org-attach-directory org-directory)) (setq org-attach-directory (doom-dir org-directory org-attach-directory))
;; A shorter link to attachments ;; A shorter link to attachments
(add-to-list 'org-link-abbrev-alist (cons "attach" (abbreviate-file-name org-attach-directory))) (add-to-list 'org-link-abbrev-alist
(cons "attach"
(abbreviate-file-name org-attach-directory)))
(org-link-set-parameters (org-link-set-parameters
"attach" "attach"
:follow (lambda (link) (find-file (expand-file-name link org-attach-directory))) :follow (lambda (link) (find-file (doom-path org-attach-directory link)))
:complete (lambda (&optional _arg) :complete (lambda (&optional _arg)
(+org--relpath (+org-link-read-file "attach" org-attach-directory) (+org--relpath (+org-link-read-file "attach" org-attach-directory)
org-attach-directory)) org-attach-directory))
@ -571,8 +573,8 @@ between the two."
"e" #'org-table-edit-formulas "e" #'org-table-edit-formulas
"=" #'org-table-eval-formulas))) "=" #'org-table-eval-formulas)))
;; Fixes #1483: this messy hack fixes `org-agenda' or `evil-org-agenda' ;; HACK Fixes #1483: this messy hack fixes `org-agenda' or `evil-org-agenda'
;; overriding SPC, breaking the localleader. TODO Improve me! ;; overriding SPC, breaking the localleader
(define-minor-mode org-agenda-localleader-mode "TODO" (define-minor-mode org-agenda-localleader-mode "TODO"
:keymap (make-sparse-keymap)) :keymap (make-sparse-keymap))
(add-hook 'org-agenda-mode-hook #'org-agenda-localleader-mode) (add-hook 'org-agenda-mode-hook #'org-agenda-localleader-mode)

View file

@ -4,10 +4,12 @@
(def-package! org-download (def-package! org-download
:commands (org-download-dnd org-download-dnd-base64) :commands (org-download-dnd org-download-dnd-base64)
:init :init
;; Add these manually so that org-download is lazy-loaded... ;; HACK We add these manually so that org-download is truly lazy-loaded
(add-to-list 'dnd-protocol-alist '("^\\(https?\\|ftp\\|file\\|nfs\\):" . +org-dragndrop-download-dnd)) (appendq!
(add-to-list 'dnd-protocol-alist '("^data:" . org-download-dnd-base64)) dnd-protocol-alist
'("^\\(?:https?\\|ftp\\|file\\|nfs\\):"
. +org-dragndrop-download-dnd)
'("^data:" . org-download-dnd-base64))
(advice-add #'org-download-enable :override #'ignore) (advice-add #'org-download-enable :override #'ignore)
:config :config
(setq org-download-image-dir org-attach-directory (setq org-download-image-dir org-attach-directory

View file

@ -61,13 +61,14 @@ character.")
"HTML encode/decode TEXT. Based on Xah's replace HTML named entities function "HTML encode/decode TEXT. Based on Xah's replace HTML named entities function
@ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html" @ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html"
(interactive "<!><r>") (interactive "<!><r>")
(seq-doseq (rep +web-entities-list) (mapc (lambda (rep)
(let ((from (elt rep (if decode-p 0 1))) (let ((from (elt rep (if decode-p 0 1)))
(to (elt rep (if decode-p 1 0))) (to (elt rep (if decode-p 1 0)))
case-fold-search) case-fold-search)
(when (and (not (equal from " ")) (when (and (not (equal from " "))
(string-match-p (regexp-quote from) text)) (string-match-p (regexp-quote from) text))
(setq text (replace-regexp-in-string (regexp-quote from) to text t t))))) (setq text (replace-regexp-in-string (regexp-quote from) to text t t)))))
+web-entities-list)
text) text)
(defun +web--entities-region (beg end &optional decode-p) (defun +web--entities-region (beg end &optional decode-p)
@ -75,14 +76,15 @@ character.")
function @ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html" function @ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html"
(save-restriction (save-restriction
(narrow-to-region beg end) (narrow-to-region beg end)
(seq-doseq (rep +web-entities-list) (mapc (lambda (rep)
(let ((from (elt rep (if decode-p 0 1))) (let ((from (elt rep (if decode-p 0 1)))
(to (elt rep (if decode-p 1 0))) (to (elt rep (if decode-p 1 0)))
case-fold-search) case-fold-search)
(unless (equal from " ") (unless (equal from " ")
(goto-char (point-min)) (goto-char (point-min))
(while (search-forward from nil t) (while (search-forward from nil t)
(replace-match to 'FIXEDCASE 'LITERAL))))))) (replace-match to 'FIXEDCASE 'LITERAL)))))
+web-entities-list)))
;;;###autoload ;;;###autoload
(defun +web-encode-entities (text) (defun +web-encode-entities (text)

View file

@ -5,6 +5,7 @@
lsp-keep-workspace-alive nil lsp-keep-workspace-alive nil
lsp-groovy-server-install-dir (concat doom-etc-dir "groovy-langserver/")) lsp-groovy-server-install-dir (concat doom-etc-dir "groovy-langserver/"))
(after! lsp-mode (after! lsp-mode
(set-lookup-handlers! 'lsp-mode :async t (set-lookup-handlers! 'lsp-mode :async t
:documentation 'lsp-describe-thing-at-point :documentation 'lsp-describe-thing-at-point

View file

@ -106,8 +106,10 @@ ensure it is built when we actually use Forge."
(def-package! magit-todos (def-package! magit-todos
:after magit :after magit
:config :config
(setq magit-todos-keyword-suffix "\\(?:([^)]+)\\)?:?") (setq magit-todos-keyword-suffix "\\(?:([^)]+)\\)?:?") ; make colon optional
(define-key magit-todos-section-map "j" nil) (define-key magit-todos-section-map "j" nil)
;; Warns that jT isn't bound. Well, yeah, you don't need to tell me, that was
;; on purpose ya goose.
(advice-add #'magit-todos-mode :around #'doom-shut-up-a) (advice-add #'magit-todos-mode :around #'doom-shut-up-a)
(magit-todos-mode +1)) (magit-todos-mode +1))