Introduce autodefs to replace some settings

+ :popup -> set-popup-rule!
+ :popups -> set-popup-rules!
+ :company-backend -> set-company-backend!
+ :evil-state -> set-evil-initial-state!

I am slowly phasing out the setting system (def-setting! and set!),
starting with these.

What are autodefs? These are functions that are always defined, whether
or not their respective modules are enabled. However, when their modules
are disabled, they are replaced with macros that no-op and don't
waste time evaluating their arguments.

The old set! function will still work, for a while.
This commit is contained in:
Henrik Lissner 2018-06-15 02:58:12 +02:00
parent 6693db48af
commit d8b1e469bc
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
54 changed files with 329 additions and 248 deletions

View file

@ -71,19 +71,19 @@ string). Stops at the first function to return non-nil.")
(require 'ob-ipython nil t)))
(add-hook '+org-babel-load-functions #'+org|babel-load-ipython)
:config
(set! :popups
'("^\\*Org Src"
((size . 100) (side . right) (slot . -1) (window-height . 0.6))
((quit) (select . t) (modeline)))
'("^\\*Python"
((slot . 0) (side . right) (size . 100))
((select) (quit) (transient)))
'("\\*ob-ipython.*"
((slot . 2) (side . right) (size . 100) (window-height . 0.2))
((select) (quit) (transient)))
'("\\*Python:.*"
((slot . 0) (side . right) (size . 100))
((select) (quit) (transient))))
(set-popup-rules!
'(("^\\*Org Src"
((size . 100) (side . right) (slot . -1) (window-height . 0.6))
((quit) (select . t) (modeline)))
("^\\*Python"
((slot . 0) (side . right) (size . 100))
((select) (quit) (transient)))
("\\*ob-ipython.*"
((slot . 2) (side . right) (size . 100) (window-height . 0.2))
((select) (quit) (transient)))
("\\*Python:.*"
((slot . 0) (side . right) (size . 100))
((select) (quit) (transient)))))
;; TODO Add more popup styles
;; advices for remote kernel and org-src-edit

View file

@ -137,19 +137,19 @@ unfold to point on startup."
(defun +org|setup-popups-rules ()
"Defines popup rules for org-mode (does nothing if :ui popup is disabled)."
(set! :popups
'("^\\*\\(?:Agenda Com\\|Calendar\\|Org \\(?:Links\\|Export Dispatcher\\|Select\\)\\)"
((slot . -1) (vslot . -1) (size . +popup-shrink-to-fit))
((transient . 0)))
'("^\\*Org Agenda"
((size . 0.35))
((select . t) (transient)))
'("^\\*Org Src"
((size . 0.3))
((quit) (select . t)))
'("^CAPTURE.*\\.org$"
((size . 0.2))
((quit) (select . t)))))
(set-popup-rules!
'(("^\\*\\(?:Agenda Com\\|Calendar\\|Org \\(?:Links\\|Export Dispatcher\\|Select\\)\\)"
((slot . -1) (vslot . -1) (size . +popup-shrink-to-fit))
((transient . 0)))
("^\\*Org Agenda"
((size . 0.35))
((select . t) (transient)))
("^\\*Org Src"
((size . 0.3))
((quit) (select . t)))
("^CAPTURE.*\\.org$"
((size . 0.2))
((quit) (select . t))))))
(defun +org|setup-ui ()
"Configures the UI for `org-mode'."