Add & revise comments

And move line number hooks to core/autoload/ui.el
This commit is contained in:
Henrik Lissner 2019-12-31 15:55:56 -05:00
parent b592e58c97
commit 6f951229ec
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 23 additions and 10 deletions

View file

@ -1,7 +1,7 @@
;;; core/autoload/ui.el -*- lexical-binding: t; -*- ;;; core/autoload/ui.el -*- lexical-binding: t; -*-
;; ;;
;; Public library ;;; Public library
;;;###autoload ;;;###autoload
(defun doom-resize-window (window new-size &optional horizontal force-p) (defun doom-resize-window (window new-size &optional horizontal force-p)
@ -24,7 +24,7 @@ are open."
;; ;;
;; Advice ;;; Advice
;;;###autoload ;;;###autoload
(defun doom-recenter-a (&rest _) (defun doom-recenter-a (&rest _)
@ -43,7 +43,7 @@ In tty Emacs, messages suppressed completely."
;; ;;
;; Hooks ;;; Hooks
;;;###autoload ;;;###autoload
(defun doom-apply-ansi-color-to-compilation-buffer-h () (defun doom-apply-ansi-color-to-compilation-buffer-h ()
@ -57,9 +57,17 @@ In tty Emacs, messages suppressed completely."
"Turn off `show-paren-mode' buffer-locally." "Turn off `show-paren-mode' buffer-locally."
(setq-local show-paren-mode nil)) (setq-local show-paren-mode nil))
;;;###autoload
(defun doom-enable-line-numbers-h ()
(display-line-numbers-mode +1))
;;;###autoload
(defun doom-disable-line-numbers-h ()
(display-line-numbers-mode -1))
;; ;;
;; Commands ;;; Commands
;;;###autoload ;;;###autoload
(defun doom/toggle-line-numbers () (defun doom/toggle-line-numbers ()

View file

@ -514,16 +514,16 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;; Explicitly define a width to reduce computation ;; Explicitly define a width to reduce computation
(setq-default display-line-numbers-width 3) (setq-default display-line-numbers-width 3)
;; Show absolute line numbers for narrowed regions ;; Show absolute line numbers for narrowed regions makes it easier to tell the
;; buffer is narrowed, and where you are, exactly.
(setq-default display-line-numbers-widen t) (setq-default display-line-numbers-widen t)
;; Enable line numbers in most text-editing modes ;; Enable line numbers in most text-editing modes. We avoid
;; `global-display-line-numbers-mode' because there are many special and
;; temporary modes where we don't need/want them.
(add-hook! '(prog-mode-hook text-mode-hook conf-mode-hook) (add-hook! '(prog-mode-hook text-mode-hook conf-mode-hook)
#'display-line-numbers-mode) #'display-line-numbers-mode)
(defun doom-enable-line-numbers-h () (display-line-numbers-mode +1))
(defun doom-disable-line-numbers-h () (display-line-numbers-mode -1))
;; ;;
;;; Theme & font ;;; Theme & font
@ -539,6 +539,8 @@ behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
"Loads `doom-font'." "Loads `doom-font'."
(cond (doom-font (cond (doom-font
(cl-pushnew (cl-pushnew
;; Avoiding `set-frame-font' because it does a lot of extra, expensive
;; work we can avoid by setting the font frame parameter instead.
(cons 'font (cons 'font
(cond ((stringp doom-font) doom-font) (cond ((stringp doom-font) doom-font)
((fontp doom-font) (font-xlfd-name doom-font)) ((fontp doom-font) (font-xlfd-name doom-font))
@ -547,6 +549,8 @@ behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
default-frame-alist default-frame-alist
:key #'car :test #'eq)) :key #'car :test #'eq))
((display-graphic-p) ((display-graphic-p)
;; We try our best to record your system font, so `doom-big-font-mode'
;; can still use it to compute a larger font size with.
(setq font-use-system-font t (setq font-use-system-font t
doom-font (face-attribute 'default :font))))) doom-font (face-attribute 'default :font)))))
@ -639,7 +643,8 @@ startup (or theme switch) time, so long as `doom--prefer-theme-elc' is non-nil."
(put 'customize 'disabled "Doom doesn't support `customize', configure Emacs from $DOOMDIR/config.el instead") (put 'customize 'disabled "Doom doesn't support `customize', configure Emacs from $DOOMDIR/config.el instead")
(put 'customize-themes 'disabled "Set `doom-theme' or use `load-theme' in $DOOMDIR/config.el instead") (put 'customize-themes 'disabled "Set `doom-theme' or use `load-theme' in $DOOMDIR/config.el instead")
;; doesn't exist in terminal Emacs; we define it to prevent errors ;; Doesn't exist in terminal Emacs, so we define it to prevent void-function
;; errors emitted from packages use it without checking for it first.
(unless (fboundp 'define-fringe-bitmap) (unless (fboundp 'define-fringe-bitmap)
(fset 'define-fringe-bitmap #'ignore)) (fset 'define-fringe-bitmap #'ignore))