mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-22 08:04:20 +01:00
For not switching windows with mouse in emacs, access window of event properly
Signed-off-by: magic_rb <magic_rb@redalder.org>
This commit is contained in:
parent
b284c90451
commit
84e1924f78
|
@ -13,19 +13,19 @@ Disable window changing using the mouse, it saves me from accidental switches.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun cv/mouse-set-point (fun event &optional promote)
|
(defun cv/mouse-set-point (fun event &optional promote)
|
||||||
(let ((window (car (car (cdr event)))))
|
(let ((window (posn-window (event-start event))))
|
||||||
(when (equal window (selected-window))
|
(when (equal window (selected-window))
|
||||||
(funcall fun event promote))))
|
(funcall fun event promote))))
|
||||||
(advice-add 'mouse-set-point :around 'cv/mouse-set-point)
|
(advice-add 'mouse-set-point :around 'cv/mouse-set-point)
|
||||||
|
|
||||||
(defun cv/mouse-drag-region (fun event)
|
(defun cv/mouse-drag-region (fun event)
|
||||||
(let ((window (car (car (cdr event)))))
|
(let ((window-end (posn-window (event-end event))))
|
||||||
(when (equal window (selected-window))
|
(when (equal window-end (selected-window))
|
||||||
(funcall fun event))))
|
(funcall fun event))))
|
||||||
(advice-add 'mouse-drag-region :around 'cv/mouse-drag-region)
|
(advice-add 'mouse-drag-region :around 'cv/mouse-drag-region)
|
||||||
|
|
||||||
(defun cv/mouse-set-region (fun event)
|
(defun cv/mouse-set-region (fun event)
|
||||||
(let ((window (car (car (cdr event)))))
|
(let ((window (posn-window (event-start event))))
|
||||||
(when (equal window (selected-window))
|
(when (equal window (selected-window))
|
||||||
(funcall fun event))))
|
(funcall fun event))))
|
||||||
(advice-add 'mouse-set-region :around 'cv/mouse-set-region)
|
(advice-add 'mouse-set-region :around 'cv/mouse-set-region)
|
||||||
|
|
Loading…
Reference in a new issue