aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnson Denen <johnson.denen@gmail.com>2017-04-15 21:07:20 -0400
committerJohnson Denen <johnson.denen@gmail.com>2017-04-15 21:15:08 -0400
commitd1aa39c22b43324751f8400aa303c7d467864665 (patch)
tree3b55278ac988d659a2c15a38bfb9604b063a5d6f
parentcb985db2f37eabd76b9c2643387b4e94009b3f88 (diff)
Provide context menu from `with-eval-after-load' block
Check for `discover' with `require' Clean up README
-rw-r--r--README.org42
-rw-r--r--lisp/mastodon.el8
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