Add tools/gist

This commit is contained in:
Henrik Lissner 2017-05-07 15:10:46 +02:00
parent eb8759041f
commit e12ee964ca
7 changed files with 76 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 "<r><!>")
(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 "<a>")
(if username
(gist-list-user username)
(gist-list)))

View File

@ -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"))

View File

@ -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)))

View File

@ -0,0 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; tools/gist/packages.el
(package! gist)