summaryrefslogtreecommitdiff
path: root/lisp/erc/erc-stamp.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/erc/erc-stamp.el')
-rw-r--r--lisp/erc/erc-stamp.el26
1 files changed, 14 insertions, 12 deletions
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index afd070e4e06..ead847ff73f 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -1,6 +1,6 @@
;;; erc-stamp.el --- Timestamping for Emacs IRC CLient
-;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
;; Author: Mario Lang <mlang@delysid.org>
;; Keywords: comm, processes, timestamp
@@ -199,20 +199,20 @@ Window System."
(erc-put-text-property 0 len 'field 'erc-timestamp s)
(insert s)))
-(defun erc-insert-aligned (string pos &optional fallback)
+(defun erc-insert-aligned (string pos)
"Insert STRING based on a fraction of the width of the buffer.
Fraction is roughly (/ POS (window-width)).
-If `erc-timestamp-right-align-by-pixel' is nil, use
-\(- POS FALLBACK) to determine how many spaces to insert."
+If `erc-timestamp-right-align-by-pixel' is nil, insert STRING at the
+POSth column, without using pixel coordinates."
(if (not erc-timestamp-right-align-by-pixel)
- (insert (make-string (- pos fallback) ? ) string)
+ (indent-to pos)
(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)))
+ `(space :align-to (,offset)))))
+ (insert string))
(defun erc-insert-timestamp-right (string)
"Insert timestamp on the right side of the screen.
@@ -257,14 +257,16 @@ be printed just before the window-width."
indent)
;; deal with variable-width characters
(setq pos (- pos (string-width string))
- ;; the following is a kludge that works with most
- ;; international input
+ ;; The following is a kludge that works with most
+ ;; international input. It is now only used to calculate
+ ;; whether to move to the next line before inserting a
+ ;; stamp.
col (+ col (ceiling (/ (- col (- (point) (point-at-bol))) 1.6))))
(if (< col pos)
- (erc-insert-aligned string pos col)
+ (erc-insert-aligned string pos)
(newline)
- (setq from (point))
(indent-to pos)
+ (setq from (point))
(insert string))
(erc-put-text-property from (1+ (point)) 'field 'erc-timestamp)
(erc-put-text-property from (1+ (point)) 'rear-nonsticky t)
@@ -338,4 +340,4 @@ NOW is position of point currently."
;; tab-width: 8
;; End:
-;; arch-tag: 9f6d31bf-61ba-45c5-bdbf-56331486ea27
+;; arch-tag: 57aefab4-63e0-4c48-91d5-6efa145487e0