Hot answers tagged

12 votes
Accepted

How to change the mouse pointer colour?

Just found this, did not tried it: (set-mouse-color "red")
user avatar
  • 5,981
12 votes

Drag selected text with the mouse

tldr; Add (setq mouse-drag-and-drop-region t) in you init file. Restart or C-c d R to reload if you're using Doom-Emacs. I just find out (SURPRISINGLY) that Emacs as text drag and drop. And this ...
user avatar
  • 339
10 votes

Smooth (mouse) scroll for inline images?

Since Emacs 26.1, the buffer can be scrolled by individual pixels instead of just lines which can be used to smoothly scroll over images using the mouse wheel. To achieve this I have used the ...
user avatar
10 votes
Accepted

Clear secondary selection without using mouse

You should be able to clear the secondary selection by evaluating: (delete-overlay mouse-secondary-overlay) If you never want to get the secondary selection I believe you can just unbind the default ...
user avatar
  • 19.1k
10 votes
Accepted

Enable Emacs column selection using mouse

Here is a solution: (defun mouse-start-rectangle (start-event) (interactive "e") (deactivate-mark) (mouse-set-point start-event) (rectangle-mark-mode +1) (let ((drag-event)) (track-...
user avatar
  • 9,993
9 votes
Accepted

What is the select word/symbol function bound to <double-mouse-1>

It's actually a bit complicated. When you double-click mouse-1 there are multiple actions. <down-mouse-1> occurs first, when you press the button. Then mouse-1 occurs, when you release the ...
user avatar
  • 69.2k
9 votes
Accepted

Keyboard equivalent of left mouse click in org mode

Function org-open-at-point (bound to C-c C-o) does precisely that I think. Its docstring (obtained through M-x describe-function) includes: (org-open-at-point &optional ARG REFERENCE-BUFFER) ...
user avatar
  • 6,943
7 votes
Accepted

Inadvertent paste when correcting spelling mistakes using flyspell

Sounds like you are being bitten by the fact that one command is bound to mouse-2, another command is bound to down-mouse-2, and the two commands do not play well together. Do C-h k and then click ...
user avatar
  • 69.2k
7 votes
Accepted

how to reveal function names that are bound to mouse buttons (eg <down-mouse-1>)?

You can view a considerable amount of information about buttons (and other text properties and overlays) by placing point on them and using what-cursor-position with a prefix arg, that is, C-u C-x =. ...
user avatar
  • 232
7 votes

What is the select word/symbol function bound to <double-mouse-1>

@Drew has explained some of the complexity associated with events bound to mouse actions. As for your ultimate goal of marking the word at point using the keyboard, you might be interested in expand-...
user avatar
  • 20.1k
6 votes

Simulating mouse operations with keyboard

Often, navigating to a location and pressing some key will have the same effect as clicking at that location. There's no built-in mechanism that ensures this, it's just that modes are typically ...
user avatar
6 votes
Accepted

Turn off mouse highlighting in org-agenda

I removed the mouse face as a whole in the agenda: (add-hook 'org-agenda-finalize-hook (lambda () (remove-text-properties (point-min) (point-max) '(mouse-face t))))
user avatar
  • 3,319
6 votes
Accepted

Emacs in PuTTY with xterm-mouse-mode: how to paste?

If mouse reporting is on, then Shift+click is still interpreted by the terminal and not passed to the application. Thus, if a right-click pastes outside Emacs, and a straight right-click is passed ...
user avatar
6 votes

Generate mouse-2 event from MacBook trackpad

After some more googling and reading of the manual, I have found a solution that works for me, by adding to the file ~/.emacs.d/init.el the following line: (define-key key-translation-map (kbd "<s-...
user avatar
  • 241
6 votes

Generate mouse-2 event from MacBook trackpad

You could also tell flyspell to use mouse-3 which seems more appropriate for a context menu: (eval-after-load "flyspell" '(progn (define-key flyspell-mouse-map [down-mouse-3] #'flyspell-...
user avatar
  • 160
6 votes
Accepted

What does this 'shift' do here?

shift in this case is a symbol, not a function. Note that the variable is given a quoted list, so nothing inside is evaluated. From the documentation of this variable (which you can access via ...
user avatar
  • 5,005
6 votes
Accepted

Difference between [mouse-1] and [down-mouse-1]

down-mouse-1 is a "button-down" event which is generated immediately when you press the mouse button. mouse-1 is a "click" event, which is generated if you release the button at ...
user avatar
  • 43.1k
5 votes
Accepted

Preventing mouse clicks in inactive windows from repositioning the cursor

The following advice achieves the behavior I want: (defadvice mouse-set-point (around cv/mouse-set-point (event) activate) (let ((event-name (car event)) (event-target-window (posn-window (...
user avatar
  • 221
5 votes
Accepted

How to make mode-line text look like a link/button on hover

You can use the mouse-face property. For example, the following snippet will make "f" look like a button when you hover the mouse pointer over it: (setq mode-line-format (list (propertize ...
user avatar
5 votes

Mouse pointer between characters and the text cursor misplacement

First, you are apparently confusing the mouse pointer with the text cursor (aka cursor). It seems that you mostly talking about the latter, but referring to it as the "cursor". Second, insertion of a ...
user avatar
  • 69.2k
5 votes
Accepted

How to disable query to turn on disabled command?

Put this in your init file: (setq disabled-command-function 'ignore) By default, disabling a command means that you get that prompt when you try to use it. But you can override this design by ...
user avatar
  • 69.2k
5 votes
Accepted

binding M-[ causes mouse focus to insert characters

This is a normal deficiency of most terminals. Terminal send escape sequences to represent input events that don't have a corresponding character, such as function keys, “exotic” modifier combinations ...
user avatar
5 votes
Accepted

How to disable changing the current buffer by clicking buffer name in mode line?

Try using: (define-key mode-line-buffer-identification-keymap [mode-line mouse-1] nil) (define-key mode-line-buffer-identification-keymap [mode-line mouse-3] nil) The variable mode-line-buffer-...
user avatar
  • 17.6k
4 votes

How to disable copy on selection with evil-mode (Mac/24.4)?

It turns out it was evil-mode that did that! The answer can be found here: https://stackoverflow.com/questions/17127009/how-to-disable-emacs-evil-selection-auto-copies-to-clipboard/23254728#23254728 ...
user avatar
  • 93
4 votes

Emacs on Android - org-mode - error - `(wrong-type-argument stringp (require . t-mouse))`

For the record: I have dug up the root cause for this one. It is not for ZShaolin build, but rather, for Termux build of Emacs, but the source of the broken load-history entry is the same, it's an ...
user avatar
  • 53
4 votes
Accepted

Is there a way to determine the face at frame x / y (mouse position)?

Here's one way. You need to bind the command to a mouse event. But if you use a mouse-button click then you will likely need to bind the event for the other part of the click (e.g. down) to ignore. ...
user avatar
  • 69.2k
4 votes

`mouse-1` (button 1) follows links, like `mouse-2` does - how to modify the behavior?

You want to look at C-h v mouse-1-click-follows-link RET, I think.
user avatar
  • 25.2k
4 votes
Accepted

Right-click to select one character under the mouse pointer?

You can do it: (defun select-char-at-click (event) "Select char at EVENT position. EVENT should be a mouse-click event." (interactive "e") (run-hooks 'mouse-leave-buffer-hook) ; Give Isearch ...
user avatar
  • 69.2k
4 votes

Turn off mouse highlighting in org-agenda

I realize you asked specifically about org-mode, but this might be of interest to others reading this. A general variable exists: mouse-highlight. Setting it to nil disables highlighting of ...
user avatar
4 votes

How to disable mouse in Spacemacs

According to your example you don't need the function with-eval-after-load. In Spacemacs it works simple like that: (defun dotspacemacs/user-config () "…" ;; … ;; dummy silence definition (...
user avatar
  • 86

Only top scored, non community-wiki answers of a minimum length are eligible