From d30027aaea1338dcd0933d6113aa22ce1f8b4240 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 1 Feb 2017 00:31:58 -0500 Subject: [PATCH] General cleanup --- core/autoload/ui.el | 26 ++++++++++++++++++++++++++ core/core-ui.el | 13 ++++--------- core/core.el | 11 ++--------- 3 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 core/autoload/ui.el diff --git a/core/autoload/ui.el b/core/autoload/ui.el new file mode 100644 index 000000000..26b7ac599 --- /dev/null +++ b/core/autoload/ui.el @@ -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))) + diff --git a/core/core-ui.el b/core/core-ui.el index db071fadb..59b90f7eb 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -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))) diff --git a/core/core.el b/core/core.el index 4115cefec..039c63478 100644 --- a/core/core.el +++ b/core/core.el @@ -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