Silence 'cannot load' false positive errors when byte-compiling
This commit is contained in:
parent
76a4ae459d
commit
ae25e319b0
2 changed files with 67 additions and 64 deletions
|
@ -328,13 +328,18 @@ MODULES is an malformed plist of modules to load."
|
|||
(message "Doom modules initialized"))))
|
||||
|
||||
(defmacro def-package! (name &rest plist)
|
||||
"A thin wrapper around `use-package'.
|
||||
|
||||
Ignores the package if its NAME is present in `doom-disabled-packages'."
|
||||
"A thin wrapper around `use-package'."
|
||||
;; Ignore package if NAME is in `doom-disabled-packages'
|
||||
(when (and (memq name doom-disabled-packages)
|
||||
(not (memq :disabled plist)))
|
||||
(setq plist (append (list :disabled t) plist)))
|
||||
`(use-package ,name ,@plist))
|
||||
;; If byte-compiling, ignore this package if it doesn't meet the condition.
|
||||
;; This avoids false-positive load errors.
|
||||
(unless (and (bound-and-true-p byte-compile-current-file)
|
||||
(or (and (plist-member plist :if) (not (eval (plist-get plist :if))))
|
||||
(and (plist-member plist :when) (not (eval (plist-get plist :when))))
|
||||
(and (plist-member plist :unless) (eval (plist-get plist :unless)))))
|
||||
`(use-package ,name ,@plist)))
|
||||
|
||||
(defmacro def-package-hook! (package when &rest body)
|
||||
"Reconfigures a package's `def-package!' block.
|
||||
|
|
|
@ -342,10 +342,10 @@ See `doom-line-numbers-style' to control the style of line numbers to display."
|
|||
(add-hook! (prog-mode text-mode conf-mode) #'doom|enable-line-numbers)
|
||||
|
||||
;; Emacs 26+ has native line number support.
|
||||
(unless (boundp 'display-line-numbers)
|
||||
;; Line number column. A faster (or equivalent, in the worst case) line number
|
||||
;; plugin than `linum-mode'.
|
||||
(def-package! nlinum
|
||||
:unless (boundp 'display-line-numbers)
|
||||
:commands nlinum-mode
|
||||
:init
|
||||
(defvar doom-line-number-lpad 4
|
||||
|
@ -359,7 +359,6 @@ By default, this is a space character. If you use `whitespace-mode' with
|
|||
`space-mark', the whitespace in line numbers will be affected (this can look
|
||||
ugly). In this case, you can change this to ?\u2002, which is a unicode
|
||||
character that looks like a space that `whitespace-mode' won't affect.")
|
||||
|
||||
:config
|
||||
(setq nlinum-highlight-current-line t)
|
||||
|
||||
|
@ -394,26 +393,25 @@ character that looks like a space that `whitespace-mode' won't affect.")
|
|||
|
||||
;; Fixes disappearing line numbers in nlinum and other quirks
|
||||
(def-package! nlinum-hl
|
||||
:unless (boundp 'display-line-numbers)
|
||||
:after nlinum
|
||||
:config
|
||||
;; With `markdown-fontify-code-blocks-natively' enabled in `markdown-mode',
|
||||
;; line numbers tend to vanish next to code blocks.
|
||||
(advice-add #'markdown-fontify-code-block-natively
|
||||
:after #'nlinum-hl-do-markdown-fontify-region)
|
||||
|
||||
;; When using `web-mode's code-folding an entire range of line numbers will
|
||||
;; vanish in the affected area.
|
||||
(advice-add #'web-mode-fold-or-unfold :after #'nlinum-hl-do-generic-flush)
|
||||
|
||||
;; Changing fonts can leave nlinum line numbers in their original size; this
|
||||
;; forces them to resize.
|
||||
(advice-add #'set-frame-font :after #'nlinum-hl-flush-all-windows))
|
||||
|
||||
(def-package! nlinum-relative
|
||||
:unless (boundp 'display-line-numbers)
|
||||
:commands nlinum-relative-mode
|
||||
:config
|
||||
(after! evil
|
||||
(nlinum-relative-setup-evil))))
|
||||
(after! evil (nlinum-relative-setup-evil)))
|
||||
|
||||
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue