From 4a670cc1fb0ab25ae4fe1c036e72e29b487c6581 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 30 Nov 2015 16:49:18 -0500 Subject: [PATCH] Update defuns --- core/lib/defuns-auto-insert.el | 4 +++- core/lib/defuns-flycheck.el | 7 +++++++ core/lib/defuns-neotree.el | 3 ++- core/lib/defuns-ui.el | 2 +- core/lib/defuns-window.el | 29 +++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/core/lib/defuns-auto-insert.el b/core/lib/defuns-auto-insert.el index 4d05d2d09..8768e4823 100644 --- a/core/lib/defuns-auto-insert.el +++ b/core/lib/defuns-auto-insert.el @@ -15,7 +15,9 @@ (yas--get-snippet-tables mode))))) (if template (yas--template-content template) nil)))) (when (and is-yasnippet-on snippet) - (yas-expand-snippet snippet))))) + (yas-expand-snippet snippet) + (when (and (featurep 'evil) evil-mode) + (evil-initialize-state 'insert)))))) (provide 'defuns-auto-insert) ;;; defuns-auto-insert.el ends here diff --git a/core/lib/defuns-flycheck.el b/core/lib/defuns-flycheck.el index fca2e64ba..691c85af4 100644 --- a/core/lib/defuns-flycheck.el +++ b/core/lib/defuns-flycheck.el @@ -28,5 +28,12 @@ 'flycheck-previous-error 'previous-error))) +;;;###autoload +(defun narf/flycheck-errors () + (interactive) + (when (bound-and-true-p flycheck-mode) + (flycheck-buffer) + (flycheck-list-errors))) + (provide 'defuns-flycheck) ;;; defuns-flycheck.el ends here diff --git a/core/lib/defuns-neotree.el b/core/lib/defuns-neotree.el index d520a201c..5e6afb059 100644 --- a/core/lib/defuns-neotree.el +++ b/core/lib/defuns-neotree.el @@ -16,7 +16,8 @@ ;;;###autoload (defun narf/neotree-find () (interactive) - (save-excursion (narf/neotree-open)) + (unless (neo-global--window-exists-p) + (save-excursion (narf/neotree-open))) (neotree-find)) ;;;###autoload diff --git a/core/lib/defuns-ui.el b/core/lib/defuns-ui.el index 383b7c8ac..cbd30ec0e 100644 --- a/core/lib/defuns-ui.el +++ b/core/lib/defuns-ui.el @@ -27,7 +27,7 @@ ;;;###autoload (defun narf/reset-theme () (interactive) - (narf/load-theme 'narf-dark)) + (narf/load-theme narf-theme)) ;;;###autoload (defun narf/load-theme (theme) diff --git a/core/lib/defuns-window.el b/core/lib/defuns-window.el index 6933a7b98..612a89879 100644 --- a/core/lib/defuns-window.el +++ b/core/lib/defuns-window.el @@ -50,6 +50,35 @@ evil-window-move-* (e.g. `evil-window-move-far-left')" (switch-to-buffer this-buffer)) (select-window that-window)))) +;;;###autoload +(defun narf/new-buffer () + (interactive) + (switch-to-buffer (generate-new-buffer "*new*"))) + +;;;###autoload +(defun narf/new-frame () + (interactive) + (let ((nlinum-p (and (featurep 'nlinum) + (memq 'nlinum--setup-window window-configuration-change-hook)))) + ;; Disable nlinum to fix elusive "invalid face linum" bug + (remove-hook 'window-configuration-change-hook 'nlinum--setup-window t) + (let ((frame (new-frame)) + (frame-name (format "*new-%s*" (length narf-wg-frames)))) + (with-selected-frame frame + (wg-create-workgroup frame-name t) + (add-to-list 'narf-wg-frames (cons frame frame-name)))) + (when nlinum-p + (add-hook 'window-configuration-change-hook 'nlinum--setup-window nil t)))) + +;;;###autoload +(defun narf/close-frame () + (interactive) + (let ((data (assq (selected-frame) narf-wg-frames))) + (if data + (progn (wg-delete-workgroup (wg-get-workgroup (cdr data))) + (delete-frame (car data))) + (delete-frame)))) + ;;;###autoload (defun narf/evil-window-move-left () "See `narf--evil-window-move'"