Fix rcirc messages printing in the wrong place
* lisp/net/rcirc.el (rcirc-send-message): Print the message before sending it to the server. (rcirc-print): Get the time with subsecond precision. * lisp/calendar/parse-time.el (parse-time-string parse-iso8601-time-string): Accept optional second FORM arguments, with the same meaning as in `decode-time'. Mention as such in the docstring. (Bug#59501) Copyright-paperwork-exempt: yes
This commit is contained in:
parent
2901a3443c
commit
8eb6e33691
2 changed files with 15 additions and 11 deletions
|
@ -147,7 +147,7 @@ letters, digits, plus or minus signs or colons."
|
|||
;;;###autoload(put 'parse-time-rules 'risky-local-variable t)
|
||||
|
||||
;;;###autoload
|
||||
(defun parse-time-string (string)
|
||||
(defun parse-time-string (string &optional form)
|
||||
"Parse the time in STRING into (SEC MIN HOUR DAY MON YEAR DOW DST TZ).
|
||||
STRING should be an ISO 8601 time string, e.g., \"2020-01-15T16:12:21-08:00\",
|
||||
or something resembling an RFC 822 (or later) date-time, e.g.,
|
||||
|
@ -156,9 +156,11 @@ somewhat liberal in what format it accepts, and will attempt to
|
|||
return a \"likely\" value even for somewhat malformed strings.
|
||||
The values returned are identical to those of `decode-time', but
|
||||
any unknown values other than DST are returned as nil, and an
|
||||
unknown DST value is returned as -1."
|
||||
unknown DST value is returned as -1.
|
||||
|
||||
See `decode-time' for the meaning of FORM."
|
||||
(condition-case ()
|
||||
(iso8601-parse string)
|
||||
(iso8601-parse string form)
|
||||
(wrong-type-argument
|
||||
(let ((time (list nil nil nil nil nil nil nil -1 nil))
|
||||
(temp (parse-time-tokenize (downcase string))))
|
||||
|
@ -199,12 +201,14 @@ unknown DST value is returned as -1."
|
|||
(setf (nth (pop slots) time) new-val))))))))
|
||||
time))))
|
||||
|
||||
(defun parse-iso8601-time-string (date-string)
|
||||
(defun parse-iso8601-time-string (date-string &optional form)
|
||||
"Parse an ISO 8601 time string, such as \"2020-01-15T16:12:21-08:00\".
|
||||
Fall back on parsing something resembling an RFC 822 (or later) date-time.
|
||||
This function is like `parse-time-string' except that it returns
|
||||
a Lisp timestamp when successful."
|
||||
(when-let ((time (parse-time-string date-string)))
|
||||
a Lisp timestamp when successful.
|
||||
|
||||
See `decode-time' for the meaning of FORM."
|
||||
(when-let ((time (parse-time-string date-string form)))
|
||||
(encode-time time)))
|
||||
|
||||
(provide 'parse-time)
|
||||
|
|
|
@ -1233,9 +1233,9 @@ If SILENT is non-nil, do not print the message in any irc buffer."
|
|||
(let ((response (if noticep "NOTICE" "PRIVMSG")))
|
||||
(rcirc-get-buffer-create process target)
|
||||
(dolist (msg (rcirc-split-message message))
|
||||
(rcirc-send-string process response target : msg)
|
||||
(unless silent
|
||||
(rcirc-print process (rcirc-nick process) response target msg)))))
|
||||
(rcirc-print process (rcirc-nick process) response target msg))
|
||||
(rcirc-send-string process response target : msg))))
|
||||
|
||||
(defvar-local rcirc-input-ring nil
|
||||
"Ring object for input.")
|
||||
|
@ -2034,7 +2034,7 @@ connection."
|
|||
(not (string= sender (rcirc-nick process))))
|
||||
(let* ((buffer (rcirc-target-buffer process sender response target text))
|
||||
(time (if-let ((time (rcirc-get-tag "time")))
|
||||
(parse-iso8601-time-string time)
|
||||
(parse-iso8601-time-string time t)
|
||||
(current-time)))
|
||||
(inhibit-read-only t))
|
||||
(with-current-buffer buffer
|
||||
|
@ -2204,7 +2204,7 @@ The message is logged in `rcirc-log', and is later written to
|
|||
disk. PROCESS is the process object for the current connection."
|
||||
(let ((filename (funcall rcirc-log-filename-function process target))
|
||||
(time (and-let* ((time (rcirc-get-tag "time")))
|
||||
(parse-iso8601-time-string time))))
|
||||
(parse-iso8601-time-string time t))))
|
||||
(unless (null filename)
|
||||
(let ((cell (assoc-string filename rcirc-log-alist))
|
||||
(line (concat (format-time-string rcirc-time-format time)
|
||||
|
@ -2996,7 +2996,7 @@ If ARG is given, opens the URL in a new browser window."
|
|||
"Insert a timestamp."
|
||||
(goto-char (point-min))
|
||||
(let ((time (and-let* ((time (rcirc-get-tag "time")))
|
||||
(parse-iso8601-time-string time))))
|
||||
(parse-iso8601-time-string time t))))
|
||||
(insert (rcirc-facify (format-time-string rcirc-time-format time)
|
||||
'rcirc-timestamp))))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue