* lisp/xt-mouse.el (xterm-mouse-translate-1): Intern drag event.

Remove also pointless window&mark manipulation.

Fixes: debbugs:17894
This commit is contained in:
Stefan Monnier 2014-07-08 14:47:47 -04:00
parent ef0cc37f85
commit dee89b6708
2 changed files with 39 additions and 41 deletions

View file

@ -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.

View file

@ -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))))
(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)
(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.
;;