all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tomas Nordin <tomasn@posteo.net>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 36979@debbugs.gnu.org
Subject: bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
Date: Sat, 10 Aug 2019 20:55:43 +0200	[thread overview]
Message-ID: <8736i86ea8.fsf@fliptop.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <8736i8yj24.5.fsf@jidanni.org>

積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:

>>>>>> "RMS" == Richard Stallman <rms@gnu.org> 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	other threads:[~2019-08-10 18:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 18:56 bug#36979: Calendar: mention how to copy date 積丹尼 Dan Jacobson
2019-08-08 23:07 ` Glenn Morris
     [not found] ` <handler.36979.D36979.156530565717008.notifdone@debbugs.gnu.org>
2019-08-09  1:31   ` bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date) 積丹尼 Dan Jacobson
2019-08-10  2:30     ` Richard Stallman
2019-08-10 18:25       ` 積丹尼 Dan Jacobson
2019-08-10 18:55         ` Tomas Nordin [this message]
2019-08-10 19:05           ` 積丹尼 Dan Jacobson
2019-08-11 11:13           ` Deus Max
2019-08-11 12:37             ` Deus Max
2019-08-11  2:39         ` Richard Stallman
2019-08-11  2:50           ` 積丹尼 Dan Jacobson
2019-08-12  1:36             ` Richard Stallman
2019-08-12 21:55               ` 積丹尼 Dan Jacobson
2019-08-13  2:14                 ` Richard Stallman
2019-08-17  1:15                   ` 積丹尼 Dan Jacobson
2019-08-17 22:20                     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736i86ea8.fsf@fliptop.i-did-not-set--mail-host-address--so-tickle-me \
    --to=tomasn@posteo.net \
    --cc=36979@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.