Re: [O] [week?] (was: insert date-stamp for one month)

2019-08-19 Thread Thomas Plass
Hello,

Uwe Brauer wrote at 16:33 on August 18, 2019:

: The problem seems to be that there is no function
: calendar-last-day-of-week.

Well, there is, it's called `calendar-week-end-day'.

This returns the index into 'calendar-day-name-array.  Note that the
variable 'calendar-week-start-day should be set properly (it defaults
to 0 = $SUNDAY, while I set this to 1, meaning $MONDAY).

This will only get you as far as computing the name of the day.
Computing a date and/or timestamp for an instance of that day name
relative to a date is quite another matter.  The file
calendar/time-date.el might provide useful stuff for doing so.

Thomas



[O] [week?] (was: insert date-stamp for one month)

2019-08-18 Thread Uwe Brauer
>>> "TP" == Thomas Plass  writes:
hi 


   > Hello,

I was wondering could that also be done for a week instead of a month

   > (defun Brauer/make-month-timerange (year month)
   >   (interactive
   >(list (string-to-int (read-string "Year: " (int-to-string (nth 5 
(decode-time)
   >  (string-to-int (read-string "Month: " (int-to-string (nth 4 
(decode-time)))
   >   (let* ((last-day (calendar-last-day-of-month month year))
   >  (start (list 0 0 0 1 month year))
   >  (end (list 0 0 0 last-day month year))
   >  (ts (format "<%d-%02d-%02d %s>--<%d-%02d-%02d %s>"
   >  year month 1 (format-time-string "%a" (apply 
#'encode-time start))
   >  year month last-day (format-time-string "%a" (apply 
#'encode-time end)
   > (message (substitute-command-keys (concat "Use \\[yank] to yank " ts)))
   > (kill-new ts)))

The problem seems to be that there is no function
calendar-last-day-of-week. I tried to play a little around but it seems 
difficult.

Anyhow

Uwe Brauer 


smime.p7s
Description: S/MIME cryptographic signature