bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)


From: Tomas Nordin
Subject: bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
Date: Sat, 10 Aug 2019 20:55:43 +0200

積丹尼 Dan Jacobson <address@hidden> writes:

>>>>>> "RMS" == Richard Stallman <address@hidden> writes:
>
>>> But do mention how to copy things like this rather than just view them.
>
> RMS> How do they get displayed?  Surely there is a way to copy text from 
> there.
> RMS> If they are displayed in the echo area, can you find them in *Messages*?
>
> Yes, but is that the "proper" way to copy them?
> One has to (know to) look in *Messages*, find the line one wants with
> the cursor, and copy that line, no more, no less.
>
> About 10 key strokes, careful positioning needed too.
>
> Clearly "looking in the dumpster for the discarded document."
>
> Thus we see the proper way to copy them has not been implemented yet.

I can add my sympathy for the desire of functionality to add date under
point to the kill ring. I was searching for such a feature at some point
(didn't find it) and wrote this function which I bound to RET in
calendar-mode-map:

(defun tn-calendar-kill-date (&optional arg)
  "Kill new a string based on point in calendar buffer in iso format

With no prefix ARG, kill the date as an iso date.
With one prefix arg ('C-u'), kill the date as an iso week.
with two prefix arg ('C-u C-u'), kill as both the iso week and date."
  (interactive "p")
  (let* ((date (calendar-cursor-to-date))
         (encoded-time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 
date)))
         (date-string (format-time-string "%Y-%m-%d" encoded-time))
         (iso-week-string (format-time-string "%gW%V" encoded-time))
         kill-string)

    (cond
     ((= arg 4)
      (setq kill-string iso-week-string))
     ((= arg 16)
      (setq kill-string (format "%s %s" iso-week-string date-string)))
     (t
      (setq kill-string date-string)))

    (kill-new kill-string)
    (message "Put %s to kill-ring" kill-string)))

Best regards
--
Tomas





reply via email to

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