unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: 10779@debbugs.gnu.org
Subject: bug#10779: 24.0.93; ERC: Patch to make server response timestamp format customizable
Date: Fri, 10 Feb 2012 16:10:27 +0200	[thread overview]
Message-ID: <87pqdmzsmk.fsf@mithlond.arda> (raw)

[-- Attachment #1: Type: text/plain, Size: 665 bytes --]

[This is a "wishlist" bug report for Emacs IRC client package ERC. This
message includes a patch that fully implements my wish.]

ERC displays various server response messages with timestamps. The
timestamp formats that are hard-coded to ERC code have some unnecessary
variation. Also, it's sometimes even unclear what is the day component
and what is the month component (due to YY/MM or MM/YY differences).

I suggest making those server response timestamp formats customizable
and having the default value in international "%Y-%m-%d %T" format (as
parsed by `format-time-string' function).

This message includes a patch that fully implements this (I believe).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ERC-Make-server-response-timestamp-format-configurab.patch --]
[-- Type: text/x-diff, Size: 3072 bytes --]

From 0ef914cc32c36e97ed7fd8b2f1fa668308c34675 Mon Sep 17 00:00:00 2001
From: Teemu Likonen <tlikonen@iki.fi>
Date: Fri, 10 Feb 2012 15:24:01 +0200
Subject: [PATCH] ERC: Make server response timestamp format configurable

Introduce new user variable erc-server-timestamp-format with
international "%Y-%m-%d %T" format as its default value.
---
 lisp/erc/erc-backend.el |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 7bc5658..fb3a90f 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -393,6 +393,12 @@ isn't displayed."
   :type 'integer
   :group 'erc-server)
 
+(defcustom erc-server-timestamp-format "%Y-%m-%d %T"
+  "*Timestamp format used with server response messages.
+This string is processed using `format-time-string'."
+  :type 'string
+  :group 'erc-server)
+
 ;;; Flood-related
 
 ;; Most of this is courtesy of Jorgen Schaefer and Circe
@@ -1454,7 +1460,8 @@ add things to `%s' instead."
   "The channel topic has changed." nil
   (let* ((ch (first (erc-response.command-args parsed)))
          (topic (erc-trim-string (erc-response.contents parsed)))
-         (time (format-time-string "%T %m/%d/%y" (current-time))))
+         (time (format-time-string erc-server-timestamp-format
+                                   (current-time))))
     (multiple-value-bind (nick login host)
         (values-list (erc-parse-user (erc-response.sender parsed)))
       (erc-update-channel-member ch nick nick nil nil nil host login)
@@ -1647,7 +1654,7 @@ See `erc-display-server-message'." nil
   (multiple-value-bind (nick seconds-idle on-since time)
       (values-list (cdr (erc-response.command-args parsed)))
     (setq time (when on-since
-                 (format-time-string "%T %Y/%m/%d"
+                 (format-time-string erc-server-timestamp-format
                                      (erc-string-to-emacs-time on-since))))
     (erc-update-user-nick nick nick nil nil nil
                           (and time (format "on since %s" time)))
@@ -1724,7 +1731,8 @@ See `erc-display-server-message'." nil
                (third (erc-response.command-args parsed)))))
     (erc-display-message
      parsed 'notice (erc-get-buffer channel proc)
-     's329 ?c channel ?t (format-time-string "%A %Y/%m/%d %X" time))))
+     's329 ?c channel ?t (format-time-string erc-server-timestamp-format
+                                             time))))
 
 (define-erc-response-handler (330)
   "Nick is authed as (on Quakenet network)." nil
@@ -1761,7 +1769,7 @@ See `erc-display-server-message'." nil
   "Who set the topic, and when." nil
   (multiple-value-bind (channel nick time)
       (values-list (cdr (erc-response.command-args parsed)))
-    (setq time (format-time-string "%T %Y/%m/%d"
+    (setq time (format-time-string erc-server-timestamp-format
                                    (erc-string-to-emacs-time time)))
     (erc-update-channel-topic channel
                               (format "\C-o (%s, %s)" nick time)
-- 
1.7.2.5


             reply	other threads:[~2012-02-10 14:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 14:10 Teemu Likonen [this message]
2012-04-12 20:20 ` bug#10779: 24.0.93; ERC: Patch to make server response timestamp format customizable Lars Magne Ingebrigtsen
2012-04-13  2:59   ` Teemu Likonen
2012-04-29 18:49     ` Teemu Likonen
2012-04-29 21:38       ` Deniz Dogan
2012-04-30  4:00         ` Teemu Likonen
2012-05-13 18:51       ` Lars Magne Ingebrigtsen
2012-05-13 19:03         ` Teemu Likonen
2012-05-13 19:05           ` Lars Magne Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87pqdmzsmk.fsf@mithlond.arda \
    --to=tlikonen@iki.fi \
    --cc=10779@debbugs.gnu.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 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).