annotate lisp/erc/erc-stamp.el @ 94990:eab7f768651d

*** empty log message ***
author John Paul Wallington <jpw@pobox.com>
date Thu, 15 May 2008 02:01:46 +0000
parents 2a734255bcc7
children b52fd6b0e051
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
68814
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
1 ;;; erc-stamp.el --- Timestamping for ERC messages
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
2
79706
5f92874bde07 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78219
diff changeset
3 ;; Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
4
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
5 ;; Author: Mario Lang <mlang@delysid.org>
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
6 ;; Keywords: comm, processes, timestamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
7 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcStamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
8
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
10
94660
2a734255bcc7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94660
2a734255bcc7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
2a734255bcc7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
14 ;; (at your option) any later version.
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
15
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
20
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94660
2a734255bcc7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
23
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
24 ;;; Commentary:
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
25
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
26 ;; The code contained in this module is responsible for inserting
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
27 ;; timestamps into ERC buffers. In order to actually activate this,
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
28 ;; you must call `erc-timestamp-mode'.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
29
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
30 ;; You can choose between two different ways of inserting timestamps.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
31 ;; Customize `erc-insert-timestamp-function' and
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
32 ;; `erc-insert-away-timestamp-function'.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
33
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
34 ;;; Code:
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
35
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
36 (require 'erc)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
37 (require 'erc-compat)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
38
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
39 (defgroup erc-stamp nil
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
40 "For long conversation on IRC it is sometimes quite
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
41 useful to have individual messages timestamp. This
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
42 group provides settings related to the format and display
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
43 of timestamp information in `erc-mode' buffer.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
44
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
45 For timestamping to be activated, you just need to load `erc-stamp'
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
46 in your .emacs file or interactively using `load-library'."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
47 :group 'erc)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
48
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
49 (defcustom erc-timestamp-format "[%H:%M]"
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
50 "*If set to a string, messages will be timestamped.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
51 This string is processed using `format-time-string'.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
52 Good examples are \"%T\" and \"%H:%M\".
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
53
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
54 If nil, timestamping is turned off."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
55 :group 'erc-stamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
56 :type '(choice (const nil)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
57 (string)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
58
84387
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
59 (defcustom erc-timestamp-format-left "\n[%a %b %e %Y]\n"
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
60 "*If set to a string, messages will be timestamped.
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
61 This string is processed using `format-time-string'.
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
62 Good examples are \"%T\" and \"%H:%M\".
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
63
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
64 This timestamp is used for timestamps on the left side of the
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
65 screen when `erc-insert-timestamp-function' is set to
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
66 `erc-insert-timestamp-left-and-right'.
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
67
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
68 If nil, timestamping is turned off."
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
69 :group 'erc-stamp
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
70 :type '(choice (const nil)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
71 (string)))
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
72
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
73 (defcustom erc-timestamp-format-right " [%H:%M]"
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
74 "*If set to a string, messages will be timestamped.
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
75 This string is processed using `format-time-string'.
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
76 Good examples are \"%T\" and \"%H:%M\".
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
77
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
78 This timestamp is used for timestamps on the right side of the
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
79 screen when `erc-insert-timestamp-function' is set to
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
80 `erc-insert-timestamp-left-and-right'.
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
81
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
82 If nil, timestamping is turned off."
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
83 :group 'erc-stamp
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
84 :type '(choice (const nil)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
85 (string)))
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
86
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
87 (defcustom erc-insert-timestamp-function 'erc-insert-timestamp-left-and-right
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
88 "*Function to use to insert timestamps.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
89
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
90 It takes a single argument STRING which is the final string
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
91 which all text-properties already appended. This function only cares about
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
92 inserting this string at the right position. Narrowing is in effect
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
93 while it is called, so (point-min) and (point-max) determine the region to
84387
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
94 operate on.
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
95
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
96 You will probably want to set
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
97 `erc-insert-away-timestamp-function' to the same value."
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
98 :group 'erc-stamp
84387
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
99 :type '(choice (const :tag "Both sides" erc-insert-timestamp-left-and-right)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
100 (const :tag "Right" erc-insert-timestamp-right)
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
101 (const :tag "Left" erc-insert-timestamp-left)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
102 function))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
103
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
104 (defcustom erc-away-timestamp-format "<%H:%M>"
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
105 "*Timestamp format used when marked as being away.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
106
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
107 If nil, timestamping is turned off when away unless `erc-timestamp-format'
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
108 is set.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
109
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
110 If `erc-timestamp-format' is set, this will not be used."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
111 :group 'erc-stamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
112 :type '(choice (const nil)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
113 (string)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
114
84387
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
115 (defcustom erc-insert-away-timestamp-function
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
116 'erc-insert-timestamp-left-and-right
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
117 "*Function to use to insert the away timestamp.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
118
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
119 See `erc-insert-timestamp-function' for details."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
120 :group 'erc-stamp
84387
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
121 :type '(choice (const :tag "Both sides" erc-insert-timestamp-left-and-right)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
122 (const :tag "Right" erc-insert-timestamp-right)
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
123 (const :tag "Left" erc-insert-timestamp-left)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
124 function))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
125
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
126 (defcustom erc-hide-timestamps nil
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
127 "*If non-nil, timestamps will be invisible.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
128
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
129 This is useful for logging, because, although timestamps will be
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
130 hidden, they will still be present in the logs."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
131 :group 'erc-stamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
132 :type 'boolean)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
133
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
134 (defcustom erc-echo-timestamps nil
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
135 "*If non-nil, print timestamp in the minibuffer when point is moved.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
136 Using this variable, you can turn off normal timestamping,
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
137 and simply move point to an irc message to see its timestamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
138 printed in the minibuffer."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
139 :group 'erc-stamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
140 :type 'boolean)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
141
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
142 (defcustom erc-echo-timestamp-format "Timestamped %A, %H:%M:%S"
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
143 "*Format string to be used when `erc-echo-timestamps' is non-nil.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
144 This string specifies the format of the timestamp being echoed in
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
145 the minibuffer."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
146 :group 'erc-stamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
147 :type 'string)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
148
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
149 (defcustom erc-timestamp-intangible t
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
150 "*Whether the timestamps should be intangible, i.e. prevent the point
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
151 from entering them and instead jump over them."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
152 :group 'erc-stamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
153 :type 'boolean)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
154
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
155 (defface erc-timestamp-face '((t (:bold t :foreground "green")))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
156 "ERC timestamp face."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
157 :group 'erc-faces)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
158
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
159 ;;;###autoload (autoload 'erc-timestamp-mode "erc-stamp" nil t)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
160 (define-erc-module stamp timestamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
161 "This mode timestamps messages in the channel buffers."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
162 ((add-hook 'erc-mode-hook 'erc-munge-invisibility-spec)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
163 (add-hook 'erc-insert-modify-hook 'erc-add-timestamp t)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
164 (add-hook 'erc-send-modify-hook 'erc-add-timestamp t))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
165 ((remove-hook 'erc-mode-hook 'erc-munge-invisibility-spec)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
166 (remove-hook 'erc-insert-modify-hook 'erc-add-timestamp)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
167 (remove-hook 'erc-send-modify-hook 'erc-add-timestamp)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
168
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
169 (defun erc-add-timestamp ()
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
170 "Add timestamp and text-properties to message.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
171
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
172 This function is meant to be called from `erc-insert-modify-hook'
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
173 or `erc-send-modify-hook'."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
174 (unless (get-text-property (point) 'invisible)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
175 (let ((ct (current-time)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
176 (if (fboundp erc-insert-timestamp-function)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
177 (funcall erc-insert-timestamp-function
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
178 (erc-format-timestamp ct erc-timestamp-format))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
179 (error "Timestamp function unbound"))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
180 (when (and (fboundp erc-insert-away-timestamp-function)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
181 erc-away-timestamp-format
76856
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
182 (erc-away-time)
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
183 (not erc-timestamp-format))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
184 (funcall erc-insert-away-timestamp-function
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
185 (erc-format-timestamp ct erc-away-timestamp-format)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
186 (add-text-properties (point-min) (point-max)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
187 (list 'timestamp ct))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
188 (add-text-properties (point-min) (point-max)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
189 (list 'point-entered 'erc-echo-timestamp)))))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
190
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
191 (defvar erc-timestamp-last-inserted nil
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
192 "Last timestamp inserted into the buffer.")
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
193 (make-variable-buffer-local 'erc-timestamp-last-inserted)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
194
84387
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
195 (defvar erc-timestamp-last-inserted-left nil
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
196 "Last timestamp inserted into the left side of the buffer.
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
197 This is used when `erc-insert-timestamp-function' is set to
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
198 `erc-timestamp-left-and-right'")
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
199 (make-variable-buffer-local 'erc-timestamp-last-inserted-left)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
200
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
201 (defvar erc-timestamp-last-inserted-right nil
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
202 "Last timestamp inserted into the right side of the buffer.
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
203 This is used when `erc-insert-timestamp-function' is set to
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
204 `erc-timestamp-left-and-right'")
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
205 (make-variable-buffer-local 'erc-timestamp-last-inserted-right)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
206
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
207 (defcustom erc-timestamp-only-if-changed-flag t
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
208 "*Insert timestamp only if its value changed since last insertion.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
209 If `erc-insert-timestamp-function' is `erc-insert-timestamp-left', a
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
210 string of spaces which is the same size as the timestamp is added to
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
211 the beginning of the line in its place. If you use
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
212 `erc-insert-timestamp-right', nothing gets inserted in place of the
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
213 timestamp."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
214 :group 'erc-stamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
215 :type 'boolean)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
216
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
217 (defcustom erc-timestamp-right-column nil
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
218 "*If non-nil, the column at which the timestamp is inserted,
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
219 if the timestamp is to be printed to the right. If nil,
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
220 `erc-insert-timestamp-right' will use other means to determine
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
221 the correct column."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
222 :group 'erc-stamp
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
223 :type '(choice
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
224 (integer :tag "Column number")
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
225 (const :tag "Unspecified" nil)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
226
68814
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
227 (defcustom erc-timestamp-use-align-to (and (not (featurep 'xemacs))
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
228 (>= emacs-major-version 22)
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
229 (eq window-system 'x))
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
230 "*If non-nil, use the :align-to display property to align the stamp.
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
231 This gives better results when variable-width characters (like
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
232 Asian language characters and math symbols) precede a timestamp.
68498
528aecb860cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-30
Miles Bader <miles@gnu.org>
parents: 68451
diff changeset
233 Unfortunately, it only works in Emacs 22 and when using the X
68814
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
234 Window System.
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
235
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
236 A side effect of enabling this is that there will only be one
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
237 space before a right timestamp in any saved logs."
68498
528aecb860cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-30
Miles Bader <miles@gnu.org>
parents: 68451
diff changeset
238 :group 'erc-stamp
528aecb860cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-30
Miles Bader <miles@gnu.org>
parents: 68451
diff changeset
239 :type 'boolean)
528aecb860cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-30
Miles Bader <miles@gnu.org>
parents: 68451
diff changeset
240
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
241 (defun erc-insert-timestamp-left (string)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
242 "Insert timestamps at the beginning of the line."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
243 (goto-char (point-min))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
244 (let* ((ignore-p (and erc-timestamp-only-if-changed-flag
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
245 (string-equal string erc-timestamp-last-inserted)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
246 (len (length string))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
247 (s (if ignore-p (make-string len ? ) string)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
248 (unless ignore-p (setq erc-timestamp-last-inserted string))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
249 (erc-put-text-property 0 len 'field 'erc-timestamp s)
76856
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
250 (erc-put-text-property 0 len 'invisible 'timestamp s)
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
251 (insert s)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
252
68719
2de3fcf69715 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents: 68630
diff changeset
253 (defun erc-insert-aligned (string pos)
68814
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
254 "Insert STRING at the POSth column.
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
255
68814
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
256 If `erc-timestamp-use-align-to' is t, use the :align-to display
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
257 property to get to the POSth column."
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
258 (if (not erc-timestamp-use-align-to)
68719
2de3fcf69715 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents: 68630
diff changeset
259 (indent-to pos)
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
260 (insert " ")
68814
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
261 (put-text-property (1- (point)) (point) 'display
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
262 (list 'space ':align-to pos)))
68719
2de3fcf69715 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents: 68630
diff changeset
263 (insert string))
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
264
85845
e95712050fdc Silence some byte-compiler warnings in ERC
Michael Olson <mwolson@gnu.org>
parents: 84387
diff changeset
265 ;; Silence byte-compiler
e95712050fdc Silence some byte-compiler warnings in ERC
Michael Olson <mwolson@gnu.org>
parents: 84387
diff changeset
266 (eval-when-compile
e95712050fdc Silence some byte-compiler warnings in ERC
Michael Olson <mwolson@gnu.org>
parents: 84387
diff changeset
267 (defvar erc-fill-column))
e95712050fdc Silence some byte-compiler warnings in ERC
Michael Olson <mwolson@gnu.org>
parents: 84387
diff changeset
268
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
269 (defun erc-insert-timestamp-right (string)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
270 "Insert timestamp on the right side of the screen.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
271 STRING is the timestamp to insert. The function is a possible value
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
272 for `erc-insert-timestamp-function'.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
273
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
274 If `erc-timestamp-only-if-changed-flag' is nil, a timestamp is always
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
275 printed. If this variable is non-nil, a timestamp is only printed if
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
276 it is different from the last.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
277
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
278 If `erc-timestamp-right-column' is set, its value will be used as the
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
279 column at which the timestamp is to be printed. If it is nil, and
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
280 `erc-fill-mode' is active, then the timestamp will be printed just
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
281 before `erc-fill-column'. Otherwise, if the current buffer is
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
282 shown in a window, that window's width is used. If the buffer is
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
283 not shown, and `fill-column' is set, then the timestamp will be
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
284 printed just `fill-column'. As a last resort, the timestamp will
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
285 be printed just before the window-width."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
286 (unless (and erc-timestamp-only-if-changed-flag
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
287 (string-equal string erc-timestamp-last-inserted))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
288 (setq erc-timestamp-last-inserted string)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
289 (goto-char (point-max))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
290 (forward-char -1);; before the last newline
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
291 (let* ((current-window (get-buffer-window (current-buffer)))
68928
133ba2ee7e43 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-88
Miles Bader <miles@gnu.org>
parents: 68814
diff changeset
292 (str-width (string-width string))
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
293 (pos (cond
68814
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
294 (erc-timestamp-right-column erc-timestamp-right-column)
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
295 ((and (boundp 'erc-fill-mode)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
296 erc-fill-mode
68814
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
297 (boundp 'erc-fill-column)
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
298 erc-fill-column)
68928
133ba2ee7e43 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-88
Miles Bader <miles@gnu.org>
parents: 68814
diff changeset
299 (1+ (- erc-fill-column str-width)))
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
300 (fill-column
68928
133ba2ee7e43 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-88
Miles Bader <miles@gnu.org>
parents: 68814
diff changeset
301 (1+ (- fill-column str-width)))
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
302 (t
68928
133ba2ee7e43 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-88
Miles Bader <miles@gnu.org>
parents: 68814
diff changeset
303 (- (window-width) str-width 1))))
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
304 (from (point))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
305 (col (current-column))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
306 indent)
68814
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
307 ;; The following is a kludge used to calculate whether to move
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
308 ;; to the next line before inserting a stamp. It allows for
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
309 ;; some margin of error if what is displayed on the line differs
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
310 ;; from the number of characters on the line.
fe9073ac802e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents: 68719
diff changeset
311 (setq col (+ col (ceiling (/ (- col (- (point) (point-at-bol))) 1.6))))
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
312 (if (< col pos)
68719
2de3fcf69715 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents: 68630
diff changeset
313 (erc-insert-aligned string pos)
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
314 (newline)
68719
2de3fcf69715 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents: 68630
diff changeset
315 (indent-to pos)
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
316 (setq from (point))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
317 (insert string))
74484
e9bc018298b2 Update from erc--emacs--22
Miles Bader <miles@gnu.org>
parents: 68928
diff changeset
318 (erc-put-text-property from (point) 'field 'erc-timestamp)
e9bc018298b2 Update from erc--emacs--22
Miles Bader <miles@gnu.org>
parents: 68928
diff changeset
319 (erc-put-text-property from (point) 'rear-nonsticky t)
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
320 (when erc-timestamp-intangible
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
321 (erc-put-text-property from (1+ (point)) 'intangible t)))))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
322
84387
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
323 (defun erc-insert-timestamp-left-and-right (string)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
324 "This is another function that can be assigned to
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
325 `erc-insert-timestamp-function'. If the date is changed, it will
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
326 print a blank line, the date, and another blank line. If the time is
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
327 changed, it will then print it off to the right."
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
328 (let* ((ct (current-time))
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
329 (ts-left (erc-format-timestamp ct erc-timestamp-format-left))
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
330 (ts-right (erc-format-timestamp ct erc-timestamp-format-right)))
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
331 ;; insert left timestamp
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
332 (unless (string-equal ts-left erc-timestamp-last-inserted-left)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
333 (goto-char (point-min))
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
334 (erc-put-text-property 0 (length ts-left) 'field 'erc-timestamp ts-left)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
335 (insert ts-left)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
336 (setq erc-timestamp-last-inserted-left ts-left))
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
337 ;; insert right timestamp
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
338 (let ((erc-timestamp-only-if-changed-flag t)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
339 (erc-timestamp-last-inserted erc-timestamp-last-inserted-right))
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
340 (erc-insert-timestamp-right ts-right)
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
341 (setq erc-timestamp-last-inserted-right ts-right))))
4ee03308c9b6 Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents: 78219
diff changeset
342
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
343 ;; for testing: (setq erc-timestamp-only-if-changed-flag nil)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
344
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
345 (defun erc-format-timestamp (time format)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
346 "Return TIME formatted as string according to FORMAT.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
347 Return the empty string if FORMAT is nil."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
348 (if format
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
349 (let ((ts (format-time-string format time)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
350 (erc-put-text-property 0 (length ts) 'face 'erc-timestamp-face ts)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
351 (erc-put-text-property 0 (length ts) 'invisible 'timestamp ts)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
352 (erc-put-text-property 0 (length ts)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
353 'isearch-open-invisible 'timestamp ts)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
354 ;; N.B. Later use categories instead of this harmless, but
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
355 ;; inelegant, hack. -- BPT
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
356 (when erc-timestamp-intangible
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
357 (erc-put-text-property 0 (length ts) 'intangible t ts))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
358 ts)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
359 ""))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
360
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
361 ;; This function is used to munge `buffer-invisibility-spec to an
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
362 ;; appropriate value. Currently, it only handles timestamps, thus its
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
363 ;; location. If you add other features which affect invisibility,
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
364 ;; please modify this function and move it to a more appropriate
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
365 ;; location.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
366 (defun erc-munge-invisibility-spec ()
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
367 (if erc-hide-timestamps
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
368 (setq buffer-invisibility-spec
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
369 (if (listp buffer-invisibility-spec)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
370 (cons 'timestamp buffer-invisibility-spec)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
371 (list 't 'timestamp)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
372 (setq buffer-invisibility-spec
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
373 (if (listp buffer-invisibility-spec)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
374 (remove 'timestamp buffer-invisibility-spec)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
375 (list 't)))))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
376
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
377 (defun erc-hide-timestamps ()
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
378 "Hide timestamp information from display."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
379 (interactive)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
380 (setq erc-hide-timestamps t)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
381 (erc-munge-invisibility-spec))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
382
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
383 (defun erc-show-timestamps ()
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
384 "Show timestamp information on display.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
385 This function only works if `erc-timestamp-format' was previously
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
386 set, and timestamping is already active."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
387 (interactive)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
388 (setq erc-hide-timestamps nil)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
389 (erc-munge-invisibility-spec))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
390
76856
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
391 (defun erc-toggle-timestamps ()
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
392 "Hide or show timestamps in ERC buffers.
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
393
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
394 Note that timestamps can only be shown for a message using this
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
395 function if `erc-timestamp-format' was set and timestamping was
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
396 enabled when the message was inserted."
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
397 (interactive)
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
398 (if erc-hide-timestamps
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
399 (setq erc-hide-timestamps nil)
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
400 (setq erc-hide-timestamps t))
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
401 (mapc (lambda (buffer)
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
402 (with-current-buffer buffer
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
403 (erc-munge-invisibility-spec)))
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
404 (erc-buffer-list)))
2fae574a2382 Release ERC 5.2.
Miles Bader <miles@gnu.org>
parents: 75346
diff changeset
405
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
406 (defun erc-echo-timestamp (before now)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
407 "Print timestamp text-property of an IRC message.
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
408 Argument BEFORE is where point was before it got moved and
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
409 NOW is position of point currently."
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
410 (when erc-echo-timestamps
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
411 (let ((stamp (get-text-property now 'timestamp)))
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
412 (when stamp
87170
e50a2e215441 * erc-stamp.el (erc-echo-timestamp):
David Kastrup <dak@gnu.org>
parents: 85845
diff changeset
413 (message "%s" (format-time-string erc-echo-timestamp-format
e50a2e215441 * erc-stamp.el (erc-echo-timestamp):
David Kastrup <dak@gnu.org>
parents: 85845
diff changeset
414 stamp))))))
68451
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
415
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
416 (provide 'erc-stamp)
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
417
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
418 ;;; erc-stamp.el ends here
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
419 ;;
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
420 ;; Local Variables:
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
421 ;; indent-tabs-mode: t
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
422 ;; tab-width: 8
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
423 ;; End:
fc745b05e928 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff changeset
424
68630
86c478cccc57 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-46
Miles Bader <miles@gnu.org>
parents: 68498
diff changeset
425 ;; arch-tag: 57aefab4-63e0-4c48-91d5-6efa145487e0