;;; mouse.el --- window system-independent mouse support
;; Copyright (C) 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: hardware, mouse
(put 'track-mouse 'lisp-indent-function 0)
(defcustom mouse-yank-at-point nil
- "*If non-nil, mouse yank commands yank at point instead of at click."
+ "If non-nil, mouse yank commands yank at point instead of at click."
:type 'boolean
:group 'mouse)
(defcustom mouse-drag-copy-region t
- "*If non-nil, mouse drag copies region to kill-ring."
+ "If non-nil, mouse drag copies region to kill-ring."
:type 'boolean
:version "22.1"
:group 'mouse)
:group 'mouse)
(defcustom mouse-1-click-in-non-selected-windows t
- "*If non-nil, a Mouse-1 click also follows links in non-selected windows.
+ "If non-nil, a Mouse-1 click also follows links in non-selected windows.
If nil, a Mouse-1 click on a link in a non-selected window performs
the normal mouse-1 binding, typically selects the window and sets
(start-event-window (posn-window start))
(start-event-frame (window-frame start-event-window))
(start-nwindows (count-windows t))
+ (on-link (and mouse-1-click-follows-link
+ (or mouse-1-click-in-non-selected-windows
+ (eq (posn-window start) (selected-window)))
+ (mouse-on-link-p start)))
(minibuffer (frame-parameter nil 'minibuffer))
should-enlarge-minibuffer event mouse y top bot edges wconfig growth)
(track-mouse
(one-window-p t))
(error "Attempt to resize sole window"))
+ ;; If we ever move, make sure we don't mistakenly treat
+ ;; some unexpected `mouse-1' final event as a sign that
+ ;; this whole drag was nothing more than a click.
+ (if (/= growth 0) (setq on-link nil))
+
;; grow/shrink minibuffer?
(if should-enlarge-minibuffer
(unless resize-mini-windows
(nth 1 (window-edges
;; Choose right window.
start-event-window)))))
- (set-window-configuration wconfig)))))))))
+ (set-window-configuration wconfig)))))
+
+ ;; Presumably if this was just a click, the last event should
+ ;; be `mouse-1', whereas if this did move the mouse, it should be
+ ;; a `drag-mouse-1'. In any case `on-link' would have been nulled
+ ;; above if there had been any significant mouse movement.
+ (when (and on-link (eq 'mouse-1 (car-safe event)))
+ (push (cons 'mouse-2 (cdr event)) unread-command-events))))))
(defun mouse-drag-mode-line (start-event)
"Change the height of a window by dragging on the mode line."
(setq mouse-last-region-tick (buffer-modified-tick)))
(defcustom mouse-scroll-delay 0.25
- "*The pause between scroll steps caused by mouse drags, in seconds.
+ "The pause between scroll steps caused by mouse drags, in seconds.
If you drag the mouse beyond the edge of a window, Emacs scrolls the
window to bring the text beyond that edge into view, with a delay of
this many seconds between scroll steps. Scrolling stops when you move
:group 'mouse)
(defcustom mouse-scroll-min-lines 1
- "*The minimum number of lines scrolled by dragging mouse out of window.
+ "The minimum number of lines scrolled by dragging mouse out of window.
Moving the mouse out the top or bottom edge of the window begins
scrolling repeatedly. The number of lines scrolled per repetition
is normally equal to the number of lines beyond the window edge that
(overlay-end mouse-secondary-overlay)))))))
\f
(defcustom mouse-buffer-menu-maxlen 20
- "*Number of buffers in one pane (submenu) of the buffer menu.
+ "Number of buffers in one pane (submenu) of the buffer menu.
If we have lots of buffers, divide them into groups of
`mouse-buffer-menu-maxlen' and make a pane (or submenu) for each one."
:type 'integer
:group 'mouse)
(defcustom mouse-buffer-menu-mode-mult 4
- "*Group the buffers by the major mode groups on \\[mouse-buffer-menu]?
+ "Group the buffers by the major mode groups on \\[mouse-buffer-menu]?
This number which determines (in a hairy way) whether \\[mouse-buffer-menu]
will split the buffer menu by the major modes (see
`mouse-buffer-menu-mode-groups') or just by menu length.
("Text" . "Text")
("Outline" . "Text")
("\\(HT\\|SG\\|X\\|XHT\\)ML" . "SGML")
- ("log\\|diff\\|vc\\|cvs" . "Version Control") ; "Change Management"?
+ ("log\\|diff\\|vc\\|cvs\\|Annotate" . "Version Control") ; "Change Management"?
("Lisp" . "Lisp"))
"How to group various major modes together in \\[mouse-buffer-menu].
Each element has the form (REGEXP . GROUPNAME).
(interactive)
(unless (display-multi-font-p)
(error "Cannot change fonts on this display"))
- (x-popup-menu
- (if (listp last-nonmenu-event)
- last-nonmenu-event
- (list '(0 0) (selected-window)))
- (append x-fixed-font-alist
- (list (generate-fontset-menu)))))
+ (car
+ (x-popup-menu
+ (if (listp last-nonmenu-event)
+ last-nonmenu-event
+ (list '(0 0) (selected-window)))
+ (append x-fixed-font-alist
+ (list (generate-fontset-menu))))))
(declare-function text-scale-mode "face-remap")