From a4ddb1bc9b9f0f1062d17c1fcd768f8abdcf338a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 28 Sep 2017 18:08:20 +0200 Subject: [PATCH] General minor refactor + cleanup --- core/autoload/popups.el | 3 ++- core/core-popups.el | 24 +++++++++++------------ core/core.el | 3 +-- modules/feature/evil/config.el | 2 ++ modules/feature/jump/config.el | 6 ++++-- modules/feature/version-control/config.el | 7 ++----- modules/lang/emacs-lisp/config.el | 14 ++++++------- modules/lang/ledger/config.el | 6 ++---- modules/org/org/autoload/org.el | 5 +++-- modules/private/hlissner/+commands.el | 2 -- modules/tools/term/autoload.el | 2 +- 11 files changed, 35 insertions(+), 39 deletions(-) diff --git a/core/autoload/popups.el b/core/autoload/popups.el index ea31dfbc9..8dff2b481 100644 --- a/core/autoload/popups.el +++ b/core/autoload/popups.el @@ -87,7 +87,8 @@ Returns t if popups were restored, nil otherwise." ;;;###autoload (defun doom/popup-toggle () - "Toggle popups." + "Toggle popups on and off. If used outside of popups (and popups are +available), it will select the nearest popup window." (interactive) (when (doom-popup-p) (if doom-popup-other-window diff --git a/core/core-popups.el b/core/core-popups.el index bd9fc289e..90952e539 100644 --- a/core/core-popups.el +++ b/core/core-popups.el @@ -55,9 +55,9 @@ recognized by DOOM's popup system. They are: :noesc If non-nil, the popup won't be closed if you press ESC from *inside* its window. Used by `doom/popup-close-maybe'. -:modeline By default, mode-lines are hidden in popups unless this is non-nil. If - it is a symbol, it'll use `doom-modeline' to fetch a modeline config - (in `doom-popup-mode'). +:modeline By default, mode-lines are hidden in popups unless this is non-nil. + If it is a symbol, it'll use `doom-modeline' to fetch a modeline + config (in `doom-popup-mode'). :autokill If non-nil, the popup's buffer will be killed when the popup is closed. Used by `doom*delete-popup-window'. NOTE @@ -274,20 +274,18 @@ properties." ;; (progn ; hacks for built-in functions - (defun doom*buffer-menu (&optional arg) - "Open `buffer-menu' in a popup window." - (interactive "P") - (let ((buf (list-buffers-noselect arg))) - (doom-popup-buffer buf) - (with-current-buffer buf - (setq mode-line-format "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %; q to quit; ? for help.")))) - (advice-add #'buffer-menu :override #'doom*buffer-menu) - (defun doom*suppress-pop-to-buffer-same-window (orig-fn &rest args) (cl-letf (((symbol-function 'pop-to-buffer-same-window) (symbol-function 'pop-to-buffer))) (apply orig-fn args))) - (advice-add #'info :around #'doom*suppress-pop-to-buffer-same-window)) + (advice-add #'info :around #'doom*suppress-pop-to-buffer-same-window) + + (defun doom*buffer-menu (&optional arg) + "Open `buffer-menu' in a popup window." + (interactive "P") + (with-selected-window (doom-popup-buffer (list-buffers-noselect arg)) + (setq mode-line-format "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %; q to quit; ? for help."))) + (advice-add #'buffer-menu :override #'doom*buffer-menu)) (after! comint diff --git a/core/core.el b/core/core.el index da13699f1..463df057f 100644 --- a/core/core.el +++ b/core/core.el @@ -63,8 +63,7 @@ problems.") (defvar doom-packages-dir (concat doom-local-dir "packages/") "Where package.el and quelpa plugins (and their caches) are stored.") -(defvar doom-autoload-file - (concat doom-local-dir "autoloads.el") +(defvar doom-autoload-file (concat doom-local-dir "autoloads.el") "Location of the autoloads file generated by `doom/reload-autoloads'.") (defgroup doom nil diff --git a/modules/feature/evil/config.el b/modules/feature/evil/config.el index 66bd54cb2..f124e7915 100644 --- a/modules/feature/evil/config.el +++ b/modules/feature/evil/config.el @@ -143,6 +143,8 @@ across windows." (evil-define-interactive-code "" :ex-arg global-match (list (when (evil-ex-p) evil-ex-argument))) + ;; Forward declare these so that ex completion works, even if the autoloaded + ;; functions aren't loaded yet. (evil-set-command-properties '+evil:align :move-point t :ex-arg 'buffer-match :ex-bang t :evil-mc t :keep-visual t :suppress-operator t) (evil-set-command-properties diff --git a/modules/feature/jump/config.el b/modules/feature/jump/config.el index f90ef2d91..e763d4718 100644 --- a/modules/feature/jump/config.el +++ b/modules/feature/jump/config.el @@ -33,10 +33,12 @@ produces an url. Used by `+jump/online'.") "Function to use to open search urls.") (defvar +jump-function-alist nil - "TODO") + "An alist mapping major modes to jump function plists, describing what to do +with `+jump/definition', `+jump/references' and `+jump/documentation' are +called.") (defvar-local +jump-current-functions nil - "TODO") + "The enabled jump functions for the current buffer.") (def-setting! :jump (modes &rest plist) "Definies a jump target for major MODES. PLIST accepts the following diff --git a/modules/feature/version-control/config.el b/modules/feature/version-control/config.el index 2e147f568..d99b54b4f 100644 --- a/modules/feature/version-control/config.el +++ b/modules/feature/version-control/config.el @@ -1,10 +1,7 @@ ;;; feature/version-control/config.el -*- lexical-binding: t; -*- -(unless (featurep! -git) - (load! +git)) -;; TODO hg support -;; (unless (featurep! -hg) -;; (load! +hg)) +(or (featurep! -git) (load! +git)) +;; TODO (or (featurep! -hg) (load! +hg)) ;; (setq vc-make-backup-files nil) diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index 59b99007b..7cdf28216 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -7,13 +7,13 @@ (set! :eval 'emacs-lisp-mode #'+emacs-lisp-eval) (set! :jump 'emacs-lisp-mode :documentation #'describe-symbol) (set! :rotate 'emacs-lisp-mode - :symbols '(("t" "nil") - ("let" "let*") - ("when" "unless") - ("append" "prepend") - ("advice-add" "advice-remove") - ("add-hook" "remove-hook") - ("add-hook!" "remove-hook!"))) + :symbols '(("t" "nil") + ("let" "let*") + ("when" "unless") + ("append" "prepend") + ("advice-add" "advice-remove") + ("add-hook" "remove-hook") + ("add-hook!" "remove-hook!"))) (add-hook! 'emacs-lisp-mode-hook #'(;; 3rd-party functionality diff --git a/modules/lang/ledger/config.el b/modules/lang/ledger/config.el index 07e823130..f76966619 100644 --- a/modules/lang/ledger/config.el +++ b/modules/lang/ledger/config.el @@ -3,15 +3,13 @@ (def-package! ledger-mode :mode "\\.ledger$" :commands ledger-mode - :config - (setq ledger-clear-whole-transactions 1)) + :config (setq ledger-clear-whole-transactions 1)) (def-package! evil-ledger :when (featurep! :feature evil) :after ledger-mode - :config - (add-hook 'ledger-mode-hook #'evil-ledger-mode)) + :config (add-hook 'ledger-mode-hook #'evil-ledger-mode)) (def-package! flycheck-ledger diff --git a/modules/org/org/autoload/org.el b/modules/org/org/autoload/org.el index 18a1c6df5..8097e9149 100644 --- a/modules/org/org/autoload/org.el +++ b/modules/org/org/autoload/org.el @@ -8,8 +8,9 @@ :group 'evil-org (setq org-hide-emphasis-markers +org-pretty-mode) (org-toggle-pretty-entities) - ;; In case the above un-align tables - (org-table-map-tables 'org-table-align t)) + (org-with-silent-modifications + ;; In case the above un-align tables + (org-table-map-tables 'org-table-align t))) ;;;###autoload (defun +org|realign-table-maybe () diff --git a/modules/private/hlissner/+commands.el b/modules/private/hlissner/+commands.el index 6c22a1ad8..47074c2cc 100644 --- a/modules/private/hlissner/+commands.el +++ b/modules/private/hlissner/+commands.el @@ -42,8 +42,6 @@ (ex! "grevert" #'git-gutter:revert-hunk) ;; Dealing with buffers -(evil-set-command-properties #'+workspace/cleanup :ex-bang t) - (ex! "clean[up]" #'+workspace/cleanup) (ex! "k[ill]" #'doom/kill-this-buffer) (ex! "k[ill]all" #'+hlissner:kill-all-buffers) diff --git a/modules/tools/term/autoload.el b/modules/tools/term/autoload.el index c1ae1e322..efab41c95 100644 --- a/modules/tools/term/autoload.el +++ b/modules/tools/term/autoload.el @@ -24,4 +24,4 @@ current project's root." (defun +term/open-popup-in-project () "Open a terminal popup window in the root of the current project." (interactive) - (+term/popup t)) + (+term/open-popup t))