emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 5483e44: * lisp/simple.el (decoded-time): Use `cl-d


From: Stefan Monnier
Subject: [Emacs-diffs] master 5483e44: * lisp/simple.el (decoded-time): Use `cl-defstruct`
Date: Mon, 29 Jul 2019 11:57:55 -0400 (EDT)

branch: master
commit 5483e44730d39284ca8fdfa360b92646bf23ba3c
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/simple.el (decoded-time): Use `cl-defstruct`
---
 lisp/simple.el | 90 +++++++++++++---------------------------------------------
 1 file changed, 19 insertions(+), 71 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 8855045..0bc39f0 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -9065,79 +9065,27 @@ to capitalize ARG words."
 
 ;;; Accessors for `decode-time' values.
 
-(defsubst decoded-time-second (time)
-  "The seconds in TIME, which is a value returned by `decode-time'.
+(cl-defstruct (decoded-time
+               (:constructor nil)
+               (:copier nil)
+               (:type list))
+  (second nil :documentation "\
 This is an integer between 0 and 60 (inclusive).  (60 is a leap
-second, which only some operating systems support.)"
-  (nth 0 time))
-
-(defsubst decoded-time-minute (time)
-  "The minutes in TIME, which is a value returned by `decode-time'.
-This is an integer between 0 and 59 (inclusive)."
-  (nth 1 time))
-
-(defsubst decoded-time-hour (time)
-  "The hours in TIME, which is a value returned by `decode-time'.
-This is an integer between 0 and 23 (inclusive)."
-  (nth 2 time))
-
-(defsubst decoded-time-day (time)
-  "The day-of-the-month in TIME, which is a value returned by `decode-time'.
-This is an integer between 1 and 31 (inclusive)."
-  (nth 3 time))
-
-(defsubst decoded-time-month (time)
-  "The month in TIME, which is a value returned by `decode-time'.
-This is an integer between 1 and 12 (inclusive).  January is 1."
-  (nth 4 time))
-
-(defsubst decoded-time-year (time)
-  "The year in TIME, which is a value returned by `decode-time'.
-This is a four digit integer."
-  (nth 5 time))
-
-(defsubst decoded-time-weekday (time)
-  "The day-of-the-week in TIME, which is a value returned by `decode-time'.
-This is a number between 0 and 6, and 0 is Sunday."
-  (nth 6 time))
-
-(defsubst decoded-time-dst (time)
-  "The daylight saving time in TIME, which is a value returned by 
`decode-time'.
-This is t if daylight saving time is in effect, and nil if not."
-  (nth 7 time))
-
-(defsubst decoded-time-zone (time)
-  "The time zone in TIME, which is a value returned by `decode-time'.
+second, which only some operating systems support.)")
+  (minute nil :documentation "This is an integer between 0 and 59 
(inclusive).")
+  (hour nil :documentation "This is an integer between 0 and 23 (inclusive).")
+  (day nil :documentation "This is an integer between 1 and 31 (inclusive).")
+  (month nil :documentation "\
+This is an integer between 1 and 12 (inclusive).  January is 1.")
+  (year nil :documentation "This is a four digit integer.")
+  (weekday nil :documentation "\
+This is a number between 0 and 6, and 0 is Sunday.")
+  (dst nil :documentation "\
+This is t if daylight saving time is in effect, and nil if not.")
+  (zone nil :documentation "\
 This is an integer indicating the UTC offset in seconds, i.e.,
-the number of seconds east of Greenwich."
-  (nth 8 time))
-
-(gv-define-setter decoded-time-second (second time)
-  `(setf (nth 0 ,time) ,second))
-
-(gv-define-setter decoded-time-minute (minute time)
-  `(setf (nth 1 ,time) ,minute))
-
-(gv-define-setter decoded-time-hour (hour time)
-  `(setf (nth 2 ,time) ,hour))
-
-(gv-define-setter decoded-time-day (day time)
-  `(setf (nth 3 ,time) ,day))
-
-(gv-define-setter decoded-time-month (month time)
-  `(setf (nth 4 ,time) ,month))
-
-(gv-define-setter decoded-time-year (year time)
-  `(setf (nth 5 ,time) ,year))
-
-;; No setter for weekday, which is the 6th element.
-
-(gv-define-setter decoded-time-dst (dst time)
-  `(setf (nth 7 ,time) ,dst))
-
-(gv-define-setter decoded-time-zone (zone time)
-  `(setf (nth 8 ,time) ,zone))
-
+the number of seconds east of Greenwich.")
+  )
 
 
 



reply via email to

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