non-@code{nil} value, dragging the mouse over a stretch of text also
adds the text to the kill ring. The default is @code{nil}.
+ If this variable is @code{non-empty}, only copy to the kill ring if
+the region is non-empty. For instance, if you mouse drag an area that
+is less than a half a character, you'd normally get the empty string
+in your kill ring, but with @code{non-empty}, this short mouse drag
+won't affect the kill ring.
+
@vindex mouse-scroll-min-lines
If you move the mouse off the top or bottom of the window while
dragging, the window scrolls at a steady rate until you move the mouse
If non-nil, this option allows scrolling a window while dragging text
around without a scroll wheel.
++++
+*** 'mouse-drag-copy-region' can now be 'non-empty'.
+This inhibits putting empty strings onto the kill ring.
+
+++
** New user options 'dnd-indicate-insertion-point' and 'dnd-scroll-margin'.
These options allow adjusting point and scrolling a window when
This affects `mouse-save-then-kill' (\\[mouse-save-then-kill]) in
addition to mouse drags.
+If this variable is `non-empty', only copy to the kill ring if
+the region is non-empty. For instance, if you mouse drag an area
+that is less than a half a character, you'd normally get the
+empty string in your kill ring, but with this value, this short
+mouse drag won't affect the kill ring.
+
This variable applies only to mouse adjustments in Emacs, not
selecting and adjusting regions in other windows."
- :type 'boolean
+ :type '(choice (const :tag "No" nil)
+ (const :tag "Yes" t)
+ (const :tag "Non-empty" non-empty))
:version "24.1")
(defcustom mouse-1-click-follows-link 450
(if (< end beg)
(setq end (nth 0 range) beg (nth 1 range))
(setq beg (nth 0 range) end (nth 1 range)))))
- (and mouse-drag-copy-region (integerp beg) (integerp end)
+ (when (and mouse-drag-copy-region
+ (integerp beg)
+ (integerp end)
+ (or (not (eq mouse-drag-copy-region 'non-empty))
+ (/= beg end)))
;; Don't set this-command to `kill-region', so a following
;; C-w won't double the text in the kill ring. Ignore
;; `last-command' so we don't append to a preceding kill.
(if before-scroll (goto-char before-scroll)))
(exchange-point-and-mark)
(mouse-set-region-1)
- (when mouse-drag-copy-region
+ (when (and mouse-drag-copy-region
+ (or (not (eq mouse-drag-copy-region 'non-empty))
+ (not (/= (mark t) (point)))))
(kill-new (filter-buffer-substring (mark t) (point))))
(setq mouse-save-then-kill-posn click-pt)))))