Move {core,modules}/lib/*.el to {core,modules}/defuns/
This commit is contained in:
parent
976d60b5da
commit
5eb60220ee
41 changed files with 68 additions and 36 deletions
|
@ -84,6 +84,12 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
|
||||||
(--filter (string-match-p pattern (buffer-name it))
|
(--filter (string-match-p pattern (buffer-name it))
|
||||||
(or buffer-list (narf/get-buffers))))
|
(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
|
;;;###autoload
|
||||||
(defun narf/get-real-buffers (&optional buffer-list)
|
(defun narf/get-real-buffers (&optional buffer-list)
|
||||||
(-filter #'narf/real-buffer-p (or buffer-list (narf/get-buffers))))
|
(-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)
|
(evil-define-command narf:kill-all-buffers (&optional bang)
|
||||||
"Kill all project buffers. If BANG, kill *all* buffers (in workgroup)."
|
"Kill all project buffers. If BANG, kill *all* buffers (in workgroup)."
|
||||||
(interactive "<!>")
|
(interactive "<!>")
|
||||||
(narf--kill-buffers (narf/get-buffers (not bang)))
|
(narf--kill-buffers (narf/get-buffers bang))
|
||||||
(delete-other-windows))
|
(when bang
|
||||||
|
(delete-other-windows)))
|
||||||
|
|
||||||
;;;###autoload (autoload 'narf:kill-buried-buffers "defuns-buffers" nil t)
|
;;;###autoload (autoload 'narf:kill-buried-buffers "defuns-buffers" nil t)
|
||||||
(evil-define-command narf:kill-buried-buffers (&optional bang)
|
(evil-define-command narf:kill-buried-buffers (&optional bang)
|
|
@ -7,10 +7,9 @@
|
||||||
;; TODO Detect init.el and init-load-path.el
|
;; TODO Detect init.el and init-load-path.el
|
||||||
(and (f-exists? (f-expand (concat (f-base file-name) ".elc") (f-dirname file-name)))
|
(and (f-exists? (f-expand (concat (f-base file-name) ".elc") (f-dirname file-name)))
|
||||||
(--any? (f-child-of? file-name it)
|
(--any? (f-child-of? file-name it)
|
||||||
(append (list narf-core-dir narf-contrib-dir)
|
(append (list narf-core-dir narf-modules-dir
|
||||||
(list (concat narf-modules-dir "lib/")
|
narf-core-dir narf-modules-dir
|
||||||
(concat narf-core-dir "lib/"))
|
narf-private-dir))))))
|
||||||
(list narf-modules-dir narf-private-dir))))))
|
|
||||||
|
|
||||||
;;;###autoload (autoload 'narf:compile-el "defuns-compile" nil t)
|
;;;###autoload (autoload 'narf:compile-el "defuns-compile" nil t)
|
||||||
(evil-define-command narf:compile-el (&optional bang)
|
(evil-define-command narf:compile-el (&optional bang)
|
|
@ -11,11 +11,12 @@
|
||||||
(set-frame-parameter nil 'alpha 0))))
|
(set-frame-parameter nil 'alpha 0))))
|
||||||
|
|
||||||
;;;###autoload (autoload 'narf:toggle-fullscreen "defuns-ui" nil t)
|
;;;###autoload (autoload 'narf:toggle-fullscreen "defuns-ui" nil t)
|
||||||
|
(after! evil
|
||||||
(evil-define-command narf:toggle-fullscreen (&optional bang)
|
(evil-define-command narf:toggle-fullscreen (&optional bang)
|
||||||
(interactive "<!>")
|
(interactive "<!>")
|
||||||
(if bang
|
(if bang
|
||||||
(writeroom-mode (if writeroom-mode -1 1))
|
(writeroom-mode (if writeroom-mode -1 1))
|
||||||
(set-frame-parameter nil 'fullscreen (if (not (frame-parameter nil 'fullscreen)) 'fullboth))))
|
(set-frame-parameter nil 'fullscreen (if (not (frame-parameter nil 'fullscreen)) 'fullboth)))))
|
||||||
|
|
||||||
(defvar narf--big-mode nil)
|
(defvar narf--big-mode nil)
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
@ -27,16 +28,23 @@
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun narf/reset-theme ()
|
(defun narf/reset-theme ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(narf/load-theme narf-theme))
|
(narf/load-theme (or narf-current-theme narf-theme)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun narf/load-theme (theme)
|
(defun narf/load-font (font)
|
||||||
(interactive)
|
(interactive)
|
||||||
(ignore-errors
|
(set-frame-font font)
|
||||||
(mapc (lambda (th)
|
(setq narf-current-font font))
|
||||||
(when (custom-theme-enabled-p th) (disable-theme th)))
|
|
||||||
custom-enabled-themes))
|
;;;###autoload
|
||||||
(load-theme theme t))
|
(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
|
;;;###autoload
|
||||||
(defun narf/default-font ()
|
(defun narf/default-font ()
|
|
@ -102,5 +102,18 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
|
||||||
(interactive)
|
(interactive)
|
||||||
(narf--evil-window-move 'right))
|
(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)
|
(provide 'defuns-window)
|
||||||
;;; defuns-window.el ends here
|
;;; defuns-window.el ends here
|
|
@ -14,11 +14,12 @@
|
||||||
(defun narf/org-insert-item (direction)
|
(defun narf/org-insert-item (direction)
|
||||||
"Inserts a new heading or item, depending on the context."
|
"Inserts a new heading or item, depending on the context."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((context (org-element-lineage
|
(let* ((context (org-element-context)
|
||||||
(org-element-context)
|
;; (org-element-lineage
|
||||||
'(table table-row headline inlinetask
|
;; '(table table-row headline inlinetask
|
||||||
item plain-list)
|
;; item plain-list)
|
||||||
t))
|
;; t)
|
||||||
|
)
|
||||||
(type (org-element-type context)))
|
(type (org-element-type context)))
|
||||||
(cond ((eq type 'item)
|
(cond ((eq type 'item)
|
||||||
(cl-case direction
|
(cl-case direction
|
||||||
|
@ -63,13 +64,15 @@
|
||||||
(defun narf/org-dwim-at-point ()
|
(defun narf/org-dwim-at-point ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((scroll-pt (window-start))
|
(let* ((scroll-pt (window-start))
|
||||||
(context (org-element-lineage
|
(context (org-element-context)
|
||||||
(org-element-context)
|
;; (org-element-lineage
|
||||||
'(table table-row clock comment comment-block footnote-definition
|
;; (org-element-context)
|
||||||
footnote-reference headline inlinetask keyword link latex-fragment
|
;; '(table table-row clock comment comment-block footnote-definition
|
||||||
latex-environment src-block inline-src-block item plain-list
|
;; footnote-reference headline inlinetask keyword link latex-fragment
|
||||||
timestamp babel-call)
|
;; latex-environment src-block inline-src-block item plain-list
|
||||||
t))
|
;; timestamp babel-call)
|
||||||
|
;; t)
|
||||||
|
)
|
||||||
(type (org-element-type context))
|
(type (org-element-type context))
|
||||||
(value (org-element-property :value context)))
|
(value (org-element-property :value context)))
|
||||||
(cond
|
(cond
|
||||||
|
@ -88,11 +91,13 @@
|
||||||
(if (eq (org-element-property :todo-type context) 'done) 'todo 'done)))
|
(if (eq (org-element-property :todo-type context) 'done) 'todo 'done)))
|
||||||
|
|
||||||
((memq type '(headline))
|
((memq type '(headline))
|
||||||
(org-remove-latex-fragment-image-overlays
|
(org-preview-latex-fragment t)
|
||||||
(save-excursion (org-beginning-of-line) (point))
|
;; (org-remove-latex-fragment-image-overlays
|
||||||
(save-excursion (org-end-of-subtree) (point)))
|
;; (save-excursion (org-beginning-of-line) (point))
|
||||||
(org-map-entries 'org-toggle-latex-fragment t 'tree)
|
;; (save-excursion (org-end-of-subtree) (point)))
|
||||||
(narf/org-refresh-inline-images))
|
;; (org-map-entries 'org-toggle-latex-fragment t 'tree)
|
||||||
|
(narf/org-refresh-inline-images)
|
||||||
|
)
|
||||||
|
|
||||||
((memq type '(babel-call))
|
((memq type '(babel-call))
|
||||||
(org-babel-lob-execute-maybe))
|
(org-babel-lob-execute-maybe))
|
||||||
|
@ -101,7 +106,7 @@
|
||||||
(org-babel-execute-src-block))
|
(org-babel-execute-src-block))
|
||||||
|
|
||||||
((memq type '(latex-fragment latex-environment))
|
((memq type '(latex-fragment latex-environment))
|
||||||
(org-toggle-latex-fragment))
|
(org-preview-latex-fragment))
|
||||||
|
|
||||||
((memq type '(link))
|
((memq type '(link))
|
||||||
(org-open-at-point))
|
(org-open-at-point))
|
Loading…
Add table
Add a link
Reference in a new issue