aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorStefan Kangas2020-03-01 01:42:36 +0100
committerStefan Kangas2020-03-01 01:56:03 +0100
commit228fb6f3846de466783fb1c3bf188c816eef005b (patch)
treecea001d1cc07976d0f7319469ac0d2f0e60eba2c /lisp/emulation
parente98ee8ddac24f7db3acfbbaadde5116d138bf698 (diff)
downloademacs-228fb6f3846de466783fb1c3bf188c816eef005b.tar.gz
emacs-228fb6f3846de466783fb1c3bf188c816eef005b.zip
Remove more XEmacs compat code from viper
* lisp/emulation/viper-mous.el (viper-multiclick-timeout) (viper-current-click-count, viper-last-click-event-timestamp) (viper-mouse-click-insert-word) (viper-mouse-click-search-word): Remove XEmacs compat code. (viper-event-click-count): Redefine as obsolete function alias for 'event-click-count'. * lisp/emulation/viper-util.el (viper-check-version): Declare obsolete.
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/viper-mous.el50
-rw-r--r--lisp/emulation/viper-util.el1
2 files changed, 8 insertions, 43 deletions
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el
index 294705f7c3a..6ecfec548cb 100644
--- a/lisp/emulation/viper-mous.el
+++ b/lisp/emulation/viper-mous.el
@@ -66,20 +66,13 @@ or a triple-click."
66;; time interval in millisecond within which successive clicks are 66;; time interval in millisecond within which successive clicks are
67;; considered related 67;; considered related
68(defcustom viper-multiclick-timeout (if (viper-window-display-p) 68(defcustom viper-multiclick-timeout (if (viper-window-display-p)
69 (if (featurep 'xemacs) 69 double-click-time
70 mouse-track-multi-click-time
71 double-click-time)
72 500) 70 500)
73 "Time interval in millisecond within which successive mouse clicks are 71 "Time interval in millisecond within which successive mouse clicks are
74considered related." 72considered related."
75 :type 'integer 73 :type 'integer
76 :group 'viper-mouse) 74 :group 'viper-mouse)
77 75
78;; current event click count; XEmacs only
79(defvar viper-current-click-count 0)
80;; time stamp of the last click event; XEmacs only
81(defvar viper-last-click-event-timestamp 0)
82
83;; Local variable used to toggle wraparound search on click. 76;; Local variable used to toggle wraparound search on click.
84(viper-deflocalvar viper-mouse-click-search-noerror t) 77(viper-deflocalvar viper-mouse-click-search-noerror t)
85 78
@@ -279,11 +272,9 @@ See `viper-surrounding-word' for the definition of a word in this case."
279 (setq interrupting-event (read-event)) 272 (setq interrupting-event (read-event))
280 (viper-mouse-event-p last-input-event))) 273 (viper-mouse-event-p last-input-event)))
281 (progn ; interrupted wait 274 (progn ; interrupted wait
282 (setq viper-global-prefix-argument arg) 275 (setq viper-global-prefix-argument arg))
283 ;; count this click for XEmacs
284 (viper-event-click-count click))
285 ;; uninterrupted wait or the interrupting event wasn't a mouse event 276 ;; uninterrupted wait or the interrupting event wasn't a mouse event
286 (setq click-count (viper-event-click-count click)) 277 (setq click-count (event-click-count click))
287 (if (> click-count 1) 278 (if (> click-count 1)
288 (setq arg viper-global-prefix-argument 279 (setq arg viper-global-prefix-argument
289 viper-global-prefix-argument nil)) 280 viper-global-prefix-argument nil))
@@ -300,33 +291,8 @@ See `viper-surrounding-word' for the definition of a word in this case."
300 (string-match "\\(mouse-\\|frame\\|screen\\|track\\)" 291 (string-match "\\(mouse-\\|frame\\|screen\\|track\\)"
301 (prin1-to-string (viper-event-key event))))) 292 (prin1-to-string (viper-event-key event)))))
302 293
303;; XEmacs has no double-click events. So, we must simulate. 294(define-obsolete-function-alias 'viper-event-click-count
304;; So, we have to simulate event-click-count. 295 'event-click-count "28.1")
305(defun viper-event-click-count (click)
306 (if (featurep 'xemacs) (viper-event-click-count-xemacs click)
307 (event-click-count click)))
308
309(when (featurep 'xemacs)
310
311 ;; kind of semaphore for updating viper-current-click-count
312 (defvar viper-counting-clicks-p nil)
313
314 (defun viper-event-click-count-xemacs (click)
315 (let ((time-delta (- (event-timestamp click)
316 viper-last-click-event-timestamp))
317 inhibit-quit)
318 (while viper-counting-clicks-p
319 (ignore))
320 (setq viper-counting-clicks-p t)
321 (if (> time-delta viper-multiclick-timeout)
322 (setq viper-current-click-count 0))
323 (discard-input)
324 (setq viper-current-click-count (1+ viper-current-click-count)
325 viper-last-click-event-timestamp (event-timestamp click))
326 (setq viper-counting-clicks-p nil)
327 (if (viper-sit-for-short viper-multiclick-timeout t)
328 viper-current-click-count
329 0))))
330 296
331(declare-function viper-forward-word "viper-cmd" (arg)) 297(declare-function viper-forward-word "viper-cmd" (arg))
332(declare-function viper-adjust-window "viper-cmd" ()) 298(declare-function viper-adjust-window "viper-cmd" ())
@@ -364,11 +330,9 @@ this command.
364 (setq viper-global-prefix-argument (or viper-global-prefix-argument 330 (setq viper-global-prefix-argument (or viper-global-prefix-argument
365 arg) 331 arg)
366 ;; remember command that was before the multiclick 332 ;; remember command that was before the multiclick
367 this-command last-command) 333 this-command last-command))
368 ;; make sure we counted this event---needed for XEmacs only
369 (viper-event-click-count click))
370 ;; uninterrupted wait 334 ;; uninterrupted wait
371 (setq click-count (viper-event-click-count click)) 335 (setq click-count (event-click-count click))
372 (setq click-word (viper-mouse-click-get-word click nil click-count)) 336 (setq click-word (viper-mouse-click-get-word click nil click-count))
373 337
374 (if (> click-count 1) 338 (if (> click-count 1)
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index ebad850e6b7..1561204151d 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -205,6 +205,7 @@ Otherwise return the normal value."
205;; incorrect. However, this gives correct result in our cases, since we are 205;; incorrect. However, this gives correct result in our cases, since we are
206;; testing for sufficiently high Emacs versions. 206;; testing for sufficiently high Emacs versions.
207(defun viper-check-version (op major minor &optional type-of-emacs) 207(defun viper-check-version (op major minor &optional type-of-emacs)
208 (declare (obsolete nil "28.1"))
208 (if (and (boundp 'emacs-major-version) (boundp 'emacs-minor-version)) 209 (if (and (boundp 'emacs-major-version) (boundp 'emacs-minor-version))
209 (and (cond ((eq type-of-emacs 'xemacs) (featurep 'xemacs)) 210 (and (cond ((eq type-of-emacs 'xemacs) (featurep 'xemacs))
210 ((eq type-of-emacs 'emacs) (featurep 'emacs)) 211 ((eq type-of-emacs 'emacs) (featurep 'emacs))