Add private/default

This will replace private/hlissner.

Addresses #301
This commit is contained in:
Henrik Lissner 2017-12-23 02:27:42 -05:00
parent 88a3732ae7
commit 79fbaf3d98
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
6 changed files with 1087 additions and 2 deletions

View file

@ -0,0 +1,45 @@
;; private/default/autoload/default.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +default/yank-buffer-filename ()
"Copy the current buffer's path to the kill ring."
(interactive)
(if-let* ((filename (or buffer-file-name (bound-and-true-p list-buffers-directory))))
(message (kill-new (abbreviate-file-name filename)))
(error "Couldn't find filename in current buffer")))
(defmacro +default--def-browse-in! (name dir &optional prefix)
(let ((prefix (cdr (doom-module-from-path load-file-name))))
`(defun ,(intern (format "%s/browse-%s" (or prefix '+default) name)) ()
(interactive)
(doom-project-browse ,dir))))
(defmacro +default--def-find-in! (name dir)
(let ((prefix (cdr (doom-module-from-path load-file-name))))
`(defun ,(intern (format "+%s/find-in-%s" prefix name)) ()
(interactive)
(doom-project-find-file ,dir))))
;;;###autoload (autoload '+default/browse-project "private/default/autoload" nil t)
(+default--def-browse-in project (doom-project-root))
;;;###autoload (autoload '+default/find-in-templates "private/default/autoload" nil t)
(+default--def-find-in! templates +file-templates-dir)
;;;###autoload (autoload '+default/browse-templates "private/default/autoload" nil t)
(+default--def-browse-in! templates +file-templates-dir)
;;;###autoload (autoload '+default/find-in-emacsd "private/default/autoload" nil t)
(+default--def-find-in! emacsd doom-emacs-dir)
;;;###autoload (autoload '+default/browse-emacsd "private/default/autoload" nil t)
(+default--def-browse-in! emacsd doom-emacs-dir)
;;;###autoload (autoload '+default/find-in-notes "private/default/autoload" nil t)
(+default--def-find-in! notes +org-dir)
;;;###autoload (autoload '+default/browse-notes "private/default/autoload" nil t)
(+default--def-browse-in! notes +org-dir)
;;;###autoload (autoload '+default/find-in-snippets "private/default/autoload" nil t)
(+default--def-find-in! snippets +default-snippets-dir)
;; NOTE No need for a browse-snippets variant, use `yas-visit-snippet-file'

View file

@ -0,0 +1,38 @@
;; private/default/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :feature evil)
;;;###autoload (autoload '+default:multi-next-line "private/default/autoload/evil" nil t)
(evil-define-motion +default:multi-next-line (count)
"Move down 6 lines."
:type line
(let ((line-move-visual (or visual-line-mode (derived-mode-p 'text-mode))))
(evil-line-move (* 6 (or count 1)))))
;;;###autoload (autoload '+default:multi-previous-line "private/default/autoload/evil" nil t)
(evil-define-motion +default:multi-previous-line (count)
"Move up 6 lines."
:type line
(let ((line-move-visual (or visual-line-mode (derived-mode-p 'text-mode))))
(evil-line-move (- (* 6 (or count 1))))))
;;;###autoload (autoload '+default:cd "private/default/autoload/evil" nil t)
(evil-define-command +default:cd ()
"Change `default-directory' with `cd'."
(interactive "<f>")
(cd input))
;;;###autoload (autoload '+default:kill-all-buffers "private/default/autoload/evil" nil t)
(evil-define-command +default:kill-all-buffers (&optional bang)
"Kill all buffers. If BANG, kill current session too."
(interactive "<!>")
(if bang
(+workspace/kill-session)
(doom/kill-all-buffers)))
;;;###autoload (autoload '+default:kill-matching-buffers "private/default/autoload/evil" nil t)
(evil-define-command +default:kill-matching-buffers (&optional bang pattern)
"Kill all buffers matching PATTERN regexp. If BANG, only match project
buffers."
(interactive "<a>")
(doom/kill-matching-buffers pattern bang))