General cleanup

This commit is contained in:
Henrik Lissner 2017-02-01 00:31:58 -05:00
parent a20bdb28b2
commit d30027aaea
3 changed files with 32 additions and 18 deletions

26
core/autoload/ui.el Normal file
View file

@ -0,0 +1,26 @@
;;; ui.el
;;;###autoload
(defun doom/toggle-fullscreen ()
"Toggle fullscreen Emacs."
(interactive)
(set-frame-parameter
nil 'fullscreen
(unless (frame-parameter nil 'fullscreen)
'fullboth)))
;;;###autoload
(defun doom/toggle-line-numbers ()
"Toggle `nlinum-mode'."
(interactive)
(nlinum-mode (if nlinum-mode -1 +1)))
;;;###autoload
(defun doom/reset-theme ()
"Reset the color theme currently in use."
(interactive)
(let ((theme (car-safe custom-enabled-themes)))
(when theme
(mapc 'disable-theme custom-enabled-themes))
(load-theme theme t)))

View file

@ -115,7 +115,7 @@ disabled.")
:config
(setq highlight-indent-guides-method 'character)
(defun doom|adjust-indent-guides (&optional start end)
(defun doom|inject-trailing-whitespace (&optional start end)
"The opposite of `delete-trailing-whitespace'. Injects whitespace into
buffer so that `highlight-indent-guides-mode' will display uninterrupted indent
markers. This whitespace is stripped out on save, as not to affect the resulting
@ -155,7 +155,7 @@ file."
(add-hook! highlight-indent-guides-mode
(if highlight-indent-guides-mode
(progn
(doom|adjust-indent-guides)
(doom|inject-trailing-whitespace)
(add-hook 'after-save-hook 'doom|adjust-indent-guides nil t))
(remove-hook 'after-save-hook 'doom|adjust-indent-guides t)
(delete-trailing-whitespace))))
@ -182,18 +182,13 @@ file."
'nlinum-mode)
:config
(defun doom/toggle-line-numbers ()
"Toggle `nlinum-mode'."
(interactive)
(nlinum-mode (if nlinum-mode -1 +1)))
;; Optimization: calculate line number column width beforehand
(add-hook! nlinum-mode
(setq nlinum--width (length (save-excursion (goto-char (point-max))
(format-mode-line "%l")))))
;; Disable nlinum when making frames, otherwise we get linum face error
;; messages that prevent frame creation.
;; Disable nlinum explicitly before making a frame, otherwise nlinum throws
;; linum face errors that prevent the frame from spawning.
(add-hook! '(before-make-frame-hook after-make-frame-functions)
(nlinum-mode -1)))

View file

@ -159,20 +159,13 @@ enable multiple minor modes for the same regexp.")
;;; Let 'er rip! (order matters!)
(require 'core-ui) ; draw me like one of your French editors
(require 'core-states) ; TODO
(require 'core-popups) ; taming sudden yet inevitable windows
(require 'core-editor) ; baseline configuration for text editing
(require 'core-projects) ; getting around your projects
(unless (require 'autoloads nil t)
(unless (require 'autoloads (concat doom-local-dir "autoloads.el") t)
(add-hook 'after-init-hook 'doom/refresh-autoloads)))
;; (require 'core-workspaces) ; TODO
;; (require 'core-completion) ; TODO company & auto-complete, for the lazy typist
;; (require 'core-evil)
;; (require 'core-jump)
;; (require 'core-repl)
;; (require 'core-snippets)
;; (require 'core-syntax-checking)
(provide 'core)
;;; core.el ends here