From d1aa39c22b43324751f8400aa303c7d467864665 Mon Sep 17 00:00:00 2001 From: Johnson Denen Date: Sat, 15 Apr 2017 21:07:20 -0400 Subject: Provide context menu from `with-eval-after-load' block Check for `discover' with `require' Clean up README --- README.org | 42 +++++++++++++++++++++++------------------- lisp/mastodon.el | 8 ++------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/README.org b/README.org index 82e5267..8d850bb 100644 --- a/README.org +++ b/README.org @@ -16,16 +16,21 @@ Then, require it and go. (require 'mastodon) #+END_SRC -I'll make mastdon.el available on MELPA when I feel like it's reached a -stable state. +*** use-package -Mastodon mode provides a overview of it's shortcuts through [[https://github.com/mickeynp/discover.el][Discover mode]]. -To activate Discover mode locally for Mastodon mode buffers add this to your emacs configuration: #+BEGIN_SRC emacs-lisp - (add-hook 'mastodon-mode-hook 'discover-mode-turn-on) + (use-package mastodon + :load-path "/path/to/mastodon.el/lisp") #+END_SRC -The context menu is then activated by pressing '?'. +*** MELPA +I'll make mastdon.el available on MELPA when I feel like it's reached a +stable state. + +*** Discover + +=mastodon-mode= will provide a context menu for its keybindings if =discover= +is installed. It is not required. ** Usage @@ -51,19 +56,18 @@ This value can be customized too, and defaults to Opens a =*mastodon-home*= buffer in the major mode so you can see toots. Keybindings: -|-----+------------------------------------------| -| Key | Action | -|-----+------------------------------------------| -| =F= | Open federated timeline | -| =H= | Open home timeline | -| =L= | Open local timeline | -| =n= | Switch to =mastodon-toot= buffer | -| =q= | Quit mastodon buffer. Leave window open. | -| =Q= | Quit mastodon buffer and kill window. | -| =T= | Prompt for tag and open its timeline | -|-----+------------------------------------------| - - +|-----+------------------------------------------------| +| Key | Action | +|-----+------------------------------------------------| +| =?= | Open context menu (if =discover= is available) | +| =F= | Open federated timeline | +| =H= | Open home timeline | +| =L= | Open local timeline | +| =n= | Switch to =mastodon-toot= buffer | +| =q= | Quit mastodon buffer. Leave window open. | +| =Q= | Quit mastodon buffer and kill window. | +| =T= | Prompt for tag and open its timeline | +|-----+------------------------------------------------| *** Toot toot diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 8511d9e..edc1d03 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -102,10 +102,8 @@ (define-key map (kbd "Q") #'kill-buffer-and-window) (define-key map (kbd "T") #'mastodon-tl--get-tag-timeline))) -(defun provide-discover-context-menu () - "Provides a shortcut overview through Discover mode. -Press '?' to activate it." - (when (bound-and-true-p discover-mode) +(with-eval-after-load 'mastodon + (when (require 'discover nil :noerror) (discover-add-context-menu :bind "?" :mode 'mastodon-mode @@ -124,7 +122,5 @@ Press '?' to activate it." ("q" "Quit mastodon buffer. Leave window open." kill-this-buffer) ("Q" "Quit mastodon buffer and kill window." kill-buffer-and-window))))))) -(add-hook 'mastodon-mode-hook 'provide-discover-context-menu t) - (provide 'mastodon) ;;; mastodon.el ends here -- cgit v1.2.3