unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36979: Calendar: mention how to copy date
@ 2019-08-08 18:56 積丹尼 Dan Jacobson
  2019-08-08 23:07 ` Glenn Morris
       [not found] ` <handler.36979.D36979.156530565717008.notifdone@debbugs.gnu.org>
  0 siblings, 2 replies; 16+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-08-08 18:56 UTC (permalink / raw)
  To: 36979

(info "(emacs) To Other Calendar")'s
p C		calendar-chinese-print-date
p a		calendar-astro-print-day-number
p b		calendar-bahai-print-date
p c		calendar-iso-print-date...
are great, except you need to mention:

If you not only want to view the date in the minibuffer, but also want
to copy it, then also use (view-echo-area-messages). It is bound to C-h e...





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: Calendar: mention how to copy date
  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>
  1 sibling, 0 replies; 16+ messages in thread
From: Glenn Morris @ 2019-08-08 23:07 UTC (permalink / raw)
  To: 36979-done


No. It is not appropriate to mention basic information like in reference
to specific commands.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
       [not found] ` <handler.36979.D36979.156530565717008.notifdone@debbugs.gnu.org>
@ 2019-08-09  1:31   ` 積丹尼 Dan Jacobson
  2019-08-10  2:30     ` Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-08-09  1:31 UTC (permalink / raw)
  To: 36979

Well fine.
But do mention how to copy things like this rather than just view them.
I suppose the author of Calendar simply forgot to add a way to copy
them.
Just like if a browser offered link previews in the corner, but no way
to copy link URLs.
So it is an oversight. The only workaround it to dig it out with C-h e.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  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
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2019-08-10  2:30 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 36979

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > But do mention how to copy things like this rather than just view them.

How do they get displayed?  Surely there is a way to copy text from there.
If they are displayed in the echo area, can you find them in *Messages*?

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-10  2:30     ` Richard Stallman
@ 2019-08-10 18:25       ` 積丹尼 Dan Jacobson
  2019-08-10 18:55         ` Tomas Nordin
  2019-08-11  2:39         ` Richard Stallman
  0 siblings, 2 replies; 16+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-08-10 18:25 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 36979

>>>>> "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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-10 18:25       ` 積丹尼 Dan Jacobson
@ 2019-08-10 18:55         ` Tomas Nordin
  2019-08-10 19:05           ` 積丹尼 Dan Jacobson
  2019-08-11 11:13           ` Deus Max
  2019-08-11  2:39         ` Richard Stallman
  1 sibling, 2 replies; 16+ messages in thread
From: Tomas Nordin @ 2019-08-10 18:55 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 36979

積丹尼 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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-10 18:55         ` Tomas Nordin
@ 2019-08-10 19:05           ` 積丹尼 Dan Jacobson
  2019-08-11 11:13           ` Deus Max
  1 sibling, 0 replies; 16+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-08-10 19:05 UTC (permalink / raw)
  To: Tomas Nordin; +Cc: 36979

Yeah, like e.g., shr-maybe-probe-and-copy-url: Copy the URL under point to the kill ring.
The user might not just want to see things, but copy them.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-10 18:25       ` 積丹尼 Dan Jacobson
  2019-08-10 18:55         ` Tomas Nordin
@ 2019-08-11  2:39         ` Richard Stallman
  2019-08-11  2:50           ` 積丹尼 Dan Jacobson
  1 sibling, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2019-08-11  2:39 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 36979

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > 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.

*Messages* is a general-purpose feature that lets you do all sorts of
things with echo area messages, including copy them.  Having
general-purpose features like this makes Emacs cleaner and simpler
than having many special-purpose features for doing various jobs of
this kind.

Instead of making and documenting some special-purpose features for
copying messages from calendar commands, we should document that you
can do it by going to the *Messages* buffer.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-11  2:39         ` Richard Stallman
@ 2019-08-11  2:50           ` 積丹尼 Dan Jacobson
  2019-08-12  1:36             ` Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-08-11  2:50 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 36979

Digging things out of *Messages* is hard unless one uses the mouse.
(And when one does, doing so actually alters *Messages* at the bottom,
with mark set messages.)





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-10 18:55         ` Tomas Nordin
  2019-08-10 19:05           ` 積丹尼 Dan Jacobson
@ 2019-08-11 11:13           ` Deus Max
  2019-08-11 12:37             ` Deus Max
  1 sibling, 1 reply; 16+ messages in thread
From: Deus Max @ 2019-08-11 11:13 UTC (permalink / raw)
  To: Tomas Nordin; +Cc: 36979

On Sat, Aug 10 2019, Tomas Nordin wrote:

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

Hi Tomas,

Great function for it can be very useful thank you.

I slightly modified it, so it doesn't blow up when the cursor is not on
a date and provides an informative message.

;; Copied from bug#36979 by Tomas Nordin, emacs-bugs maillist.
(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 t)))
    (if date
        ;; date is valid
        (let* ((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)))
          ;; add to kill ring
          (kill-new kill-string)
          (message "Put %s to kill-ring" kill-string))
      ;; date is not valid - cursor is not on a date.
      (message "Not on a date."))))






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-11 11:13           ` Deus Max
@ 2019-08-11 12:37             ` Deus Max
  0 siblings, 0 replies; 16+ messages in thread
From: Deus Max @ 2019-08-11 12:37 UTC (permalink / raw)
  To: Tomas Nordin; +Cc: 36979

On Sun, Aug 11 2019, Deus Max wrote:

> On Sat, Aug 10 2019, Tomas Nordin wrote:
>
>>
>> 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:
>>

I believe it is probably more intuitive is to bind it to "k" instead of
RET.








^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-11  2:50           ` 積丹尼 Dan Jacobson
@ 2019-08-12  1:36             ` Richard Stallman
  2019-08-12 21:55               ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2019-08-12  1:36 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 36979

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Digging things out of *Messages* is hard unless one uses the mouse.

I use Emacs on a text terminal -- no mouse -- and I don't find that to be so.


-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-12  1:36             ` Richard Stallman
@ 2019-08-12 21:55               ` 積丹尼 Dan Jacobson
  2019-08-13  2:14                 ` Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-08-12 21:55 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 36979

>> Digging things out of *Messages* is hard unless one uses the mouse.

RMS> I use Emacs on a text terminal -- no mouse -- and I don't find that to be so.

Post the (view-lossage) of what you use.
At least 10 keystroks when one would have been enough.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-12 21:55               ` 積丹尼 Dan Jacobson
@ 2019-08-13  2:14                 ` Richard Stallman
  2019-08-17  1:15                   ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2019-08-13  2:14 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 36979

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > At least 10 keystroks when one would have been enough.

It might be so, but how often does the average user do such a thing?
Once a week?

You can define a keyboard macro if you do it more often.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-13  2:14                 ` Richard Stallman
@ 2019-08-17  1:15                   ` 積丹尼 Dan Jacobson
  2019-08-17 22:20                     ` Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-08-17  1:15 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 36979

Maybe there should be a generic
copy-previous-message - copies last message we saw in the minibuffer to the kill ring.
copy-next-message     - will copy the next message we will see in the minibuffer to the kill ring.

With argument copies the ARGth message.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#36979: closed (Re: bug#36979: Calendar: mention how to copy date)
  2019-08-17  1:15                   ` 積丹尼 Dan Jacobson
@ 2019-08-17 22:20                     ` Richard Stallman
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2019-08-17 22:20 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 36979

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Maybe there should be a generic
  > copy-previous-message - copies last message we saw in the _echo area_ to the kill ring.
  > copy-next-message     - will copy the next message we will see in the _echo area_ to the kill ring.

I think the first one could be useful.  Repeating the command could
get you successively earlier messages, each replacing the one you got
before.

It could display the message again in the echo area as well as putting
it in the kill ring, adding the string "Copied: " to show that the
message was not emitted just now.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-08-17 22:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).