Move {core,modules}/lib/*.el to {core,modules}/defuns/

This commit is contained in:
Henrik Lissner
2016-01-29 02:05:16 -05:00
parent 976d60b5da
commit 5eb60220ee
41 changed files with 68 additions and 36 deletions

View File

@@ -84,6 +84,12 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
(--filter (string-match-p pattern (buffer-name it))
(or buffer-list (narf/get-buffers))))
;;;###autoload
(defun narf/get-buffers-in-modes (modes &optional buffer-list)
"Get a list of buffers whose major-mode is one of MODES"
(--filter (with-current-buffer it (memq major-mode modes))
(or buffer-list (narf/get-buffers))))
;;;###autoload
(defun narf/get-real-buffers (&optional buffer-list)
(-filter #'narf/real-buffer-p (or buffer-list (narf/get-buffers))))
@@ -215,8 +221,9 @@ left, create a scratch buffer."
(evil-define-command narf:kill-all-buffers (&optional bang)
"Kill all project buffers. If BANG, kill *all* buffers (in workgroup)."
(interactive "<!>")
(narf--kill-buffers (narf/get-buffers (not bang)))
(delete-other-windows))
(narf--kill-buffers (narf/get-buffers bang))
(when bang
(delete-other-windows)))
;;;###autoload (autoload 'narf:kill-buried-buffers "defuns-buffers" nil t)
(evil-define-command narf:kill-buried-buffers (&optional bang)

View File

@@ -7,10 +7,9 @@
;; TODO Detect init.el and init-load-path.el
(and (f-exists? (f-expand (concat (f-base file-name) ".elc") (f-dirname file-name)))
(--any? (f-child-of? file-name it)
(append (list narf-core-dir narf-contrib-dir)
(list (concat narf-modules-dir "lib/")
(concat narf-core-dir "lib/"))
(list narf-modules-dir narf-private-dir))))))
(append (list narf-core-dir narf-modules-dir
narf-core-dir narf-modules-dir
narf-private-dir))))))
;;;###autoload (autoload 'narf:compile-el "defuns-compile" nil t)
(evil-define-command narf:compile-el (&optional bang)

View File

@@ -11,11 +11,12 @@
(set-frame-parameter nil 'alpha 0))))
;;;###autoload (autoload 'narf:toggle-fullscreen "defuns-ui" nil t)
(evil-define-command narf:toggle-fullscreen (&optional bang)
(interactive "<!>")
(if bang
(writeroom-mode (if writeroom-mode -1 1))
(set-frame-parameter nil 'fullscreen (if (not (frame-parameter nil 'fullscreen)) 'fullboth))))
(after! evil
(evil-define-command narf:toggle-fullscreen (&optional bang)
(interactive "<!>")
(if bang
(writeroom-mode (if writeroom-mode -1 1))
(set-frame-parameter nil 'fullscreen (if (not (frame-parameter nil 'fullscreen)) 'fullboth)))))
(defvar narf--big-mode nil)
;;;###autoload
@@ -27,16 +28,23 @@
;;;###autoload
(defun narf/reset-theme ()
(interactive)
(narf/load-theme narf-theme))
(narf/load-theme (or narf-current-theme narf-theme)))
;;;###autoload
(defun narf/load-theme (theme)
(defun narf/load-font (font)
(interactive)
(ignore-errors
(mapc (lambda (th)
(when (custom-theme-enabled-p th) (disable-theme th)))
custom-enabled-themes))
(load-theme theme t))
(set-frame-font font)
(setq narf-current-font font))
;;;###autoload
(defun narf/load-theme (theme &optional suppress-font)
(interactive)
(when narf-current-theme
(disable-theme narf-current-theme))
(load-theme theme t)
(unless suppress-font
(narf/load-font narf-current-font))
(setq narf-current-theme theme))
;;;###autoload
(defun narf/default-font ()

View File

@@ -102,5 +102,18 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
(interactive)
(narf--evil-window-move 'right))
;;;###autoload
(defun narf/window-reorient ()
"Reorient all windows that are scrolled to the right."
(interactive)
(let ((i 0))
(mapc (lambda (w)
(with-selected-window w
(when (> (window-hscroll) 0)
(cl-incf i)
(evil-beginning-of-line))))
(narf/get-visible-windows))
(message "Reoriented %s windows" i)))
(provide 'defuns-window)
;;; defuns-window.el ends here