From bb88411cc98fa08d2e88700e0456bacf90ea39bb Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 14 May 2018 20:55:55 +0200 Subject: [PATCH] General minor refactor & docstring fixes --- core/core-packages.el | 7 +++---- core/core-ui.el | 4 ++-- modules/app/twitter/config.el | 3 ++- modules/feature/evil/config.el | 4 ++-- modules/feature/lookup/autoload/lookup.el | 8 ++++---- modules/lang/haskell/+intero.el | 12 ++++++++++-- modules/lang/haskell/autoload.el | 10 ---------- modules/lang/javascript/config.el | 5 +++-- modules/lang/org/config.el | 2 +- 9 files changed, 27 insertions(+), 28 deletions(-) delete mode 100644 modules/lang/haskell/autoload.el diff --git a/core/core-packages.el b/core/core-packages.el index 6f2234f42..3bd3f84cc 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -551,7 +551,6 @@ The module is only loaded once. If RELOAD-P is non-nil, load it again." (if (file-directory-p module-path) `(condition-case-unless-debug ex (let ((doom--current-module ',(cons module submodule))) - ;; ,(if plist `(doom-module-set ,module ',submodule ,@plist)) (load! init ,module-path :noerror) (load! config ,module-path :noerror)) ('error @@ -566,12 +565,12 @@ The module is only loaded once. If RELOAD-P is non-nil, load it again." "Returns t if MODULE SUBMODULE is enabled. If FLAG is provided, returns t if MODULE SUBMODULE has FLAG enabled. - (featurep! :private default) + (featurep! :config default) Module FLAGs are set in your config's `doom!' block, typically in ~/.emacs.d/init.el. Like so: - :private (default +flag1 -flag2) + :config (default +flag1 -flag2) When this macro is used from inside a module, MODULE and SUBMODULE can be omitted. eg. (featurep! +flag1)" @@ -579,7 +578,7 @@ omitted. eg. (featurep! +flag1)" (let* ((path (or load-file-name byte-compile-current-file)) (module-pair (doom-module-from-path path))) (unless module-pair - (error "featurep! couldn't detect what module I'm in! (in %s)" path)) + (error "featurep! couldn't detect what module its in! (in %s)" path)) (setq flag module module (car module-pair) submodule (cdr module-pair)))) diff --git a/core/core-ui.el b/core/core-ui.el index 118a50a23..758d98827 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -304,8 +304,8 @@ DEFAULT is non-nil, set the default mode-line for all buffers." ;; remove prompt if the file is opened in other clients (defun server-remove-kill-buffer-hook () - (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)) -(add-hook 'server-visit-hook 'server-remove-kill-buffer-hook) + (remove-hook 'kill-buffer-query-functions #'server-kill-buffer-query-function)) +(add-hook 'server-visit-hook #'server-remove-kill-buffer-hook) ;; whitespace-mode settings (setq whitespace-line-column nil diff --git a/modules/app/twitter/config.el b/modules/app/twitter/config.el index ae40a8e4c..acc592b40 100644 --- a/modules/app/twitter/config.el +++ b/modules/app/twitter/config.el @@ -47,9 +47,10 @@ (bar matches " %b " selection-info) ()) - (add-hook! twittering-mode + (defun +twitter|switch-mode-and-header-line () (setq header-line-format (or (doom-modeline 'twitter) mode-line-format) mode-line-format nil)) + (add-hook 'twittering-mode-hook #'+twitter|switch-mode-and-header-line) (map! :map twittering-mode-map "q" #'+twitter/quit diff --git a/modules/feature/evil/config.el b/modules/feature/evil/config.el index bf107e1cc..c2ca114cc 100644 --- a/modules/feature/evil/config.el +++ b/modules/feature/evil/config.el @@ -365,8 +365,8 @@ the new algorithm is confusing, like in python or ruby." evil-visualstar/begin-search-forward evil-visualstar/begin-search-backward) :init - (map! :v "*" #'evil-visualstar/begin-search-forward - :v "#" #'evil-visualstar/begin-search-backward) + (map! :m [remap evil-ex-search-word-forward] #'evil-visualstar/begin-search-forward + :m [remap evil-ex-search-word-backward] #'evil-visualstar/begin-search-backward) :config (global-evil-visualstar-mode 1)) diff --git a/modules/feature/lookup/autoload/lookup.el b/modules/feature/lookup/autoload/lookup.el index b248c18d3..56203adf5 100644 --- a/modules/feature/lookup/autoload/lookup.el +++ b/modules/feature/lookup/autoload/lookup.el @@ -31,11 +31,11 @@ :documentation +lookup-documentation-functions :file +lookup-file-functions) prop) - for fn = (or (command-remapping fn) fn) + for cmd = (or (command-remapping fn) fn) if (condition-case e - (or (if (commandp fn) - (call-interactively fn) - (funcall fn identifier)) + (or (if (commandp cmd) + (call-interactively cmd) + (funcall cmd identifier)) (/= (point-marker) origin)) ('error (ignore (message "%s" e)))) return it)) diff --git a/modules/lang/haskell/+intero.el b/modules/lang/haskell/+intero.el index 372e3e51b..7463cfa8a 100644 --- a/modules/lang/haskell/+intero.el +++ b/modules/lang/haskell/+intero.el @@ -2,9 +2,17 @@ ;;;###if (featurep! +intero) (def-package! intero - :after haskell-mode - :config + :commands intero-mode + :init + (defun +haskell|init-intero () + "Initializes `intero-mode' in haskell-mode, unless stack isn't installed. +This is necessary because `intero-mode' doesn't do its own error checks." + (when (derived-mode-p 'haskell-mode) + (if (executable-find "stack") + (intero-mode +1) + (message "Couldn't find stack. Refusing to enable intero-mode.")))) (add-hook 'haskell-mode-hook #'+haskell|init-intero) + :config (add-hook 'intero-mode-hook #'flycheck-mode) (set! :lookup 'haskell-mode :definition #'intero-goto-definition)) diff --git a/modules/lang/haskell/autoload.el b/modules/lang/haskell/autoload.el deleted file mode 100644 index ba2d4fec6..000000000 --- a/modules/lang/haskell/autoload.el +++ /dev/null @@ -1,10 +0,0 @@ -;;; lang/haskell/autoload.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +haskell|init-intero () - "Initializes `intero-mode' in haskell-mode, unless stack isn't installed. -This is necessary because `intero-mode' doesn't do its own error checks." - (when (derived-mode-p 'haskell-mode) - (if (executable-find "stack") - (intero-mode +1) - (message "Couldn't find stack. Refusing to enable intero-mode.")))) diff --git a/modules/lang/javascript/config.el b/modules/lang/javascript/config.el index b84c011da..8d7c4d202 100644 --- a/modules/lang/javascript/config.el +++ b/modules/lang/javascript/config.el @@ -183,8 +183,9 @@ (def-package! eslintd-fix :commands (eslintd-fix-mode eslintd-fix) :config - (add-hook! 'eslintd-fix-mode-hook - (setq flycheck-javascript-eslint-executable eslintd-fix-executable))) + (defun +javascript|set-flycheck-executable-to-eslint () + (setq flycheck-javascript-eslint-executable eslintd-fix-executable)) + (add-hook 'eslintd-fix-mode-hook #'+javascript|set-flycheck-executable-to-eslint)) (def-package! skewer-mode diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index b4d29c5cd..70e1f2c05 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -306,7 +306,7 @@ between the two." (defun +org|setup-hacks () "Getting org to behave." ;; Don't open separate windows - (map-put org-link-frame-setup 'file 'find-file) + (map-put org-link-frame-setup 'file #'find-file) ;; Let OS decide what to do with files when opened (setq org-file-apps