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

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

[elpa] externals/hyperbole 06d6cf1 16/53: V6.0.2a; Action Key drag from


From: Robert Weiner
Subject: [elpa] externals/hyperbole 06d6cf1 16/53: V6.0.2a; Action Key drag from buffer, file and helm buffer item menus to another window to display.
Date: Wed, 15 Nov 2017 22:47:00 -0500 (EST)

branch: externals/hyperbole
commit 06d6cf1692caf1d658acd824e44b2d848d71b250
Author: Bob Weiner <address@hidden>
Commit: Bob Weiner <address@hidden>

    V6.0.2a; Action Key drag from buffer, file and helm buffer item menus to 
another window to display.
    
    * hmouse-drv.el (action-key-depress): Added action-key-depress-hook.
                    (assist-key-depress): Added assist-key-depress-hook.
                (action-mouse-key):   Added action-key-release-hook.
                (assist-mouse-key):   Added assist-key-release-hook.
                    (action-key): Added action-key-depress/release-hook.
                (assist-key): Added assist-key-depress/release-hook.
      hui-window.el (action-key-depress-hook): Set to select helm items
        prior to a drag outside the helm buffer window.
    
    * hui-mouse.el (smart-helm-line-has-action): Fixed to use position of
        Action Key depress; this properly selects the item chosen, even when
        a cross-window drag is used; this allows helm buffer and file items to
        be used in Hyperbole drag actions.
    
    * hib-social.el (github-reference): Added support for
        gh#orgs/<org-name>/people query to list users in an org.
    
    * hmouse-drv.el (hmouse-depress-inactive-minibuffer-p): Improved doc and
        changed param name to `event'.
                    (action-key-depress-window, assist-key-depress-window):
        Improved doc.
    
    * hui-window.el (smart-coords-in-window-p, smart-window-of-coords,
                     hmouse-inactive-minibuffer-p):
      hmouse-drv.el (hmouse-depress-inactive-minibuffer-p):
      hargs.el (hargs:select-event-window): Updated to handle multiple frames 
and minibuffers.
    
    * hui-window.el (hmouse-alist): Extended hmouse-drag-between-windows to
        allow dragging items from a buffer menu or file menu buffer to a 
destination
        window for display.  Helm buffer items are supported as well.
                    (hmouse-item-to-window, hmouse-drag-buffer-to-window): 
Added.
      hui-mouse.el (smart-helm-to-minibuffer): Added to encapsulate when to
        return to minibuffer, and called.
    
    * hversion.el (hyperb:version): Start adding a letter at the end of the 
version number for
        significant pre-releases published to git, so we know which version is 
in use.
---
 Changes       | 42 +++++++++++++++++++++++++++++
 hargs.el      | 13 +++++----
 hib-social.el |  8 +++++-
 hmouse-drv.el | 38 +++++++++++++++++---------
 hui-mouse.el  | 29 +++++++++++---------
 hui-window.el | 85 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
 hversion.el   |  2 +-
 7 files changed, 167 insertions(+), 50 deletions(-)

diff --git a/Changes b/Changes
index 71b62aa..4a91ca2 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,45 @@
+2017-09-26  Bob Weiner  <address@hidden>
+
+* hmouse-drv.el (action-key-depress): Added action-key-depress-hook.
+                (assist-key-depress): Added assist-key-depress-hook.
+               (action-mouse-key):   Added action-key-release-hook.
+               (assist-mouse-key):   Added assist-key-release-hook.
+                (action-key): Added action-key-depress/release-hook.
+               (assist-key): Added assist-key-depress/release-hook.
+  hui-window.el (action-key-depress-hook): Set to select helm items
+    prior to a drag outside the helm buffer window.
+
+* hui-mouse.el (smart-helm-line-has-action): Fixed to use position of
+    Action Key depress; this properly selects the item chosen, even when
+    a cross-window drag is used; this allows helm buffer and file items to
+    be used in Hyperbole drag actions.
+
+* hib-social.el (github-reference): Added support for
+    gh#orgs/<org-name>/people query to list users in an org.
+
+* hmouse-drv.el (hmouse-depress-inactive-minibuffer-p): Improved doc and
+    changed param name to `event'.
+                (action-key-depress-window, assist-key-depress-window):
+    Improved doc.
+
+* hui-window.el (smart-coords-in-window-p, smart-window-of-coords,
+                 hmouse-inactive-minibuffer-p): 
+  hmouse-drv.el (hmouse-depress-inactive-minibuffer-p): 
+  hargs.el (hargs:select-event-window): Updated to handle multiple frames and 
minibuffers.
+
+
+* hui-window.el (hmouse-alist): Extended hmouse-drag-between-windows to
+    allow dragging items from a buffer menu or file menu buffer to a 
destination
+    window for display.  Helm buffer items are supported as well.
+                (hmouse-item-to-window, hmouse-drag-buffer-to-window): Added.
+  hui-mouse.el (smart-helm-to-minibuffer): Added to encapsulate when to
+    return to minibuffer, and called.
+
+* hversion.el (hyperb:version): Start adding a letter at the end of the 
version number for
+    significant pre-releases published to git, so we know which version is in 
use.
+
+----
+
 2017-09-25  Bob Weiner  <address@hidden>
 
 * hui-mini.el (hui:menu-item): Improved so that if menu item has no help 
string but its action is a
diff --git a/hargs.el b/hargs.el
index a291078..3d0881c 100644
--- a/hargs.el
+++ b/hargs.el
@@ -198,13 +198,12 @@ Optional DEFAULT-PROMPT is used to describe default 
value."
   (if (featurep 'xemacs)
       (if current-mouse-event
          (select-window
-          (or (event-window current-mouse-event)
-              (selected-window))))
-    (let* ((event last-command-event)
-          (window (posn-window (event-start event))))
-      (if (and (eq window (minibuffer-window))
-              (not (minibuffer-window-active-p
-                    (minibuffer-window))))
+          (or (event-window current-mouse-event) (selected-window))))
+    (let ((window (posn-window (event-start last-command-event))))
+      (if (framep window)
+         (setq window (frame-selected-window window)))
+      (if (and (window-minibuffer-p window)
+              (not (minibuffer-window-active-p window)))
          (error "Attempt to select inactive minibuffer window")
        (select-window (or window (selected-window)))))))
 
diff --git a/hib-social.el b/hib-social.el
index fa9f4e4..4318c16 100644
--- a/hib-social.el
+++ b/hib-social.el
@@ -80,6 +80,8 @@
 ;;     gh#rswgnu/helm/global_mouse               Display user project's branch
 ;;     gh#rswgnu/hyperbole/55a1f0                Display user project's commit 
diff
 ;;
+;;     gh#orgs/github/people                     List the org, github's staff
+;;
 ;;     (setq hibtypes-github-default-user "rswgnu")
 ;;     github#/hyperbole                         Display default user's project
 ;;
@@ -306,7 +308,11 @@ PROJECT value is provided, it defaults to the value of
        (unless (stringp user) (setq user hibtypes-github-default-user))
        (unless (stringp project) (setq project 
hibtypes-github-default-project))
        (when reference
-         (cond ((member reference '("branches" "commits" "issues" "pulls" 
"tags"))
+         (cond ((equal user "orgs")
+                ;; A specific organization reference
+                (setq ref-type reference
+                      reference ""))
+               ((member reference '("branches" "commits" "issues" "pulls" 
"tags"))
                 ;; All branches, commits, open issues, pull requests or commit 
tags reference
                 (setq ref-type reference
                       reference ""))
diff --git a/hmouse-drv.el b/hmouse-drv.el
index 8df194d..53f4a1d 100644
--- a/hmouse-drv.el
+++ b/hmouse-drv.el
@@ -41,9 +41,11 @@
   "List of mouse event args from most recent release of the Assist Key.")
 
 (defvar action-key-depress-window nil
-  "The last window in which the Action Key was depressed or nil.")
+  "The last window in which the Action Key was depressed or nil.
+This is set to nil when the depress is on an inactive minibuffer.")
 (defvar assist-key-depress-window nil
-  "The last window in which the Assist Key was depressed or nil.")
+  "The last window in which the Assist Key was depressed or nil.
+This is set to nil when the depress is on an inactive minibuffer.")
 (defvar action-key-release-window nil
   "The last window in which the Action Key was released or nil.")
 (defvar assist-key-release-window nil
@@ -114,7 +116,8 @@ This permits the Smart Keys to behave as paste keys.")
                                      (selected-window))
        action-key-release-args nil
        action-key-release-window nil
-       action-key-release-prev-point nil))
+       action-key-release-prev-point nil)
+  (run-hooks 'action-key-depress-hook))
 
 (defun assist-key-depress (&rest args)
   (interactive)
@@ -129,7 +132,8 @@ This permits the Smart Keys to behave as paste keys.")
                                      (selected-window))
        assist-key-release-args nil
        assist-key-release-window nil
-       assist-key-release-prev-point nil))
+       assist-key-release-prev-point nil)
+  (run-hooks 'assist-key-depress-hook))
 
 (defun action-key-depress-emacs (event)
   (interactive "e")
@@ -167,7 +171,9 @@ Any ARGS will be passed to `hmouse-function'."
              (assist-key-depressed-flag
                (hmouse-function nil nil args))
              ((hkey-mouse-help nil args))
-             (t (hmouse-function #'action-key-internal nil args)))
+             (t
+              (run-hooks 'action-key-release-hook)
+              (hmouse-function #'action-key-internal nil args)))
        ;; Need to clear these variables so that mouse pasting does
        ;; not occur repeatedly from a single region selection.
        (setq hkey-region nil
@@ -188,7 +194,9 @@ Any ARGS will be passed to `hmouse-function'."
              (action-key-depressed-flag
                (hmouse-function nil t args))
              ((hkey-mouse-help t args))
-             (t (hmouse-function #'assist-key-internal t args)))
+             (t
+              (run-hooks 'assist-key-release-hook)
+              (hmouse-function #'assist-key-internal t args)))
        ;; Need to clear this variable so that mouse pasting does
        ;; not occur repeatedly from a single region selection.
        (setq hkey-region nil
@@ -210,7 +218,8 @@ a valid function."
        action-key-release-args nil
        action-key-release-window nil
        action-key-release-prev-point nil)
-  (action-key-internal))
+  (prog1 (action-key-internal)
+    (run-hooks 'action-key-depress-hook 'action-key-release-hook)))
 
 (defun action-key-internal ()
   (setq action-key-depressed-flag nil)
@@ -237,7 +246,8 @@ bound to a valid function."
        assist-key-release-args nil
        assist-key-release-window nil
        assist-key-release-prev-point nil)
-  (assist-key-internal))
+  (prog1 (assist-key-internal)
+    (run-hooks 'assist-key-depress-hook 'assist-key-release-hook)))
 
 (defun assist-key-internal ()
   (setq assist-key-depressed-flag nil)
@@ -524,11 +534,13 @@ With optional ARG, override them iff ARG is positive."
     (setq hkey-debug t)
     (message "Smart Key debugging is on; press a Smart Key to see its 
context.")))
 
-(defun hmouse-depress-inactive-minibuffer-p (args)
-  "Return the minibuffer window if the last Smart Mouse Key depress was in it 
and it was inactive, else nil."
-  (if (= (minibuffer-depth) 0)
-      (if (eq (minibuffer-window) (posn-window (event-start args)))
-         (minibuffer-window))))
+(defun hmouse-depress-inactive-minibuffer-p (event)
+  "Return the minibuffer window if the last Smart Mouse Key depress EVENT was 
in it and it was inactive, else nil."
+  (let ((window (posn-window (event-start event))))
+    (if (framep window) (setq window (frame-selected-window window)))
+    (and (window-minibuffer-p window)
+        (not (minibuffer-window-active-p window))
+        window)))
 
 (defun hmouse-key-release-args-emacs (event)
   (if (integerp event)
diff --git a/hui-mouse.el b/hui-mouse.el
index 06676fc..4f20ced 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -779,24 +779,27 @@ If assist-key is pressed within:
 ;;; ************************************************************************
 
 (defun smart-helm-at-header ()
-  "Return t iff Action Mouse Key depress was on the first fixed header line or 
a helm section header of the current buffer."
+  "Returns t iff Action Key depress was on the first fixed header line or a 
helm section header of the current buffer."
   (or (helm-pos-header-line-p)
       (and (eventp action-key-depress-args)
           (eq (posn-area (event-start action-key-depress-args))
               'header-line))))
 
 (defun smart-helm-line-has-action ()
-  "Marks and returns the actions for the helm selection item at point, or nil 
if line lacks any action.
+  "Marks and returns the actions for the helm selection item at the point of 
Action Key depress, or nil if line lacks any action.
 Assumes Hyperbole has already checked that helm is active."
   (let ((helm-buffer (if (equal helm-action-buffer (buffer-name)) helm-buffer 
(buffer-name))))
     (save-excursion
       (with-helm-buffer
-       (if hkey-debug (setq cursor-type t)) ; For testing where mouse presses 
set point.
+       (setq cursor-type hkey-debug) ; For testing where mouse presses set 
point.
+       (and (eventp action-key-depress-args)
+            (goto-char (posn-point (event-start action-key-depress-args))))
        (when (not (or (eobp)
                       (smart-helm-at-header)
                       (helm-pos-candidate-separator-p)))
-         (helm-mark-current-line)
-         (helm-get-current-action))))))
+         (let ((helm-selection-point (point)))
+           (helm-mark-current-line)
+           (helm-get-current-action)))))))
 
 (defun smart-helm-alive-p ()
   ;; Handles case where helm-action-buffer is visible but helm-buffer
@@ -816,7 +819,7 @@ Assumes Hyperbole has already checked that helm is active."
     (sit-for 0.2)))
 
 (defun smart-helm-at (depress-event)
-  "Return non-nil iff Smart Mouse DEPRESS-EVENT was on a helm section header, 
candidate separator or at eob or eol.
+  "Returns non-nil iff Smart Mouse DEPRESS-EVENT was on a helm section header, 
candidate separator or at eob or eol.
 If non-nil, returns a property list of the form: (section-header <bool> 
separator <bool> eob <bool> or eol <bool>).
 If a section-header or separator, selects the first following candidate line.
 Assumes Hyperbole has already checked that helm is active."
@@ -843,6 +846,11 @@ Assumes Hyperbole has already checked that helm is active."
                  (goto-char opoint)
                  nil))))))
 
+(defun smart-helm-to-minibuffer ()
+  "Selects minibuffer window when it is active."
+  (if (> (minibuffer-depth) 0)
+      (select-window (minibuffer-window))))
+
 (defun smart-helm()
   "Executes helm actions based on Action Key click locations:
   At the end of the buffer, quits from helm and exits the minibuffer.
@@ -865,10 +873,8 @@ Assumes Hyperbole has already checked that helm is active."
     ;; Handle end-of-line clicks.
     (if (and eol (not eob) (not non-text-area-p))
        (progn (with-helm-buffer (funcall action-key-eol-function))
-              (if (> (minibuffer-depth) 0)
-                  (select-window (minibuffer-window))))
-      (if (> (minibuffer-depth) 0)
-         (select-window (minibuffer-window)))
+              (smart-helm-to-minibuffer))
+      (smart-helm-to-minibuffer)
       (when (and (smart-helm-alive-p) (not separator))
        (let* ((key (kbd (cond
                          ;; Exit
@@ -942,8 +948,7 @@ Assumes Hyperbole has already checked that helm is active."
             (if hkey-debug
                 (message "(HyDebug): In smart-helm-assist, key to execute is: 
{%s}; binding is: %s"
                          (if key (key-description key) "Help" (if key binding 
"None"))))))
-      (if (> (minibuffer-depth) 0)
-         (select-window (minibuffer-window))))
+      (smart-helm-to-minibuffer))
     (if key (call-interactively (key-binding (kbd key))))))
 
 ;;; ************************************************************************
diff --git a/hui-window.el b/hui-window.el
index 1af9188..bd607ee 100644
--- a/hui-window.el
+++ b/hui-window.el
@@ -89,6 +89,13 @@ of screen control commands."
 (defvar hmouse-y-diagonal-sensitivity 3
   "*Number of lines mouse must move vertically between depress/release to 
register a diagonal drag.")
 
+;; Ensure any helm item at Action Mouse Key depress point is selected
+;; before a drag that ends in another window.
+(add-hook 'action-key-depress-hook
+         (lambda () (if (eq major-mode 'helm-major-mode)
+                        ;; Select any line with an action.
+                        (smart-helm-line-has-action))))
+
 ;;;
 ;;; Add window handling to hmouse-alist dispatch table.
 ;;;
@@ -113,7 +120,7 @@ of screen control commands."
                ((hmouse-drag-between-windows) .
                 ;; Note that `hui:link-directly' uses any active
                 ;; region as the label of the button to create.
-                ((hui:link-directly) . (hmouse-swap-buffers 'assist)))
+                ((or (hmouse-drag-item-to-window) (hui:link-directly)) . 
(hmouse-swap-buffers 'assist)))
                ((hmouse-drag-region-active) .
                 ((hmouse-drag-not-allowed) . (hmouse-drag-not-allowed)))
                ((setq hkey-value (and (not (hmouse-drag-between-windows))
@@ -123,7 +130,7 @@ of screen control commands."
                 ((hmouse-vertical-action-drag) . 
(hmouse-vertical-assist-drag)))
                ((setq hkey-value (hmouse-drag-diagonally)) .
                 ((hywconfig-ring-save) . (hywconfig-yank-pop
-                                        (prefix-numeric-value 
current-prefix-arg))))
+                                          (prefix-numeric-value 
current-prefix-arg))))
                ;;
                ;; Now since this is not a drag and if there was an active
                ;; region prior to when the Action or Assist Key was
@@ -307,10 +314,17 @@ If free variable `assist-flag' is non-nil, uses Assist 
Key."
       (and assist-key-depress-window assist-key-release-window
           (not (eq assist-key-depress-window
                    assist-key-release-window)))
-    (and (not (smart-helm-alive-p)) ;; Ignore Action Key drag if helm is 
active.
-        action-key-depress-window action-key-release-window
+    (and action-key-depress-window action-key-release-window
         (not (eq action-key-depress-window action-key-release-window)))))
 
+(defun hmouse-drag-item-to-window ()
+  "Depress on a buffer name in Buffer-menu or ibuffer mode and release in 
another window in which to display the buffer.
+Return t unless source is not a buffer menu mode, then nil."
+  (let ((mode (cdr (assq 'major-mode (buffer-local-variables (window-buffer 
action-key-depress-window))))))
+    (when (memq mode '(Buffer-menu-mode ibuffer-mode helm-major-mode))
+      (hmouse-item-to-window)
+      t)))
+
 (defun hmouse-drag-diagonally ()
   "Returns non-nil iff last Action Key use was a diagonal drag within a single 
window.
 If free variable `assist-flag' is non-nil, uses Assist Key.
@@ -465,7 +479,9 @@ Beeps and prints message if the window cannot be split 
further."
   "Tests if COORDS are in WINDOW.  Returns WINDOW if they are, nil otherwise."
   (cond ((null coords) nil)
        ((and hyperb:emacs-p (eventp coords))
-        (eq (posn-window (event-start coords)) window))
+        (let ((w-or-f (posn-window (event-start coords))))
+          (if (framep w-or-f) (setq w-or-f (frame-selected-window w-or-f)))
+          (eq w-or-f window)))
        ((if (featurep 'xemacs)
             (if (eventp coords)
                 (eq (event-window coords) window)
@@ -498,7 +514,9 @@ Ignores minibuffer window."
   (cond ((markerp coords)
         (get-buffer-window (marker-buffer coords)))
        ((and hyperb:emacs-p (eventp coords))
-        (posn-window (event-start coords)))
+        (let ((w-or-f (posn-window (event-start coords))))
+          (if (framep w-or-f) (setq w-or-f (frame-selected-window w-or-f)))
+          w-or-f))
        ((if (featurep 'xemacs)
             (if (eventp coords)
                 (event-window coords)
@@ -553,8 +571,10 @@ Ignores minibuffer window."
 
 (defun hmouse-inactive-minibuffer-p ()
   "Return t if the last command event was a mouse press or release within an 
inactive minibuffer, else nil."
-  (if (= (minibuffer-depth) 0)
-      (eq (minibuffer-window) (posn-window (event-start last-command-event)))))
+  (let ((window (posn-window (event-start last-command-event))))
+    (if (framep window) (setq window (frame-selected-window window)))
+    (and (window-minibuffer-p window)
+        (not (minibuffer-window-active-p window)))))
 
 (defun hmouse-insert-region ()
   "Save a mark, then insert at point the text from `hkey-region' and indent 
it."
@@ -569,6 +589,35 @@ Ignores minibuffer window."
   ;; (if (fboundp 'fill-region-and-align) (fill-region-and-align (mark) 
(point)))
   )
 
+(defun hmouse-item-to-window ()
+  "Displays buffer or file menu item at Action Key depress in window of Action 
Key release."
+  (let* ((w1 action-key-depress-window)
+        (w2 action-key-release-window)
+        (buf-name)
+        (w1-ref (when (and w1 w2)
+                  (unwind-protect
+                      (progn (select-window w1)
+                             (cond ((eq major-mode 'Buffer-menu-mode)
+                                    (Buffer-menu-buffer t))
+                                   ((eq major-mode 'ibuffer-mode)
+                                    (ibuffer-current-buffer t))
+                                   ((eq major-mode 'helm-major-mode)
+                                    ;; Returns item string
+                                    (helm-get-selection (current-buffer)))
+                                   (t nil)))
+                    (select-window w2)))))
+    (unwind-protect
+       (cond ((not w1-ref)
+              (error "(hmouse-item-to-window): Last depress was not within a 
window."))
+             ((buffer-live-p w1-ref)
+              (set-window-buffer w2 w1-ref))
+             ((and (stringp w1-ref) (file-readable-p w1-ref))
+              (set-window-buffer w2 (find-file-noselect w1-ref)))
+             (t (error "(hmouse-item-to-window): Cannot find or read `%s'." 
w1-ref)))
+      ;; If helm is active, end in the minibuffer window.
+      (if (smart-helm-alive-p)
+         (smart-helm-to-minibuffer)))))
+
 (defun action-key-modeline ()
   "Handles Action Key depresses on a window mode line.
 If the Action Key is:
@@ -841,10 +890,12 @@ If optional arg ASSIST-FLAG is non-nil, uses Assist Key."
                 (current-column))
             (eval (cdr (assoc (hyperb:window-system)
                               '(("emacs" . (if (eventp args)
-                                               (+ (car (posn-col-row
-                                                        (event-start args)))
-                                                  (nth 0 (window-edges
-                                                          (car (cadr args)))))
+                                               (let ((w-or-f (posn-window 
(event-start args))))
+                                                 (if (framep w-or-f)
+                                                     (setq w-or-f 
(frame-selected-window w-or-f)))
+                                                 (+ (car (posn-col-row
+                                                          (event-start args)))
+                                                    (nth 0 (window-edges 
w-or-f))))
                                              (car args)))
                                 ("xemacs" .  (if (eventp args)
                                                  (event-x args)
@@ -858,10 +909,12 @@ If optional arg ASSIST-FLAG is non-nil, uses Assist Key."
   "Returns y coordinate in frame lines from window system dependent ARGS."
   (let ((y (eval (cdr (assoc (hyperb:window-system)
                             '(("emacs" . (if (eventp args)
-                                             (+ (cdr (posn-col-row
-                                                      (event-start args)))
-                                                (nth 1 (window-edges
-                                                        (car (cadr args)))))
+                                             (let ((w-or-f (posn-window 
(event-start args))))
+                                               (if (framep w-or-f)
+                                                   (setq w-or-f 
(frame-selected-window w-or-f)))
+                                               (+ (cdr (posn-col-row
+                                                        (event-start args)))
+                                                  (nth 1 (window-edges 
w-or-f))))
                                            (cdr args)))
                               ("xemacs" .  (if (eventp args)
                                                (event-y args)
diff --git a/hversion.el b/hversion.el
index 7242de6..4929ea8 100644
--- a/hversion.el
+++ b/hversion.el
@@ -23,7 +23,7 @@
 ;;; Public variables
 ;;; ************************************************************************
 
-(defconst hyperb:version "6.0.2" "GNU Hyperbole revision number.")
+(defconst hyperb:version "6.0.2a" "GNU Hyperbole revision number.")
 
 ;;;###autoload
 (defvar hyperb:microcruft-os-p



reply via email to

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