Re: [O] insert date-stamp for one month

2019-08-18 Thread Uwe Brauer
>>> "KM" == Ken Mankoff  writes:

   > On 2019-08-18 at 03:58 -04, Uwe Brauer  wrote...
   >> I sometimes need to insert a date-stamp which corresponds to one month
   >> in a year, say march 2019. I usually insert <2019-03-01
   Fri> --<2019-03-31 Sun>, but this is cumbersome to do manually.
   >> 
   >> Somebody has a better idea or know how to insert something like <03.2019>

   > What about picking one day in the month, but only displaying the month?

   > e.g. 
https://emacs.stackexchange.com/questions/2243/how-can-i-change-org-mode-time-format-for-one-buffer

   > 
https://stackoverflow.com/questions/50233694/org-mode-edit-timestamp-with-custom-format

   > 
https://emacs.stackexchange.com/questions/32889/can-the-format-of-a-timestamp-in-an-org-mode-document-be-locally-adjusted-for-ex

Thanks, but this is either buffer or export specific, I want it for some
entries but not for all in my buffer. So Thomas solution, was precisely
what I was looking for.


smime.p7s
Description: S/MIME cryptographic signature


Re: [O] insert date-stamp for one month

2019-08-18 Thread Ken Mankoff
On 2019-08-18 at 03:58 -04, Uwe Brauer  wrote...
> I sometimes need to insert a date-stamp which corresponds to one month
> in a year, say march 2019. I usually insert <2019-03-01
> Fri>--<2019-03-31 Sun>, but this is cumbersome to do manually.
>
> Somebody has a better idea or know how to insert something like <03.2019>

What about picking one day in the month, but only displaying the month?

e.g. 
https://emacs.stackexchange.com/questions/2243/how-can-i-change-org-mode-time-format-for-one-buffer

https://stackoverflow.com/questions/50233694/org-mode-edit-timestamp-with-custom-format

https://emacs.stackexchange.com/questions/32889/can-the-format-of-a-timestamp-in-an-org-mode-document-be-locally-adjusted-for-ex

  -k.



Re: [O] insert date-stamp for one month

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

   > Hello,
   > Uwe Brauer wrote at 09:58 on August 18, 2019:
   > : I sometimes need to insert a date-stamp which corresponds to one month
   > : in a year, say march 2019. I usually insert 
   > : <2019-03-01 Fri>--<2019-03-31 Sun>, but this is cumbersome to do
   > : manually.

   > This'll put the computed result on the kill ring.  Beautification and
   > error checking of input values left as an exercise for the reader.

   > (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)))

Very cool, thanks a lot. But why no

(defun Plass/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)
(insert ts)))


smime.p7s
Description: S/MIME cryptographic signature


Re: [O] insert date-stamp for one month

2019-08-18 Thread Thomas Plass
Hello,

Uwe Brauer wrote at 09:58 on August 18, 2019:
: I sometimes need to insert a date-stamp which corresponds to one month
: in a year, say march 2019. I usually insert 
: <2019-03-01 Fri>--<2019-03-31 Sun>, but this is cumbersome to do
: manually.

This'll put the computed result on the kill ring.  Beautification and
error checking of input values left as an exercise for the reader.

(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)))


Regards

Thomas





[O] insert date-stamp for one month

2019-08-18 Thread Uwe Brauer

Hi 

I sometimes need to insert a date-stamp which corresponds to one month
in a year, say march 2019. I usually insert 
<2019-03-01 Fri>--<2019-03-31 Sun>, but this is cumbersome to do
manually.

Somebody has a better idea or know how to insert something like <03.2019>

Uwe Brauer


smime.p7s
Description: S/MIME cryptographic signature