]> git.eshelyaron.com Git - emacs.git/commitdiff
lisp/emacs-lisp/timer.el (timer--time): Define setter with gv-define-setter.
authorJuanma Barranquero <lekktu@gmail.com>
Sat, 10 Aug 2013 12:30:38 +0000 (14:30 +0200)
committerJuanma Barranquero <lekktu@gmail.com>
Sat, 10 Aug 2013 12:30:38 +0000 (14:30 +0200)
lisp/ChangeLog
lisp/emacs-lisp/timer.el

index da0ea72364b98fdd259821c3c81c04d03400b732..15ff4e131a05ba9d134e9675f4e7bfc1aac04571 100644 (file)
@@ -1,7 +1,10 @@
 2013-08-10  Juanma Barranquero  <lekktu@gmail.com>
 
+       * emacs-lisp/timer.el (timer--time): Define setter with
+       gv-define-setter to avoid deprecation warning.
+
        * completion.el: Remove stuff unused since revno:3176 (1993-05-27).
-       (*record-cmpl-statistics-p*): Remove (was commented out ).
+       (*record-cmpl-statistics-p*): Remove (was commented out).
        (cmpl-statistics-block): Remove (body was commented out).
        All callers changed.
        (add-completions-from-buffer, load-completions-from-file):
index 0aa31f717ed1d1e04efec95ccee98f7474dc1357..410e43b16e6a44f1665dc13ec406b779c20a65be 100644 (file)
        (timer--usecs timer)
        (timer--psecs timer)))
 
-(gv-define-simple-setter timer--time
-  (lambda (timer time)
-    (timer--check timer)
-    (setf (timer--high-seconds timer) (pop time))
-    (let ((low time) (usecs 0) (psecs 0))
-      (if (consp time)
-          (progn
-            (setq low (pop time))
-            (if time
-                (progn
-                  (setq usecs (pop time))
-                  (if time
-                      (setq psecs (car time)))))))
-      (setf (timer--low-seconds timer) low)
-      (setf (timer--usecs timer) usecs)
-      (setf (timer--psecs timer) psecs))))
-
+(gv-define-setter timer--time (time timer)
+  (macroexp-let2 nil val time
+    `(progn
+       (timer--check ,timer)
+       (setf (timer--high-seconds ,timer) (pop ,val))
+       (let ((low ,val) (usecs 0) (psecs 0))
+        (when (consp ,val)
+          (setq low (pop ,val))
+          (when ,val
+            (setq usecs (pop ,val))
+            (when ,val
+              (setq psecs (car ,val)))))
+        (setf (timer--low-seconds ,timer) low)
+        (setf (timer--usecs ,timer) usecs)
+        (setf (timer--psecs ,timer) psecs))
+       ,val)))
 
 (defun timer-set-time (timer time &optional delta)
   "Set the trigger time of TIMER to TIME.