emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master e05ea0e: Make xterm-mouse-truncate-wrap obsolete


From: Paul Eggert
Subject: [Emacs-diffs] master e05ea0e: Make xterm-mouse-truncate-wrap obsolete
Date: Tue, 12 Feb 2019 18:21:17 -0500 (EST)

branch: master
commit e05ea0ea3117aa0ddd963585d5647fe116b8ffa0
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Make xterm-mouse-truncate-wrap obsolete
    
    * lisp/xt-mouse.el (xterm-mouse-truncate-wrap): Now obsolete,
    since we no longer need to worry about integer overflow.
    (xterm-mouse-event): Use plain ‘truncate’ instead.
---
 lisp/xt-mouse.el | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index fc00d1d..770aecf 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -123,20 +123,7 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
                      (terminal-parameter nil 'xterm-mouse-y))))
   pos)
 
-(defun xterm-mouse-truncate-wrap (f)
-  "Truncate with wrap-around."
-  (condition-case nil
-      ;; First try the built-in truncate, in case there's no overflow.
-      (truncate f)
-    ;; In case of overflow, do wraparound by hand.
-    (range-error
-     ;; In our case, we wrap around every 3 days or so, so if we assume
-     ;; a maximum of 65536 wraparounds, we're safe for a couple years.
-     ;; Using a power of 2 makes rounding errors less likely.
-     (let* ((maxwrap (* 65536 2048))
-            (dbig (truncate (/ f maxwrap)))
-            (fdiff (- f (* 1.0 maxwrap dbig))))
-       (+ (truncate fdiff) (* maxwrap dbig))))))
+(define-obsolete-function-alias 'xterm-mouse-truncate-wrap 'truncate "27.1")
 
 (defcustom xterm-mouse-utf-8 nil
   "Non-nil if UTF-8 coordinates should be used to read mouse coordinates.
@@ -256,7 +243,7 @@ which is the \"1006\" extension implemented in Xterm >= 
277."
              (y    (nth 2 click))
              ;; Emulate timestamp information.  This is accurate enough
              ;; for default value of mouse-1-click-follows-link (450msec).
-             (timestamp (xterm-mouse-truncate-wrap
+             (timestamp (truncate
                          (* 1000
                             (- (float-time)
                                (or xt-mouse-epoch
@@ -266,8 +253,8 @@ which is the \"1006\" extension implemented in Xterm >= 
277."
              (left (nth 0 ltrb))
              (top (nth 1 ltrb))
              (posn (if w
-                                (posn-at-x-y (- x left) (- y top) w t)
-                              (append (list nil 'menu-bar)
+                      (posn-at-x-y (- x left) (- y top) w t)
+                    (append (list nil 'menu-bar)
                              (nthcdr 2 (posn-at-x-y x y)))))
              (event (list type posn)))
         (setcar (nthcdr 3 posn) timestamp)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]