Mercurial > emacs
annotate lisp/erc/erc-stamp.el @ 85380:3400b26060b4
(Fill Commands): Undocument fill-paragraph-or-region.
fill-paragraph operates on the active region in Transient Mark mode.
(Fill Prefix, Format Indentation): Replace fill-paragraph-or-region
with fill-paragraph.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Thu, 18 Oct 2007 00:09:22 +0000 |
parents | 4ee03308c9b6 |
children | e95712050fdc |
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 |
75346 | 3 ;; Copyright (C) 2002, 2003, 2004, 2006, 2007 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 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
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 |
78219
85d67fae9a94
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76856
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, or (at your option) |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
14 ;; any later version. |
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 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
24 ;; Boston, MA 02110-1301, USA. |
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 ;;; Commentary: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
27 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
28 ;; 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
|
29 ;; 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
|
30 ;; 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
|
31 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
32 ;; 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
|
33 ;; 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
|
34 ;; `erc-insert-away-timestamp-function'. |
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 ;;; Code: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
37 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
38 (require 'erc) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
39 (require 'erc-compat) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
40 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
41 (defgroup erc-stamp nil |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
42 "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
|
43 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
|
44 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
|
45 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
|
46 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
47 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
|
48 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
|
49 :group 'erc) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
50 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
51 (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
|
52 "*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
|
53 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
|
54 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
|
55 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
56 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
|
57 :group 'erc-stamp |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
58 :type '(choice (const nil) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
59 (string))) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
60 |
84387
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
61 (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
|
62 "*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
|
63 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
|
64 Good examples are \"%T\" and \"%H:%M\". |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
65 |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
66 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
|
67 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
|
68 `erc-insert-timestamp-left-and-right'. |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
69 |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
70 If nil, timestamping is turned off." |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
71 :group 'erc-stamp |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
72 :type '(choice (const nil) |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
73 (string))) |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
74 |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
75 (defcustom erc-timestamp-format-right " [%H:%M]" |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
76 "*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
|
77 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
|
78 Good examples are \"%T\" and \"%H:%M\". |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
79 |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
80 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
|
81 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
|
82 `erc-insert-timestamp-left-and-right'. |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
83 |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
84 If nil, timestamping is turned off." |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
85 :group 'erc-stamp |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
86 :type '(choice (const nil) |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
87 (string))) |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
88 |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
89 (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
|
90 "*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
|
91 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
92 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
|
93 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
|
94 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
|
95 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
|
96 operate on. |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
97 |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
98 You will probably want to set |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
99 `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
|
100 :group 'erc-stamp |
84387
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
101 :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
|
102 (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
|
103 (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
|
104 function)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
105 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
106 (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
|
107 "*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
|
108 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
109 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
|
110 is set. |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
111 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
112 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
|
113 :group 'erc-stamp |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
114 :type '(choice (const nil) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
115 (string))) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
116 |
84387
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
117 (defcustom erc-insert-away-timestamp-function |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
118 '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
|
119 "*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
|
120 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
121 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
|
122 :group 'erc-stamp |
84387
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
123 :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
|
124 (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
|
125 (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
|
126 function)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
127 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
128 (defcustom erc-hide-timestamps nil |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
129 "*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
|
130 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
131 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
|
132 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
|
133 :group 'erc-stamp |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
134 :type 'boolean) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
135 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
136 (defcustom erc-echo-timestamps nil |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
137 "*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
|
138 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
|
139 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
|
140 printed in the minibuffer." |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
141 :group 'erc-stamp |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
142 :type 'boolean) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
143 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
144 (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
|
145 "*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
|
146 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
|
147 the minibuffer." |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
148 :group 'erc-stamp |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
149 :type 'string) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
150 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
151 (defcustom erc-timestamp-intangible t |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
152 "*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
|
153 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
|
154 :group 'erc-stamp |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
155 :type 'boolean) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
156 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
157 (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
|
158 "ERC timestamp face." |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
159 :group 'erc-faces) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
160 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
161 ;;;###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
|
162 (define-erc-module stamp timestamp |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
163 "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
|
164 ((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
|
165 (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
|
166 (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
|
167 ((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
|
168 (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
|
169 (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
|
170 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
171 (defun erc-add-timestamp () |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
172 "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
|
173 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
174 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
|
175 or `erc-send-modify-hook'." |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
176 (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
|
177 (let ((ct (current-time))) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
178 (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
|
179 (funcall erc-insert-timestamp-function |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
180 (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
|
181 (error "Timestamp function unbound")) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
182 (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
|
183 erc-away-timestamp-format |
76856 | 184 (erc-away-time) |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
185 (not erc-timestamp-format)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
186 (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
|
187 (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
|
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 'timestamp ct)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
190 (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
|
191 (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
|
192 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
193 (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
|
194 "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
|
195 (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
|
196 |
84387
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
197 (defvar erc-timestamp-last-inserted-left nil |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
198 "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
|
199 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
|
200 `erc-timestamp-left-and-right'") |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
201 (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
|
202 |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
203 (defvar erc-timestamp-last-inserted-right nil |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
204 "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
|
205 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
|
206 `erc-timestamp-left-and-right'") |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
207 (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
|
208 |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
209 (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
|
210 "*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
|
211 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
|
212 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
|
213 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
|
214 `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
|
215 timestamp." |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
216 :group 'erc-stamp |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
217 :type 'boolean) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
218 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
219 (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
|
220 "*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
|
221 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
|
222 `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
|
223 the correct column." |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
224 :group 'erc-stamp |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
225 :type '(choice |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
226 (integer :tag "Column number") |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
227 (const :tag "Unspecified" nil))) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
228 |
68814
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
229 (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
|
230 (>= emacs-major-version 22) |
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
231 (eq window-system 'x)) |
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
232 "*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
|
233 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
|
234 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
|
235 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
|
236 Window System. |
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
237 |
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
238 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
|
239 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
|
240 :group 'erc-stamp |
528aecb860cf
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-30
Miles Bader <miles@gnu.org>
parents:
68451
diff
changeset
|
241 :type 'boolean) |
528aecb860cf
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-30
Miles Bader <miles@gnu.org>
parents:
68451
diff
changeset
|
242 |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
243 (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
|
244 "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
|
245 (goto-char (point-min)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
246 (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
|
247 (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
|
248 (len (length string)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
249 (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
|
250 (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
|
251 (erc-put-text-property 0 len 'field 'erc-timestamp s) |
76856 | 252 (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
|
253 (insert s))) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
254 |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
68630
diff
changeset
|
255 (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
|
256 "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
|
257 |
68814
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
258 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
|
259 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
|
260 (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
|
261 (indent-to pos) |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
262 (insert " ") |
68814
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
263 (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
|
264 (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
|
265 (insert string)) |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
266 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
267 (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
|
268 "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
|
269 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
|
270 for `erc-insert-timestamp-function'. |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
271 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
272 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
|
273 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
|
274 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
|
275 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
276 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
|
277 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
|
278 `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
|
279 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
|
280 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
|
281 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
|
282 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
|
283 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
|
284 (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
|
285 (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
|
286 (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
|
287 (goto-char (point-max)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
288 (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
|
289 (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
|
290 (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
|
291 (pos (cond |
68814
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
292 (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
|
293 ((and (boundp 'erc-fill-mode) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
294 erc-fill-mode |
68814
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
295 (boundp 'erc-fill-column) |
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
296 erc-fill-column) |
68928
133ba2ee7e43
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-88
Miles Bader <miles@gnu.org>
parents:
68814
diff
changeset
|
297 (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
|
298 (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+ (- 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 (t |
68928
133ba2ee7e43
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-88
Miles Bader <miles@gnu.org>
parents:
68814
diff
changeset
|
301 (- (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
|
302 (from (point)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
303 (col (current-column)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
304 indent) |
68814
fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Miles Bader <miles@gnu.org>
parents:
68719
diff
changeset
|
305 ;; 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
|
306 ;; 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
|
307 ;; 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
|
308 ;; 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
|
309 (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
|
310 (if (< col pos) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
68630
diff
changeset
|
311 (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
|
312 (newline) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
68630
diff
changeset
|
313 (indent-to pos) |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
314 (setq from (point)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
315 (insert string)) |
74484 | 316 (erc-put-text-property from (point) 'field 'erc-timestamp) |
317 (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
|
318 (when erc-timestamp-intangible |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
319 (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
|
320 |
84387
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
321 (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
|
322 "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
|
323 `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
|
324 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
|
325 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
|
326 (let* ((ct (current-time)) |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
327 (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
|
328 (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
|
329 ;; insert left timestamp |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
330 (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
|
331 (goto-char (point-min)) |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
332 (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
|
333 (insert ts-left) |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
334 (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
|
335 ;; insert right timestamp |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
336 (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
|
337 (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
|
338 (erc-insert-timestamp-right ts-right) |
4ee03308c9b6
Sync ERC 5.3 (devel) from upstream
Michael Olson <mwolson@gnu.org>
parents:
78219
diff
changeset
|
339 (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
|
340 |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
341 ;; 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
|
342 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
343 (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
|
344 "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
|
345 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
|
346 (if format |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
347 (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
|
348 (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
|
349 (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
|
350 (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
|
351 'isearch-open-invisible 'timestamp ts) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
352 ;; 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
|
353 ;; inelegant, hack. -- BPT |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
354 (when erc-timestamp-intangible |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
355 (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
|
356 ts) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
357 "")) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
358 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
359 ;; 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
|
360 ;; 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
|
361 ;; 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
|
362 ;; 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
|
363 ;; location. |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
364 (defun erc-munge-invisibility-spec () |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
365 (if erc-hide-timestamps |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
366 (setq buffer-invisibility-spec |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
367 (if (listp buffer-invisibility-spec) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
368 (cons 'timestamp buffer-invisibility-spec) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
369 (list 't 'timestamp))) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
370 (setq buffer-invisibility-spec |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
371 (if (listp buffer-invisibility-spec) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
372 (remove 'timestamp buffer-invisibility-spec) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
373 (list 't))))) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
374 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
375 (defun erc-hide-timestamps () |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
376 "Hide timestamp information from display." |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
377 (interactive) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
378 (setq erc-hide-timestamps t) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
379 (erc-munge-invisibility-spec)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
380 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
381 (defun erc-show-timestamps () |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
382 "Show timestamp information on display. |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
383 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
|
384 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
|
385 (interactive) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
386 (setq erc-hide-timestamps nil) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
387 (erc-munge-invisibility-spec)) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
388 |
76856 | 389 (defun erc-toggle-timestamps () |
390 "Hide or show timestamps in ERC buffers. | |
391 | |
392 Note that timestamps can only be shown for a message using this | |
393 function if `erc-timestamp-format' was set and timestamping was | |
394 enabled when the message was inserted." | |
395 (interactive) | |
396 (if erc-hide-timestamps | |
397 (setq erc-hide-timestamps nil) | |
398 (setq erc-hide-timestamps t)) | |
399 (mapc (lambda (buffer) | |
400 (with-current-buffer buffer | |
401 (erc-munge-invisibility-spec))) | |
402 (erc-buffer-list))) | |
403 | |
68451
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
404 (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
|
405 "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
|
406 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
|
407 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
|
408 (when erc-echo-timestamps |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
409 (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
|
410 (when stamp |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
411 (message (format-time-string erc-echo-timestamp-format |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
412 stamp)))))) |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
413 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
414 (provide 'erc-stamp) |
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 ;;; erc-stamp.el ends here |
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 ;; Local Variables: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
419 ;; indent-tabs-mode: t |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
420 ;; tab-width: 8 |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
421 ;; End: |
fc745b05e928
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-22
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
422 |
68630
86c478cccc57
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-46
Miles Bader <miles@gnu.org>
parents:
68498
diff
changeset
|
423 ;; arch-tag: 57aefab4-63e0-4c48-91d5-6efa145487e0 |