Function: ghostel-mouse-release-or-set-point

ghostel-mouse-release-or-set-point is an interactive and natively compiled function defined in ghostel.el.

Signature

(ghostel-mouse-release-or-set-point EVENT &optional PROMOTE-TO-REGION)

Documentation

Forward EVENT to the terminal, or set point / switch input mode.

Without terminal mouse input, sets point (PROMOTE-TO-REGION keeps the word/line selection of a multi-click) and, in semi-char mode, switches to ghostel-mouse-drag-input-mode after a multi-click or a single click in an already-selected window. A single click that only focuses a previously-unselected window or frame instead preserves the pre-click view and stays in semi-char (skipped when ghostel-mouse-drag-input-mode is nil).

Key Bindings

ghostel-mode-map <mouse-1>

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel-mouse-release-or-set-point (event &optional promote-to-region)
  "Forward EVENT to the terminal, or set point / switch input mode.
Without terminal mouse input, sets point (PROMOTE-TO-REGION keeps
the word/line selection of a multi-click) and, in semi-char mode,
switches to `ghostel-mouse-drag-input-mode' after a multi-click or
a single click in an already-selected window.  A single click that
only focuses a previously-unselected window or frame instead preserves
the pre-click view and stays in semi-char (skipped when
`ghostel-mouse-drag-input-mode' is nil)."
  (interactive "e\np")
  (let ((active (and ghostel-mouse-drag-input-mode
                     (eq ghostel--input-mode 'semi-char))))
    (cond
     ((ghostel--mouse-release event))
     ;; Focus-only clicks must not move point; the saved window view is
     ;; what the user clicked back to inspect.
     ((and active
           (= (event-click-count event) 1)
           (not ghostel--mouse-press-was-selected))
      (deactivate-mark))
     ;; Multi-click, or a single click in an already-selected window: set
     ;; point/selection, then freeze (a focus click never reaches here).
     (t
      (mouse-set-point event promote-to-region)
      (when active
        (ghostel--enter-readonly-input-mode ghostel-mouse-drag-input-mode))))))