From 4057c56e4cbb64f7ecb67fb914c7726fc7655445 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 03:10:27 -0400 Subject: [PATCH 01/25] extra => custom --- init.el | 10 +-- modules/custom-demo.el | 55 +++++++++++++++ modules/{extra-tags.el => custom-tags.el} | 7 +- modules/{extra-tmux.el => custom-tmux.el} | 10 +-- modules/custom-write.el | 51 ++++++++++++++ modules/extra-demo.el | 51 -------------- modules/extra-write.el | 83 ----------------------- 7 files changed, 120 insertions(+), 147 deletions(-) create mode 100644 modules/custom-demo.el rename modules/{extra-tags.el => custom-tags.el} (90%) rename modules/{extra-tmux.el => custom-tmux.el} (89%) create mode 100644 modules/custom-write.el delete mode 100644 modules/extra-demo.el delete mode 100644 modules/extra-write.el diff --git a/init.el b/init.el index debcde856..8023a222c 100644 --- a/init.el +++ b/init.el @@ -83,11 +83,11 @@ module-eshell ; for inferior OSes *cough*windows module-org ; for organized fearless leader - ;;; Extra libraries - extra-demo ; allow me to demonstrate... - extra-tags ; if you liked it you should've generated a tag for it - extra-tmux ; close the rift between GUI & terminal - extra-write ; Emacs as a word processor + ;;; Custom modules + custom-demo ; allow me to demonstrate... + custom-tags ; if you liked it you should've generated a tag for it + custom-tmux ; close the rift between GUI & terminal + custom-write ; Emacs as a word processor ;;; Personal my-commands diff --git a/modules/custom-demo.el b/modules/custom-demo.el new file mode 100644 index 000000000..9f2fd5b9a --- /dev/null +++ b/modules/custom-demo.el @@ -0,0 +1,55 @@ +;;; custom-demo.el --- -*- no-byte-compile: t; -*- + +(defvar powerline-height) + +;; This library offers: +;; + impatient-mode: for broadcasting my emacs session +;; + big-mode: for enlarged text while screencasting +;; + TODO integration with reveal.js for presentations +;; + TODO peer programming collab + +;; Big-mode settings +(defconst big-mode-font (font-spec :family "Inconsolata" :size 16)) +(defconst big-mode-line-spacing 0) +(defconst big-mode-modeline-height 35) + +;; +(use-package impatient-mode + :commands impatient-mode + :config (httpd-start)) + +(defvar big-mode--old-line-spacing line-spacing) +(defvar big-mode--old-modeline-height powerline-height) +(define-minor-mode big-mode + :init-value nil + :lighter " BIG" + :global t + (when big-mode-font + (doom/load-font (if big-mode big-mode-font doom-default-font))) + (if big-mode + (setq-default + powerline-height big-mode-modeline-height + line-spacing big-mode-line-spacing) + (setq-default + powerline-height big-mode--old-modeline-height + line-spacing big-mode--old-line-spacing))) + +(evil-define-command doom:big (&optional size) + "Use to enable large text mode." + (interactive "") + (if size + (let ((big-mode-font big-mode-font)) + (big-mode -1) + (font-put big-mode-font :size (string-to-int size)) + (big-mode +1)) + (big-mode (if big-mode -1 +1)))) + +(defun doom/resize-for-stream () + "Resize the frame pixelwise, so that it fits directly into my livecoding.tv +streaming layout." + (interactive) + (set-frame-width (selected-frame) 1325 nil t) + (set-frame-height (selected-frame) 1080 nil t)) + +(provide 'custom-demo) +;;; custom-demo.el ends here diff --git a/modules/extra-tags.el b/modules/custom-tags.el similarity index 90% rename from modules/extra-tags.el rename to modules/custom-tags.el index 3f72db469..2ebf0438d 100644 --- a/modules/extra-tags.el +++ b/modules/custom-tags.el @@ -1,4 +1,4 @@ -;;; extra-tags.el +;;; custom-tags.el ;; WIP @@ -27,6 +27,7 @@ ;;;###autoload (defun doom/find-def () + "Find definition using tags, falling back to dumb-jump otherwise." (interactive) (let ((orig-pt (point)) (orig-file (buffer-file-name))) @@ -44,5 +45,5 @@ (let ((path (expand-file-name ".tags" (doom/project-root)))) (and (f-exists? path) path))) -(provide 'extra-tags) -;;; extra-tags.el ends here +(provide 'custom-tags) +;;; custom-tags.el ends here diff --git a/modules/extra-tmux.el b/modules/custom-tmux.el similarity index 89% rename from modules/extra-tmux.el rename to modules/custom-tmux.el index b0f4d6e5c..0f7c561e6 100644 --- a/modules/extra-tmux.el +++ b/modules/custom-tmux.el @@ -1,4 +1,4 @@ -;;; extra-tmux.el +;;; custom-tmux.el ;; This library offers: ;; + A way of communicating with a tmux instance @@ -24,7 +24,7 @@ :ex-arg shell (list (when (evil-ex-p) (evil-ex-file-arg)))) -;;;###autoload (autoload 'doom:tmux-cd "extra-tmux" nil t) +;;;###autoload (autoload 'doom:tmux-cd "custom-tmux" nil t) (evil-define-command doom:tmux-cd (&optional bang) (interactive "") (if bang @@ -32,7 +32,7 @@ (doom/tmux-cd-to-here))) (defvar doom-tmux-last-command nil "The last command sent to tmux") -;;;###autoload (autoload 'doom:tmux "extra-tmux" nil t) +;;;###autoload (autoload 'doom:tmux "custom-tmux" nil t) (evil-define-operator doom:tmux (&optional command bang) "Sends input to tmux. Use `bang' to append to tmux" :type inclusive @@ -56,5 +56,5 @@ (interactive) (doom/tmux-cd-to-here (doom/project-root))) -(provide 'extra-tmux) -;;; extra-tmux.el ends here +(provide 'custom-tmux) +;;; custom-tmux.el ends here diff --git a/modules/custom-write.el b/modules/custom-write.el new file mode 100644 index 000000000..81f5059ef --- /dev/null +++ b/modules/custom-write.el @@ -0,0 +1,51 @@ +;; custom-write.el + +;; This library offers the following: +;; + Write-mode: a mode that turns Emacs into an app for writing notes, +;; papers, or fiction: it adds eye-candy to org-mode, switches to a light +;; color theme and to a more readable font. +;; + Bibtex integration + +;; Write-mode settings +(defconst write-mode-theme 'doom-one) +(defconst write-mode-font (font-spec :family "Source Sans Pro" :size 14)) + +(defconst write-mode--last-mode-line mode-line-format) +(defconst write-mode--last-theme doom-current-theme) +(defconst write-mode--last-line-spacing line-spacing) + +(after! spaceline + (spaceline-compile + 'write + '(((*macro-recording *anzu *iedit *evil-substitute *flycheck) + :skip-alternate t + :tight t) + *buffer-path + *buffer-modified) + '((*selection-info :when active) + *buffer-encoding-abbrev + (global :when active) + *buffer-position + *pad))) + +(defvar write-mode nil) +(defun doom/write-mode () + "A mode that turns Emacs into an app for writing notes, papers, or fiction: it +adds eye-candy to org-mode, switches to a light color theme and to a more +readable font." + (interactive) + (setq write-mode (not write-mode)) + (when write-mode-theme + (doom/load-theme (if write-mode write-mode-theme write-mode--last-theme) t)) + (when write-mode-font + (doom/load-font (if write-mode write-mode-font doom-default-font))) + (mapc (lambda (b) + (with-current-buffer b + (setq line-spacing (if write-mode write-mode--last-line-spacing '2)) + (when (featurep 'spaceline) + (let ((doom-hide-mode-line-format '("%e" (:eval (spaceline-ml-write))))) + (doom-hide-mode-line-mode (if write-mode +1 -1)))))) + (doom/get-buffers-in-modes '(org-mode markdown-mode)))) + +(provide 'custom-write) +;;; custom-write.el ends here diff --git a/modules/extra-demo.el b/modules/extra-demo.el deleted file mode 100644 index 3cce498a8..000000000 --- a/modules/extra-demo.el +++ /dev/null @@ -1,51 +0,0 @@ -;;; extra-demo.el --- -*- no-byte-compile: t; -*- - -(defvar powerline-height) - -;; This library offers: -;; + impatient-mode: for broadcasting my emacs session -;; + big-mode: for enlarged text while screencasting -;; + TODO integration with reveal.js for presentations -;; + TODO peer programming collab - -;; Big-mode settings -(defconst big-mode-font (font-spec :family "Inconsolata" :size 16)) -(defconst big-mode-line-spacing 0) -(defconst big-mode-modeline-height 35) - -;; -(use-package impatient-mode - :commands impatient-mode - :config (httpd-start)) - -(defvar big-mode--line-spacing line-spacing) -(defvar big-mode--powerline-height powerline-height) -(define-minor-mode big-mode - :init-value nil - :lighter " BIG" - :global t - (doom/load-font (if big-mode big-mode-font doom-default-font)) - (setq-default - powerline-height - (if big-mode big-mode-modeline-height big-mode--powerline-height) - line-spacing - (if big-mode big-mode-line-spacing big-mode--line-spacing)) - (if big-mode - (progn - (setq neo-window-width 25) - (add-hook 'neo-after-create-hook 'doom|text-scale-1)) - (setq neo-window-width 28) - (remove-hook 'neo-after-create-hook 'doom|text-scale-1))) - -(defun doom|text-scale-1 (&rest _) - (text-scale-set -1) (setq line-spacing 0)) - -(evil-define-command doom:big-mode (&optional size) - (interactive "") - (let ((big-mode-font big-mode-font)) - (when (and size (not big-mode)) - (font-put big-mode-font :size (string-to-int size))) - (big-mode (if big-mode -1 +1)))) - -(provide 'extra-demo) -;;; extra-demo.el ends here diff --git a/modules/extra-write.el b/modules/extra-write.el deleted file mode 100644 index fd25c33e4..000000000 --- a/modules/extra-write.el +++ /dev/null @@ -1,83 +0,0 @@ -;; extra-write.el - -;; This library offers the following: -;; + TODO Write-mode: a mode that turns Emacs into an app for writing notes, papers, or -;; fiction: it adds eye-candy to org-mode, switches to a light color theme and to a -;; more readable font. -;; + Bibtex integration - -;; Write-mode settings -(defconst write-mode nil) -(defconst write-mode-theme 'doom-light) -(defconst write-mode-font (font-spec :family "Hack" :size 12)) - -(defconst write-mode--last-mode-line mode-line-format) -(defconst write-mode--last-theme doom-current-theme) -(defconst write-mode--last-line-spacing line-spacing) - -(after! spaceline - (spaceline-compile - 'write - '(((*macro-recording *anzu *iedit *evil-substitute *flycheck) - :skip-alternate t - :tight t) - *buffer-path - *buffer-modified) - '((*selection-info :when active) - *buffer-encoding-abbrev - (global :when active) - *buffer-position - *pad))) - -;; -(defun write-mode|org-hook () - "A hook that runs in org-mode buffers when `write-mode' is active." - (when write-mode - (setq header-line-format '("%e" (:eval (spaceline-ml-write))) - mode-line-format nil))) - -(defun write-mode-toggle () - "Enable write-mode, this is not a [global] minor mode because it mixes some frame-local -functionality with buffer-local ones, which can be buggy in a minor-mode." - (interactive) - (let* ((mode-p write-mode) - (on-off (if mode-p -1 +1))) - (doom/load-theme (if mode-p write-mode--last-theme write-mode-theme) t) - (doom/load-font (if mode-p doom-default-font write-mode-font)) - (if mode-p - (remove-hook 'org-mode-hook 'write-mode|org-hook) - (add-hook 'org-mode-hook 'write-mode|org-hook)) - (mapc (lambda (b) - (with-current-buffer b - (setq line-spacing (if mode-p write-mode--last-line-spacing '2)) - (when (and (eq major-mode 'org-mode) - (not mode-p)) - (write-mode|org-hook)) - (unless mode-p - (setq mode-line-format write-mode--last-mode-line - header-line-format nil)))) - (doom/get-buffers-in-modes '(org-mode markdown-mode))) - (setq write-mode (not mode-p)))) - -(when (> emacs-major-version 24) - ;; From - ;; Splitting windows while visual-fill-column makes Emacs go crazy. This prevents that - ;; by simply disabled VFC before splitting. - (after! visual-fill-column - (advice-add 'split-window :around #'visual-fill-column--disable-on-split-window)) - (defun visual-fill-column--disable-on-split-window (fn window &rest args) - "Undo the effects of `visual-fill-column-mode' for splitting window." - (if (and (or (not window) (window-live-p window)) - (buffer-local-value 'visual-fill-column-mode - (window-buffer (or window (selected-window))))) - (let ((inhibit-redisplay t)) - (set-window-fringes (or window (selected-window)) nil) - (set-window-margins (or window (selected-window)) 0 0) - (unwind-protect (apply fn window args) - (save-selected-window - (when window (select-window window 'norecord)) - (visual-fill-column--adjust-window)))) - (apply fn window args)))) - -(provide 'extra-write) -;;; extra-write.el ends here From 002704d6bb384fd48383715a03e5e508293b04b9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 03:50:20 -0400 Subject: [PATCH 02/25] Add ex-local! + define local org ex commands --- core/core-defuns.el | 8 ++++++++ private/my-commands.el | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/core-defuns.el b/core/core-defuns.el index bda613001..b970b665e 100644 --- a/core/core-defuns.el +++ b/core/core-defuns.el @@ -190,6 +190,14 @@ Examples: (after! evil (defalias 'ex! 'evil-ex-define-cmd) + ;; NOTE evil-mode doesn't read local `evil-ex-commands', and will + ;; not autocomplete local commands. + (defun ex-local! (cmd fn) + "Define a buffer-local ex command." + (unless (local-variable-p 'evil-ex-commands) + (setq-local evil-ex-commands (copy-alist evil-ex-commands))) + (evil-ex-define-cmd cmd fn)) + ;; Register keywords for proper indentation (see `map!') (put ':prefix 'lisp-indent-function 'defun) (put ':map 'lisp-indent-function 'defun) diff --git a/private/my-commands.el b/private/my-commands.el index 2ffaf1fbf..56f9e3252 100644 --- a/private/my-commands.el +++ b/private/my-commands.el @@ -98,9 +98,11 @@ (ex! "tabs" 'doom/tab-display) ;; Org-mode -(ex! "att[ach]" 'doom:org-attach) ; attach file to org file -(ex! "link" 'doom:org-link) -(ex! "org" 'doom:org-helm-search) ; search org notes +(add-hook! org-mode + ;;(ex! "org" 'doom:org-helm-search) ; search org notes + (ex! "att[ach]" 'doom:org-attach) ; attach file to org file + (ex! "link" 'doom:org-link) + (ex-local! "vlc" 'doom-org-insert-vlc)) (provide 'my-commands) ;;; my-commands.el ends here From 84821fd265256cc43cfae00bd09d03997cc81502 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 03:50:47 -0400 Subject: [PATCH 03/25] Caskfile: restore org packages + disable vestigial helm package --- Cask | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Cask b/Cask index 8c1948fe6..79ffefe38 100644 --- a/Cask +++ b/Cask @@ -271,13 +271,13 @@ ;;;; Experimental ;;;;;;;;;;;; ;; Org -- modules/module-org.el -;(depends-on "org-plus-contrib") -;(depends-on "ob-go" :git "https://github.com/pope/ob-go") -;(depends-on "ob-http") -;(depends-on "org-bullets") +(depends-on "org-plus-contrib") +; (depends-on "ob-go" :git "https://github.com/pope/ob-go") +; (depends-on "ob-http") +(depends-on "org-bullets") ;; Org Notebook -- modules/module-org-notebook.el -;(depends-on "org-download") -;(depends-on "ox-pandoc") +(depends-on "org-download") +(depends-on "ox-pandoc") ;;;; EXTRA TOOLS ;;;;;;;;;;;;;;;;;;;;;;; @@ -286,4 +286,4 @@ (depends-on "impatient-mode") ;; Writing -- modules/extra-write.el -(depends-on "helm-bibtex") +; (depends-on "helm-bibtex") From b535c4e937a3b2058f7b27f3c7c11f53468e573a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 05:15:17 -0400 Subject: [PATCH 04/25] Fix def-yas-mode! usages --- modules/module-java.el | 2 +- modules/module-python.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/module-java.el b/modules/module-java.el index 5e3e4bdc6..0d2975d15 100644 --- a/modules/module-java.el +++ b/modules/module-java.el @@ -32,7 +32,7 @@ :init (add-hook! (java-mode groovy-mode nxml-mode) 'doom|android-mode-enable-maybe) :config - (def-yas-mode! 'android-mode) + (def-yas-mode! android-mode) (after! company-dict (push 'android-mode company-dict-minor-mode-list))) diff --git a/modules/module-python.el b/modules/module-python.el index 567a92301..d4f847ba6 100644 --- a/modules/module-python.el +++ b/modules/module-python.el @@ -67,7 +67,7 @@ :init (associate! nose-mode :match "/test_.+\\.py$" :in (python-mode)) :config (def-popup! "*nosetests*" :align below :size 0.4 :noselect t) - (def-yas-mode! 'nose-mode) + (def-yas-mode! nose-mode) (map! :map nose-mode-map (:localleader :n "tr" 'nosetests-again From 98af05c49a942d100ce8cdc5e521bf5f7d76b626 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 14:36:35 -0400 Subject: [PATCH 05/25] Fix evil-want-fine-undo; fixed upstream as of evil v1.2.13 --- core/core-evil.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/core/core-evil.el b/core/core-evil.el index 4c52c596a..d9db6bb6d 100644 --- a/core/core-evil.el +++ b/core/core-evil.el @@ -11,6 +11,7 @@ evil-echo-state nil evil-ex-substitute-global t evil-insert-skip-empty-lines t + evil-want-fine-undo nil evil-normal-state-tag "N" evil-insert-state-tag "I" @@ -25,11 +26,7 @@ evil-normal-state-cursor 'box evil-emacs-state-cursor `(,(face-attribute 'shadow :foreground nil nil) box) evil-insert-state-cursor 'bar - evil-visual-state-cursor 'hollow - - ;; NOTE: a bug in emacs 25 breaks undoing in evil. See - ;; https://bitbucket.org/lyro/evil/issues/594/undo-doesnt-behave-like-vim - evil-want-fine-undo (if (> emacs-major-version 24) 'fine)) + evil-visual-state-cursor 'hollow) ;; highlight matching delimiters where it's important (defun show-paren-mode-off () (show-paren-mode -1)) From 83fe910469db82ee423a57ceaf6dd7eb5d7bf021 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 14:37:01 -0400 Subject: [PATCH 06/25] applescript-mode: Enable nlinum-mode + add quickrun command --- core/core-os-osx.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/core-os-osx.el b/core/core-os-osx.el index 31de3264f..21295e3ef 100644 --- a/core/core-os-osx.el +++ b/core/core-os-osx.el @@ -46,7 +46,15 @@ (use-package applescript-mode :mode "\\.applescript$" - :config (def-docset! applescript-mode "applescript")) + :init (add-hook 'applescript-mode-hook 'nlinum-mode) + :config + (def-docset! applescript-mode "applescript") + (after! quickrundb + (quickrun-add-command + "applescript" `((:command . ,as-osascript-command) + (:cmdopt . "-ss %s") + (:description . "Run applescript")) + :mode 'applescript-mode))) (def-project-type! lb6 "lb6" :match "\\.lb\\(action\\|ext\\)/.+$" From 2ad73e974d2b4f0d6d34131fe77c167c008a4b3a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 14:37:28 -0400 Subject: [PATCH 07/25] Improve doom-buffer kill-buffer-query-functions; update doom-buffer when visible --- core/core-scratch.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/core-scratch.el b/core/core-scratch.el index 5918d8070..bf9ba47f7 100644 --- a/core/core-scratch.el +++ b/core/core-scratch.el @@ -10,15 +10,22 @@ "The global and persistent scratch buffer for doom.") (defvar doom-buffer-name "*doom*" "The name of the doom scratch buffer.") -(defvar-local doom-buffer-edited nil +(defvar doom-buffer-edited nil "If non-nil, the scratch buffer has been edited.") (define-derived-mode doom-mode fundamental-mode "DOOM" "Major mode for special DOOM buffers.") +;; Update the doom buffer if it's visible during a killing +(add-hook! 'kill-buffer-query-functions + (when (and (get-buffer-window-list doom-buffer nil t) + (not doom-buffer-edited)) + (doom-mode-init t)) + t) + ;; Don't kill the scratch buffer (add-hook! 'kill-buffer-query-functions - (not (string= doom-buffer-name (buffer-name)))) + (not (eq doom-buffer (current-buffer)))) (after! uniquify (push (regexp-quote doom-buffer-name) uniquify-ignore-buffers-re)) From 57fa809023a5d8579819bc31ccea07e1edc1c94a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 14:38:30 -0400 Subject: [PATCH 08/25] Refactor real-buffer system --- core/defuns/defuns-buffers.el | 91 +++++++++++++++-------------------- 1 file changed, 39 insertions(+), 52 deletions(-) diff --git a/core/defuns/defuns-buffers.el b/core/defuns/defuns-buffers.el index 2be34da8d..445c92435 100644 --- a/core/defuns/defuns-buffers.el +++ b/core/defuns/defuns-buffers.el @@ -98,28 +98,19 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/" "Kill buffer (but only bury scratch buffer), then switch to a real buffer. Only buries the buffer if it is being displayed in another window." (interactive (list t)) - (if (eq doom-buffer (current-buffer)) - (if (one-window-p) - (progn - (when (= (length (get-buffer-window-list doom-buffer nil t)) 1) - (doom-mode-init t)) - (when arg (message "Already in scratch buffer"))) - (doom/previous-real-buffer)) - (let ((new-dir (doom/project-root))) - (if (doom/popup-p) - (doom/popup-close) - (if (> (length (get-buffer-window-list (current-buffer) nil t)) 1) - (bury-buffer) - (when (and buffer-file-name (buffer-modified-p)) - (if (yes-or-no-p "Buffer is unsaved, save it?") - (save-buffer) - (set-buffer-modified-p nil))) - (kill-this-buffer)) - (unless (doom/real-buffer-p (current-buffer)) - (doom/previous-real-buffer)) - (when (get-buffer-window-list doom-buffer nil t) - (doom|update-scratch-buffer new-dir))))) - t) + (cond ((doom/popup-p) + (doom/popup-close)) + (t + (if (> (length (get-buffer-window-list (current-buffer) nil t)) 1) + (bury-buffer) + (when (and buffer-file-name (buffer-modified-p)) + (if (yes-or-no-p "Buffer is unsaved, save it?") + (save-buffer) + (set-buffer-modified-p nil))) + (kill-buffer) + (unless (doom/real-buffer-p) + (doom/previous-real-buffer))))) + t) ;;;###autoload (defun doom/kill-unreal-buffers () @@ -168,45 +159,41 @@ the buffer if it is being displayed in another window." "Switch to the previous buffer and avoid special buffers. If there's nothing left, create a scratch buffer." (let* ((start-buffer (current-buffer)) - (move-func (if (< n 0) 'switch-to-next-buffer 'switch-to-prev-buffer)) - (real-buffers (doom/get-real-buffers)) - (realc (length real-buffers)) + (move-func (if (> n 0) 'switch-to-next-buffer 'switch-to-prev-buffer)) (max 25) (i 0) - (continue t)) - (if (or (= realc 0) - (and (= realc 1) (eq (car real-buffers) (current-buffer)))) - (progn - (doom|update-scratch-buffer) - (switch-to-buffer doom-buffer-name) - (message "Nowhere to go")) - (funcall move-func) - (while (and continue) - (let ((current-buffer (current-buffer))) - (cond ((or (eq current-buffer start-buffer) - (>= i max)) - (doom|update-scratch-buffer) - (switch-to-buffer doom-buffer-name) - (setq continue nil)) - ((not (memq current-buffer real-buffers)) - (funcall move-func)) - (t - (setq continue nil)))) - (cl-incf i))))) + (continue t) + destbuf) + (setq destbuf + (catch 'goto + (if (not (doom/get-real-buffers)) + (throw 'goto doom-buffer) + (funcall move-func) + (while (not (and (doom/real-buffer-p) + (doom/project-p))) + (if (or (eq (current-buffer) start-buffer) + (>= i max)) + (throw 'goto doom-buffer) + (funcall move-func)) + (cl-incf i)) + (current-buffer)))) + (when (eq destbuf doom-buffer) + (doom|update-scratch-buffer) + (message "Nowhere to go")) + (switch-to-buffer destbuf))) ;;;###autoload (defun doom/real-buffer-p (&optional buffer) "Returns whether BUFFER a 'real' buffer or not. Real means it isn't a popup, temporary, scratch or special buffer." - (setq buffer (get-buffer (or buffer (current-buffer)))) + (setq buffer (or (and (bufferp buffer) buffer) + (and (stringp buffer) (get-buffer buffer)) + (current-buffer))) (when (buffer-live-p buffer) (with-current-buffer buffer - (not (or (apply #'derived-mode-p - (-filter 'symbolp doom-unreal-buffers)) - (--any? (if (stringp it) - (string-match-p it (buffer-name buffer)) - (eq major-mode it)) - doom-unreal-buffers)))))) + (not (or (apply #'derived-mode-p (-filter 'symbolp doom-unreal-buffers)) + (--any? (string-match-p it (buffer-name buffer)) + (-filter 'stringp doom-unreal-buffers))))))) ;; Inspired by spacemacs ;;;###autoload From f1a4db0f617f22887da1e488311f1682871805d1 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 14:38:54 -0400 Subject: [PATCH 09/25] Improve neotree keymap --- core/core-project.el | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/core/core-project.el b/core/core-project.el index 0fd4dce85..9e8538f63 100644 --- a/core/core-project.el +++ b/core/core-project.el @@ -112,19 +112,20 @@ (map! :map neotree-mode-map :m "\\\\" 'evil-window-prev "ESC ESC" 'neotree-hide - "q" 'neotree-hide - "RET" 'neotree-enter - "J" 'neotree-select-next-sibling-node - "K" 'neotree-select-previous-sibling-node - "H" 'neotree-select-up-node - "L" 'neotree-select-down-node - "v" 'neotree-enter-vertical-split - "s" 'neotree-enter-horizontal-split - "c" 'neotree-create-node - "d" 'neotree-delete-node - "g" 'neotree-refresh - "r" 'neotree-rename-node - "R" 'neotree-change-root)) + "q" 'neotree-hide + [return] 'neotree-enter + "RET" 'neotree-enter + :m "J" 'neotree-select-next-sibling-node + :m "K" 'neotree-select-previous-sibling-node + :m "H" 'neotree-select-up-node + :m "L" 'neotree-select-down-node + "v" 'neotree-enter-vertical-split + "s" 'neotree-enter-horizontal-split + "c" 'neotree-create-node + "d" 'neotree-delete-node + "g" 'neotree-refresh + "r" 'neotree-rename-node + "R" 'neotree-change-root)) (use-package projectile :config From ea13be53b1b0ec64dc8cadf9d5b84e0570912566 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 14:40:01 -0400 Subject: [PATCH 10/25] help-mode: fix links to already open buffers --- core/core-popup.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/core-popup.el b/core/core-popup.el index 97282b25a..eb8ba1d63 100644 --- a/core/core-popup.el +++ b/core/core-popup.el @@ -72,7 +72,8 @@ (let ((location (find-function-search-for-symbol fun nil file))) (doom/popup-save - (switch-to-buffer (car location) nil t)) + (switch-to-buffer (car location) nil t) + (awhen (cdr location) (goto-char it))) (if (cdr location) (goto-char (cdr location)) (message "Unable to find location in file"))))) @@ -84,7 +85,8 @@ (setq file (help-C-file-name var 'var))) (let ((location (find-variable-noselect var file))) (doom/popup-save - (switch-to-buffer (car location) nil t)) + (switch-to-buffer (car location) nil t) + (awhen (cdr location) (goto-char it))) (if (cdr location) (goto-char (cdr location)) (message "Unable to find location in file"))))) @@ -96,7 +98,8 @@ (let ((location (find-function-search-for-symbol fun 'defface file))) (doom/popup-save - (switch-to-buffer (car location) nil t)) + (switch-to-buffer (car location) nil t) + (awhen (cdr location) (goto-char it))) (if (cdr location) (goto-char (cdr location)) (message "Unable to find location in file")))))) From eaa467c1a755a51259678af3bded3e1b83d9aa8f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 14:43:40 -0400 Subject: [PATCH 11/25] General cleanup --- core/core-defuns.el | 4 ++-- core/core-eval.el | 1 - core/core-ui.el | 12 +++++++----- core/core-vcs.el | 1 + core/core-yasnippet.el | 4 +--- core/defuns/defuns-popups.el | 1 - modules/module-cc.el | 2 +- modules/module-csharp.el | 2 +- modules/module-elisp.el | 5 ++--- modules/module-php.el | 2 +- modules/module-scala.el | 2 +- modules/module-text.el | 2 +- 12 files changed, 18 insertions(+), 20 deletions(-) diff --git a/core/core-defuns.el b/core/core-defuns.el index b970b665e..374e69594 100644 --- a/core/core-defuns.el +++ b/core/core-defuns.el @@ -190,8 +190,8 @@ Examples: (after! evil (defalias 'ex! 'evil-ex-define-cmd) - ;; NOTE evil-mode doesn't read local `evil-ex-commands', and will - ;; not autocomplete local commands. + ;; NOTE evil-mode doesn't read local `evil-ex-commands', and will not + ;; autocomplete local commands. (defun ex-local! (cmd fn) "Define a buffer-local ex command." (unless (local-variable-p 'evil-ex-commands) diff --git a/core/core-eval.el b/core/core-eval.el index 0babc1b10..694cb4ef1 100644 --- a/core/core-eval.el +++ b/core/core-eval.el @@ -63,7 +63,6 @@ :n "k" 'evil-previous-line :n "h" 'evil-backward-char :n "l" 'evil-forward-char - ;; FIXME Greedy command buffer always grabs focus :m "n" 'realgud:cmd-next :m "b" 'realgud:cmd-break :m "B" 'realgud:cmd-clear diff --git a/core/core-ui.el b/core/core-ui.el index 0f48f7f5a..ce447013f 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -97,9 +97,8 @@ :init (add-hook! (prog-mode markdown-mode) 'hl-line-mode) :config ;; Doesn't seem to play nice in emacs 25+ - (when (< emacs-major-version 25) - (setq hl-line-sticky-flag nil - global-hl-line-sticky-flag nil)) + (setq hl-line-sticky-flag nil + global-hl-line-sticky-flag nil) (defvar-local doom--hl-line-mode nil) (defun doom|hl-line-on () (if doom--hl-line-mode (hl-line-mode +1))) @@ -394,9 +393,11 @@ anzu to be enabled." 'doom-flycheck-warning 'mode-line)))))))))) + (defvar *pad-active (pl/percent-xpm powerline-height 100 0 100 0 3 "#00B3EF" nil)) + (defvar *pad-inactive (pl/percent-xpm powerline-height 100 0 100 0 3 nil nil)) (spaceline-define-segment *pad "Padding, to ensure the mode-line is `powerline-height' pixels tall" - (pl/percent-xpm powerline-height 100 0 100 0 3 (if active "#00B3EF") nil) + (if active *pad-active *pad-inactive) :tight t) (spaceline-compile @@ -441,9 +442,10 @@ anzu to be enabled." :tight t :face 'mode-line) + (defvar *eldoc-pad-xpm (pl/percent-xpm powerline-height 100 0 100 0 3 "#B3EF00" nil)) (spaceline-define-segment *eldoc-pad "Padding, to ensure the mode-line is `powerline-height' pixels tall" - (pl/percent-xpm powerline-height 100 0 100 0 3 "#B3EF00" nil) + *eldoc-pad-xpm :tight t :face 'mode-line) diff --git a/core/core-vcs.el b/core/core-vcs.el index ab1b9058b..643826a4a 100644 --- a/core/core-vcs.el +++ b/core/core-vcs.el @@ -68,6 +68,7 @@ (select-window (get-buffer-window doom-prev-buffer))) (switch-to-buffer b))) + ;; Prevent magit and evil-snipe conflicts (add-hook 'magit-mode-hook 'turn-off-evil-snipe-override-mode) (require 'evil-magit) diff --git a/core/core-yasnippet.el b/core/core-yasnippet.el index a13c9563e..5b4e8f039 100644 --- a/core/core-yasnippet.el +++ b/core/core-yasnippet.el @@ -43,9 +43,7 @@ ;; Strip out whitespace before a line selection (add-hook 'yas-before-expand-snippet-hook 'doom|yas-before-expand) ;; Fix previous hook persisting yas-selected-text between expansions - (add-hook 'yas-after-exit-snippet-hook 'doom|yas-after-expand) - ;; Suppress yasnippet with helm - (after! helm (push 'helm-alive-p yas-dont-activate-functions))) + (add-hook 'yas-after-exit-snippet-hook 'doom|yas-after-expand)) (use-package auto-yasnippet :commands (aya-create aya-expand aya-open-line aya-persist-snippet) diff --git a/core/defuns/defuns-popups.el b/core/defuns/defuns-popups.el index 702c52e75..e0578c043 100644 --- a/core/defuns/defuns-popups.el +++ b/core/defuns/defuns-popups.el @@ -144,7 +144,6 @@ the display (unless DONT-REDRAW is non-nil)." doom-popup-rules)))) (setq doom-last-popup (current-buffer)) (setq-local doom-popup-rule rules) - ;; (set-window-dedicated-p (selected-window) doom-popup-mode) (unless (memq :noesc rules) (make-local-variable 'doom-popup-mode-map) (let ((map doom-popup-mode-map)) diff --git a/modules/module-cc.el b/modules/module-cc.el index ddb40f347..88795420f 100644 --- a/modules/module-cc.el +++ b/modules/module-cc.el @@ -45,7 +45,7 @@ :config (setq irony-server-install-prefix (concat doom-temp-dir "/irony/")) (add-hook! c++-mode - (make-variable-buffer-local 'irony-additional-clang-options) + (make-local-variable 'irony-additional-clang-options) (push "-std=c++11" irony-additional-clang-options)) (require 'irony-eldoc) diff --git a/modules/module-csharp.el b/modules/module-csharp.el index 40c7562e6..13167107a 100644 --- a/modules/module-csharp.el +++ b/modules/module-csharp.el @@ -12,7 +12,7 @@ (setq omnisharp-auto-complete-want-documentation nil omnisharp-server-executable-path (concat doom-ext-dir "/OmniSharp.exe")) :when (file-exists-p omnisharp-server-executable-path) - :init (add-hook! csharp-mode '(turn-on-eldoc-mode omnisharp-mode)) + :init (add-hook! csharp-mode '(eldoc-mode omnisharp-mode)) :config (def-company-backend! csharp-mode (omnisharp)) (map! :map omnisharp-mode-map diff --git a/modules/module-elisp.el b/modules/module-elisp.el index b5c9649bb..d1aabf650 100644 --- a/modules/module-elisp.el +++ b/modules/module-elisp.el @@ -1,7 +1,7 @@ ;;; module-elisp --- all things lisp (associate! emacs-lisp-mode :match "\\(/Cask\\|\\.\\(el\\|gz\\)\\)$") -(add-hook! emacs-lisp-mode '(turn-on-eldoc-mode flycheck-mode highlight-numbers-mode)) +(add-hook! emacs-lisp-mode '(eldoc-mode flycheck-mode highlight-numbers-mode)) ;; Real go-to-definition for elisp (map! :map emacs-lisp-mode-map :m "gd" 'doom/elisp-find-function-at-pt) @@ -103,11 +103,10 @@ :config (setq inferior-lisp-program "clisp")) (use-package auto-compile - :commands (auto-compile-on-save-mode) + :commands auto-compile-on-save-mode :init (add-hook 'emacs-lisp-mode-hook 'auto-compile-on-save-mode) :config (setq auto-compile-display-buffer nil)) - ;; (def-project-type! emacs-ert "ert" :modes (emacs-lisp-mode) diff --git a/modules/module-php.el b/modules/module-php.el index d48b0a9e4..af4a2c552 100644 --- a/modules/module-php.el +++ b/modules/module-php.el @@ -29,7 +29,7 @@ (use-package php-extras :after php-mode - :init (add-hook 'php-mode-hook 'turn-on-eldoc-mode) + :init (add-hook 'php-mode-hook 'eldoc-mode) :config (defun php-extras-company-setup ()) ;; company will set up itself ;; Generate php-extras documentation and completion asynchronously diff --git a/modules/module-scala.el b/modules/module-scala.el index fdd91fe23..41337c8b2 100644 --- a/modules/module-scala.el +++ b/modules/module-scala.el @@ -2,7 +2,7 @@ (use-package scala-mode :mode "\\.s\\(cala\\|bt\\)$" - :init (add-hook 'scala-mode-hook 'turn-on-eldoc-mode) + :init (add-hook 'scala-mode-hook 'eldoc-mode) :config (def-company-backend! scala-mode '(ensime-company (company-yasnippet)))) (use-package sbt-mode diff --git a/modules/module-text.el b/modules/module-text.el index 9585203ac..95dd05f64 100644 --- a/modules/module-text.el +++ b/modules/module-text.el @@ -6,7 +6,7 @@ :mode ("\\.m\\(d\\|arkdown\\)$" "/README$" ("/README\\.md$" . gfm-mode)) :init - (add-hook 'markdown-mode-hook 'turn-on-auto-fill) + (add-hook 'markdown-mode-hook 'auto-fill-mode) (setq markdown-enable-wiki-links t markdown-italic-underscore t markdown-enable-math t From 96e0b3ac370e6550b579df39316228d53d3fe8e0 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 14:44:11 -0400 Subject: [PATCH 12/25] Lazy load evil-anzu --- core/core-evil.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/core-evil.el b/core/core-evil.el index d9db6bb6d..f18120eee 100644 --- a/core/core-evil.el +++ b/core/core-evil.el @@ -44,6 +44,13 @@ (evil-mode 1) (evil-select-search-module 'evil-search-module 'evil-search) + ;; evil-anzu is strangely slow on startup. Byte compiling doesn't help. + ;; We use this to lazy load it instead. + (defun doom*evil-search (&rest _) + (require 'evil-anzu) + (advice-remove 'evil-ex-start-search 'doom*evil-search)) + (advice-add 'evil-ex-start-search :before 'doom*evil-search) + ;; Reset evil-mode in the messages buffer, because it opens before evil ;; normalizes its keymaps, so none of the custom keybindings work in it. (add-hook! emacs-startup @@ -152,7 +159,7 @@ :commands (evil-numbers/inc-at-pt evil-numbers/dec-at-pt)) (use-package evil-anzu - :defer 1 + :defer t :config (setq anzu-cons-mode-line-p nil anzu-minimum-input-length 1 From 78c95aae3a5e17d6aef3b36da1369c5b71cb9c75 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 14:45:29 -0400 Subject: [PATCH 13/25] split-window-preferred-function = 'visual-line-mode-split-window-sensibly' --- core/core-ui.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/core-ui.el b/core/core-ui.el index ce447013f..16cbc5128 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -111,7 +111,8 @@ (use-package visual-fill-column :defer t :config (setq-default visual-fill-column-center-text nil - visual-fill-column-width fill-column)) + visual-fill-column-width fill-column + split-window-preferred-function 'visual-line-mode-split-window-sensibly)) (use-package highlight-indentation :commands (highlight-indentation-mode From 873133eb67fc616fbbc4601ab0b169125e182bbe Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 21:08:19 -0400 Subject: [PATCH 14/25] Add command-log-mode --- Cask | 1 + core/core-editor.el | 4 ++++ private/my-commands.el | 1 + 3 files changed, 6 insertions(+) diff --git a/Cask b/Cask index 79ffefe38..14c0b4cd0 100644 --- a/Cask +++ b/Cask @@ -64,6 +64,7 @@ (depends-on "ace-link") (depends-on "ace-window") (depends-on "avy") +(depends-on "command-log-mode") (depends-on "dumb-jump") (depends-on "editorconfig") (depends-on "eldoc-eval") diff --git a/core/core-editor.el b/core/core-editor.el index 3a6a5322e..30062d01e 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -146,6 +146,10 @@ :config (setq avy-all-windows nil avy-background t)) +(use-package command-log-mode + :commands (clm/command-log-buffer command-log-mode global-command-log-mode) + :config (setq command-log-mode-is-global t)) + (use-package dumb-jump :commands (dumb-jump-go dumb-jump-quick-look dumb-jump-back) :config diff --git a/private/my-commands.el b/private/my-commands.el index 56f9e3252..a203e51a2 100644 --- a/private/my-commands.el +++ b/private/my-commands.el @@ -12,6 +12,7 @@ (ex! "bc[omp]" 'doom:byte-compile) (ex! "re[load]" 'doom-reload) (ex! "re[load]au" 'doom-reload-autoloads) +(ex! "clog" 'clm/toggle-command-log-buffer) ;; Quick mapping keys to commands, allows :nmap \m !make (ex! "imap" 'doom:imap) From 791faeece4575e0292d2c620fb4d74c0019b0beb Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 21:08:43 -0400 Subject: [PATCH 15/25] Fix :re command collision --- private/my-commands.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/private/my-commands.el b/private/my-commands.el index a203e51a2..01f9ae9b9 100644 --- a/private/my-commands.el +++ b/private/my-commands.el @@ -42,7 +42,7 @@ (ex! "db" 'doom:db) (ex! "dbu[se]" 'doom:db-select) (ex! "http" 'httpd-start) ; start http server -(ex! "re[gex]" 'doom:regex) ; open re-builder +(ex! "rx" 'doom:regex) ; open re-builder (ex! "repl" 'doom:repl) ; invoke or send to repl (ex! "sh[ell]" 'doom/eshell) (ex! "t[mux]" 'doom:tmux) ; send to tmux From 75f54bf82eb03dc84029a9ac45d4d9fb5d1def8e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 21:09:19 -0400 Subject: [PATCH 16/25] scratch buffer: check if mode is a function before running it --- core/defuns/defuns-buffers.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/defuns/defuns-buffers.el b/core/defuns/defuns-buffers.el index 445c92435..7257e69da 100644 --- a/core/defuns/defuns-buffers.el +++ b/core/defuns/defuns-buffers.el @@ -263,7 +263,8 @@ buffers regardless of project." ;; or scratch buffer by default (with-current-buffer (doom/popup-buffer doom-buffer) (doom|update-scratch-buffer nil t) - (unless (eq major-mode mode) + (when (and (not (eq major-mode mode)) + (functionp mode)) (funcall mode)) (unless doom-buffer-edited (erase-buffer) From 343b63ef170d68b56d05fd64749697e9c298d08a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Jun 2016 00:21:16 -0400 Subject: [PATCH 17/25] fixup! Add command-log-mode --- core/core-popup.el | 1 + 1 file changed, 1 insertion(+) diff --git a/core/core-popup.el b/core/core-popup.el index eb8ba1d63..64946d4b3 100644 --- a/core/core-popup.el +++ b/core/core-popup.el @@ -28,6 +28,7 @@ ("*Warnings*" :align below :size 10 :noselect t) (compilation-mode :align below :size 15 :noselect t) (eww-mode :align below :size 30 :select t) + ("*command-log*" :align right :size 28 :noselect t) ;; vcs ("*vc-diff*" :align below :size 15 :noselect t) ("*vc-change-log*" :align below :size 15 :select t) From a072cb87c9e3ec8b1e86669ede6421ecbbe96573 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Jun 2016 00:21:53 -0400 Subject: [PATCH 18/25] Don't let cursor stay in help buffer popup after following a link --- core/core-popup.el | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/core/core-popup.el b/core/core-popup.el index 64946d4b3..0c0ddbd91 100644 --- a/core/core-popup.el +++ b/core/core-popup.el @@ -70,14 +70,13 @@ (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))) + (let ((location (find-function-search-for-symbol fun nil file))) (doom/popup-save (switch-to-buffer (car location) nil t) - (awhen (cdr location) (goto-char it))) - (if (cdr location) - (goto-char (cdr location)) - (message "Unable to find location in file"))))) + (if (cdr location) + (goto-char (cdr location)) + (message "Unable to find location in file"))) + (select-window (get-buffer-window (car location)))))) (define-button-type 'help-variable-def :supertype 'help-xref @@ -87,10 +86,10 @@ (let ((location (find-variable-noselect var file))) (doom/popup-save (switch-to-buffer (car location) nil t) - (awhen (cdr location) (goto-char it))) - (if (cdr location) - (goto-char (cdr location)) - (message "Unable to find location in file"))))) + (if (cdr location) + (goto-char (cdr location)) + (message "Unable to find location in file"))) + (select-window (get-buffer-window (car location)))))) (define-button-type 'help-face-def :supertype 'help-xref @@ -100,10 +99,10 @@ (find-function-search-for-symbol fun 'defface file))) (doom/popup-save (switch-to-buffer (car location) nil t) - (awhen (cdr location) (goto-char it))) - (if (cdr location) - (goto-char (cdr location)) - (message "Unable to find location in file")))))) + (if (cdr location) + (goto-char (cdr location)) + (message "Unable to find location in file"))) + (select-window (get-buffer-window (car location))))))) (provide 'core-popup) ;;; core-popup.el ends here From 5f1cd1972f7175916ffbfe91f3436919ba3a227e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Jun 2016 00:22:39 -0400 Subject: [PATCH 19/25] Don't use delete-trailing-whitespace as a hook with highlight-indentation-mode --- core/core-ui.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/core-ui.el b/core/core-ui.el index 16cbc5128..5d9240df8 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -130,10 +130,9 @@ (if highlight-indentation-mode (progn (doom/add-whitespace) - (add-hook 'after-save-hook 'doom/add-whitespace nil t) - (add-hook 'before-save-hook 'delete-trailing-whitespace nil t)) + (add-hook 'after-save-hook 'doom/add-whitespace nil t)) (remove-hook 'after-save-hook 'doom/add-whitespace t) - (remove-hook 'before-save-hook 'delete-trailing-whitespace t)))) + (delete-trailing-whitespace)))) (use-package highlight-numbers :commands (highlight-numbers-mode)) From 93b5cecd9d1f9ceeaa62eaa0d04b20675f241c4e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Jun 2016 00:24:40 -0400 Subject: [PATCH 20/25] Polish neotree integration + Smaller font in neotree window (with slightly thinner window) + Refactor advice naming + Add space-prepended buffer name to winner-boring-alist + Remove unnecessary advice defuns --- core/core-project.el | 15 +++++++-------- core/core-vars.el | 2 +- core/defuns/defuns-neotree.el | 17 +++++++---------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/core/core-project.el b/core/core-project.el index 9e8538f63..d47d20f78 100644 --- a/core/core-project.el +++ b/core/core-project.el @@ -81,7 +81,7 @@ neo-auto-indent-point t neo-mode-line-type 'none neo-persist-show nil - neo-window-width 28 + neo-window-width 26 neo-show-updir-line nil neo-auto-indent-point t neo-theme 'nerd ; fallback @@ -90,24 +90,23 @@ (evil-set-initial-state 'neotree-mode 'motion) (add-hook 'neo-after-create-hook 'doom-hide-mode-line-mode) - ;; Don't mess with neotree on wg-related window-config changes - (advice-add 'doom/undo-window-change :around 'doom*save-neotree) - (advice-add 'doom/redo-window-change :around 'doom*save-neotree) ;; A custom and simple theme for neotree - (advice-add 'neo-buffer--insert-fold-symbol :override 'doom*neo-theme) + (advice-add 'neo-buffer--insert-fold-symbol :override 'doom*neo-insert-fold-symbol) ;; Shorter pwd in neotree - (advice-add 'neo-buffer--insert-root-entry :filter-args 'doom*neotree-shorten-pwd) + (advice-add 'neo-buffer--insert-root-entry :filter-args 'doom*neo-insert-root-entry) ;; Don't ask for confirmation when creating files (advice-add 'neotree-create-node :around 'doom*neotree-create-node) ;; Prevents messing up the neotree buffer on window changes (advice-add 'doom/evil-window-move :around 'doom*save-neotree) - (defun doom*neotree-no-fringes () - (set-window-fringes neo-global--window 1 0)) + ;; Minimize 'border' between windows (won't work in hook) + (defun doom*neotree-no-fringes () (set-window-fringes neo-global--window 1 0)) (advice-add 'neo-global--select-window :after 'doom*neotree-no-fringes) (add-hook! neotree-mode (set (make-local-variable 'hl-line-sticky-flag) t) + (setq line-spacing 2) + (text-scale-set -1) (hl-line-mode +1)) (map! :map neotree-mode-map :m "\\\\" 'evil-window-prev diff --git a/core/core-vars.el b/core/core-vars.el index 3fa305f65..df6faee57 100644 --- a/core/core-vars.el +++ b/core/core-vars.el @@ -13,7 +13,7 @@ killed by `doom/kill-unreal-buffers', or after `doom/kill-real-buffer').") (defvar doom-ignore-buffers '("*Messages*" "*eval*" "*Completions*" "*Compile-Log*" "*inferior-lisp*" "*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*" "*Buffer List*" - "*Ibuffer*" "*NeoTree*" "*NeoTree*" "*esh command on file*" "*WoMan-Log*" + "*Ibuffer*" " *NeoTree*" "*NeoTree*" "*esh command on file*" "*WoMan-Log*" "*compilation*" "*use-package*" "*quickrun*" "*eclim: problems*" "*Flycheck errors*" "*popwin-dummy*" ;; Helm diff --git a/core/defuns/defuns-neotree.el b/core/defuns/defuns-neotree.el index 08b232a25..3bfba40f2 100644 --- a/core/defuns/defuns-neotree.el +++ b/core/defuns/defuns-neotree.el @@ -45,19 +45,16 @@ (apply orig-fun args))) ;;;###autoload -(defun doom*neotree-shorten-pwd (node) - "Shorter pwd in neotree" +(defun doom*neo-insert-root-entry (node) + "Pretty-print pwd in neotree" (list (concat "  " (projectile-project-name)))) ;;;###autoload -(defun doom*neo-theme (name) - "Custom hybrid ascii theme with leading whitespace." - (let ((n-insert-symbol (lambda (n) - (neo-buffer--insert-with-face - n 'neo-expand-btn-face)))) - (or (and (eq name 'open) (funcall n-insert-symbol " -  ")) - (and (eq name 'close) (funcall n-insert-symbol " +  ")) - (and (eq name 'leaf) (funcall n-insert-symbol " "))))) +(defun doom*neo-insert-fold-symbol (name) + "Custom hybrid unicode theme with leading whitespace." + (or (and (eq name 'open) (neo-buffer--insert-with-face " -  " 'neo-expand-btn-face)) + (and (eq name 'close) (neo-buffer--insert-with-face " +  " 'neo-expand-btn-face)) + (and (eq name 'leaf) (neo-buffer--insert-with-face " " 'neo-expand-btn-face)))) (provide 'defuns-neotree) ;;; defuns-neotree.el ends here From 2c55f53cbdc1c11a691c914d09f8c51667ec8c95 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Jun 2016 00:26:47 -0400 Subject: [PATCH 21/25] doom*evil-esc-quit: ESC is special in popups --- core/defuns/defuns-evil.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/defuns/defuns-evil.el b/core/defuns/defuns-evil.el index 808d01179..9ee49158c 100644 --- a/core/defuns/defuns-evil.el +++ b/core/defuns/defuns-evil.el @@ -192,13 +192,15 @@ monkey patch it to use pop-to-buffer." ;;;###autoload (defun doom*evil-esc-quit () "Close popups, disable search highlights and quit the minibuffer if open." - (let ((minib-p (minibuffer-window-active-p (minibuffer-window))) - (evil-hl-p (evil-ex-hl-active-p 'evil-ex-search))) - (when minib-p (abort-recursive-edit)) - (when evil-hl-p (evil-ex-nohighlight)) - ;; Close non-repl popups and clean up `doom-popup-windows' - (unless (or minib-p evil-hl-p (bound-and-true-p doom-popup-mode)) - (doom/popup-close-all)))) + (if (and (doom/popup-p) (memq :noesc doom-popup-rule)) + (doom/popup-close) + (let ((minib-p (minibuffer-window-active-p (minibuffer-window))) + (evil-hl-p (evil-ex-hl-active-p 'evil-ex-search))) + (when minib-p (abort-recursive-edit)) + (when evil-hl-p (evil-ex-nohighlight)) + ;; Close non-repl popups and clean up `doom-popup-windows' + (unless (or minib-p evil-hl-p) + (doom/popup-close-all))))) ;;;###autoload (defun doom*evil-ex-replace-special-filenames (file-name) From 906e5006ae6984e9ba0eafe9bc1d946117e61f90 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Jun 2016 00:27:56 -0400 Subject: [PATCH 22/25] Refactor nlinum hl/unhl; sacrifice a little performance for stability --- core/defuns/defuns-nlinum.el | 46 ++++++++++++++---------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/core/defuns/defuns-nlinum.el b/core/defuns/defuns-nlinum.el index 28065ec67..33d8f5a63 100644 --- a/core/defuns/defuns-nlinum.el +++ b/core/defuns/defuns-nlinum.el @@ -11,50 +11,40 @@ (defun doom|nlinum-enable (&rest _) (nlinum-mode +1) (add-hook 'post-command-hook 'doom|nlinum-hl-line nil t) - (doom|nlinum-unhl-line)) + (doom--nlinum-unhl-line)) ;;;###autoload (defun doom|nlinum-disable (&rest _) (nlinum-mode -1) (remove-hook 'post-command-hook 'doom|nlinum-hl-line t) - (doom|nlinum-unhl-line)) + (doom--nlinum-unhl-line)) -;;;###autoload -(defun doom|nlinum-unhl-line () +(defun doom--nlinum-unhl-line () "Unhighlight line number" (when doom--hl-nlinum-overlay (let* ((disp (get-text-property 0 'display (overlay-get doom--hl-nlinum-overlay 'before-string))) (str (nth 1 disp))) (put-text-property 0 (length str) 'face 'linum str) - (setq doom--hl-nlinum-overlay nil - doom--hl-nlinum-line nil) + (setq doom--hl-nlinum-overlay nil) disp))) ;;;###autoload -(defun doom|nlinum-hl-line (&optional line) +(defun doom|nlinum-hl-line () "Highlight line number" - (let ((line-no (or line (string-to-number (format-mode-line "%l"))))) - (unless doom--hl-nlinum-line - (setq doom--hl-nlinum-line line-no)) - (if (and nlinum-mode (or (not (= line-no doom--hl-nlinum-line)) - (memq this-command '(next-line previous-line - evil-window-bottom evil-window-top - evil-goto-line evil-goto-first-line)))) - (let* ((pbol (line-beginning-position)) - (peol (1+ pbol)) - (max (point-max))) - ;; Handle EOF case - (when (>= peol max) - (setq peol max)) - (jit-lock-fontify-now pbol peol) - (let ((ov (--first (overlay-get it 'nlinum) (overlays-in pbol peol)))) - (when ov - (doom|nlinum-unhl-line) - (let ((str (nth 1 (get-text-property 0 'display (overlay-get ov 'before-string))))) - (put-text-property 0 (length str) 'face 'doom-nlinum-highlight str) - (setq doom--hl-nlinum-line line-no - doom--hl-nlinum-overlay ov)))))))) + (let* ((pbol (line-beginning-position)) + (peol (1+ pbol)) + (max (point-max))) + ;; Handle EOF case + (when (>= peol max) + (setq peol max)) + (jit-lock-fontify-now pbol peol) + (let ((ov (--first (overlay-get it 'nlinum) (overlays-in pbol peol)))) + (doom--nlinum-unhl-line) + (when ov + (let ((str (nth 1 (get-text-property 0 'display (overlay-get ov 'before-string))))) + (put-text-property 0 (length str) 'face 'doom-nlinum-highlight str) + (setq doom--hl-nlinum-overlay ov)))))) (provide 'defuns-nlinum) ;;; defuns-nlinum.el ends here From 955b9cb20fb55f38c2842cd7e045e04fd4c76963 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Jun 2016 00:28:43 -0400 Subject: [PATCH 23/25] Remove redundant boundp check in def-yas-mode! --- core/defuns/macros-yasnippet.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/defuns/macros-yasnippet.el b/core/defuns/macros-yasnippet.el index d355f35af..3ceab5c58 100644 --- a/core/defuns/macros-yasnippet.el +++ b/core/defuns/macros-yasnippet.el @@ -4,11 +4,10 @@ (defmacro def-yas-mode! (mode) "Register minor MODES in yasnippet." `(after! yasnippet - (when (boundp 'yas--extra-modes) - (add-hook! ,mode - (if (symbol-value ,mode) - (yas-activate-extra-mode ,mode) - (yas-deactivate-extra-mode ,mode)))))) + (add-hook! ,mode + (if ,mode + (yas-activate-extra-mode ,mode) + (yas-deactivate-extra-mode ,mode))))) (provide 'macros-yasnippet) ;;; macros-yasnippet.el ends here From 66a30074d6971b2ce9fde3dab2f91e50bf565e8e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Jun 2016 00:29:08 -0400 Subject: [PATCH 24/25] Enable highlight-numbers-mode in css modes --- modules/module-css.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/module-css.el b/modules/module-css.el index ff0cd572d..904cc38fa 100644 --- a/modules/module-css.el +++ b/modules/module-css.el @@ -11,7 +11,7 @@ (use-package css-mode :mode "\\.css$" - :init (add-hook! css-mode '(yas-minor-mode-on flycheck-mode rainbow-mode)) + :init (add-hook! css-mode '(yas-minor-mode-on flycheck-mode rainbow-mode highlight-numbers-mode)) :config (def-company-backend! css-mode (css yasnippet)) (push '("css" "scss" "sass" "less" "styl") projectile-other-file-alist)) From 9ad1d48a106eee1f9e0a7dc151aa777d8c48bbad Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Jun 2016 00:29:22 -0400 Subject: [PATCH 25/25] elisp: fontify ex-local! macro calls --- modules/module-elisp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/module-elisp.el b/modules/module-elisp.el index d1aabf650..58b696630 100644 --- a/modules/module-elisp.el +++ b/modules/module-elisp.el @@ -46,7 +46,7 @@ (,(concat "(\\(" (regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook" - "associate" "define-org-link" "ex" + "associate" "define-org-link" "ex" "ex-local" "define-org-section" "set" "noop")) "!\\)") (1 font-lock-keyword-face append))