From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ryan Yeske Newsgroups: gmane.emacs.devel Subject: Re: rcirc update Date: Tue, 30 Oct 2007 22:21:09 -0700 Message-ID: <87bqafq2pm.fsf@tarn.lan> References: <87sl43ni06.fsf@tarn.lan> <5zlk9miuec.fsf@fencepost.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1193808097 20321 80.91.229.12 (31 Oct 2007 05:21:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 31 Oct 2007 05:21:37 +0000 (UTC) Cc: emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 31 06:21:34 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1In61F-00021G-5k for ged-emacs-devel@m.gmane.org; Wed, 31 Oct 2007 06:21:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1In614-0007eV-UX for ged-emacs-devel@m.gmane.org; Wed, 31 Oct 2007 01:21:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1In611-0007bM-4h for emacs-devel@gnu.org; Wed, 31 Oct 2007 01:21:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1In60z-0007YC-Mo for emacs-devel@gnu.org; Wed, 31 Oct 2007 01:21:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1In60z-0007Xy-Gl for emacs-devel@gnu.org; Wed, 31 Oct 2007 01:21:17 -0400 Original-Received: from mail.tor.primus.ca ([216.254.136.21] helo=mail-06.primus.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1In60u-0008CE-V9; Wed, 31 Oct 2007 01:21:13 -0400 Original-Received: from [209.90.176.221] (helo=tarn.lan) by mail-06.primus.ca with esmtp (Exim 4.63) (envelope-from ) id 1In60t-0003RN-0r; Wed, 31 Oct 2007 01:21:11 -0400 In-Reply-To: <5zlk9miuec.fsf@fencepost.gnu.org> (message from Glenn Morris on Sun, 28 Oct 2007 21:25:47 -0400) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:82187 Archived-At: Glenn Morris writes: > Ryan Yeske wrote: > >> 2007-10-22 Ryan Yeske > > 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 * 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.