summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-07-08 14:47:47 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2014-07-08 14:47:47 -0400
commitdee89b6708a2f369ea1ba4ff0366f6506ccaeaef (patch)
tree96d00587032f61fca4e09dd47e921d47c4ffa4e5
parentef0cc37f8552b30fd48cd4437f8307182533d3db (diff)
downloademacs-dee89b6708a2f369ea1ba4ff0366f6506ccaeaef.tar.gz
* lisp/xt-mouse.el (xterm-mouse-translate-1): Intern drag event.
Remove also pointless window&mark manipulation. Fixes: debbugs:17894
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/xt-mouse.el79
2 files changed, 40 insertions, 42 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 29e55de249d..b2982c56754 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2014-07-08 Stefan Monnier <monnier@iro.umontreal.ca>
+ * xt-mouse.el (xterm-mouse-translate-1): Intern drag event (bug#17894).
+ Remove also pointless window&mark manipulation.
+
* progmodes/perl-mode.el: Use syntax-ppss; fix one indentation case.
(perl-indent-line): Use syntax-ppss to detect we're in a doc-section.
(perl-continuation-line-p): Don't skip over anything else than labels.
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index e5e77405b02..59f1eb8c887 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -62,49 +62,44 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
(defun xterm-mouse-translate-1 (&optional extension)
(save-excursion
- (save-window-excursion ;FIXME: Why?
- (deactivate-mark) ;FIXME: Why?
- (let* ((event (xterm-mouse-event extension))
- (ev-command (nth 0 event))
- (ev-data (nth 1 event))
- (ev-where (nth 1 ev-data))
- (vec (if (and (symbolp ev-where) (consp ev-where))
- ;; FIXME: This condition can *never* be non-nil!?!
- (vector (list ev-where ev-data) event)
- (vector event)))
- (is-down (string-match "down-" (symbol-name ev-command))))
-
- (cond
- ((null event) nil) ;Unknown/bogus byte sequence!
- (is-down
- (setf (terminal-parameter nil 'xterm-mouse-last-down) event)
- vec)
- (t
- (let* ((down (terminal-parameter nil 'xterm-mouse-last-down))
- (down-data (nth 1 down))
- (down-where (nth 1 down-data)))
- (setf (terminal-parameter nil 'xterm-mouse-last-down) nil)
- (cond
- ((null down)
- ;; This is an "up-only" event. Pretend there was an up-event
- ;; right before and keep the up-event for later.
- (push event unread-command-events)
- (vector (cons (intern (replace-regexp-in-string
- "\\`\\([ACMHSs]-\\)*" "\\&down-"
- (symbol-name ev-command) t))
- (cdr event))))
- ((equal ev-where down-where) vec)
+ (let* ((event (xterm-mouse-event extension))
+ (ev-command (nth 0 event))
+ (ev-data (nth 1 event))
+ (ev-where (nth 1 ev-data))
+ (vec (vector event))
+ (is-down (string-match "down-" (symbol-name ev-command))))
+
+ (cond
+ ((null event) nil) ;Unknown/bogus byte sequence!
+ (is-down
+ (setf (terminal-parameter nil 'xterm-mouse-last-down) event)
+ vec)
+ (t
+ (let* ((down (terminal-parameter nil 'xterm-mouse-last-down))
+ (down-data (nth 1 down))
+ (down-where (nth 1 down-data)))
+ (setf (terminal-parameter nil 'xterm-mouse-last-down) nil)
+ (cond
+ ((null down)
+ ;; This is an "up-only" event. Pretend there was an up-event
+ ;; right before and keep the up-event for later.
+ (push event unread-command-events)
+ (vector (cons (intern (replace-regexp-in-string
+ "\\`\\([ACMHSs]-\\)*" "\\&down-"
+ (symbol-name ev-command) t))
+ (cdr event))))
+ ((equal ev-where down-where) vec)
(t
- (let ((drag (if (symbolp ev-where)
- 0 ;FIXME: Why?!?
- (list (replace-regexp-in-string
- "\\`\\([ACMHSs]-\\)*" "\\&drag-"
- (symbol-name ev-command) t)
- down-data ev-data))))
- (if (null track-mouse)
- (vector drag)
- (push drag unread-command-events)
- (vector (list 'mouse-movement ev-data)))))))))))))
+ (let ((drag (if (symbolp ev-where)
+ 0 ;FIXME: Why?!?
+ (list (intern (replace-regexp-in-string
+ "\\`\\([ACMHSs]-\\)*" "\\&drag-"
+ (symbol-name ev-command) t))
+ down-data ev-data))))
+ (if (null track-mouse)
+ (vector drag)
+ (push drag unread-command-events)
+ (vector (list 'mouse-movement ev-data))))))))))))
;; These two variables have been converted to terminal parameters.
;;