emacs-devel
[Top][All Lists]
Advanced

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

Re: rcirc update


From: Ryan Yeske
Subject: Re: rcirc update
Date: Tue, 30 Oct 2007 22:21:09 -0700

Glenn Morris <address@hidden> writes:

> Ryan Yeske wrote:
>
>> 2007-10-22  Ryan Yeske  <address@hidden>
>
> Thanks; installed.

Thanks for installing this Glenn.  I have a follow up patch here that
fixes a couple minor things.

2007-10-31  Ryan Yeske  <address@hidden>

        * net/rcirc.el (rcirc-last-quit-line, rcirc-last-line)
        (rcirc-elapsed-lines): New argument PROCESS.  Update callers.
        (rcirc-print): Only update the line count when not marking the
        line as ommittable.
        (rcirc-log-write): Specify coding system when writing logfile.
        (rcirc-markup-fill): Make sure ellipsis does not cause line to
        wrap.

Index: rcirc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/rcirc.el,v
retrieving revision 1.39
diff -c -r1.39 rcirc.el
*** rcirc.el    29 Oct 2007 01:23:19 -0000      1.39
--- rcirc.el    31 Oct 2007 05:19:26 -0000
***************
*** 1308,1336 ****
    :type 'integer
    :group 'rcirc)
  
! (defun rcirc-last-quit-line (nick target)
    "Return the line number where NICK left TARGET.
  Returns nil if the information is not recorded."
!   (let ((chanbuf (rcirc-get-buffer (rcirc-buffer-process) target)))
      (when chanbuf
        (cdr (assoc-string nick (with-current-buffer chanbuf
                                rcirc-recent-quit-alist))))))
  
! (defun rcirc-last-line (nick target)
    "Return the line from the last activity from NICK in TARGET."
!   (let* ((chanbuf (rcirc-get-buffer (rcirc-buffer-process) target))
         (line (or (cdr (assoc-string target
                                      (gethash nick (with-rcirc-server-buffer
                                                      rcirc-nick-table)) t))
!                  (rcirc-last-quit-line nick target))))
      (if line
        line
        ;;(message "line is nil for %s in %s" nick target)
        nil)))
  
! (defun rcirc-elapsed-lines (nick target)
    "Return the number of lines since activity from NICK in TARGET."
!   (let ((last-activity-line (rcirc-last-line nick target)))
      (when (and last-activity-line
               (> last-activity-line 0))
        (- rcirc-current-line last-activity-line))))
--- 1308,1336 ----
    :type 'integer
    :group 'rcirc)
  
! (defun rcirc-last-quit-line (process nick target)
    "Return the line number where NICK left TARGET.
  Returns nil if the information is not recorded."
!   (let ((chanbuf (rcirc-get-buffer process target)))
      (when chanbuf
        (cdr (assoc-string nick (with-current-buffer chanbuf
                                rcirc-recent-quit-alist))))))
  
! (defun rcirc-last-line (process nick target)
    "Return the line from the last activity from NICK in TARGET."
!   (let* ((chanbuf (rcirc-get-buffer process target))
         (line (or (cdr (assoc-string target
                                      (gethash nick (with-rcirc-server-buffer
                                                      rcirc-nick-table)) t))
!                  (rcirc-last-quit-line process nick target))))
      (if line
        line
        ;;(message "line is nil for %s in %s" nick target)
        nil)))
  
! (defun rcirc-elapsed-lines (process nick target)
    "Return the number of lines since activity from NICK in TARGET."
!   (let ((last-activity-line (rcirc-last-line process nick target)))
      (when (and last-activity-line
               (> last-activity-line 0))
        (- rcirc-current-line last-activity-line))))
***************
*** 1340,1353 ****
      rcirc-markup-my-nick
      rcirc-markup-urls
      rcirc-markup-keywords
!     rcirc-markup-bright-nicks
!     rcirc-markup-fill)
  
    "List of functions used to manipulate text before it is printed.
  
! Each function takes two arguments, SENDER, RESPONSE.  The buffer
! is narrowed with the text to be printed and the point is at the
! beginning of the `rcirc-text' propertized text.")
  
  (defun rcirc-print (process sender response target text &optional activity)
    "Print TEXT in the buffer associated with TARGET.
--- 1340,1352 ----
      rcirc-markup-my-nick
      rcirc-markup-urls
      rcirc-markup-keywords
!     rcirc-markup-bright-nicks)
  
    "List of functions used to manipulate text before it is printed.
  
! Each function takes two arguments, SENDER, and RESPONSE.  The
! buffer is narrowed with the text to be printed and the point is
! at the beginning of the `rcirc-text' propertized text.")
  
  (defun rcirc-print (process sender response target text &optional activity)
    "Print TEXT in the buffer associated with TARGET.
***************
*** 1395,1403 ****
                                                              'rcirc-text)
                                 rcirc-prompt-end-marker)))
  
-           ;; increment the line count
-           (setq rcirc-current-line (1+ rcirc-current-line))
- 
            ;; run markup functions
            (save-excursion
              (save-restriction
--- 1394,1399 ----
***************
*** 1415,1427 ****
                  (add-text-properties (point-min) (point-max)
                                       '(read-only t front-sticky t))))
              ;; make text omittable
!             (let ((last-activity-lines (rcirc-elapsed-lines sender target)))
!               (when (and (not (string= (rcirc-nick process) sender))
!                          (member response rcirc-omit-responses)
!                          (or (not last-activity-lines)
!                              (< rcirc-omit-threshold last-activity-lines)))
!                 (put-text-property (1- start) (1- rcirc-prompt-start-marker)
!                                    'invisible 'rcirc-omit)))))
  
          (set-marker-insertion-type rcirc-prompt-start-marker nil)
          (set-marker-insertion-type rcirc-prompt-end-marker nil)
--- 1411,1425 ----
                  (add-text-properties (point-min) (point-max)
                                       '(read-only t front-sticky t))))
              ;; make text omittable
!             (let ((last-activity-lines (rcirc-elapsed-lines process sender 
target)))
!               (if (and (not (string= (rcirc-nick process) sender))
!                        (member response rcirc-omit-responses)
!                        (or (not last-activity-lines)
!                            (< rcirc-omit-threshold last-activity-lines)))
!                   (put-text-property (1- start) (1- rcirc-prompt-start-marker)
!                                      'invisible 'rcirc-omit)
!                 ;; otherwise increment the line count
!                 (setq rcirc-current-line (1+ rcirc-current-line))))))
  
          (set-marker-insertion-type rcirc-prompt-start-marker nil)
          (set-marker-insertion-type rcirc-prompt-end-marker nil)
***************
*** 1504,1512 ****
    (dolist (cell rcirc-log-alist)
      (with-temp-buffer
        (insert (cdr cell))
!       (write-region (point-min) (point-max)
!                   (concat rcirc-log-directory "/" (car cell))
!                   t 'quiet)))
    (setq rcirc-log-alist nil))
  
  (defun rcirc-join-channels (process channels)
--- 1502,1511 ----
    (dolist (cell rcirc-log-alist)
      (with-temp-buffer
        (insert (cdr cell))
!       (let ((coding-system-for-write 'utf-8))
!       (write-region (point-min) (point-max)
!                     (concat rcirc-log-directory "/" (car cell))
!                     t 'quiet))))
    (setq rcirc-log-alist nil))
  
  (defun rcirc-join-channels (process channels)
***************
*** 1538,1544 ****
  
  If the record doesn't exist, and LINE is nil, set the linestamp
  to zero."
-   ;;(message "rcirc-put-nick-channel: %S %S %S" nick channel line)
    (let ((nick (rcirc-user-nick nick)))
      (with-rcirc-process-buffer process
        (let* ((chans (gethash nick rcirc-nick-table))
--- 1537,1542 ----
***************
*** 2240,2250 ****
      (let ((fill-prefix
           (or rcirc-fill-prefix
               (make-string (- (point) (line-beginning-position)) ?\s)))
!         (fill-column (cond ((eq rcirc-fill-column 'frame-width)
!                             (1- (frame-width)))
!                            (rcirc-fill-column
!                             rcirc-fill-column)
!                            (t fill-column))))
        (fill-region (point) (point-max) nil t))))
  
  ;;; handlers
--- 2238,2250 ----
      (let ((fill-prefix
           (or rcirc-fill-prefix
               (make-string (- (point) (line-beginning-position)) ?\s)))
!         (fill-column (- (cond ((eq rcirc-fill-column 'frame-width)
!                                (1- (frame-width)))
!                               (rcirc-fill-column
!                                rcirc-fill-column)
!                               (t fill-column))
!                         ;; make sure ... doesn't cause line wrapping
!                         3)))          
        (fill-region (point) (point-max) nil t))))
  
  ;;; handlers
***************
*** 2254,2260 ****
  ;; verbatim
  (defun rcirc-handler-001 (process sender args text)
    (rcirc-handler-generic process "001" sender args text)
-   ;; set the real server name
    (with-rcirc-process-buffer process
      (setq rcirc-connecting nil)
      (rcirc-reschedule-timeout process)
--- 2254,2259 ----
***************
*** 2303,2312 ****
        ;; when recently rejoining, restore the linestamp
        (rcirc-put-nick-channel process sender channel
                              (let ((last-activity-lines
!                                    (rcirc-elapsed-lines sender channel)))
                                (when (and last-activity-lines
                                           (< last-activity-lines 
rcirc-omit-threshold))
!                                 (rcirc-last-line sender channel)))))
  
      (rcirc-print process sender "JOIN" channel "")
  
--- 2302,2311 ----
        ;; when recently rejoining, restore the linestamp
        (rcirc-put-nick-channel process sender channel
                              (let ((last-activity-lines
!                                    (rcirc-elapsed-lines process sender 
channel)))
                                (when (and last-activity-lines
                                           (< last-activity-lines 
rcirc-omit-threshold))
!                                 (rcirc-last-line process sender channel)))))
  
      (rcirc-print process sender "JOIN" channel "")
  
***************
*** 2357,2371 ****
  
  (defun rcirc-maybe-remember-nick-quit (process nick channel)
    "Remember NICK as leaving CHANNEL if they recently spoke."
!   (let ((elapsed-lines (rcirc-elapsed-lines nick channel)))
      (when (and elapsed-lines
               (< elapsed-lines rcirc-omit-threshold))
        (let ((buffer (rcirc-get-buffer process channel)))
        (when buffer
          (with-current-buffer buffer
!           (let ((record (assoc-string nick rcirc-recent-quit-alist
!                                       t))
!                 (line (rcirc-last-line nick channel)))
              (if record
                  (setcdr record line)
                (setq rcirc-recent-quit-alist
--- 2356,2369 ----
  
  (defun rcirc-maybe-remember-nick-quit (process nick channel)
    "Remember NICK as leaving CHANNEL if they recently spoke."
!   (let ((elapsed-lines (rcirc-elapsed-lines process nick channel)))
      (when (and elapsed-lines
               (< elapsed-lines rcirc-omit-threshold))
        (let ((buffer (rcirc-get-buffer process channel)))
        (when buffer
          (with-current-buffer buffer
!           (let ((record (assoc-string nick rcirc-recent-quit-alist t))
!                 (line (rcirc-last-line process nick channel)))
              (if record
                  (setcdr record line)
                (setq rcirc-recent-quit-alist


Diffs between working revision and workfile end here.





reply via email to

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