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 ...
Asme Just's user avatar
  • 384
11 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 ...
Matthew Palermo's user avatar
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 ...
Drew's user avatar
  • 77.5k
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) ...
JeanPierre's user avatar
  • 7,465
8 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 ...
phils's user avatar
  • 51.2k
7 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-...
Renzo's user avatar
  • 251
7 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 ...
Gilles 'SO- stop being evil''s user avatar
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-...
Tyler's user avatar
  • 22.3k
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-...
Bryan Ash's user avatar
  • 160
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))))
mutbuerger's user avatar
  • 3,494
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 ...
Juancho's user avatar
  • 5,455
6 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 ...
Drew's user avatar
  • 77.5k
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 ...
Drew's user avatar
  • 77.5k
5 votes

How to disable query to turn on disabled command?

Drew's answer solves your stated question so I would suggest accepting that; but my best guess is that something like this is what you're actually after: (global-set-key [remap mouse-save-then-kill] '...
phils's user avatar
  • 51.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 ...
Gilles 'SO- stop being evil''s 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-...
lawlist's user avatar
  • 19.1k
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 ...
RN3AOH's user avatar
  • 53
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 ...
rotspelikaan's 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 (...
tasmo's user avatar
  • 86
3 votes
Accepted

How to find the window under the mouse pointer

This should do it: (window-at (cadr (mouse-position)) (cddr (mouse-position)) (car (mouse-position))) See the Elisp manual section (elisp) Coordinates and Windows for more ...
Tyler's user avatar
  • 22.3k
3 votes
Accepted

How to make mouse-1 behave the same as RET in dired?

Bind mouse-1 to the command you want: (define-key dired-mode-map [mouse-1] 'dired-find-file) Or bind it to a command that is like dired-mouse-find-file-other-window but uses the same window. (defun ...
Drew's user avatar
  • 77.5k
3 votes

Mouse pointer between characters and the text cursor misplacement

I suggest you file this as a bug or a feature request with M-x report-emacs-bug. It can probably be fixed to some extent in Elisp by tweaking mouse-set-point as Vladimir suggested: this function ...
Stefan's user avatar
  • 26.4k
3 votes

Smooth (mouse) scroll for inline images?

The problem as I understand it is that the image is a single line. Changing how scrolling behaves won't solve the problem. The only solution I am aware of is to slice the image up so that there are ...
Ista's user avatar
  • 1,188
3 votes

Smooth (mouse) scroll for inline images?

How about this: ;; scroll one line at a time (less "jumpy" than defaults) (setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time (setq mouse-wheel-progressive-speed nil) ;; don't ...
C137's user avatar
  • 31
3 votes

Is it possible to disable the support for the mouse in GUI?

Two-and-a-half answers: Artur Malabarba's init.el code. The blog post has useful comments. Victor Deryagin's init.el code from which Malabarba derived his. My third "answer" probably only applies to ...
TomRoche's user avatar
  • 632
3 votes
Accepted

Dired reuse buffer on mouse click

(define-key dired-mode-map (kbd "<mouse-2>") 'diredp-mouse-find-file) If you did C-h k and then clicked mouse-1 on a file or directory it would have told you: <down-mouse-1> at that ...
Drew's user avatar
  • 77.5k
3 votes

Detect if mouse button is held down?

This seems to do what you want: (defun mouse-button-pressed-p () "Return non-nil if last event is a mouse-button down event." (run-hooks 'mouse-leave-buffer-hook) (and (consp last-input-event) ...
Drew's user avatar
  • 77.5k
3 votes

Making it so that cursor movement after command will deactivate region

End your command with this: (setq deactivate-mark t) or this: (deactivate-mark) C-h v deactivate-mark: deactivate-mark is a variable defined in C source code. Its value is nil ...
Drew's user avatar
  • 77.5k
3 votes

Hide mouse pointer while typing

You can use the mouse-avoidance-mode, see here for documentation. To test it simply enter M-x mouse-avoidance-mode and then select an option (see documentation link above) To have it permanently use ...
jue's user avatar
  • 4,576
3 votes
Accepted

local keymap in mode-line doesn't work in terminal

IIUC this is a bug in Emacs's C code which was fixed recently in Emacs's master branch (i.e. it will be fixed in Emacs-27, but not Emacs-26). There might be a way to workaround the bug with some ...
Stefan's user avatar
  • 26.4k

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