[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 8ef773d 18/25: Add Action/Assist key support
From: |
Stefan Monnier |
Subject: |
[elpa] externals/hyperbole 8ef773d 18/25: Add Action/Assist key support for magit modes |
Date: |
Tue, 22 Sep 2020 10:29:29 -0400 (EDT) |
branch: externals/hyperbole
commit 8ef773d9abe3d5f9db7824e7a6bf95bd10cfea9f
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>
Add Action/Assist key support for magit modes
---
Changes | 4 ++++
hui-mouse.el | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
man/hkey-help.txt | 1 +
3 files changed, 56 insertions(+), 1 deletion(-)
diff --git a/Changes b/Changes
index 41f9b71..eaa0dba 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
2020-07-29 Bob Weiner <rsw@gnu.org>
+* man/hkey-help.txt: Added magit modes.
+ hui-mouse.el (smart-magit, smart-magit-assist): Added.
+ (hkey-alist): Added support for magit modes.
+
* kotl/kotl-mode.el (kotl-mode:eolp): Added optional 'next-char-visible' arg.
(kotl-mode:action-key, kotl-mode:assist-key):
hui-mouse.el (hkey-alist): In kotl-mode, matched to eol only if following
diff --git a/hui-mouse.el b/hui-mouse.el
index a0c41d6..e0759a2 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -370,6 +370,9 @@ Its default value is #'smart-scroll-down."
((eq major-mode 'gomoku-mode) .
((gomoku-human-plays) . (gomoku-human-takes-back)))
;;
+ ((string-prefix-p "magit-" (symbol-name major-mode)) .
+ ((smart-magit) . (smart-magit-assist)))
+ ;;
;; Support the OO-Browser when available. It is a separate Emacs
;; package not included with Hyperbole. Hyperbole supplies a stub
;; `br-in-browser' test for use here.
@@ -1188,7 +1191,7 @@ buffer and has moved the cursor to the selected buffer."
;;; ************************************************************************
(defun smart-imenu-display-item-where (item-name item-pos)
- "Displays an ITEM-NAME defined at ITEM-POS within the current buffer.
+ "Display an ITEM-NAME defined at ITEM-POS within the current buffer.
Uses the imenu library and the value of `hpath:display-where' to display."
(hpath:display-buffer (current-buffer))
(funcall imenu-default-goto-function item-name item-pos))
@@ -1250,6 +1253,53 @@ NO-RECURSE-FLAG non-nil prevents infinite recursions."
;;; ************************************************************************
;;; In "hmouse-info.el".
+
+;;; ************************************************************************
+;;; smart-magit functions
+;;; ************************************************************************
+
+(defun smart-magit ()
+ "Use a key or mouse key to jump to source and to hide/show changes.
+
+Invoked via a key press when in a magit mode and not on a button.
+It assumes that its caller has already checked that the key was
+pressed in an appropriate buffer and has moved the cursor to the
+selected buffer.
+
+If key is pressed:
+ (1) on the last line, quit from the magit mode (\"q\" key binding);
+ (2) at the end of a line, scroll up a windowful;
+ (3) anywhere else, hide/show the thing at point (\"TAB\" key binding)."
+ (interactive)
+ (cond ((last-line-p)
+ (call-interactively (key-binding "q")))
+ ((eolp)
+ (smart-scroll-up))
+ (t
+ (call-interactively (key-binding "\t")))))
+
+(defun smart-magit-assist ()
+ "Use an assist key or mouse key to jump to source and to hide/show changes.
+
+Invoked via an assist key press when in a magit mode and not on a
+button. It assumes that its caller has already checked that the
+assist-key was pressed in an appropriate buffer and has moved the
+cursor to the selected buffer.
+
+If assist-key is pressed:
+ (1) on the last line, quit from the magit mode (\"q\" key binding);
+ (2) at the end of a line, scroll down a windowful;
+ (3) anywhere else, jump to the thing at point (\"RET\" key binding)."
+ (interactive)
+ (cond ((last-line-p)
+ (call-interactively (key-binding "q")))
+ ((eolp)
+ (smart-scroll-down))
+ (t
+ (setq current-prefix-arg 1)
+ (let ((magit-display-file-buffer-function #'hpath:display-buffer))
+ (call-interactively (key-binding "\r"))))))
+
;;; ************************************************************************
;;; smart-man functions
;;; ************************************************************************
diff --git a/man/hkey-help.txt b/man/hkey-help.txt
index 1d1289e..0b8645d 100644
--- a/man/hkey-help.txt
+++ b/man/hkey-help.txt
@@ -103,6 +103,7 @@ Hyperbole Key Press/Click in Special Modes
Include file Jumps to Texinfo referent Button help
code/var reference Displays doc for referent Button help
Org Mode Follows links and cycles outline views
+ Magit Modes Collapses and expands things
Outline Major/Minor Modes Collapses, expands, and moves outline entries
Man Apropos Displays man page entry <- same
Man Pages Follows cross refs, file refs and C code refs
- [elpa] externals/hyperbole f55f332 03/25: Smart Key activation of global Org links and Agenda items, (continued)
- [elpa] externals/hyperbole f55f332 03/25: Smart Key activation of global Org links and Agenda items, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole af73116 07/25: hib-kbd.el: Recognize helm-M-x or counsel-M-x bound to M-x, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 82653d5 06/25: hib-kbd.el: Recognize helm-M-x or counsel-M-x bound to M-x, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 09032d9 13/25: Disable minibuffer-completion-confirm while processing key series, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 74922d1 14/25: Merge Mats dired-sidebar support and rsw mods, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 7eae539 05/25: (hui:ibut-label-create): Skip back past opening delimiter, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 1cf5f3d 16/25: Allow Action Key to expand a tree when point is on the ellipsis, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 9e13b43 02/25: hui-select.el and hyperbole.el reformatting; no logic changes, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 42487cb 09/25: Temporarily disable helm-mode when executing a key series, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole f633365 17/25: Normalize committer email addresses, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 8ef773d 18/25: Add Action/Assist key support for magit modes,
Stefan Monnier <=
- [elpa] externals/hyperbole 520ecae 19/25: Fix improper registering of a drag outside of Emacs when none, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 008182b 22/25: Fixes, Helm and Magit Smart Key support doc in prep. for 7.1.3, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 6f36320 08/25: Merge branch 'master' of github.com:rswgnu/hyperbole, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 97a4d80 10/25: Raise org-mode ibtype priority to near top; fix markdown # link activation, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 734c6a8 11/25: Merge branch 'master' of github.com:rswgnu/hyperbole, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 335441d 15/25: Fix that Action Key did not expand collapsed Koutline trees, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 845119a 24/25: hib-social.el - Rename to hibtypes-git-use-magit-flag; make first ebut in file work without saving, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole d65920b 25/25: V7.1.3 - Improve key series, mouse handling and, Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 3c0df00 12/25: Add support for dired-sidebar (#33), Stefan Monnier, 2020/09/22
- [elpa] externals/hyperbole 21b2b1c 20/25: Use magit if available for git social button (#32), Stefan Monnier, 2020/09/22