emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole faa061e 48/50: Magit Action/Assist Mouse Key


From: Stefan Monnier
Subject: [elpa] externals/hyperbole faa061e 48/50: Magit Action/Assist Mouse Key on header line toggles diff/all sections visibility
Date: Wed, 17 Mar 2021 18:44:23 -0400 (EDT)

branch: externals/hyperbole
commit faa061eddc8d5a535fc146e93125df0015d6135f
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    Magit Action/Assist Mouse Key on header line toggles diff/all sections 
visibility
---
 Changes            |   7 +++++++
 hui-mouse.el       |  49 +++++++++++++++++++++++++++++--------------------
 man/hyperbole.html |  12 +++++++-----
 man/hyperbole.info | Bin 543519 -> 543680 bytes
 man/hyperbole.pdf  | Bin 1300887 -> 1300951 bytes
 man/hyperbole.texi |  10 ++++++----
 6 files changed, 49 insertions(+), 29 deletions(-)

diff --git a/Changes b/Changes
index 18a88d6..da33caa 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,10 @@
+2021-03-14  Bob Weiner  <rsw@gnu.org>
+
+* man/hyperbole.texi (Smart Key - Magit Mode):
+  hui-mouse.el (smart-magit, smart-magit-assist): With Action/Assist Mouse
+    Key press on a read-only header line, cycle visibility of diff/all
+    sections in the buffer.
+
 2021-03-14  Mats Lidell  <matsl@gnu.org>
 
 * test/hbut-tests.el (hbut-ib-link-to-file-with-label-variants): Test
diff --git a/hui-mouse.el b/hui-mouse.el
index 8fef759..2774b64 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -1269,7 +1269,8 @@ 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)
+ (3) on an initial read-only header line, cycle visibility of diff sections;
+ (4) anywhere else, hide/show the thing at point (\"TAB\" key binding)
      unless that does nothing in the mode, then jump to the thing at
      point (\"RET\" key binding)."
   (interactive)
@@ -1292,7 +1293,8 @@ 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)."
+ (3) on an initial read-only header line, cycle visibility of all sections;
+ (4) anywhere else, jump to the thing at point (\"RET\" key binding)."
   (interactive)
   (cond ((last-line-p)
         (call-interactively (key-binding "q")))
@@ -1300,28 +1302,35 @@ If assist-key is pressed:
         (smart-scroll-down))
        (t
         (let ((magit-display-file-buffer-function #'hpath:display-buffer)
-              (current-prefix-arg))
-          (call-interactively (key-binding "\r"))))))
-
-;; Thanks to Jonas Bernoulli <tarsius>, magit author, for this code.
+              (current-prefix-arg)
+              (non-text-area-p (and (eventp action-key-depress-args)
+                                    (posn-area (event-start 
action-key-depress-args)))))
+          (cond (non-text-area-p (magit-section-cycle-global))
+                (t (call-interactively (key-binding "\r"))))))))
+
+;; Thanks to Jonas Bernoulli <tarsius>, magit author, for most of this
+;; next function.
 (defun smart-magit-tab (section)
   ;; Usage: (define-key magit-section-mode-map "TAB" 'smart-magit-tab
   "Toggle visibility of the body of the current section."
   (interactive (list (magit-current-section)))
-  (cond ((eq section magit-root-section)
-         (user-error "Cannot hide root section"))
-        ((or (oref section content)
-             (oref section washer))
-         (goto-char (oref section start))
-         (if (oref section hidden)
-             (magit-section-show section)
-           (magit-section-hide section)))
-        (t
-        (if-let ((command (key-binding (kbd "RET"))))
-             (progn (setq last-command-event ?\()
-                    (setq this-command command)
-                    (call-interactively command))
-           (user-error "Nothing to visit either")))))
+  (let* ((non-text-area-p (and (eventp action-key-depress-args)
+                              (posn-area (event-start 
action-key-depress-args)))))
+    (cond (non-text-area-p (magit-section-cycle-diffs))
+         ((eq section magit-root-section)
+          (user-error "Cannot hide root section"))
+          ((or (oref section content)
+              (oref section washer))
+          (goto-char (oref section start))
+          (if (oref section hidden)
+              (magit-section-show section)
+            (magit-section-hide section)))
+          (t
+          (if-let ((command (key-binding (kbd "RET"))))
+              (progn (setq last-command-event ?\()
+                     (setq this-command command)
+                     (call-interactively command))
+            (user-error "Nothing to visit either"))))))
 
 ;;; ************************************************************************
 ;;; smart-man functions
diff --git a/man/hyperbole.html b/man/hyperbole.html
index 715c0d9..b2a821f 100644
--- a/man/hyperbole.html
+++ b/man/hyperbole.html
@@ -363,7 +363,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P>
 
 <PRE>
 Edition 7.1.4
-Printed March 11, 2021.
+Printed March 14, 2021.
 
   Published by the Free Software Foundation, Inc.
   Author:    Bob Weiner
@@ -4156,7 +4156,7 @@ look like this:
 <a name="index-selection_002c-menu-items"></a>
 <a name="index-TAB"></a>
 <a name="index-M_002df"></a>
-<a name="index-Shift_002d"></a>
+<a name="index-Shift_002dTAB"></a>
 <a name="index-M_002db"></a>
 <p>All menu items are selected via the first character of their names (letter
 case does not matter), with presses of the Action Key or by using
@@ -11525,13 +11525,15 @@ Next: <a href="#Smart-Key-_002d-The-OO_002dBrowser" 
accesskey="n" rel="next">Sma
   ACTION KEY
      (1) on the last line, quit from the magit mode (<kbd>{q}</kbd> key 
binding);
      (2) at the end of a line, scroll up a windowful;
-     (3) anywhere else, hide/show the thing at point (<kbd>{<span 
class="key">TAB</span>}</kbd> key binding)
+     (3) on an initial read-only header line, cycle visibility of diff 
sections;
+     (4) anywhere else, hide/show the thing at point (<kbd>{<span 
class="key">TAB</span>}</kbd> key binding)
          unless that does nothing in the mode, then jump to the thing at point
          (<kbd>{<span class="key">RET</span>}</kbd> key binding).
   ASSIST KEY
      (1) on the last line, quit from the magit mode (<kbd>{q}</kbd> key 
binding);
      (2) at the end of a line, scroll down a windowful;
-     (3) anywhere else, jump to the thing at point (<kbd>{<span 
class="key">RET</span>}</kbd> key binding).&quot;
+     (3) on an initial read-only header line, cycle visibility of all sections;
+     (4) anywhere else, jump to the thing at point (<kbd>{<span 
class="key">RET</span>}</kbd> key binding).&quot;
 </pre></div>
 
 <hr>
@@ -12507,10 +12509,10 @@ Next: <a href="#Function" accesskey="n" 
rel="next">Function</a>, Previous: <a hr
 <tr><td></td><td valign="top"><a href="#index-screen_002c-_005b"><code>screen, 
[</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-screen_002c-_005d"><code>screen, 
]</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-screen_002c-_007e"><code>screen, 
~</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
-<tr><td></td><td valign="top"><a 
href="#index-Shift_002d"><code>Shift-</code></a>:</td><td>&nbsp;</td><td 
valign="top"><a href="#Menus">Menus</a></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-shift_002dleft-mouse-key"><code>shift-left mouse 
key</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#Smart-Key-Bindings">Smart Key Bindings</a></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-shift_002dmiddle-mouse-key"><code>shift-middle mouse 
key</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#Smart-Key-Bindings">Smart Key Bindings</a></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-shift_002dright-mouse-key"><code>shift-right mouse 
key</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#Smart-Key-Bindings">Smart Key Bindings</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-Shift_002dTAB"><code>Shift-<span 
class="key">TAB</span></code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#Menus">Menus</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-SPC"><code><span 
class="key">SPC</span></code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyRolo-Keys">HyRolo Keys</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th><a name="Key-Index_ky_letter-T">T</a></th><td></td><td></td></tr>
diff --git a/man/hyperbole.info b/man/hyperbole.info
index f9eaed1..8484225 100644
Binary files a/man/hyperbole.info and b/man/hyperbole.info differ
diff --git a/man/hyperbole.pdf b/man/hyperbole.pdf
index 15f3e07..efba952 100644
Binary files a/man/hyperbole.pdf and b/man/hyperbole.pdf differ
diff --git a/man/hyperbole.texi b/man/hyperbole.texi
index 2005b69..f815264 100644
--- a/man/hyperbole.texi
+++ b/man/hyperbole.texi
@@ -155,7 +155,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P>
 
 <PRE>
 Edition 7.1.4
-Printed March 11, 2021.
+Printed March 14, 2021.
 
   Published by the Free Software Foundation, Inc.
   Author:    Bob Weiner
@@ -197,7 +197,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 @example
 Edition 7.1.4
-March 11, 2021
+March 14, 2021
 
   Published by the Free Software Foundation, Inc.
   Author:    Bob Weiner
@@ -9729,13 +9729,15 @@ If pressed within a Magit buffer and not on a button:
   ACTION KEY
      (1) on the last line, quit from the magit mode (@bkbd{q} key binding);
      (2) at the end of a line, scroll up a windowful;
-     (3) anywhere else, hide/show the thing at point (@bkbd{@key{TAB}} key 
binding)
+     (3) on an initial read-only header line, cycle visibility of diff 
sections;
+     (4) anywhere else, hide/show the thing at point (@bkbd{@key{TAB}} key 
binding)
          unless that does nothing in the mode, then jump to the thing at point
          (@bkbd{@key{RET}} key binding).
   ASSIST KEY
      (1) on the last line, quit from the magit mode (@bkbd{q} key binding);
      (2) at the end of a line, scroll down a windowful;
-     (3) anywhere else, jump to the thing at point (@bkbd{@key{RET}} key 
binding)."
+     (3) on an initial read-only header line, cycle visibility of all sections;
+     (4) anywhere else, jump to the thing at point (@bkbd{@key{RET}} key 
binding)."
 @end group
 @end format
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]