diff --git a/TODO.org b/TODO.org index 68bf7289a..161cbbd4e 100644 --- a/TODO.org +++ b/TODO.org @@ -5,9 +5,8 @@ + [-] Work-in-progress + [X] Complete -** Unreleased [54/129] -+ [2/13] Potential plugins - + [ ] [[https://github.com/etu/webpaste.el][webpaste.el]]: sending text to bin servies (like gist, ix.io, sprunge, etc.) +** Unreleased [55/130] ++ [2/12] Potential plugins + [ ] [[https://github.com/emacs-lsp/lsp-mode][lsp-mode]]: client for MS Language Server Protocol, keep an eye on this + [ ] lang/javascript: [[https://github.com/codesuki/add-node-modules-path][add-node-modules-path]] (adds node_modules to ~exec-path~) + [ ] lang/org: [[https://github.com/Malabarba/latex-extra][orgit]] (org links to magit buffers) @@ -26,11 +25,12 @@ + [ ] app/irc + [-] app/crm + [-] app/write -+ [5/57] Add README.org's (with working babel blocks?) to modules (see [[modules/lang/go/README.org][lang/go/README.org]]) to replace bootstaps - + [0/8] :tools ++ [5/58] Add README.org's (with working babel blocks?) to modules (see [[modules/lang/go/README.org][lang/go/README.org]]) to replace bootstaps + + [0/9] :tools + [ ] dired + [ ] electric-indent + [ ] eshell + + [ ] gist + [ ] macos + [ ] rotate-text + [ ] term @@ -98,6 +98,7 @@ + [ ] Update screenshots + [ ] tools/upload: add ~+upload/open-remote-file~ command to open current file on the remote (with TRAMP) + [ ] Fix ~0/0~ displaying in modeline (caused by leftover anzu state) ++ [X] Add tools/gist (gist.el) + [X] Fix ~show-paren-mode~ overlays conflicting with org-indent (causes flickering) + [X] Fix ~M-z~, ~C-u~ and ~C-w~ in ~org-store-link~ & ~org-insert-link~ prompts Should undo, delete-line, and delete-word, respectively. Instead, they fall diff --git a/init.example.el b/init.example.el index 45637bcd1..c4d3a322c 100644 --- a/init.example.el +++ b/init.example.el @@ -56,9 +56,10 @@ hl-todo ; highlight TODO/FIXME/NOTE tags :tools + dired ; making dired pretty [functional] electric-indent ; smarter, keyword-based electric-indent eshell ; a consistent, cross-platform shell (WIP) - dired ; making dired pretty [functional] + gist ; manage & create gists macos ; macos-specific commands rotate-text ; cycle region at point between text candidates tmux ; an API for interacting with tmux diff --git a/modules/private/hlissner/+commands.el b/modules/private/hlissner/+commands.el index 7c372fa79..4ea1cdc4c 100644 --- a/modules/private/hlissner/+commands.el +++ b/modules/private/hlissner/+commands.el @@ -30,6 +30,8 @@ (ex! "x" '+doom:scratch-buffer) ;; GIT +(ex! "gist" '+gist:send) ; send current buffer/region to gist +(ex! "gistl" '+gist:list) ; list gists by user (ex! "gbrowse" '+vcs/git-browse) ; show file in github/gitlab (ex! "gissues" '+vcs/git-browse-issues) ; show github issues (ex! "git" 'magit-status) ; open magit status window diff --git a/modules/tools/gist/autoload/evil.el b/modules/tools/gist/autoload/evil.el new file mode 100644 index 000000000..8cee9a681 --- /dev/null +++ b/modules/tools/gist/autoload/evil.el @@ -0,0 +1,16 @@ +;;; tools/gist/autoload/evil.el + +;;;###autoload (autoload '+gist:send "tools/gist/autoload/evil" nil t) +(evil-define-operator +gist:send (beg end search bang) + :type inclusive :repeat nil + (interactive "") + (if bang + (gist-region-or-buffer-private) + (gist-region-or-buffer))) + +;;;###autoload (autoload '+gist:list "tools/gist/autoload/evil" nil t) +(evil-define-command +gist:list (&optional username) + (interactive "") + (if username + (gist-list-user username) + (gist-list))) diff --git a/modules/tools/gist/autoload/gist.el b/modules/tools/gist/autoload/gist.el new file mode 100644 index 000000000..a72cf6e3e --- /dev/null +++ b/modules/tools/gist/autoload/gist.el @@ -0,0 +1,13 @@ +;;; tools/gist/autoload/gist.el + +;;;###autoload +(defun +gist/open-current () + (interactive) + (gist-fetch-current) + (doom/popup-close-all)) + +;;;###autoload +(defun +gist/kill-cache () + (interactive) + (delete-directory (expand-file-name "gh" pcache-directory) t) + (message "gist.el cache cleared")) diff --git a/modules/tools/gist/config.el b/modules/tools/gist/config.el new file mode 100644 index 000000000..75b2328a8 --- /dev/null +++ b/modules/tools/gist/config.el @@ -0,0 +1,33 @@ +;;; tools/gist/config.el + +;; NOTE On occasion, the cache gets corrupted, causing wrong-type-argument +;; errors. If that happens, try `+gist/kill-cache'. You may have to restart +;; Emacs. + +(def-package! gist + :commands (gist-list gist-region-or-buffer-private gist-region-or-buffer) + :init + (add-hook 'gist-mode-hook #'doom-buffer-mode) + :config + (set! :popup "*github:gists*" :size 15 :select t :autokill t) + + ;; evil-ify gist listing + (set! :evil-state 'gist-list-mode 'normal) + (map! :map gist-list-menu-mode-map + :n "RET" '+gist/open-current + :n "d" 'gist-kill-current + :n "r" 'gist-list-reload + :n "c" 'gist-add-buffer + :n "y" 'gist-print-current-url + :n "b" 'gist-browse-current-url + :n "s" 'gist-star + :n "S" 'gist-unstar + :n "f" 'gist-fork + :n "q" 'quit-window) + + (when (bound-and-true-p shackle-mode) + (defun +gist*list-render (orig-fn &rest args) + (funcall orig-fn (car args) t) + (unless (cadr args) + (doom-popup-buffer (current-buffer)))) + (advice-add #'gist-list-render :around #'+gist*list-render))) diff --git a/modules/tools/gist/packages.el b/modules/tools/gist/packages.el new file mode 100644 index 000000000..de58b4035 --- /dev/null +++ b/modules/tools/gist/packages.el @@ -0,0 +1,4 @@ +;; -*- no-byte-compile: t; -*- +;;; tools/gist/packages.el + +(package! gist)