Remove core-{set,states}.el (will be replaced)

This commit is contained in:
Henrik Lissner 2017-02-06 01:24:27 -05:00
parent 2bc459a343
commit 30f5d0d79c
3 changed files with 0 additions and 97 deletions

View file

@ -1,47 +0,0 @@
;;; set.el
(defvar doom-describe-setting-buffer nil
"Buffer that was current when describe-setting was invoked.")
;;;###autoload
(defun doom/describe-setting (setting)
"Display the full documentation of SETTING (a keyword)."
(interactive
(let ((st (symbol-at-point))
(enable-recursive-minibuffers t)
val)
(setq val (completing-read (if st
(format "Describe setting (default %s): " st)
"Describe setting: ")
(mapcar (lambda (x) (symbol-name (car x))) doom-settings)
'fboundp t nil nil
(and st (symbol-name st))))
(list (if (equal val "")
st (intern val)))))
(or (and setting (keywordp setting))
(user-error "You didn't specify a setting keyword"))
(or (assq setting doom-settings)
(user-error "Symbol's setting definition is void: %s" setting))
(let ((doom-describe-setting-buffer
(or doom-describe-setting-buffer (current-buffer)))
(file-name
(find-lisp-object-file-name 'doom--set:enable 'defun)))
(help-setup-xref
(list (lambda (setting buffer)
(let ((doom-describe-setting-buffer (if (buffer-live-p buffer) buffer)))
(describe-setting function)))
setting doom-describe-setting-buffer)
(called-interactively-p 'interactive))
(save-excursion
(with-help-window (help-buffer)
(prin1 setting)
;; Use " is " instead of a colon so that
;; it is easier to get out the function name using forward-sexp.
(princ " is a DOOM Emacs setting, defined in ")
(princ (format-message " in `%s'" (help-fns-short-filename file-name)))
(with-current-buffer standard-output
;; Return the text we displayed.
(buffer-string))))))

View file

@ -1,44 +0,0 @@
;;; core-set.el
;;
;; This provides a centralized configuration system that a) won't evaluate its
;; arguments if it doesn't need to (performance), b) won't complain if the
;; setting doesn't exist and c) is more elegant than a bunch of `after!' blocks,
;; which can cause intermittent stuttering in large quantities. I'm a fan of
;; concise, do-what-I-mean front-facing configuration, believe it or not.
;;
;; Plus, it can benefit from byte-compilation.
(define-key help-map "\C-s" 'doom/describe-setting)
(defvar doom-settings nil
"An alist of settings, mapping setting keywords to setter functions, which can
be a lambda or symbol.")
(defmacro def-setting! (keyword arglist &optional docstring &rest forms)
"Define a setting macro. Takes the same arguments as `defmacro'. This should
return forms, which will be run when `set!' is used to call this setting."
(declare (indent defun) (doc-string 3))
(unless (keywordp keyword)
(error "Not a valid property name: %s" keyword))
`(push (list ,keyword
:source ,(__FILE__)
:docstring ,docstring
:fn (lambda ,arglist
,docstring
,@forms))
doom-settings))
(defmacro set! (keyword &rest rest)
"Set an option defined by `def-setting!'. Skip if doesn't exist."
(declare (indent defun))
(let* ((plist (cdr (assq keyword doom-settings)))
(fn (plist-get plist :fn)))
(when (and doom-debug-mode (not fn))
(message "No setting found for %s" keyword))
(when fn
(macroexp-progn
(mapcar (lambda (args) `(apply #',fn ',(-list args)))
rest)))))
(provide 'core-set)
;;; core-set.el ends here

View file

@ -1,6 +0,0 @@
;;; core-states.el
(provide 'core-states)
;;; core-states.el ends here