--- /dev/null
++2006-01-30 Michael Olson <mwolson@gnu.org>
++
++ * erc-stamp.el (erc-timestamp-right-align-by-pixel): New option
++ that determines whether to use pixel values to align right
++ timestamps. The default is not to do so, since it only works with
++ Emacs22 on X, and even then some people have trouble.
++ (erc-insert-aligned): Use `erc-timestamp-right-align-by-pixel'.
++
+ 2006-01-29 Michael Olson <mwolson@gnu.org>
+
+ * ChangeLog, ChangeLog.2005, ChangeLog.2004, ChangeLog.2003,
+ ChangeLog.2002, ChangeLog.2001: Add "See ChangeLog.NNNN" line for
+ earlier changes. Use utf-8 encoding. Fix some accent typos.
+
+ * erc-speedbar.el (erc-speedbar-buttons): Fix reference to free
+ variable.
+ (erc-speedbar-goto-buffer): Fix compiler warning.
+
+ * erc-ibuffer.el: Use `define-ibuffer-filter' instead of
+ `ibuffer-degine-limiter'. Use `define-ibuffer-column' instead of
+ `ibuffer-define-column'. Require 'ibuf-ext so that the macros
+ work without compiler warnings.
+
+ * man/erc.texi (Obtaining ERC, Installation): Note that these
+ sections may be skipped if using the version of ERC that comes
+ with Emacs.
+
+ 2006-01-29 Edward O'Connor <ted@oconnor.cx>
+
+ * erc-viper.el: Remove. Now that ERC is included in Emacs, these
+ work-arounds live in Viper itself.
+
+ 2006-01-28 Michael Olson <mwolson@gnu.org>
+
+ * erc-*.el, erc.texi, NEWS: Add Arch taglines as per Emacs
+ guidelines.
+
+ * erc-*.el: Space out copyright years like the rest of Emacs. Use
+ the Emacs copyright statement. Refer to ourselves as ERC rather
+ than "Emacs IRC Client", since there are now several IRC clients
+ for Emacs.
+
+ * erc-compat.el (erc-emacs-build-time): Define as a variable.
+
+ * erc-log.el (erc-log-setup-logging): Use write-file-functions.
+
+ * erc-ibuffer.el: Require 'erc.
+
+ * erc-stamp.el (erc-insert-aligned): Only use the special text
+ property when window-system is X.
+
+ * erc.texi: Adapt for inclusion in Emacs.
+
+ 2006-01-28 Johan Bockgård <bojohan@users.sourceforge.net>
+
+ * erc.el (erc-format-message): More `cl' breakage; don't use
+ `oddp'.
+
+ 2006-01-27 Michael Olson <mwolson@gnu.org>
+
+ * debian/changelog: Update for new release.
+
+ * debian/control (Description): Update.
+
+ * debian/rules: Concatenate ChangeLog for 2005.
+
+ * Makefile (MISC): Include ChangeLog.2005 and erc.texi.
+ (debrelease, release): Copy images directory.
+
+ * NEWS: Spelling fixes. Add items for recent changes.
+
+ * erc.el (erc): Move call to erc-update-modules before the call to
+ erc-mode. This should fix a timestamp display issue.
+ (erc-version-string): Release ERC 5.1.
+
+ 2006-01-26 Michael Olson <mwolson@gnu.org>
+
+ * erc-stamp.el (erc-insert-aligned): New function that inserts
+ text in an perfectly-aligned way relative to the right margin. It
+ only works well with Emacs22. A sane fallback is provided for
+ other versions of Emacs.
+ (erc-insert-timestamp-right): Use the new function.
+
+ 2006-01-25 Edward O'Connor <ted@oconnor.cx>
+
+ * erc.el (erc-modules): Ensure that `erc-button-mode' gets enabled
+ before `erc-match-mode'.
+
+ * erc-match.el (match): Append `erc-match-message' to
+ `erc-insert-modify-hook'.
+
+ 2006-01-25 Michael Olson <mwolson@gnu.org>
+
+ * FOR-RELEASE: Mark last release requirement as done.
+
+ * Makefile (realclean, distclean): Remove docs.
+
+ * erc.texi: Take care of all pre-5.1 items.
+
+ * erc-backend.el (erc-server-send, erc-server-send-queue): Wrap
+ `process-send-string' in `condition-case' to avoid an error when
+ quitting ERC.
+
+ * erc-stamp.el (erc-insert-timestamp-right): Try to deal with
+ variable-width characters in the timestamp and on the same line.
+ The latter is a kludge, but it seems to work with most of the
+ input I've thrown at it so far. It's certainly better than going
+ past the end of line consistently when we have variable-width
+ characters on the same line. When `erc-timestamp-intangible' is
+ non-nil, add intangible properties to the whitespace as well, so
+ that hitting <end> does what you'd expect.
+
+ * erc.el (erc-flood-protect, erc-toggle-flood-control): Update
+ this to only use boolean values for `erc-flood-protect'. Update
+ documentation.
+ (erc-cmd-QUIT): Set the active buffer to be the server buffer, so
+ that any QUIT-related messages go there.
+ (erc): Try to be more clever about re-using channel buffers when
+ automatically re-connecting. Thanks to e1f for noticing.
+
+ 2006-01-23 Michael Olson <mwolson@gnu.org>
+
+ * ChangeLog.2005: Remove erroneous line.
+
+ * FOR-RELEASE: Make that the Makefile tweaking is complete.
+ (NEWS): Mark as done.
+
+ * Makefile (MANUAL): New option indicating the name of the manual.
+ (PREFIX, ELISPDIR, INFODIR): New options that specify the
+ directories to install lisp code and info manuals to. PREFIX is
+ used only by ELISPDIR and INFODIR.
+ (all): Call `lisp' and create the manual.
+ (lisp): Compile lisp code.
+ (%.info, %.html): New rules that make Info files and HTML files,
+ respectively, from a TexInfo source.
+ (doc): Create both the Info and HTML versions of the manual. This
+ is for the user -- we never call it automatically.
+ (install-info): Install Info files.
+ (install-bin): Install compiled and source Lisp files.
+ (todo): Remove, since it seems pointless.
+
+ * NEWS: Update.
+
+ * README: Add Installation instructions. Tweak layout.
+
+ * erc.texi: Work on some pre-5.1 items.
+
+ * erc-stamp.el, erc-track.el: Move some functions and options in
+ order to get rid of a few compiler warnings.
+
+ * erc.el (erc-modules): Enable readonly by default. This will
+ prevent new users from accidentally removing old messages, which
+ could be disconcerting. Also enable stamp by default, since
+ timestamps are a fairly standard feature among IRC clients.
+
+ * erc-button.el: Munge whitespace.
+
+ * erc-identd.el (erc-identd-start): Instead of throwing an error,
+ just try to use the obsolete function.
+
+ 2006-01-22 Michael Olson <mwolson@gnu.org>
+
+ * erc-backend.el (erc-decode-string-from-target): Make sure that
+ we have a string as an argument. If not, coerce it to the empty
+ string. Hopefully, this will work painlessly around an edge case
+ related to quitting ERC around the same time a message comes in.
+
+ 2006-01-22 Johan Bockgård <bojohan@users.sourceforge.net>
+
+ * erc-track.el: Use `(eval-when-compile (require 'cl))' (for
+ `case'). Doc fixes.
+ (erc-find-parsed-property): Simplify.
+ (erc-track-get-active-buffer): Fix logic. Simplify.
+ (erc-track-switch-buffer): Remove unused variable `dir'. Simplify.
+
+ * erc-speak.el: Doc fixes.
+ (erc-speak-region): `propertize' --> `erc-propertize'.
+
+ * erc-dcc.el (erc-dcc-chat-parse-output): `propertize' -->
+ `erc-propertize'.
+
+ * erc-button.el (erc-button-add-button): Take erc-fill-prefix into
+ account when wrapping URLs.
+
+ * erc-bbdb.el (erc-bbdb-elide-display): Doc fix.
+
+ * erc-backend.el (define-erc-response-handler): Doc fix.
+
+ 2006-01-22 Michael Olson <mwolson@gnu.org>
+
+ * erc.el (erc-update-modules): Use `require' instead of `load',
+ but prevent it from causing errors, in order to preserve the
+ previous behavior.
+
+ 2006-01-21 Michael Olson <mwolson@gnu.org>
+
+ * FOR-RELEASE (Source): Mark cl task as done.
+
+ * Makefile (erc-auto.el): Call erc-generate-autoloads rather than
+ generate-autoloads.
+ (erc-auto.el, %.elc): Don't show command, just its output.
+
+ * NEWS: Add items from 2005-01-01 to 2005-08-13.
+
+ * debian/copyright (Copyright): Update.
+
+ * erc-auto.in (erc-generate-autoloads): Rename from
+ generate-autoloads.
+
+ * erc.el, erc-autoaway.el, erc-backend.el: Use
+ erc-server-process-alive instead of erc-process-alive.
+
+ * erc.el, erc-backend.el, erc-ezbounce.el, erc-list.el,
+ erc-log.el, erc-match.el, erc-nets.el, erc-netsplit.el,
+ erc-nicklist.el, erc-nickserv.el, erc-notify.el, erc-pcomplete.el:
+ Use (eval-when-compile (require 'cl)), so that compilation doesn't
+ fail.
+
+ * erc-fill.el, erc-truncate.el: Whitespace munging.
+
+ * erc.el: Update copyright notice. Remove eval-after-load code.
+ (erc-with-buffer): Docfix.
+ (erc-once-with-server-event, erc-once-with-server-event-global)
+ (erc-with-buffer, erc-with-all-buffers-of-server): Use erc-gensym
+ instead of gensym.
+ (erc-banlist-update): Use erc-delete-if instead of delete-if.
+ (erc): Call `erc-update-modules' here.
+
+ * erc-backend.el: Require 'erc-compat to minimize compiler
+ warnings.
+ (erc-decode-parsed-server-response): Docfix.
+ (erc-server-process-alive): Move here from erc.el and rename from
+ `erc-process-alive'.
+ (erc-server-send, erc-remove-channel-users): Make sure process is
+ alive before sending data to it.
+
+ * erc-bbdb.el: Update copyright years.
+ (erc-bbdb-whois): Remove overexuberant comment.
+
+ * erc-button.el: Require erc-fill, since we make liberal use of
+ `erc-fill-column'.
+
+ * erc-compat.el (erc-const-expr-p, erc-list*, erc-assert): New
+ functions, the latter of which provides an `assert' equivalent.
+ (erc-remove-if-not): New function that provides a simple
+ implementation of `remove-if-not'.
+ (erc-gensym): New function that provides a simple implementation
+ of `gensym'.
+ (erc-delete-if): New function that provides a simple
+ implementation of `delete-if'.
+ (erc-member-if): New function that provides a simple
+ implementation of `member-if'.
+ (field-end): Remove this, since it is unused, and later versions
+ of XEmacs have this function already.
+ (erc-function-arglist): Moved here from erc.el.
+ (erc-delete-dups): New compatibility function for dealing with
+ XEmacs.
+ (erc-subseq): New function copied from cl-extra.el.
+
+ * erc-dcc.el: Require pcomplete during compilation to avoid
+ compiler warnings.
+ (erc-unpack-int, erc-dcc-send-filter)
+ (erc-dcc-get-filter): Use erc-assert instead of assert.
+ (pcomplete/erc-mode/DCC): Use erc-remove-if-not instead of
+ remove-if-not.
+
+ * erc-match.el (erc-log-matches): Fix compiler warning.
+
+ * erc-nicklist.el: Update copyright notice.
+ (erc-nicklist-menu): Change use of caadr to (car (cadr ...)).
+ (erc-nicklist-bitlbee-connected-p): Remove.
+ (erc-nicklist-insert-medium-name-or-icon): Accept channel
+ argument. Use it to determine whether we are on bitlbee. Now
+ that bitlbee names its channel "&bitlbee", this is trivial.
+ (erc-nicklist-insert-contents): Pass channel as specified above.
+ Don't try to determine whether we are on bitlbee here.
+ (erc-nicklist-channel-users-info): Use erc-remove-if-not instead
+ of remove-if-not.
+ (erc-nicklist-search-for-nick): Use erc-member-if instead of
+ member-if.
+
+ * erc-notify.el (erc-notify-QUIT): Use erc-delete-if with a
+ partially-evaluated lambda expression instead of `delete' and
+ `find'.
+
+ * erc-track.el: Use erc-assert.
+ (erc-track-modified-channels): Remove use of `return'.
+ (erc-track-modified-channels): Use `cadr' instead of `second',
+ since otherwise we would need yet another eval-when-compile line.
+
+ 2006-01-19 Michael Olson <mwolson@gnu.org>
+
+ * erc-backend.el (erc-process-sentinel-1): Remove attempt to
+ detect SIGPIPE, since it doesn't work.
+
+ 2006-01-10 Diane Murray <disumu@x3y2z1.net>
+
+ * erc-spelling.el: Updated copyright years.
+ (define-erc-module): Enable/disable `flyspell-mode' for all open
+ ERC buffers as well.
+ (erc-spelling-dictionaries): Reworded customize description.
+
+ * erc.el (erc-command-symbol): New function.
+ (erc-extract-command-from-line): Use `erc-command-symbol'. This
+ fixes a bug where "Symbol's function definition is void:
+ erc-cmd-LIST" would be shown after typing /list at the prompt (the
+ command was interned because erc-menu.el uses it and is enabled by
+ default whereas erc-list.el is not).
+
+ * NEWS: Started a list of renamed variables.
+
+ * erc.el: Reworded the message sent when defining variable
+ aliases.
+ (erc-command-indicator-face): Doc fix.
+ (erc-modules): Enable the match module by default which makes
+ current nickname highlighting on as the default.
+
+ * erc-button.el: Updated copyright years.
+ (erc-button): New face.
+ (erc-button-face): Use `erc-button'.
+ (erc-button-nickname-face): New customizable variable.
+ (erc-button-add-nickname-buttons, erc-button-add-buttons-1): Send
+ new argument to `erc-button-add-button'.
+ (erc-button-add-button): Doc fix. Added new argument to function
+ definition, NICK-P. If it's a nickname, use
+ `erc-button-nickname-face', otherwise use `erc-button-face'. This
+ makes channel tracking and buttons work better together when
+ `erc-button-buttonize-nicks' is enabled, since there is a nickname
+ on just about every line.
+
+ * erc-track.el (erc-track-use-faces): Doc fix.
+ (erc-track-faces-priority-list): Added `erc-button' to list.
+ (erc-track-priority-faces-only): Doc fix.
+
+ 2006-01-09 Diane Murray <disumu@x3y2z1.net>
+
+ * erc-button.el (erc-button-url-regexp): Use `concat' so the
+ regexp is not one long line.
+ (erc-button-alist): Fixed so that customizing works correctly.
+ Reorganized. Removed lambda functions with more than two lines.
+ Doc fix.
+ (erc-button-describe-symbol, erc-button-beats-to-time): New
+ functions. Moved from `erc-button-alist'.
+
+ 2006-01-07 Michael Olson <mwolson@gnu.org>
+
+ * erc-backend.el (erc-process-sentinel-1): Don't try to re-open a
+ process if a SIGPIPE occurs. This happens when a new message
+ comes in at the same time a /quit is requested.
+ (erc-process-sentinel): Use string-match rather than string= to do
+ these comparisons. Matching literal newlines makes me nervous.
+
+ * erc-track.el (erc-track-remove-from-mode-line): Handle case
+ where global-mode-string is not a list. Emacs22 permits this.
+
+
+ See ChangeLog.2005 for earlier changes.
+
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ Copying and distribution of this file, with or without modification,
+ are permitted provided the copyright notice and this notice are preserved.
+
+ ;; Local Variables:
+ ;; coding: utf-8
+ ;; End:
+
+ ;; arch-tag: 865a75f6-2bcb-46df-bf0c-b514dadf688a
--- /dev/null
-If the current version of Emacs doesn't support this, use
+ ;;; erc-stamp.el --- Timestamping for Emacs IRC CLient
+
+ ;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ ;; Author: Mario Lang <mlang@delysid.org>
+ ;; Keywords: comm, processes, timestamp
+ ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcStamp
+
+ ;; This file is part of GNU Emacs.
+
+ ;; GNU Emacs is free software; you can redistribute it and/or modify
+ ;; it under the terms of the GNU General Public License as published by
+ ;; the Free Software Foundation; either version 2, or (at your option)
+ ;; any later version.
+
+ ;; GNU Emacs is distributed in the hope that it will be useful,
+ ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ;; GNU General Public License for more details.
+
+ ;; You should have received a copy of the GNU General Public License
+ ;; along with GNU Emacs; see the file COPYING. If not, write to the
+ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ ;; Boston, MA 02110-1301, USA.
+
+ ;;; Commentary:
+
+ ;; The code contained in this module is responsible for inserting
+ ;; timestamps into ERC buffers. In order to actually activate this,
+ ;; you must call `erc-timestamp-mode'.
+
+ ;; You can choose between two different ways of inserting timestamps.
+ ;; Customize `erc-insert-timestamp-function' and
+ ;; `erc-insert-away-timestamp-function'.
+
+ ;;; Code:
+
+ (require 'erc)
+ (require 'erc-compat)
+
+ (defgroup erc-stamp nil
+ "For long conversation on IRC it is sometimes quite
+ useful to have individual messages timestamp. This
+ group provides settings related to the format and display
+ of timestamp information in `erc-mode' buffer.
+
+ For timestamping to be activated, you just need to load `erc-stamp'
+ in your .emacs file or interactively using `load-library'."
+ :group 'erc)
+
+ (defcustom erc-timestamp-format "[%H:%M]"
+ "*If set to a string, messages will be timestamped.
+ This string is processed using `format-time-string'.
+ Good examples are \"%T\" and \"%H:%M\".
+
+ If nil, timestamping is turned off."
+ :group 'erc-stamp
+ :type '(choice (const nil)
+ (string)))
+
+ (defcustom erc-insert-timestamp-function 'erc-insert-timestamp-right
+ "*Function to use to insert timestamps.
+
+ It takes a single argument STRING which is the final string
+ which all text-properties already appended. This function only cares about
+ inserting this string at the right position. Narrowing is in effect
+ while it is called, so (point-min) and (point-max) determine the region to
+ operate on."
+ :group 'erc-stamp
+ :type '(choice (const :tag "Right" erc-insert-timestamp-right)
+ (const :tag "Left" erc-insert-timestamp-left)
+ function))
+
+ (defcustom erc-away-timestamp-format "<%H:%M>"
+ "*Timestamp format used when marked as being away.
+
+ If nil, timestamping is turned off when away unless `erc-timestamp-format'
+ is set.
+
+ If `erc-timestamp-format' is set, this will not be used."
+ :group 'erc-stamp
+ :type '(choice (const nil)
+ (string)))
+
+ (defcustom erc-insert-away-timestamp-function 'erc-insert-timestamp-right
+ "*Function to use to insert the away timestamp.
+
+ See `erc-insert-timestamp-function' for details."
+ :group 'erc-stamp
+ :type '(choice (const :tag "Right" erc-insert-timestamp-right)
+ (const :tag "Left" erc-insert-timestamp-left)
+ function))
+
+ (defcustom erc-hide-timestamps nil
+ "*If non-nil, timestamps will be invisible.
+
+ This is useful for logging, because, although timestamps will be
+ hidden, they will still be present in the logs."
+ :group 'erc-stamp
+ :type 'boolean)
+
+ (defcustom erc-echo-timestamps nil
+ "*If non-nil, print timestamp in the minibuffer when point is moved.
+ Using this variable, you can turn off normal timestamping,
+ and simply move point to an irc message to see its timestamp
+ printed in the minibuffer."
+ :group 'erc-stamp
+ :type 'boolean)
+
+ (defcustom erc-echo-timestamp-format "Timestamped %A, %H:%M:%S"
+ "*Format string to be used when `erc-echo-timestamps' is non-nil.
+ This string specifies the format of the timestamp being echoed in
+ the minibuffer."
+ :group 'erc-stamp
+ :type 'string)
+
+ (defcustom erc-timestamp-intangible t
+ "*Whether the timestamps should be intangible, i.e. prevent the point
+ from entering them and instead jump over them."
+ :group 'erc-stamp
+ :type 'boolean)
+
+ (defface erc-timestamp-face '((t (:bold t :foreground "green")))
+ "ERC timestamp face."
+ :group 'erc-faces)
+
+ ;;;###autoload (autoload 'erc-timestamp-mode "erc-stamp" nil t)
+ (define-erc-module stamp timestamp
+ "This mode timestamps messages in the channel buffers."
+ ((add-hook 'erc-mode-hook 'erc-munge-invisibility-spec)
+ (add-hook 'erc-insert-modify-hook 'erc-add-timestamp t)
+ (add-hook 'erc-send-modify-hook 'erc-add-timestamp t))
+ ((remove-hook 'erc-mode-hook 'erc-munge-invisibility-spec)
+ (remove-hook 'erc-insert-modify-hook 'erc-add-timestamp)
+ (remove-hook 'erc-send-modify-hook 'erc-add-timestamp)))
+
+ (defun erc-add-timestamp ()
+ "Add timestamp and text-properties to message.
+
+ This function is meant to be called from `erc-insert-modify-hook'
+ or `erc-send-modify-hook'."
+ (unless (get-text-property (point) 'invisible)
+ (let ((ct (current-time)))
+ (if (fboundp erc-insert-timestamp-function)
+ (funcall erc-insert-timestamp-function
+ (erc-format-timestamp ct erc-timestamp-format))
+ (error "Timestamp function unbound"))
+ (when (and (fboundp erc-insert-away-timestamp-function)
+ erc-away-timestamp-format
+ (with-current-buffer (erc-server-buffer) erc-away)
+ (not erc-timestamp-format))
+ (funcall erc-insert-away-timestamp-function
+ (erc-format-timestamp ct erc-away-timestamp-format)))
+ (add-text-properties (point-min) (point-max)
+ (list 'timestamp ct))
+ (add-text-properties (point-min) (point-max)
+ (list 'point-entered 'erc-echo-timestamp)))))
+
+ (defvar erc-timestamp-last-inserted nil
+ "Last timestamp inserted into the buffer.")
+ (make-variable-buffer-local 'erc-timestamp-last-inserted)
+
+ (defcustom erc-timestamp-only-if-changed-flag t
+ "*Insert timestamp only if its value changed since last insertion.
+ If `erc-insert-timestamp-function' is `erc-insert-timestamp-left', a
+ string of spaces which is the same size as the timestamp is added to
+ the beginning of the line in its place. If you use
+ `erc-insert-timestamp-right', nothing gets inserted in place of the
+ timestamp."
+ :group 'erc-stamp
+ :type 'boolean)
+
+ (defcustom erc-timestamp-right-column nil
+ "*If non-nil, the column at which the timestamp is inserted,
+ if the timestamp is to be printed to the right. If nil,
+ `erc-insert-timestamp-right' will use other means to determine
+ the correct column."
+ :group 'erc-stamp
+ :type '(choice
+ (integer :tag "Column number")
+ (const :tag "Unspecified" nil)))
+
++(defcustom erc-timestamp-right-align-by-pixel nil
++ "*If non-nil, insert the right timestamp based on a pixel value.
++This is needed when variable-width text precedes a timestamp.
++Unfortunately, it only works in Emacs 22 and when using the X
++Window System."
++ :group 'erc-stamp
++ :type 'boolean)
++
+ (defun erc-insert-timestamp-left (string)
+ "Insert timestamps at the beginning of the line."
+ (goto-char (point-min))
+ (let* ((ignore-p (and erc-timestamp-only-if-changed-flag
+ (string-equal string erc-timestamp-last-inserted)))
+ (len (length string))
+ (s (if ignore-p (make-string len ? ) string)))
+ (unless ignore-p (setq erc-timestamp-last-inserted string))
+ (erc-put-text-property 0 len 'field 'erc-timestamp s)
+ (insert s)))
+
+ (defun erc-insert-aligned (string pos &optional fallback)
+ "Insert STRING based on a fraction of the width of the buffer.
+ Fraction is roughly (/ POS (window-width)).
+
- (if (or (featurep 'xemacs)
- (< emacs-major-version 22)
- (not (eq window-system 'x)))
++If `erc-timestamp-right-align-by-pixel' is nil, use
+ \(- POS FALLBACK) to determine how many spaces to insert."
++ (if (not erc-timestamp-right-align-by-pixel)
+ (insert (make-string (- pos fallback) ? ) string)
+ (insert " ")
+ (let ((offset (floor (* (/ (1- pos) (window-width) 1.0)
+ (nth 2 (window-inside-pixel-edges))))))
+ (put-text-property (1- (point)) (point) 'display
+ `(space :align-to (,offset))))
+ (insert string)))
+
+ (defun erc-insert-timestamp-right (string)
+ "Insert timestamp on the right side of the screen.
+ STRING is the timestamp to insert. The function is a possible value
+ for `erc-insert-timestamp-function'.
+
+ If `erc-timestamp-only-if-changed-flag' is nil, a timestamp is always
+ printed. If this variable is non-nil, a timestamp is only printed if
+ it is different from the last.
+
+ If `erc-timestamp-right-column' is set, its value will be used as the
+ column at which the timestamp is to be printed. If it is nil, and
+ `erc-fill-mode' is active, then the timestamp will be printed just
+ before `erc-fill-column'. Otherwise, if the current buffer is
+ shown in a window, that window's width is used. If the buffer is
+ not shown, and `fill-column' is set, then the timestamp will be
+ printed just `fill-column'. As a last resort, the timestamp will
+ be printed just before the window-width."
+ (unless (and erc-timestamp-only-if-changed-flag
+ (string-equal string erc-timestamp-last-inserted))
+ (setq erc-timestamp-last-inserted string)
+ (goto-char (point-max))
+ (forward-char -1);; before the last newline
+ (let* ((current-window (get-buffer-window (current-buffer)))
+ (pos (cond
+ (erc-timestamp-right-column
+ (+ erc-timestamp-right-column (length string)))
+ ((and (boundp 'erc-fill-mode)
+ erc-fill-mode
+ (boundp 'erc-fill-column))
+ (1+ erc-fill-column))
+ (current-window
+ (- (window-width current-window)
+ 1))
+ (fill-column
+ (1+ fill-column))
+ (t
+ (- (window-width)
+ 1))))
+ (from (point))
+ (col (current-column))
+ indent)
+ ;; deal with variable-width characters
+ (setq pos (- pos (string-width string))
+ ;; the following is a kludge that works with most
+ ;; international input
+ col (+ col (ceiling (/ (- col (- (point) (point-at-bol))) 1.6))))
+ (if (< col pos)
+ (erc-insert-aligned string pos col)
+ (newline)
+ (setq from (point))
+ (indent-to pos)
+ (insert string))
+ (erc-put-text-property from (1+ (point)) 'field 'erc-timestamp)
+ (erc-put-text-property from (1+ (point)) 'rear-nonsticky t)
+ (when erc-timestamp-intangible
+ (erc-put-text-property from (1+ (point)) 'intangible t)))))
+
+ ;; for testing: (setq erc-timestamp-only-if-changed-flag nil)
+
+ (defun erc-format-timestamp (time format)
+ "Return TIME formatted as string according to FORMAT.
+ Return the empty string if FORMAT is nil."
+ (if format
+ (let ((ts (format-time-string format time)))
+ (erc-put-text-property 0 (length ts) 'face 'erc-timestamp-face ts)
+ (erc-put-text-property 0 (length ts) 'invisible 'timestamp ts)
+ (erc-put-text-property 0 (length ts)
+ 'isearch-open-invisible 'timestamp ts)
+ ;; N.B. Later use categories instead of this harmless, but
+ ;; inelegant, hack. -- BPT
+ (when erc-timestamp-intangible
+ (erc-put-text-property 0 (length ts) 'intangible t ts))
+ ts)
+ ""))
+
+ ;; This function is used to munge `buffer-invisibility-spec to an
+ ;; appropriate value. Currently, it only handles timestamps, thus its
+ ;; location. If you add other features which affect invisibility,
+ ;; please modify this function and move it to a more appropriate
+ ;; location.
+ (defun erc-munge-invisibility-spec ()
+ (if erc-hide-timestamps
+ (setq buffer-invisibility-spec
+ (if (listp buffer-invisibility-spec)
+ (cons 'timestamp buffer-invisibility-spec)
+ (list 't 'timestamp)))
+ (setq buffer-invisibility-spec
+ (if (listp buffer-invisibility-spec)
+ (remove 'timestamp buffer-invisibility-spec)
+ (list 't)))))
+
+ (defun erc-hide-timestamps ()
+ "Hide timestamp information from display."
+ (interactive)
+ (setq erc-hide-timestamps t)
+ (erc-munge-invisibility-spec))
+
+ (defun erc-show-timestamps ()
+ "Show timestamp information on display.
+ This function only works if `erc-timestamp-format' was previously
+ set, and timestamping is already active."
+ (interactive)
+ (setq erc-hide-timestamps nil)
+ (erc-munge-invisibility-spec))
+
+ (defun erc-echo-timestamp (before now)
+ "Print timestamp text-property of an IRC message.
+ Argument BEFORE is where point was before it got moved and
+ NOW is position of point currently."
+ (when erc-echo-timestamps
+ (let ((stamp (get-text-property now 'timestamp)))
+ (when stamp
+ (message (format-time-string erc-echo-timestamp-format
+ stamp))))))
+
+ (provide 'erc-stamp)
+
+ ;;; erc-stamp.el ends here
+ ;;
+ ;; Local Variables:
+ ;; indent-tabs-mode: t
+ ;; tab-width: 8
+ ;; End:
+
+ ;; arch-tag: 9f6d31bf-61ba-45c5-bdbf-56331486ea27