summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-03-19 10:27:19 +0800
committerPo Lu <luangruo@yahoo.com>2022-03-19 10:27:19 +0800
commit808a6f8f5f86f5c2356585dcf4b495916ed8bf6d (patch)
tree5e0d5ffdf3ee359087d48995d9c1c7fafc792d9e /lisp
parent1467b04f5cf586c0f44b7df00591986fa8d40c66 (diff)
downloademacs-808a6f8f5f86f5c2356585dcf4b495916ed8bf6d.tar.gz
emacs-808a6f8f5f86f5c2356585dcf4b495916ed8bf6d.tar.bz2
emacs-808a6f8f5f86f5c2356585dcf4b495916ed8bf6d.zip
Fix some glitches when dragging files from dired
* lisp/dired.el (dired-mouse-drag-files): Fix initial values. (dired-mouse-drag): Clear mark if active and only make button release events unread.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dired.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index da3c3c80cc1..2fe30d2a4e2 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -257,7 +257,7 @@ creating a copy of it .
If the value is `link', then a symbolic link will be created to
the file instead by the other program (usually a file manager)."
:type '(choice (const :tag "Don't allow dragging" nil)
- (const :tag "Copy file to other window" tx)
+ (const :tag "Copy file to other window" t)
(const :tag "Create symbolic link to file" link)))
(defcustom dired-copy-preserve-time t
@@ -1689,15 +1689,17 @@ see `dired-use-ls-dired' for more details.")
(declare-function x-begin-drag "xfns.cx")
(defun dired-mouse-drag (event)
- "Begin a drag-and-drop operation for the file at EVENT.
-If we get a mouse motion event right "
+ "Begin a drag-and-drop operation for the file at EVENT."
(interactive "e")
+ (when mark-active
+ (deactivate-mark))
(save-excursion
(goto-char (posn-point (event-end event)))
(track-mouse
(let ((new-event (read-event)))
(if (not (eq (event-basic-type new-event) 'mouse-movement))
- (push new-event unread-command-events)
+ (when (eq (event-basic-type new-event) 'mouse-1)
+ (push new-event unread-command-events))
;; We can get an error if there's by some chance no file
;; name at point.
(condition-case nil
@@ -1709,7 +1711,8 @@ If we get a mouse motion event right "
(if (eq 'dired-mouse-drag-files 'link)
'XdndActionLink
'XdndActionCopy)))
- (error (push new-event unread-command-events))))))))
+ (error (when (eq (event-basic-type new-event) 'mouse-1)
+ (push new-event unread-command-events)))))))))
(defvar dired-mouse-drag-files-map (let ((keymap (make-sparse-keymap)))
(define-key keymap [down-mouse-1] #'dired-mouse-drag)