Hot answers tagged

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
  • 374
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 ...
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
  • 74.6k
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,273
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

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

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
  • 21.4k
7 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
  • 47.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,419
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,225
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
  • 74.6k
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 ...
Drew's user avatar
  • 74.6k
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
  • 18.6k
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.
Stefan's user avatar
  • 26k
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. ...
Drew's user avatar
  • 74.6k
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
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 ...
Drew's user avatar
  • 74.6k
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
4 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
  • 47.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
  • 74.6k
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
  • 26k
3 votes
Accepted

Yank from mouse in helm modes

After poking around the helm source code a bit, it looks like helm tries to temporarily override all the mouse commands using the minor mode helm--remap-mouse-mode, and this is most likely the source ...
Aaron Harris's user avatar
  • 2,654
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,138
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
Accepted

A dual-purpose function for keyboard shortcut and mouse

Yes. (defun dired-follow-link-with-mouse (event) "Follow the link in the dired directory heading, causing a new dired buffer to be opened." (interactive (list last-nonmenu-event)) (run-hooks '...
Drew's user avatar
  • 74.6k
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
  • 592
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
  • 21.4k

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