Remove report- prefix

This commit is contained in:
contrapunctus 2022-03-28 02:38:41 +05:30
parent 236dbfda8f
commit fc7ed02df7

View File

@ -168,14 +168,14 @@ After hacking, always test for and ensure the following -
:END:
A quick description, starting from the first time [[#program-frontend-report-command][report]] is run in an Emacs session -
1. We get the current date as a =ts= struct, using date.
2. The variable =report-week-start-day= stores the day we consider the week to start with. The default is "Sunday".
2. The variable =week-start-day= stores the day we consider the week to start with. The default is "Sunday".
We check if the date from #2 is on the week start day, else decrement it till we are, using =(report-previous-week-start)=.
3. We store the date from #3 in the global variable =report--ui-date=.
4. By counting up from =report--ui-date=, we get dates for the days in the next 7 days using =(report-date->dates-in-week)=. We store them in =report--ui-week-dates=.
We check if the date from #2 is on the week start day, else decrement it till we are, using =(previous-week-start)=.
3. We store the date from #3 in the global variable =-ui-date=.
4. By counting up from =-ui-date=, we get dates for the days in the next 7 days using =(date->dates-in-week)=. We store them in =-ui-week-dates=.
The dates in =report--ui-week-dates= are what is finally used to query the data displayed in the buffer.
5. To get data for the previous/next weeks, we decrement/increment the date in =report--ui-date= by 7 days and repeat the above process (via =(report-previous-week)= / =(report-next-week)=).
The dates in =-ui-week-dates= are what is finally used to query the data displayed in the buffer.
5. To get data for the previous/next weeks, we decrement/increment the date in =-ui-date= by 7 days and repeat the above process (via =(previous-week)= / =(next-week)=).
** Literate programming
:PROPERTIES:
@ -456,14 +456,14 @@ The default is midnight, i.e. \"00:00:00\"."
*** week-start-day :custom:variable:
#+BEGIN_SRC lisp
(defcustom report-week-start-day "Sunday"
(defcustom week-start-day "Sunday"
"The day used for start of week by `report'."
:type 'string)
#+END_SRC
*** weekday-number-alist :custom:variable:
#+BEGIN_SRC lisp
(defcustom report-weekday-number-alist
(defcustom weekday-number-alist
'(("Sunday" . 0)
("Monday" . 1)
("Tuesday" . 2)
@ -478,19 +478,18 @@ The default is midnight, i.e. \"00:00:00\"."
*** previous-week-start :reader:
#+BEGIN_SRC lisp
(defun previous-week-start (ts)
"Find the previous `report-week-start-day' from TS.
"Find the previous `week-start-day' from TS.
Return a ts struct for said day's beginning.
If the day of TS is the same as the
`report-week-start-day', return TS.
`week-start-day', return TS.
TS must be a ts struct (see `ts.el')."
(loop with week-start = (alist-get report-week-start-day
report-weekday-number-alist
nil nil #'equal)
until (= week-start (ts-dow ts))
do (ts-decf (ts-day ts))
finally return ts))
(loop with week-start = (alist-get week-start-day
weekday-number-alist nil nil #'equal)
until (= week-start (ts-dow ts))
do (ts-decf (ts-day ts))
finally return ts))
#+END_SRC
*** plist-remove :function: