mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-16 15:56:52 -05:00
💥 Rename def-package! -> use-package!
Calling this pivotal macro "def-package!" has frequently been a source of confusion. It is a thin wrapper around use-package, and it should be obvious that it is so. For this reason, and to match the naming convention used with other convenience macros/wrappers, it is now use-package!. Also changes def-package-hook! -> use-package-hook! The old macros are now marked obsolete and will be removed when straight integration is merged.
This commit is contained in:
@@ -381,7 +381,7 @@ current file is in, or d) the module associated with the current major mode (see
|
||||
(split-string
|
||||
(shell-command-to-string
|
||||
(format "git grep --no-break --no-heading --line-number '%s %s\\($\\| \\)'"
|
||||
"\\(^;;;###package\\|(after!\\|(def-package!\\)"
|
||||
"\\(^;;;###package\\|(after!\\|(use-package!\\)"
|
||||
package))
|
||||
"\n" t)))
|
||||
|
||||
|
@@ -63,7 +63,7 @@ successfully sets indent_style/indent_size.")
|
||||
;;
|
||||
;;; Built-in plugins
|
||||
|
||||
(def-package! autorevert
|
||||
(use-package! autorevert
|
||||
;; revert buffers when their files/state have changed
|
||||
:hook (focus-in . doom-auto-revert-buffers-h)
|
||||
:hook (after-save . doom-auto-revert-buffers-h)
|
||||
@@ -99,7 +99,7 @@ successfully sets indent_style/indent_size.")
|
||||
(setq bookmark-save-flag t))
|
||||
|
||||
|
||||
(def-package! recentf
|
||||
(use-package! recentf
|
||||
;; Keep track of recently opened files
|
||||
:defer-incrementally easymenu tree-widget timer
|
||||
:after-call after-find-file
|
||||
@@ -141,7 +141,7 @@ successfully sets indent_style/indent_size.")
|
||||
(quiet! (recentf-mode +1))))
|
||||
|
||||
|
||||
(def-package! savehist
|
||||
(use-package! savehist
|
||||
;; persist variables across sessions
|
||||
:defer-incrementally custom
|
||||
:after-call post-command-hook
|
||||
@@ -161,7 +161,7 @@ successfully sets indent_style/indent_size.")
|
||||
else if item collect it)))))
|
||||
|
||||
|
||||
(def-package! saveplace
|
||||
(use-package! saveplace
|
||||
;; persistent point location in buffers
|
||||
:after-call after-find-file dired-initial-position-hook
|
||||
:config
|
||||
@@ -175,7 +175,7 @@ successfully sets indent_style/indent_size.")
|
||||
(save-place-mode +1))
|
||||
|
||||
|
||||
(def-package! server
|
||||
(use-package! server
|
||||
:when (display-graphic-p)
|
||||
:after-call pre-command-hook after-find-file focus-out-hook
|
||||
:init
|
||||
@@ -189,7 +189,7 @@ successfully sets indent_style/indent_size.")
|
||||
;;
|
||||
;;; Packages
|
||||
|
||||
(def-package! better-jumper
|
||||
(use-package! better-jumper
|
||||
:after-call pre-command-hook
|
||||
:init
|
||||
(global-set-key [remap evil-jump-forward] #'better-jumper-jump-forward)
|
||||
@@ -227,7 +227,7 @@ successfully sets indent_style/indent_size.")
|
||||
nil))
|
||||
|
||||
|
||||
(def-package! command-log-mode
|
||||
(use-package! command-log-mode
|
||||
:commands global-command-log-mode
|
||||
:config
|
||||
(setq command-log-mode-auto-show t
|
||||
@@ -236,7 +236,7 @@ successfully sets indent_style/indent_size.")
|
||||
command-log-mode-window-size 50))
|
||||
|
||||
|
||||
(def-package! dtrt-indent
|
||||
(use-package! dtrt-indent
|
||||
;; Automatic detection of indent settings
|
||||
:unless noninteractive
|
||||
:defer t
|
||||
@@ -273,7 +273,7 @@ successfully sets indent_style/indent_size.")
|
||||
(funcall orig-fn arg)))))
|
||||
|
||||
|
||||
(def-package! helpful
|
||||
(use-package! helpful
|
||||
;; a better *help* buffer
|
||||
:commands helpful--read-symbol
|
||||
:init
|
||||
@@ -308,7 +308,7 @@ successfully sets indent_style/indent_size.")
|
||||
(add-hook 'imenu-after-jump-hook #'recenter)
|
||||
|
||||
|
||||
(def-package! smartparens
|
||||
(use-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
|
||||
@@ -363,12 +363,12 @@ successfully sets indent_style/indent_size.")
|
||||
(smartparens-global-mode +1))
|
||||
|
||||
|
||||
(def-package! so-long
|
||||
(use-package! so-long
|
||||
:after-call after-find-file
|
||||
:config (global-so-long-mode +1))
|
||||
|
||||
|
||||
(def-package! undo-tree
|
||||
(use-package! undo-tree
|
||||
;; Branching & persistent undo
|
||||
:after-call doom-switch-buffer-hook after-find-file
|
||||
:config
|
||||
@@ -395,7 +395,7 @@ successfully sets indent_style/indent_size.")
|
||||
(global-undo-tree-mode +1))
|
||||
|
||||
|
||||
(def-package! ws-butler
|
||||
(use-package! ws-butler
|
||||
;; a less intrusive `delete-trailing-whitespaces' on save
|
||||
:after-call after-find-file
|
||||
:config
|
||||
|
@@ -177,7 +177,7 @@ localleader prefix."
|
||||
;;
|
||||
;;; Packages
|
||||
|
||||
(def-package! which-key
|
||||
(use-package! which-key
|
||||
:defer 1
|
||||
:after-call pre-command-hook
|
||||
:init
|
||||
|
@@ -193,7 +193,7 @@ at the values with which this function was called."
|
||||
(call-interactively ,command))))
|
||||
(defalias 'lambda!! 'λ!!)
|
||||
|
||||
(define-obsolete-function-alias 'FILE! 'file!)
|
||||
(define-obsolete-function-alias 'FILE! 'file!) ; DEPRECATED
|
||||
(defun file! ()
|
||||
"Return the emacs lisp file this macro is called from."
|
||||
(cond ((bound-and-true-p byte-compile-current-file))
|
||||
@@ -202,7 +202,7 @@ at the values with which this function was called."
|
||||
(car current-load-list))
|
||||
(buffer-file-name)))
|
||||
|
||||
(define-obsolete-function-alias 'DIR! 'dir!)
|
||||
(define-obsolete-function-alias 'DIR! 'dir!) ; DEPRECATED
|
||||
(defun dir! ()
|
||||
"Returns the directory of the emacs lisp file this macro is called from."
|
||||
(when-let (path (file!))
|
||||
|
@@ -244,10 +244,10 @@ This value is cached. If REFRESH-P, then don't use the cached value."
|
||||
use-package-minimum-reported-time (if doom-debug-mode 0 0.1)
|
||||
use-package-expand-minimally (not noninteractive)))
|
||||
|
||||
;; Adds four new keywords to `use-package' (and consequently, `def-package!') to
|
||||
;; Adds four new keywords to `use-package' (and consequently, `use-package!') to
|
||||
;; expand its lazy-loading capabilities. They are:
|
||||
;;
|
||||
;; Check out `def-package!'s documentation for more about these two.
|
||||
;; Check out `use-package!'s documentation for more about these two.
|
||||
;; :after-call SYMBOL|LIST
|
||||
;; :defer-incrementally SYMBOL|LIST|t
|
||||
;;
|
||||
@@ -393,7 +393,8 @@ to least)."
|
||||
`(setq doom-modules ',doom-modules))
|
||||
|
||||
(defvar doom-disabled-packages)
|
||||
(defmacro def-package! (name &rest plist)
|
||||
(define-obsolete-function-alias 'def-package! 'use-package!) ; DEPRECATED
|
||||
(defmacro use-package! (name &rest plist)
|
||||
"Declares and configures a package.
|
||||
|
||||
This is a thin wrapper around `use-package', and is ignored if the NAME package
|
||||
@@ -407,7 +408,7 @@ two extra properties:
|
||||
The first time any of these functions or hooks are executed, the package is
|
||||
loaded. e.g.
|
||||
|
||||
(def-package! projectile
|
||||
(use-package! projectile
|
||||
:after-call (pre-command-hook after-find-file dired-before-readin-hook)
|
||||
...)
|
||||
|
||||
@@ -421,7 +422,7 @@ two extra properties:
|
||||
NAME is implicitly added if this property is present and non-nil. No need to
|
||||
specify it. A value of `t' implies NAME, e.g.
|
||||
|
||||
(def-package! abc
|
||||
(use-package! abc
|
||||
;; This is equivalent to :defer-incrementally (abc)
|
||||
:defer-incrementally t
|
||||
...)"
|
||||
@@ -434,8 +435,9 @@ two extra properties:
|
||||
(not (locate-library (symbol-name name)))))
|
||||
`(use-package ,name ,@plist)))
|
||||
|
||||
(defmacro def-package-hook! (package when &rest body)
|
||||
"Reconfigures a package's `def-package!' block.
|
||||
(define-obsolete-function-alias 'def-package-hook! 'use-package-hook!) ; DEPRECATED
|
||||
(defmacro use-package-hook! (package when &rest body)
|
||||
"Reconfigures a package's `use-package!' block.
|
||||
|
||||
Only use this macro in a module's init.el file.
|
||||
|
||||
@@ -446,11 +448,11 @@ WHEN should be one of the following:
|
||||
:pre-init :post-init :pre-config :post-config
|
||||
|
||||
WARNING: If :pre-init or :pre-config hooks return nil, the original
|
||||
`def-package!''s :init/:config block (respectively) is overwritten, so remember
|
||||
`use-package!''s :init/:config block (respectively) is overwritten, so remember
|
||||
to have them return non-nil (or exploit that to overwrite Doom's config)."
|
||||
(declare (indent defun))
|
||||
(unless (memq when '(:pre-init :post-init :pre-config :post-config))
|
||||
(error "'%s' isn't a valid hook for def-package-hook!" when))
|
||||
(error "'%s' isn't a valid hook for use-package-hook!" when))
|
||||
`(progn
|
||||
(setq use-package-inject-hooks t)
|
||||
(add-hook!
|
||||
|
@@ -64,7 +64,7 @@ missing) and shouldn't be deleted.")
|
||||
"A list of recipes for straight's recipe repos.")
|
||||
|
||||
(defvar doom-disabled-packages ()
|
||||
"A list of packages that should be ignored by `def-package!' and `after!'.")
|
||||
"A list of packages that should be ignored by `use-package!' and `after!'.")
|
||||
|
||||
|
||||
;;
|
||||
|
@@ -21,7 +21,7 @@ Emacs.")
|
||||
;;
|
||||
;;; Packages
|
||||
|
||||
(def-package! projectile
|
||||
(use-package! projectile
|
||||
:after-call after-find-file dired-before-readin-hook minibuffer-setup-hook
|
||||
:commands (projectile-project-root
|
||||
projectile-project-name
|
||||
|
@@ -365,7 +365,7 @@ treat Emacs as a non-application window."
|
||||
(setq ansi-color-for-comint-mode t)
|
||||
|
||||
|
||||
(def-package! compile
|
||||
(use-package! compile
|
||||
:defer t
|
||||
:config
|
||||
(setq compilation-always-kill t ; kill compilation process before starting another
|
||||
@@ -375,7 +375,7 @@ treat Emacs as a non-application window."
|
||||
(add-hook 'compilation-filter-hook #'doom-apply-ansi-color-to-compilation-buffer-h))
|
||||
|
||||
|
||||
(def-package! ediff
|
||||
(use-package! ediff
|
||||
:defer t
|
||||
:init
|
||||
(setq ediff-diff-options "-w" ; turn off whitespace checking
|
||||
@@ -394,7 +394,7 @@ treat Emacs as a non-application window."
|
||||
'append))
|
||||
|
||||
|
||||
(def-package! hl-line
|
||||
(use-package! hl-line
|
||||
;; Highlights the current line
|
||||
:hook ((prog-mode text-mode conf-mode) . hl-line-mode)
|
||||
:config
|
||||
@@ -418,14 +418,14 @@ treat Emacs as a non-application window."
|
||||
(hl-line-mode +1))))))
|
||||
|
||||
|
||||
(def-package! winner
|
||||
(use-package! winner
|
||||
;; undo/redo changes to Emacs' window layout
|
||||
: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
|
||||
(use-package! paren
|
||||
;; highlight matching delimiters
|
||||
:after-call after-find-file doom-switch-buffer-hook
|
||||
:config
|
||||
@@ -449,7 +449,7 @@ treat Emacs as a non-application window."
|
||||
;;
|
||||
;;; Third party packages
|
||||
|
||||
(def-package! all-the-icons
|
||||
(use-package! all-the-icons
|
||||
:commands (all-the-icons-octicon
|
||||
all-the-icons-faicon
|
||||
all-the-icons-fileicon
|
||||
@@ -471,7 +471,7 @@ treat Emacs as a non-application window."
|
||||
#'hide-mode-line-mode)
|
||||
|
||||
;; Better fontification of number literals in code
|
||||
(def-package! highlight-numbers
|
||||
(use-package! highlight-numbers
|
||||
:hook ((prog-mode conf-mode) . highlight-numbers-mode)
|
||||
:config (setq highlight-numbers-generic-regexp "\\_<[[:digit:]]+\\(?:\\.[0-9]*\\)?\\_>"))
|
||||
|
||||
@@ -501,7 +501,7 @@ treat Emacs as a non-application window."
|
||||
(defun doom-disable-line-numbers-h () (display-line-numbers-mode -1))
|
||||
|
||||
;; `nlinum' is used for Emacs 25 users, as Emacs 26+ has native line numbers.
|
||||
(def-package! nlinum
|
||||
(use-package! nlinum
|
||||
;; Line number column. A faster (or equivalent, in the worst case) line number
|
||||
;; plugin than `linum-mode'.
|
||||
:unless EMACS26+
|
||||
@@ -550,7 +550,7 @@ character that looks like a space that `whitespace-mode' won't affect.")
|
||||
(length (save-excursion (goto-char (point-max))
|
||||
(format-mode-line "%l")))))))
|
||||
|
||||
(def-package! nlinum-hl
|
||||
(use-package! nlinum-hl
|
||||
;; Fixes disappearing line numbers in nlinum and other quirks
|
||||
:unless EMACS26+
|
||||
:after nlinum
|
||||
@@ -566,7 +566,7 @@ character that looks like a space that `whitespace-mode' won't affect.")
|
||||
;; forces them to resize.
|
||||
(add-hook 'after-setting-font-hook #'nlinum-hl-flush-all-windows))
|
||||
|
||||
(def-package! nlinum-relative
|
||||
(use-package! nlinum-relative
|
||||
:unless EMACS26+
|
||||
:defer t
|
||||
:config
|
||||
|
Reference in New Issue
Block a user