General cleanup + refactor core.el

This commit is contained in:
Henrik Lissner 2017-02-06 01:25:48 -05:00
parent b4c033d352
commit b8042bdaaa
4 changed files with 19 additions and 68 deletions

View file

@ -18,7 +18,7 @@
(unless (doom-popup-p)
(setq doom-popup-other-window (selected-window)))
(when (and plist (not (plist-member plist :align)))
(plist-put plist :align shackle-default-alignment))
(plist-put plist :align t))
(shackle-display-buffer
buffer
nil (or plist (shackle-match buffer-name)))))

View file

@ -1,10 +1,8 @@
;;; core-lib.el
(require 'dash)
(require 'f)
(require 's)
(eval-when-compile (require 'cl-lib))
(require 'f)
(defvar +evil-leader)
(defvar +evil-localleader)
@ -53,11 +51,12 @@
(defmacro λ! (&rest body)
"A shortcut for inline keybind lambdas."
(declare (doc-string 1))
`(lambda () (interactive) ,@body))
(defmacro after! (feature &rest forms)
"A smart wrapper around `with-eval-after-load', that supresses warnings
during compilation."
"A smart wrapper around `with-eval-after-load'. Supresses warnings during
compilation."
(declare (indent defun) (debug t))
`(,(if (or (not (boundp 'byte-compile-current-file))
(not byte-compile-current-file)

View file

@ -222,54 +222,6 @@ monkey patch it to use pop-to-buffer, and to remember the previous window."
window t arg windmove-wrap-around t))
(advice-add 'windmove-find-other-window :override 'doom*ignore-window-parameters-in-popups))
;; (after! help-mode
;; ;; Help buffers use itself (or `other-window') to decide where to open
;; ;; followed links, which can be unpredictable. It should *only* replace the
;; ;; original buffer we opened the popup from. To fix this these three button
;; ;; types need to be redefined to set aside the popup before following a link.
;; (define-button-type 'help-function-def
;; :supertype 'help-xref
;; 'help-function (lambda (fun file)
;; (require 'find-func)
;; (when (eq file 'C-source)
;; (setq file (help-C-file-name (indirect-function fun) 'fun)))
;; (let ((location (find-function-search-for-symbol fun nil file)))
;; (doom/popup-close)
;; (switch-to-buffer (car location) nil t)
;; (if (cdr location)
;; (progn
;; (goto-char (cdr location))
;; (recenter nil))
;; (message "Unable to find location in file")))))
;; (define-button-type 'help-variable-def
;; :supertype 'help-xref
;; 'help-function (lambda (var &optional file)
;; (when (eq file 'C-source)
;; (setq file (help-C-file-name var 'var)))
;; (let ((location (find-variable-noselect var file)))
;; (doom/popup-close)
;; (switch-to-buffer (car location) nil t)
;; (if (cdr location)
;; (progn
;; (goto-char (cdr location))
;; (recenter nil))
;; (message "Unable to find location in file")))))
;; (define-button-type 'help-face-def
;; :supertype 'help-xref
;; 'help-function (lambda (fun file)
;; (require 'find-func)
;; (let ((location
;; (find-function-search-for-symbol fun 'defface file)))
;; (doom/popup-close)
;; (switch-to-buffer (car location) nil t)
;; (if (cdr location)
;; (progn
;; (goto-char (cdr location))
;; (recenter nil))
;; (message "Unable to find location in file"))))))
;; (after! magit
;; ;; Don't open files (from magit) within the magit popup
;; (advice-add 'magit-display-file-buffer-traditional :around 'doom*popup-save))

View file

@ -34,9 +34,6 @@ line or use --debug-init to enable this.")
(defvar doom-modules-dir (concat doom-emacs-dir "modules/")
"Where configuration modules are stored")
(defvar doom-scripts-dir (concat doom-emacs-dir "scripts/")
"Where external dependencies are stored (like libraries or binaries)")
(defvar doom-local-dir (concat doom-emacs-dir ".local/")
"Untracked directory for local Emacs files, including the cache
(`doom-cache-dir'), packages (`doom-packages-dir') and autoloads file.")
@ -49,6 +46,11 @@ line or use --debug-init to enable this.")
(concat doom-local-dir "packages/")
"Where package.el and quelpa plugins (and their caches) are kept.")
(defvar doom-autoload-file
(concat doom-local-dir "autoloads.el")
"Location of the autoloads.el, which is generated by `doom/refresh-autoloads'
and `doom-initialize-autoloads'.")
(defconst IS-MAC (eq system-type 'darwin))
(defconst IS-LINUX (eq system-type 'gnu/linux))
@ -83,6 +85,11 @@ line or use --debug-init to enable this.")
make-backup-files nil
vc-make-backup-files nil)
;; be quiet at startup
(advice-add 'display-startup-echo-area-message :override 'ignore)
(setq inhibit-startup-message t
inhibit-startup-echo-area-message user-login-name)
;;;
;; Automatic minor modes
@ -120,27 +127,20 @@ enable multiple minor modes for the same regexp.")
(eval-and-compile
(require 'core-packages (concat doom-core-dir "core-packages")))
(eval-when-compile
;; Ensure cache folder exist
(unless (file-exists-p doom-cache-dir)
(make-directory doom-cache-dir t))
(doom-initialize))
(setq load-path (eval-when-compile load-path))
;;; Let 'er rip
(require 'core-lib)
(require 'autoloads (concat doom-local-dir "autoloads.el") t)
(unless noninteractive
(require 'core-set) ; a centralized config system; provides `set!'
(require 'core-states) ; TODO
(require 'core-ui) ; draw me like one of your French editors
(require 'core-popups) ; taming sudden yet inevitable windows
(require 'core-editor) ; baseline configuration for text editing
(require 'core-projects) ; making Emacs project-aware
(require 'core-projects)) ; making Emacs project-aware
;; We check last as a promise that the core files won't use autoloaded
;; functions. If they do, it shouldn't be autoloaded!
(unless (featurep 'autoloads)
(doom/refresh-autoloads))))
;; We do this last to promise that core files will not use autoloaded files.
;; If they did, those functions shouldn't be autoloaded!
(doom-initialize-autoloads))
(provide 'core)
;;; core.el ends here