emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/erc/erc-stamp.el


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/erc/erc-stamp.el
Date: Wed, 08 Feb 2006 02:41:27 +0000

Index: emacs/lisp/erc/erc-stamp.el
diff -u emacs/lisp/erc/erc-stamp.el:1.3 emacs/lisp/erc/erc-stamp.el:1.4
--- emacs/lisp/erc/erc-stamp.el:1.3     Sun Feb  5 12:42:51 2006
+++ emacs/lisp/erc/erc-stamp.el Wed Feb  8 02:41:23 2006
@@ -199,20 +199,20 @@
     (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 @@
           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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]