42 |
"*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." |
43 |
:type 'boolean |
:type 'boolean |
44 |
:group 'mouse) |
:group 'mouse) |
45 |
|
|
46 |
|
(defcustom mouse-drag-copy-region t |
47 |
|
"*If non-nil, mouse drag copies region to kill-ring." |
48 |
|
:type 'boolean |
49 |
|
:group 'mouse) |
50 |
|
|
51 |
|
|
52 |
;; Provide a mode-specific menu on a mouse button. |
;; Provide a mode-specific menu on a mouse button. |
53 |
|
|
618 |
;; Don't set this-command to kill-region, so that a following |
;; Don't set this-command to kill-region, so that a following |
619 |
;; C-w will not double the text in the kill ring. |
;; C-w will not double the text in the kill ring. |
620 |
;; Ignore last-command so we don't append to a preceding kill. |
;; Ignore last-command so we don't append to a preceding kill. |
621 |
(let (this-command last-command deactivate-mark) |
(when mouse-drag-copy-region |
622 |
(copy-region-as-kill (mark) (point))) |
(let (this-command last-command deactivate-mark) |
623 |
|
(copy-region-as-kill (mark) (point)))) |
624 |
(mouse-set-region-1))) |
(mouse-set-region-1))) |
625 |
|
|
626 |
(defun mouse-set-region-1 () |
(defun mouse-set-region-1 () |
627 |
|
;; Set transient-mark-mode for a little while. |
628 |
|
(setq transient-mark-mode (or transient-mark-mode 'only)) |
629 |
(setq mouse-last-region-beg (region-beginning)) |
(setq mouse-last-region-beg (region-beginning)) |
630 |
(setq mouse-last-region-end (region-end)) |
(setq mouse-last-region-end (region-end)) |
631 |
(setq mouse-last-region-tick (buffer-modified-tick))) |
(setq mouse-last-region-tick (buffer-modified-tick))) |
836 |
(push-mark region-commencement t t) |
(push-mark region-commencement t t) |
837 |
(goto-char region-termination) |
(goto-char region-termination) |
838 |
;; Don't let copy-region-as-kill set deactivate-mark. |
;; Don't let copy-region-as-kill set deactivate-mark. |
839 |
(let (deactivate-mark) |
(when mouse-drag-copy-region |
840 |
(copy-region-as-kill (point) (mark t))) |
(let (deactivate-mark) |
841 |
|
(copy-region-as-kill (point) (mark t)))) |
842 |
(let ((buffer (current-buffer))) |
(let ((buffer (current-buffer))) |
843 |
(mouse-show-mark) |
(mouse-show-mark) |
844 |
;; mouse-show-mark can call read-event, |
;; mouse-show-mark can call read-event, |