Function: hmouse-unshifted-setup

hmouse-unshifted-setup is an interactive and byte-compiled function defined in hmouse-sh.el.

Signature

(hmouse-unshifted-setup &optional MIDDLE-KEY-ONLY-FLAG)

Documentation

Bind the middle and right mouse keys as Action and Assist Keys, respectively.

With optional MIDDLE-KEY-ONLY-FLAG non-nil, bind only the middle mouse key.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hmouse-sh.el
(defun hmouse-unshifted-setup (&optional middle-key-only-flag)
  "Bind the middle and right mouse keys as Action and Assist Keys, respectively.
With optional MIDDLE-KEY-ONLY-FLAG non-nil, bind only the middle mouse key."
  (interactive)
  ;; Globally Emacs uses key-translation-map to link mouse-1 to
  ;; do whatever mouse-2 does when 'mouse-1-click-follows-link' is
  ;; non-nil (the default) and point is on an Emacs button.
  ;; Since Hyperbole rebinds mouse-2 here, this does not work by
  ;; default.  We fix that here by overriding the setting of
  ;; down-mouse-1 to include the down Action Key command plus the
  ;; original mouse-1 command.  Then when mouse-1 is released on an
  ;; Emacs button, the Action Key command is run which handles
  ;; activating the button/following a link.
  (global-set-key [down-mouse-1] 'hmouse-drag-region)
  ;;
  ;; Unbind Emacs push-button mouse keys since Hyperbole handles them.
  (define-key button-map [mouse-2] nil)
  (define-key button-map [mode-line mouse-2] nil)
  (define-key button-map [header-line mouse-2] nil)
  ;; Remove push-button help echo string for mouse-2 key.
  (put 'default-button 'help-echo nil)
  ;;
  ;; Remove mouse-2 binding In Info-mode since Hyperbole handles it.
  (var:add-and-run-hook 'Info-mode-hook (lambda () (define-key Info-mode-map [mouse-2] nil)))
  ;;
  (unless (eq window-system 'dps)
    ;; X, macOS or MS Windows
    (hmouse-bind-key-emacs 2 #'action-key-depress-emacs #'action-mouse-key-emacs)
    (unless middle-key-only-flag
      (hmouse-bind-key-emacs 3 #'assist-key-depress-emacs #'assist-mouse-key-emacs))
    `(with-eval-after-load "company"
       (define-key company-active-map [down-mouse-2] 'ignore)
       (define-key company-active-map [mouse-2] 'smart-company-to-definition)
       (unless ,middle-key-only-flag
	 (define-key company-active-map [down-mouse-3] 'ignore)
	 (define-key company-active-map [mouse-3] 'smart-company-help)))))