unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* rcirc update
@ 2007-06-09  5:21 Ryan Yeske
  2007-06-13 20:30 ` Chong Yidong
  0 siblings, 1 reply; 22+ messages in thread
From: Ryan Yeske @ 2007-06-09  5:21 UTC (permalink / raw)
  To: emacs-devel

2007-06-08  Ryan Yeske  <rcyeske@gmail.com>

	* rcirc.el (rcirc-format-response-string): Use rcirc-nick-syntax
	around bright and dim regexps. Make sure bright and dim matches
	use word anchors.  Send text through rcirc-markup functions.
	(rcirc-url-regexp): Add single quote character.
	(rcirc-connect): Write logs to disk on auto-save-hook.  Make
	server a non-optional argument.
	(rcirc-log-alist): New variable.
	(rcirc-log-directory): Make customizable.
	(rcirc-log-flag): New customizable variable.
	(rcirc-log): New function.
	(rcirc-print): Use above function.
	(rcirc-log-write): New function.
	(rcirc-generate-new-buffer-name): Strip text properties.
	(rcirc-switch-to-buffer-function): Remove variable.
	(rcirc-last-non-irc-buffer): Remove variable.
	(rcirc-non-irc-buffer): Add function.
	(rcirc-next-active-buffer): Use above function.
	(rcirc-keepalive): Send KEEPALIVE ctcp instead of a PING.
	(rcirc-handler-ctcp-KEEPALIVE): Add handler.
	(rcirc-handler-CTCP): Don't print KEEPALIVE responses.
	(rcirc-omit-mode): Add minor-mode.
	(rcirc-mode-map): Change C-c C-o binding.
	(rcirc-mode): Clear mode-line-process. Use a custom
	fill-paragraph-function.  Set up buffer-invisibility-spec.
	(rcirc-response-formats): Remove timestamp code.
	(rcirc-omit-responses): Add variable.
	(rcirc-print): Don't put the overlay arrow on potentially omitted
	lines.  Log line to disk.  Record activity for private messages
	from /dim nicks.  Facify the fill-prefix with rcirc-timestamp
	face.
	(rcirc-jump-to-first-unread-line): Print message if there is no
	unread text.
	(rcirc-clear-unread): New function.
	(rcirc-markup-text-functions): Add variable.
	(rcirc-markup-timestamp, rcirc-markup-fill): Add functions.
	(rcirc-debug): Don't mess with window configuration.
	(rcirc-send-message): Send message before printing locally.  Add
	SILENT argument, do not print message if non-nil.
	(rcirc-visible-buffers): New function and variable.
	(rcirc-window-configuration-change-1): Add function.
	(rcirc-target-buffer): Make sure ACTIONs don't get sent to the
	server buffer.
	(rcirc-clean-up-buffer): Set rcirc-target to nil when finished.
	(rcirc-fill-paragraph): Add function.
	(rcirc-record-activity, rcirc-window-configuration-change-1): Only
	update the activity string if it has actually changed.
	(rcirc-update-activity-string): Remove padding characters from the
	mode-line string.
	(rcirc-disconnect-buffer): New function to be called when a
	channel is parted or the user quits.
	(rcirc-server-name): Warn when the server-name hasn't been set.
	(rcirc-window-configuration-change): Postpone work until
	post-command-hook.
	(rcirc-window-configuration-change-1): Update mode-line and
	overlay arrows here.
	(rcirc-authenticate): Fix chanserv identification.
	(rcirc-default-server): Remove variable.
	(rcirc): Connect according to rcirc-connections.
	(rcirc-connections): Add variable.
	(rcirc-startup-channels-alist): Remove variable.
	(rcirc-startup-channels): Remove function.

Index: rcirc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/net/rcirc.el,v
retrieving revision 1.32.2.2
diff -c -r1.32.2.2 rcirc.el
*** rcirc.el	21 May 2007 19:38:52 -0000	1.32.2.2
--- rcirc.el	9 Jun 2007 05:10:29 -0000
***************
*** 55,63 ****
    :link '(custom-manual "(rcirc)")
    :group 'applications)
  
! (defcustom rcirc-default-server "irc.freenode.net"
!   "The default server to connect to."
!   :type 'string
    :group 'rcirc)
  
  (defcustom rcirc-default-port 6667
--- 55,78 ----
    :link '(custom-manual "(rcirc)")
    :group 'applications)
  
! (defcustom rcirc-connections
!   '(("irc.freenode.net" :channels ("#rcirc")))
!   "An alist of IRC connections to establish when running `rcirc'.
! Each element looks like (SERVER-NAME PARAMETERS).
! 
! SERVER-NAME is a string describing the server to connect
! to.
! 
! PARAMETERS is a plist of optional connection parameters.  Valid
! properties are: nick (a string), port (number or string),
! user-name (string), full-name (string), and channels (list of
! strings)."
!   :type '(alist :key-type string 
! 		:value-type (plist :options ((nick string)
! 					     (port integer)
! 					     (user-name string)
! 					     (full-name string)
! 					     (channels (repeat string)))))
    :group 'rcirc)
  
  (defcustom rcirc-default-port 6667
***************
*** 82,93 ****
    :type 'string
    :group 'rcirc)
  
- (defcustom rcirc-startup-channels-alist '(("^irc.freenode.net$" "#rcirc"))
-   "Alist of channels to join at startup.
- Each element looks like (SERVER-REGEXP . CHANNEL-LIST)."
-   :type '(alist :key-type string :value-type (repeat string))
-   :group 'rcirc)
- 
  (defcustom rcirc-fill-flag t
    "*Non-nil means line-wrap messages printed in channel buffers."
    :type 'boolean
--- 97,102 ----
***************
*** 95,105 ****
  
  (defcustom rcirc-fill-column nil
    "*Column beyond which automatic line-wrapping should happen.
! If nil, use value of `fill-column'.
! If `window-width', use the window's width as maximum.
! If `frame-width', use the frame's width as maximum."
    :type '(choice (const :tag "Value of `fill-column'")
- 		 (const :tag "Full window width" window-width)
  		 (const :tag "Full frame width" frame-width)
  		 (integer :tag "Number of columns"))
    :group 'rcirc)
--- 104,112 ----
  
  (defcustom rcirc-fill-column nil
    "*Column beyond which automatic line-wrapping should happen.
! If nil, use value of `fill-column'.  If 'frame-width, use the
! maximum frame width."
    :type '(choice (const :tag "Value of `fill-column'")
  		 (const :tag "Full frame width" frame-width)
  		 (integer :tag "Number of columns"))
    :group 'rcirc)
***************
*** 120,125 ****
--- 127,137 ----
    "If non-nil, activity in this buffer is considered low priority.")
  (make-variable-buffer-local 'rcirc-low-priority-flag)
  
+ (defvar rcirc-omit-mode nil
+   "Non-nil if Rcirc-Omit mode is enabled.
+ Use the command `rcirc-omit-mode' to change this variable.")
+ (make-variable-buffer-local 'rcirc-omit-mode)
+ 
  (defcustom rcirc-time-format "%H:%M "
    "*Describes how timestamps are printed.
  Used as the first arg to `format-time-string'."
***************
*** 145,151 ****
    :group 'rcirc)
  
  (defcustom rcirc-scroll-show-maximum-output t
!   "*If non-nil, scroll buffer to keep the point at the bottom of the window."
    :type 'boolean
    :group 'rcirc)
  
--- 157,164 ----
    :group 'rcirc)
  
  (defcustom rcirc-scroll-show-maximum-output t
!   "*If non-nil, scroll buffer to keep the point at the bottom of
! the window."
    :type 'boolean
    :group 'rcirc)
  
***************
*** 319,354 ****
  (defconst rcirc-id-string (concat "rcirc on GNU Emacs " emacs-version))
  \f
  (defvar rcirc-startup-channels nil)
  ;;;###autoload
  (defun rcirc (arg)
!   "Connect to IRC.
! If ARG is non-nil, prompt for a server to connect to."
    (interactive "P")
    (if arg
!       (let* ((server (read-string "IRC Server: " rcirc-default-server))
! 	     (port (read-string "IRC Port: " (number-to-string rcirc-default-port)))
! 	     (nick (read-string "IRC Nick: " rcirc-default-nick))
  	     (channels (split-string
  			(read-string "IRC Channels: "
! 				     (mapconcat 'identity (rcirc-startup-channels server) " "))
  			"[, ]+" t)))
! 	(rcirc-connect server port nick rcirc-default-user-name rcirc-default-user-full-name
  		       channels))
!     ;; make new connection using defaults unless already connected to
!     ;; the default rcirc-server
!     (let (connected)
!       (dolist (p (rcirc-process-list))
! 	(when (string= rcirc-default-server (process-name p))
! 	  (setq connected p)))
!       (if (not connected)
! 	  (rcirc-connect rcirc-default-server rcirc-default-port
! 			 rcirc-default-nick rcirc-default-user-name
! 			 rcirc-default-user-full-name
! 			 (rcirc-startup-channels rcirc-default-server))
! 	(switch-to-buffer (process-buffer connected))
! 	(message "Connected to %s"
! 		 (process-contact (get-buffer-process (current-buffer))
! 				  :host))))))
  ;;;###autoload
  (defalias 'irc 'rcirc)
  
--- 332,400 ----
  (defconst rcirc-id-string (concat "rcirc on GNU Emacs " emacs-version))
  \f
  (defvar rcirc-startup-channels nil)
+ 
  ;;;###autoload
  (defun rcirc (arg)
!   "Connect to all servers in `rcirc-connections'.
! 
! Do not connect to a server if it is already connected.
! 
! If ARG is non-nil, instead prompt for connection parameters."
    (interactive "P")
    (if arg
!       (let* ((server (completing-read "IRC Server: " 
! 				      rcirc-connections
! 				      nil nil
! 				      (caar rcirc-connections)))
! 	     (server-plist (cdr (assoc-string server rcirc-connections)))
! 	     (port (read-string "IRC Port: " 
! 				(number-to-string
! 				 (or (plist-get server-plist 'port)
! 				     rcirc-default-port))))
! 	     (nick (read-string "IRC Nick: "
! 				(or (plist-get server-plist 'nick)
! 				    rcirc-default-nick)))
  	     (channels (split-string
  			(read-string "IRC Channels: "
! 				     (mapconcat 'identity 
! 						(plist-get server-plist
! 							   'channels)
! 						" "))
  			"[, ]+" t)))
! 	(rcirc-connect server port nick rcirc-default-user-name
! 		       rcirc-default-user-full-name
  		       channels))
!     ;; connect to servers in `rcirc-connections'
!     (let (connected-servers)
!       (dolist (c rcirc-connections)
! 	(let ((server (car c))
! 	      (port (or (plist-get (cdr c) 'port) rcirc-default-port))
! 	      (nick (or (plist-get (cdr c) 'nick) rcirc-default-nick))
! 	      (user-name (or (plist-get (cdr c) 'user-name)
! 			     rcirc-default-user-name))
! 	      (full-name (or (plist-get (cdr c) 'full-name) 
! 			     rcirc-default-user-full-name))
! 	      (channels (plist-get (cdr c) 'channels)))
! 	  (when server
! 	    (let (connected)
! 	      (dolist (p (rcirc-process-list))
! 		(when (string= server (process-name p))
! 		  (setq connected p)))
! 	      (if (not connected)
! 		  (condition-case e
! 		      (rcirc-connect server port nick user-name 
! 				     full-name channels)
! 		    (quit (message "Quit connecting to %s" server))) 
! 		(with-current-buffer (process-buffer connected)
! 		  (setq connected-servers
! 			(cons (process-contact (get-buffer-process
! 						(current-buffer)) :host)
! 			      connected-servers))))))))
!       (when connected-servers
! 	(message "Already connected to %s"
! 		 (concat (mapconcat 'identity (butlast connected-servers) ", ")
! 			 ", and " (car (last connected-servers))))))))
! 
  ;;;###autoload
  (defalias 'irc 'rcirc)
  
***************
*** 365,371 ****
  (defvar rcirc-process nil)
  
  ;;;###autoload
! (defun rcirc-connect (&optional server port nick user-name full-name startup-channels)
    (save-excursion
      (message "Connecting to %s..." server)
      (let* ((inhibit-eol-conversion)
--- 411,418 ----
  (defvar rcirc-process nil)
  
  ;;;###autoload
! (defun rcirc-connect (server &optional port nick user-name full-name 
! 			     startup-channels)
    (save-excursion
      (message "Connecting to %s..." server)
      (let* ((inhibit-eol-conversion)
***************
*** 374,380 ****
  				(string-to-number port)
  			      port)
  			  rcirc-default-port))
- 	   (server (or server rcirc-default-server))
  	   (nick (or nick rcirc-default-nick))
  	   (user-name (or user-name rcirc-default-user-name))
  	   (full-name (or full-name rcirc-default-user-full-name))
--- 421,426 ----
***************
*** 412,417 ****
--- 458,465 ----
        (make-local-variable 'rcirc-connecting)
        (setq rcirc-connecting t)
  
+       (add-hook 'auto-save-hook 'rcirc-log-write)
+ 
        ;; identify
        (rcirc-send-string process (concat "NICK " nick))
        (rcirc-send-string process (concat "USER " user-name
***************
*** 446,457 ****
        (mapc (lambda (process)
  	      (with-rcirc-process-buffer process
  		(when (not rcirc-connecting)
! 		  (rcirc-send-string process (concat "PING " (rcirc-server-name process))))))
              (rcirc-process-list))
      ;; no processes, clean up timer
      (cancel-timer rcirc-keepalive-timer)
      (setq rcirc-keepalive-timer nil)))
  
  (defvar rcirc-debug-buffer " *rcirc debug*")
  (defvar rcirc-debug-flag nil
    "If non-nil, write information to `rcirc-debug-buffer'.")
--- 494,514 ----
        (mapc (lambda (process)
  	      (with-rcirc-process-buffer process
  		(when (not rcirc-connecting)
! 		  (rcirc-send-string process 
! 				     (format "PRIVMSG %s :\C-aKEEPALIVE %f\C-a"
! 					     rcirc-nick
! 					     (time-to-seconds
! 					      (current-time)))))))
              (rcirc-process-list))
      ;; no processes, clean up timer
      (cancel-timer rcirc-keepalive-timer)
      (setq rcirc-keepalive-timer nil)))
  
+ (defun rcirc-handler-ctcp-KEEPALIVE (process target sender message)
+   (with-rcirc-process-buffer process
+     (setq header-line-format (format "%f" (- (time-to-seconds (current-time))
+ 					     (string-to-number message))))))
+ 
  (defvar rcirc-debug-buffer " *rcirc debug*")
  (defvar rcirc-debug-flag nil
    "If non-nil, write information to `rcirc-debug-buffer'.")
***************
*** 461,474 ****
  is non-nil."
    (when rcirc-debug-flag
      (save-excursion
!       (save-window-excursion
!         (set-buffer (get-buffer-create rcirc-debug-buffer))
!         (goto-char (point-max))
!         (insert (concat
!                  "["
!                  (format-time-string "%Y-%m-%dT%T ") (process-name process)
!                  "] "
!                  text))))))
  
  (defvar rcirc-sentinel-hooks nil
    "Hook functions called when the process sentinel is called.
--- 518,530 ----
  is non-nil."
    (when rcirc-debug-flag
      (save-excursion
!       (set-buffer (get-buffer-create rcirc-debug-buffer))
!       (goto-char (point-max))
!       (insert (concat
! 	       "["
! 	       (format-time-string "%Y-%m-%dT%T ") (process-name process)
! 	       "] "
! 	       text)))))
  
  (defvar rcirc-sentinel-hooks nil
    "Hook functions called when the process sentinel is called.
***************
*** 486,497 ****
  			       (process-name process)
  			       sentinel
  			       (process-status process)) (not rcirc-target))
! 	  ;; remove the prompt from buffers
! 	  (let ((inhibit-read-only t))
! 	    (delete-region rcirc-prompt-start-marker
! 			   rcirc-prompt-end-marker))))
        (run-hook-with-args 'rcirc-sentinel-hooks process sentinel))))
  
  (defun rcirc-process-list ()
    "Return a list of rcirc processes."
    (let (ps)
--- 542,557 ----
  			       (process-name process)
  			       sentinel
  			       (process-status process)) (not rcirc-target))
! 	  (rcirc-disconnect-buffer)))
        (run-hook-with-args 'rcirc-sentinel-hooks process sentinel))))
  
+ (defun rcirc-disconnect-buffer (&optional buffer)
+   (with-current-buffer (or buffer (current-buffer))
+     ;; set rcirc-target to nil for each channel so cleanup
+     ;; doesnt happen when we reconnect
+     (setq rcirc-target nil)
+     (setq mode-line-process ":disconnected")))  
+ 
  (defun rcirc-process-list ()
    "Return a list of rcirc processes."
    (let (ps)
***************
*** 593,599 ****
  (defun rcirc-server-name (process)
    "Return PROCESS server name, given by the 001 response."
    (with-rcirc-process-buffer process
!     (or rcirc-server-name rcirc-default-server)))
  
  (defun rcirc-nick (process)
    "Return PROCESS nick."
--- 653,660 ----
  (defun rcirc-server-name (process)
    "Return PROCESS server name, given by the 001 response."
    (with-rcirc-process-buffer process
!     (or rcirc-server-name
! 	(warn "server name for process %S unknown" process))))
  
  (defun rcirc-nick (process)
    "Return PROCESS nick."
***************
*** 610,618 ****
  (defvar rcirc-max-message-length 420
    "Messages longer than this value will be split.")
  
! (defun rcirc-send-message (process target message &optional noticep)
    "Send TARGET associated with PROCESS a privmsg with text MESSAGE.
! If NOTICEP is non-nil, send a notice instead of privmsg."
    ;; max message length is 512 including CRLF
    (let* ((response (if noticep "NOTICE" "PRIVMSG"))
           (oversize (> (length message) rcirc-max-message-length))
--- 671,680 ----
  (defvar rcirc-max-message-length 420
    "Messages longer than this value will be split.")
  
! (defun rcirc-send-message (process target message &optional noticep silent)
    "Send TARGET associated with PROCESS a privmsg with text MESSAGE.
! If NOTICEP is non-nil, send a notice instead of privmsg.
! If SILENT is non-nil, do not print the message in any irc buffer."
    ;; max message length is 512 including CRLF
    (let* ((response (if noticep "NOTICE" "PRIVMSG"))
           (oversize (> (length message) rcirc-max-message-length))
***************
*** 625,632 ****
           (more (if oversize
                     (substring message rcirc-max-message-length))))
      (rcirc-get-buffer-create process target)
-     (rcirc-print process (rcirc-nick process) response target text)
      (rcirc-send-string process (concat response " " target " :" text))
      (when more (rcirc-send-message process target more noticep))))
  
  (defvar rcirc-input-ring nil)
--- 687,695 ----
           (more (if oversize
                     (substring message rcirc-max-message-length))))
      (rcirc-get-buffer-create process target)
      (rcirc-send-string process (concat response " " target " :" text))
+     (unless silent
+       (rcirc-print process (rcirc-nick process) response target text))
      (when more (rcirc-send-message process target more noticep))))
  
  (defvar rcirc-input-ring nil)
***************
*** 711,717 ****
  (define-key rcirc-mode-map (kbd "C-c C-d") 'rcirc-cmd-mode)
  (define-key rcirc-mode-map (kbd "C-c C-m") 'rcirc-cmd-msg)
  (define-key rcirc-mode-map (kbd "C-c C-r") 'rcirc-cmd-nick) ; rename
! (define-key rcirc-mode-map (kbd "C-c C-o") 'rcirc-cmd-oper)
  (define-key rcirc-mode-map (kbd "C-c C-p") 'rcirc-cmd-part)
  (define-key rcirc-mode-map (kbd "C-c C-q") 'rcirc-cmd-query)
  (define-key rcirc-mode-map (kbd "C-c C-t") 'rcirc-cmd-topic)
--- 774,780 ----
  (define-key rcirc-mode-map (kbd "C-c C-d") 'rcirc-cmd-mode)
  (define-key rcirc-mode-map (kbd "C-c C-m") 'rcirc-cmd-msg)
  (define-key rcirc-mode-map (kbd "C-c C-r") 'rcirc-cmd-nick) ; rename
! (define-key rcirc-mode-map (kbd "C-c C-o") 'rcirc-omit-mode)
  (define-key rcirc-mode-map (kbd "C-c C-p") 'rcirc-cmd-part)
  (define-key rcirc-mode-map (kbd "C-c C-q") 'rcirc-cmd-query)
  (define-key rcirc-mode-map (kbd "C-c C-t") 'rcirc-cmd-topic)
***************
*** 737,742 ****
--- 800,809 ----
  
  (defvar rcirc-last-post-time nil)
  
+ (defvar rcirc-log-alist nil
+   "Alist of lines to log to disk when `rcirc-log-flag' is non-nil.
+ Each element looks like (FILENAME . TEXT).")
+ 
  (defun rcirc-mode (process target)
    "Major mode for IRC channel buffers.
  
***************
*** 745,750 ****
--- 812,818 ----
    (use-local-map rcirc-mode-map)
    (setq mode-name "rcirc")
    (setq major-mode 'rcirc-mode)
+   (setq mode-line-process nil)
  
    (make-local-variable 'rcirc-input-ring)
    (setq rcirc-input-ring (make-ring rcirc-input-ring-size))
***************
*** 756,761 ****
--- 824,831 ----
    (setq rcirc-topic nil)
    (make-local-variable 'rcirc-last-post-time)
    (setq rcirc-last-post-time (current-time))
+   (make-local-variable 'fill-paragraph-function)
+   (setq fill-paragraph-function 'rcirc-fill-paragraph)
  
    (make-local-variable 'rcirc-short-buffer-name)
    (setq rcirc-short-buffer-name nil)
***************
*** 785,790 ****
--- 855,862 ----
    (setq overlay-arrow-position (make-marker))
    (set-marker overlay-arrow-position nil)
  
+   (setq buffer-invisibility-spec '(rcirc-ignored-user))
+ 
    ;; if the user changes the major mode or kills the buffer, there is
    ;; cleanup work to do
    (add-hook 'change-major-mode-hook 'rcirc-change-major-mode-hook nil t)
***************
*** 873,886 ****
  	(when rcirc-target
  	  (rcirc-remove-nick-channel (rcirc-buffer-process)
  				     (rcirc-buffer-nick)
! 				     rcirc-target))))))
  
  (defun rcirc-generate-new-buffer-name (process target)
    "Return a buffer name based on PROCESS and TARGET.
  This is used for the initial name given to IRC buffers."
!   (if target
!       (concat target "@" (process-name process))
!     (concat "*" (process-name process) "*")))
  
  (defun rcirc-get-buffer (process target &optional server)
    "Return the buffer associated with the PROCESS and TARGET.
--- 945,960 ----
  	(when rcirc-target
  	  (rcirc-remove-nick-channel (rcirc-buffer-process)
  				     (rcirc-buffer-nick)
! 				     rcirc-target))))
!     (setq rcirc-target nil)))
  
  (defun rcirc-generate-new-buffer-name (process target)
    "Return a buffer name based on PROCESS and TARGET.
  This is used for the initial name given to IRC buffers."
!   (substring-no-properties
!    (if target
!        (concat target "@" (process-name process))
!      (concat "*" (process-name process) "*"))))
  
  (defun rcirc-get-buffer (process target &optional server)
    "Return the buffer associated with the PROCESS and TARGET.
***************
*** 902,915 ****
  	  (when (not rcirc-target)
   	    (setq rcirc-target target))
  	  buffer)
! 	;; create the buffer
! 	(with-rcirc-process-buffer process
! 	  (let ((new-buffer (get-buffer-create
! 			     (rcirc-generate-new-buffer-name process target))))
! 	    (with-current-buffer new-buffer
! 	      (rcirc-mode process target))
! 	    (rcirc-put-nick-channel process (rcirc-nick process) target)
! 	    new-buffer)))))
  
  (defun rcirc-send-input ()
    "Send input to target associated with the current buffer."
--- 976,989 ----
  	  (when (not rcirc-target)
   	    (setq rcirc-target target))
  	  buffer)
!       ;; create the buffer
!       (with-rcirc-process-buffer process
! 	(let ((new-buffer (get-buffer-create
! 			   (rcirc-generate-new-buffer-name process target))))
! 	  (with-current-buffer new-buffer
! 	    (rcirc-mode process target))
! 	  (rcirc-put-nick-channel process (rcirc-nick process) target)
! 	  new-buffer)))))
  
  (defun rcirc-send-input ()
    "Send input to target associated with the current buffer."
***************
*** 943,948 ****
--- 1017,1030 ----
  	  (ring-insert rcirc-input-ring input)
  	  (setq rcirc-input-ring-index 0))))))
  
+ (defun rcirc-fill-paragraph (&optional arg)
+   (interactive "p")
+   (when (> (point) rcirc-prompt-end-marker)
+     (save-restriction
+       (narrow-to-region rcirc-prompt-end-marker (point-max))
+       (let ((fill-column rcirc-max-message-length))
+ 	(fill-region (point-min) (point-max))))))
+ 
  (defun rcirc-process-input-line (line)
    (if (string-match "^/\\([^ ]+\\) ?\\(.*\\)$" line)
        (rcirc-process-command (match-string 1 line)
***************
*** 1021,1027 ****
  (defun rcirc-multiline-minor-submit ()
    "Send the text in buffer back to parent buffer."
    (interactive)
-   (assert rcirc-parent-buffer)
    (untabify (point-min) (point-max))
    (let ((text (buffer-substring (point-min) (point-max)))
          (buffer (current-buffer))
--- 1103,1108 ----
***************
*** 1052,1063 ****
  	(process-buffer process)))))
  
  (defcustom rcirc-response-formats
!   '(("PRIVMSG" . "%T<%N> %m")
!     ("NOTICE"  . "%T-%N- %m")
!     ("ACTION"  . "%T[%N %m]")
!     ("COMMAND" . "%T%m")
!     ("ERROR"   . "%T%fw!!! %m")
!     (t         . "%T%fp*** %fs%n %r %m"))
    "An alist of formats used for printing responses.
  The format is looked up using the response-type as a key;
  if no match is found, the default entry (with a key of `t') is used.
--- 1133,1144 ----
  	(process-buffer process)))))
  
  (defcustom rcirc-response-formats
!   '(("PRIVMSG" . "<%N> %m")
!     ("NOTICE"  . "-%N- %m")
!     ("ACTION"  . "[%N %m]")
!     ("COMMAND" . "%m")
!     ("ERROR"   . "%fw!!! %m")
!     (t         . "%fp*** %fs%n %r %m"))
    "An alist of formats used for printing responses.
  The format is looked up using the response-type as a key;
  if no match is found, the default entry (with a key of `t') is used.
***************
*** 1069,1075 ****
    %n        The sender's nick
    %N        The sender's nick (with face `rcirc-my-nick' or `rcirc-other-nick')
    %r        The response-type
-   %T        The timestamp (with face `rcirc-timestamp')
    %t        The target
    %fw       Following text uses the face `font-lock-warning-face'
    %fp       Following text uses the face `rcirc-server-prefix'
--- 1150,1155 ----
***************
*** 1082,1173 ****
  		:value-type string)
    :group 'rcirc)
  
  (defun rcirc-format-response-string (process sender response target text)
    "Return a nicely-formatted response string, incorporating TEXT
  \(and perhaps other arguments).  The specific formatting used
  is found by looking up RESPONSE in `rcirc-response-formats'."
!   (let ((chunks
! 	 (split-string (or (cdr (assoc response rcirc-response-formats))
! 			   (cdr (assq t rcirc-response-formats)))
! 		       "%"))
! 	(sender (or sender ""))
! 	(result "")
! 	(face nil)
! 	key face-key repl)
!     (when (equal (car chunks) "")
!       (pop chunks))
!     (dolist (chunk chunks)
!       (if (equal chunk "")
! 	  (setq key ?%)
! 	(setq key (aref chunk 0))
! 	(setq chunk (substring chunk 1)))
!       (setq repl
! 	    (cond ((eq key ?%)
! 		   ;; %% -- literal % character
! 		   "%")
! 		  ((or (eq key ?n) (eq key ?N))
! 		   ;; %n/%N -- nick
! 		   (let ((nick (concat (if (string= (rcirc-server-name process)
! 						    sender)
! 					   ""
! 					 sender)
! 				       (and target (concat "," target)))))
! 		     (rcirc-facify nick
! 				   (if (eq key ?n)
! 				       face
! 				     (cond ((string= sender (rcirc-nick process))
! 					    'rcirc-my-nick)
! 					   ((and rcirc-bright-nicks
! 						 (string-match
! 						  (regexp-opt rcirc-bright-nicks)
! 						  sender))
! 					    'rcirc-bright-nick)
! 					   ((and rcirc-dim-nicks
! 						 (string-match
! 						  (regexp-opt rcirc-dim-nicks)
! 						  sender))
! 					    'rcirc-dim-nick)
! 					   (t
! 					    'rcirc-other-nick))))))
! 		   ((eq key ?T)
! 		   ;; %T -- timestamp
! 		   (rcirc-facify
! 		    (format-time-string rcirc-time-format (current-time))
! 		    'rcirc-timestamp))
! 		  ((eq key ?m)
! 		   ;; %m -- message text
! 		   (rcirc-markup-text process sender response (rcirc-facify text face)))
! 		  ((eq key ?t)
! 		   ;; %t -- target
! 		   (rcirc-facify (or rcirc-target "") face))
! 		  ((eq key ?r)
! 		   ;; %r -- response
! 		   (rcirc-facify response face))
! 		  ((eq key ?f)
! 		   ;; %f -- change face
! 		   (setq face-key (aref chunk 0))
! 		   (setq chunk (substring chunk 1))
! 		   (cond ((eq face-key ?w)
! 			  ;; %fw -- warning face
! 			  (setq face 'font-lock-warning-face))
! 			 ((eq face-key ?p)
! 			  ;; %fp -- server-prefix face
! 			  (setq face 'rcirc-server-prefix))
! 			 ((eq face-key ?s)
! 			  ;; %fs -- warning face
! 			  (setq face 'rcirc-server))
! 			 ((eq face-key ?-)
! 			  ;; %fs -- warning face
! 			  (setq face nil))
! 			 ((and (eq face-key ?\[)
! 			       (string-match "^\\([^]]*\\)[]]" chunk)
! 			       (facep (match-string 1 chunk)))
! 			  ;; %f[...] -- named face
! 			  (setq face (intern (match-string 1 chunk)))
! 			  (setq chunk (substring chunk (match-end 0)))))
! 		   "")))
!       (setq result (concat result repl (rcirc-facify chunk face))))
!     result))
  
  (defun rcirc-target-buffer (process sender response target text)
    "Return a buffer to print the server response."
--- 1162,1228 ----
  		:value-type string)
    :group 'rcirc)
  
+ (defcustom rcirc-omit-responses 
+   '("JOIN" "PART" "QUIT")
+   "Responses which will be hidden when `rcirc-omit-mode' is enabled."
+   :type '(repeat string)
+   :group 'rcirc)
+ 
  (defun rcirc-format-response-string (process sender response target text)
    "Return a nicely-formatted response string, incorporating TEXT
  \(and perhaps other arguments).  The specific formatting used
  is found by looking up RESPONSE in `rcirc-response-formats'."
!   (with-temp-buffer
!     (insert (or (cdr (assoc response rcirc-response-formats))
! 		(cdr (assq t rcirc-response-formats))))
!     (goto-char (point-min))
!     (let ((start (point-min))
! 	  (sender (if (or (not sender)
! 			  (string= (rcirc-server-name process) sender))
! 		      ""
! 		    sender))
! 	  face)
!       (while (re-search-forward "%\\(\\(f\\(.\\)\\)\\|\\(.\\)\\)" nil t)
! 	(rcirc-add-face start (match-beginning 0) face)
! 	(setq start (match-beginning 0))
! 	(replace-match
! 	 (case (aref (match-string 1) 0)
! 	    (?f (setq face
! 		      (case (string-to-char (match-string 3))
! 			(?w 'font-lock-warning-face)
! 			(?p 'rcirc-server-prefix)
! 			(?s 'rcirc-server)
! 			(t nil)))
! 		"")
! 	    (?n sender)
! 	    (?N (let ((my-nick (rcirc-nick process)))
! 		  (save-match-data
! 		    (with-syntax-table rcirc-nick-syntax-table
! 		      (rcirc-facify sender
! 				    (cond ((string= sender my-nick)
! 					   'rcirc-my-nick)
! 					  ((and rcirc-bright-nicks
! 						(string-match 
! 						 (regexp-opt rcirc-bright-nicks
! 							     'words)
! 						 sender))
! 					   'rcirc-bright-nick)
! 					  ((and rcirc-dim-nicks
! 						(string-match
! 						 (regexp-opt rcirc-dim-nicks
! 							     'words)
! 						 sender))
! 					   'rcirc-dim-nick)
! 					  (t
! 					   'rcirc-other-nick)))))))
! 	    (?m (propertize text 'rcirc-text text))
! 	    (?r response)
! 	    (?t (or target ""))
! 	    (t (concat "UNKNOWN CODE:" (match-string 0))))
! 	 t t nil 0)
! 	(rcirc-add-face (match-beginning 0) (match-end 0) face))
!       (rcirc-add-face start (match-beginning 0) face))
!       (buffer-substring (point-min) (point-max))))
  
  (defun rcirc-target-buffer (process sender response target text)
    "Return a buffer to print the server response."
***************
*** 1177,1183 ****
  	   (rcirc-any-buffer process))
  	  ((not (rcirc-channel-p target))
  	   ;; message from another user
! 	   (if (string= response "PRIVMSG")
  	       (rcirc-get-buffer-create process (if (string= sender rcirc-nick)
  						    target
  						  sender))
--- 1232,1239 ----
  	   (rcirc-any-buffer process))
  	  ((not (rcirc-channel-p target))
  	   ;; message from another user
! 	   (if (or (string= response "PRIVMSG")
! 		   (string= response "ACTION"))
  	       (rcirc-get-buffer-create process (if (string= sender rcirc-nick)
  						    target
  						  sender))
***************
*** 1190,1195 ****
--- 1246,1262 ----
  (defvar rcirc-last-sender nil)
  (make-variable-buffer-local 'rcirc-last-sender)
  
+ (defcustom rcirc-log-directory "~/.emacs.d/rcirc-log"
+   "Directory to keep IRC logfiles."
+   :type 'directory
+   :group 'rcirc)
+ 
+ (defcustom rcirc-log-flag nil
+   "Non-nil means log IRC activity to disk.
+ Logfiles are kept in `rcirc-log-directory'."
+   :type 'boolean
+   :group 'rcirc)
+ 
  (defun rcirc-print (process sender response target text &optional activity)
    "Print TEXT in the buffer associated with TARGET.
  Format based on SENDER and RESPONSE.  If ACTIVITY is non-nil,
***************
*** 1212,1218 ****
  	    (setq text (decode-coding-string text rcirc-decode-coding-system))
  	    ;; mark the line with overlay arrow
  	    (unless (or (marker-position overlay-arrow-position)
! 			(get-buffer-window (current-buffer)))
  	      (set-marker overlay-arrow-position
  			  (marker-position rcirc-prompt-start-marker))))
  
--- 1279,1286 ----
  	    (setq text (decode-coding-string text rcirc-decode-coding-system))
  	    ;; mark the line with overlay arrow
  	    (unless (or (marker-position overlay-arrow-position)
! 			(get-buffer-window (current-buffer))
! 			(member response rcirc-omit-responses))
  	      (set-marker overlay-arrow-position
  			  (marker-position rcirc-prompt-start-marker))))
  
***************
*** 1222,1265 ****
  	  (set-marker-insertion-type rcirc-prompt-start-marker t)
  	  (set-marker-insertion-type rcirc-prompt-end-marker t)
  
! 	  (let ((fmted-text
! 		 (rcirc-format-response-string process sender response nil
! 					       text)))
! 
! 	    (insert fmted-text (propertize "\n" 'hard t))
! 	    (set-marker-insertion-type rcirc-prompt-start-marker nil)
! 	    (set-marker-insertion-type rcirc-prompt-end-marker nil)
! 
! 	    (let ((text-start (make-marker)))
! 	      (set-marker text-start
! 			  (or (next-single-property-change fill-start
! 							   'rcirc-text)
! 			      rcirc-prompt-end-marker))
! 	      ;; squeeze spaces out of text before rcirc-text
! 	      (fill-region fill-start (1- text-start))
! 
! 	      ;; fill the text we just inserted, maybe
! 	      (when (and rcirc-fill-flag
! 			 (not (string= response "372"))) ;/motd
! 		(let ((fill-prefix
! 		       (or rcirc-fill-prefix
! 			   (make-string (- text-start fill-start) ?\s)))
! 		      (fill-column (cond ((eq rcirc-fill-column 'frame-width)
! 					  (1- (frame-width)))
! 					 ((eq rcirc-fill-column 'window-width)
! 					  (1- (window-width)))
! 					 (rcirc-fill-column
! 					  rcirc-fill-column)
! 					 (t fill-column))))
! 		  (fill-region fill-start rcirc-prompt-start-marker 'left t)))))
! 
! 	  ;; set inserted text to be read-only
! 	  (when rcirc-read-only-flag
! 	    (put-text-property rcirc-prompt-start-marker fill-start 'read-only t)
! 	    (let ((inhibit-read-only t))
! 	      (put-text-property rcirc-prompt-start-marker fill-start
! 				 'front-sticky t)
! 	      (put-text-property (1- (point)) (point) 'rear-nonsticky t)))
  
  	  ;; truncate buffer if it is very long
  	  (save-excursion
--- 1290,1329 ----
  	  (set-marker-insertion-type rcirc-prompt-start-marker t)
  	  (set-marker-insertion-type rcirc-prompt-end-marker t)
  
! 	  (let ((start (point)))
! 	    (insert (rcirc-format-response-string process sender response nil 
! 						  text)
! 		    (propertize "\n" 'hard t))
! 
!  	    ;; squeeze spaces out of text before rcirc-text
! 	    (fill-region fill-start 
! 			 (1- (or (next-single-property-change fill-start
! 							      'rcirc-text)
! 				 rcirc-prompt-end-marker)))
! 
! 	    ;; run markup functions
!  	    (save-excursion
!  	      (save-restriction
!  		(narrow-to-region start rcirc-prompt-start-marker)
! 		(goto-char (or (next-single-property-change start 'rcirc-text)
! 			       (point)))
! 		(when (rcirc-buffer-process)
! 		  (save-excursion (rcirc-markup-timestamp sender response))
! 		  (dolist (fn rcirc-markup-text-functions)
! 		    (save-excursion (funcall fn sender response)))
! 		  (save-excursion (rcirc-markup-fill sender response)))
! 
! 		(when rcirc-read-only-flag
! 		  (add-text-properties (point-min) (point-max)
! 				       '(read-only t front-sticky t))))
! 	      ;; make text omittable
! 	      (when (and (member response rcirc-omit-responses)
! 			 (> start (point-min)))
! 		(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)
  
  	  ;; truncate buffer if it is very long
  	  (save-excursion
***************
*** 1275,1301 ****
  					 (window-buffer w))
  				     (>= (window-point w)
  					 rcirc-prompt-end-marker))
! 			    (set-window-point w (point-max))))
  			nil t)
  
  	  ;; restore the point
  	  (goto-char (if moving rcirc-prompt-end-marker old-point))
  
!         ;; keep window on bottom line if it was already there
  	  (when rcirc-scroll-show-maximum-output
  	    (walk-windows (lambda (w)
  			    (when (eq (window-buffer w) (current-buffer))
  			      (with-current-buffer (window-buffer w)
  				(when (eq major-mode 'rcirc-mode)
  				  (with-selected-window w
!  				    (when (<= (- (window-height)
!  						 (count-screen-lines
! 						  (window-point)
! 						  (window-start))
  						 1)
  					      0)
  				      (recenter -1)))))))
! 			  nil t))
  
  	  ;; flush undo (can we do something smarter here?)
  	  (buffer-disable-undo)
--- 1339,1364 ----
  					 (window-buffer w))
  				     (>= (window-point w)
  					 rcirc-prompt-end-marker))
! 			      (set-window-point w (point-max))))
  			nil t)
  
  	  ;; restore the point
  	  (goto-char (if moving rcirc-prompt-end-marker old-point))
  
! 	  ;; keep window on bottom line if it was already there
  	  (when rcirc-scroll-show-maximum-output
  	    (walk-windows (lambda (w)
  			    (when (eq (window-buffer w) (current-buffer))
  			      (with-current-buffer (window-buffer w)
  				(when (eq major-mode 'rcirc-mode)
  				  (with-selected-window w
! 				    (when (<= (- (window-height)
! 						 (count-screen-lines (window-point)
! 								     (window-start))
  						 1)
  					      0)
  				      (recenter -1)))))))
! 				  nil t))
  
  	  ;; flush undo (can we do something smarter here?)
  	  (buffer-disable-undo)
***************
*** 1305,1326 ****
  	(when (and activity
  		   (not rcirc-ignore-buffer-activity-flag)
  		   (not (and rcirc-dim-nicks sender
! 			     (string-match (regexp-opt rcirc-dim-nicks) sender))))
  	      (rcirc-record-activity (current-buffer)
  				     (when (not (rcirc-channel-p rcirc-target))
  				       'nick)))
  
  	(sit-for 0)			; displayed text before hook
  	(run-hook-with-args 'rcirc-print-hooks
  			    process sender response target text)))))
  
! (defun rcirc-startup-channels (server)
!   "Return the list of startup channels for SERVER."
!   (let (channels)
!     (dolist (i rcirc-startup-channels-alist)
!       (if (string-match (car i) server)
!           (setq channels (append channels (cdr i)))))
!     channels))
  
  (defun rcirc-join-channels (process channels)
    "Join CHANNELS."
--- 1368,1412 ----
  	(when (and activity
  		   (not rcirc-ignore-buffer-activity-flag)
  		   (not (and rcirc-dim-nicks sender
! 			     (string-match (regexp-opt rcirc-dim-nicks) sender)
! 			     (rcirc-channel-p target))))
  	      (rcirc-record-activity (current-buffer)
  				     (when (not (rcirc-channel-p rcirc-target))
  				       'nick)))
  
+ 	(when rcirc-log-flag
+ 	  (rcirc-log process sender response target text))
+ 
  	(sit-for 0)			; displayed text before hook
  	(run-hook-with-args 'rcirc-print-hooks
  			    process sender response target text)))))
  
! (defun rcirc-log (process sender response target text)
!   "Record line in `rcirc-log', to be later written to disk."
!   (let* ((filename (rcirc-generate-new-buffer-name process target))
! 	 (cell (assoc-string filename rcirc-log-alist))
! 	 (line (concat (format-time-string rcirc-time-format)
! 		       (substring-no-properties
! 			(rcirc-format-response-string process sender
! 						      response target text))
! 		       "\n")))
!     (if cell
! 	(setcdr cell (concat (cdr cell) line))
!       (setq rcirc-log-alist
! 	    (cons (cons filename line) rcirc-log-alist)))))
! 
! (defun rcirc-log-write ()
!   "Flush `rcirc-log-alist' data to disk.
! 
! Log data is written to `rcirc-log-directory'."
!   (make-directory rcirc-log-directory t)
!   (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)
    "Join CHANNELS."
***************
*** 1437,1442 ****
--- 1523,1531 ----
  (or (assq 'rcirc-low-priority-flag minor-mode-alist)
      (setq minor-mode-alist
            (cons '(rcirc-low-priority-flag " LowPri") minor-mode-alist)))
+ (or (assq 'rcirc-omit-mode minor-mode-alist)
+     (setq minor-mode-alist
+           (cons '(rcirc-omit-mode " Omit") minor-mode-alist)))
  
  (defun rcirc-toggle-ignore-buffer-activity ()
    "Toggle the value of `rcirc-ignore-buffer-activity-flag'."
***************
*** 1458,1505 ****
  	     "Activity in this buffer is normal priority"))
    (force-mode-line-update))
  
! (defvar rcirc-switch-to-buffer-function 'switch-to-buffer
!   "Function to use when switching buffers.
! Possible values are `switch-to-buffer', `pop-to-buffer', and
! `display-buffer'.")
  
  (defun rcirc-switch-to-server-buffer ()
    "Switch to the server buffer associated with current channel buffer."
    (interactive)
!   (funcall rcirc-switch-to-buffer-function rcirc-server-buffer))
  
  (defun rcirc-jump-to-first-unread-line ()
    "Move the point to the first unread line in this buffer."
    (interactive)
!   (when (marker-position overlay-arrow-position)
!     (goto-char overlay-arrow-position)))
! 
! (defvar rcirc-last-non-irc-buffer nil
!   "The buffer to switch to when there is no more activity.")
  
  (defun rcirc-next-active-buffer (arg)
!   "Go to the next rcirc buffer with activity.
! With prefix ARG, go to the next low priority buffer with activity.
! The function given by `rcirc-switch-to-buffer-function' is used to
! show the buffer."
    (interactive "P")
    (let* ((pair (rcirc-split-activity rcirc-activity))
  	 (lopri (car pair))
  	 (hipri (cdr pair)))
      (if (or (and (not arg) hipri)
  	    (and arg lopri))
! 	(progn
! 	  (unless (eq major-mode 'rcirc-mode)
! 	    (setq rcirc-last-non-irc-buffer (current-buffer)))
! 	  (funcall rcirc-switch-to-buffer-function
! 		   (car (if arg lopri hipri))))
        (if (eq major-mode 'rcirc-mode)
! 	  (if (not (and rcirc-last-non-irc-buffer
! 			(buffer-live-p rcirc-last-non-irc-buffer)))
! 	      (message "No IRC activity.  Start something.")
! 	    (message "No more IRC activity.  Go back to work.")
! 	    (funcall rcirc-switch-to-buffer-function rcirc-last-non-irc-buffer)
! 	    (setq rcirc-last-non-irc-buffer nil))
  	(message (concat
  		  "No IRC activity."
  		  (when lopri
--- 1547,1605 ----
  	     "Activity in this buffer is normal priority"))
    (force-mode-line-update))
  
! (defun rcirc-omit-mode ()
!   "Toggle the Rcirc-Omit mode.
! If enabled, \"uninteresting\" lines are not shown.  
! Uninteresting lines are those whose responses are listed in
! `rcirc-omit-responses'."
!   (interactive)
!   (setq rcirc-omit-mode (not rcirc-omit-mode))
!   (let ((line (1- (count-screen-lines (point) (window-start)))))
!     (if rcirc-omit-mode
! 	(progn
! 	  (add-to-invisibility-spec 'rcirc-omit)
! 	  (message "Rcirc-Omit mode enabled"))
!       (remove-from-invisibility-spec 'rcirc-omit)
!       (message "Rcirc-Omit mode disabled"))
!     (recenter line))
!   (force-mode-line-update))
  
  (defun rcirc-switch-to-server-buffer ()
    "Switch to the server buffer associated with current channel buffer."
    (interactive)
!   (switch-to-buffer rcirc-server-buffer))
  
  (defun rcirc-jump-to-first-unread-line ()
    "Move the point to the first unread line in this buffer."
    (interactive)
!   (if (marker-position overlay-arrow-position)
!       (goto-char overlay-arrow-position)
!     (message "No unread messages")))
! 
! (defun rcirc-non-irc-buffer ()
!   (let ((buflist (buffer-list))
! 	buffer)
!     (while (and buflist (not buffer))
!       (with-current-buffer (car buflist)
! 	(unless (or (eq major-mode 'rcirc-mode)
! 		    (= ?\s (aref (buffer-name) 0)) ; internal buffers
! 		    (get-buffer-window (current-buffer)))
! 	  (setq buffer (current-buffer))))
!       (setq buflist (cdr buflist)))
!     buffer))
  
  (defun rcirc-next-active-buffer (arg)
!   "Switch to the next rcirc buffer with activity.
! With prefix ARG, go to the next low priority buffer with activity."
    (interactive "P")
    (let* ((pair (rcirc-split-activity rcirc-activity))
  	 (lopri (car pair))
  	 (hipri (cdr pair)))
      (if (or (and (not arg) hipri)
  	    (and arg lopri))
! 	(switch-to-buffer (car (if arg lopri hipri)) t)
        (if (eq major-mode 'rcirc-mode)
! 	  (switch-to-buffer (rcirc-non-irc-buffer))
  	(message (concat
  		  "No IRC activity."
  		  (when lopri
***************
*** 1518,1532 ****
  (defun rcirc-record-activity (buffer &optional type)
    "Record BUFFER activity with TYPE."
    (with-current-buffer buffer
!     (when (not (get-buffer-window (current-buffer) t))
!       (setq rcirc-activity
! 	    (sort (add-to-list 'rcirc-activity (current-buffer))
! 		  (lambda (b1 b2)
! 		    (let ((t1 (with-current-buffer b1 rcirc-last-post-time))
! 			  (t2 (with-current-buffer b2 rcirc-last-post-time)))
! 		      (time-less-p t2 t1)))))
!       (pushnew type rcirc-activity-types)
!       (rcirc-update-activity-string)))
    (run-hook-with-args 'rcirc-activity-hooks buffer))
  
  (defun rcirc-clear-activity (buffer)
--- 1618,1636 ----
  (defun rcirc-record-activity (buffer &optional type)
    "Record BUFFER activity with TYPE."
    (with-current-buffer buffer
!     (let ((old-activity rcirc-activity)
! 	  (old-types rcirc-activity-types))
!       (when (not (get-buffer-window (current-buffer) t))
! 	(setq rcirc-activity
! 	      (sort (add-to-list 'rcirc-activity (current-buffer))
! 		    (lambda (b1 b2)
! 		      (let ((t1 (with-current-buffer b1 rcirc-last-post-time))
! 			    (t2 (with-current-buffer b2 rcirc-last-post-time)))
! 			(time-less-p t2 t1)))))
! 	(pushnew type rcirc-activity-types)
! 	(unless (and (equal rcirc-activity old-activity)
! 		     (member type old-types))
! 	  (rcirc-update-activity-string)))))
    (run-hook-with-args 'rcirc-activity-hooks buffer))
  
  (defun rcirc-clear-activity (buffer)
***************
*** 1535,1540 ****
--- 1639,1650 ----
    (with-current-buffer buffer
      (setq rcirc-activity-types nil)))
  
+ (defun rcirc-clear-unread (buffer)
+   "Erase the last read message arrow from BUFFER."
+   (when (buffer-live-p buffer)
+     (with-current-buffer buffer
+       (set-marker overlay-arrow-position nil))))
+ 
  (defun rcirc-split-activity (activity)
    "Return a cons cell with ACTIVITY split into (lopri . hipri)."
    (let (lopri hipri)
***************
*** 1546,1551 ****
--- 1656,1664 ----
  	  (add-to-list 'hipri buf t))))
      (cons lopri hipri)))
  
+ (defvar rcirc-update-activity-string-hook nil
+   "Hook run whenever the activity string is updated.")
+ 
  ;; TODO: add mouse properties
  (defun rcirc-update-activity-string ()
    "Update mode-line string."
***************
*** 1554,1572 ****
  	 (hipri (cdr pair)))
      (setq rcirc-activity-string
  	  (cond ((or hipri lopri)
! 		 (concat "-"
! 			 (and hipri "[")
  			 (rcirc-activity-string hipri)
  			 (and hipri lopri ",")
  			 (and lopri
  			      (concat "("
  				      (rcirc-activity-string lopri)
  				      ")"))
! 			 (and hipri "]")
! 			 "-"))
  		((not (null (rcirc-process-list)))
! 		 "-[]-")
! 		(t "")))))
  
  (defun rcirc-activity-string (buffers)
    (mapconcat (lambda (b)
--- 1667,1684 ----
  	 (hipri (cdr pair)))
      (setq rcirc-activity-string
  	  (cond ((or hipri lopri)
! 		 (concat (and hipri "[")
  			 (rcirc-activity-string hipri)
  			 (and hipri lopri ",")
  			 (and lopri
  			      (concat "("
  				      (rcirc-activity-string lopri)
  				      ")"))
! 			 (and hipri "]")))
  		((not (null (rcirc-process-list)))
! 		 "[]")
! 		(t "[]")))
!     (run-hooks 'rcirc-update-activity-string-hook)))
  
  (defun rcirc-activity-string (buffers)
    (mapconcat (lambda (b)
***************
*** 1586,1618 ****
    (with-current-buffer buffer
      (or rcirc-short-buffer-name (buffer-name))))
  
! (defvar rcirc-current-buffer nil)
! (defun rcirc-window-configuration-change ()
!   "Go through visible windows and remove buffers from activity list.
! Also, clear the overlay arrow if the current buffer is now hidden."
!   (let ((current-now-hidden t))
      (walk-windows (lambda (w)
! 		    (let ((buf (window-buffer w)))
! 		      (with-current-buffer buf
! 			(when (eq major-mode 'rcirc-mode)
! 			  (rcirc-clear-activity buf)))
! 			(when (eq buf rcirc-current-buffer)
! 			  (setq current-now-hidden nil)))))
!     ;; add overlay arrow if the buffer isn't displayed
!     (when (and current-now-hidden
! 	       rcirc-current-buffer
! 	       (buffer-live-p rcirc-current-buffer))
!       (with-current-buffer rcirc-current-buffer
! 	(when (and (eq major-mode 'rcirc-mode)
! 		   (marker-position overlay-arrow-position))
! 	  (set-marker overlay-arrow-position nil)))))
! 
!   ;; remove any killed buffers from list
!   (setq rcirc-activity
! 	(delq nil (mapcar (lambda (buf) (when (buffer-live-p buf) buf))
! 			  rcirc-activity)))
!   (rcirc-update-activity-string)
!   (setq rcirc-current-buffer (current-buffer)))
  
  \f
  ;;; buffer name abbreviation
--- 1698,1744 ----
    (with-current-buffer buffer
      (or rcirc-short-buffer-name (buffer-name))))
  
! (defun rcirc-visible-buffers ()
!   "Return a list of the visible buffers that are in rcirc-mode."
!   (let (acc)
      (walk-windows (lambda (w)
! 		    (with-current-buffer (window-buffer w)
! 		      (when (eq major-mode 'rcirc-mode)
! 			(push (current-buffer) acc)))))
!     acc))
! 
! (defvar rcirc-visible-buffers nil)
! (defun rcirc-window-configuration-change ()
!   (unless (minibuffer-window-active-p (minibuffer-window))
!     ;; delay this until command has finished to make sure window is
!     ;; actually visible before clearing activity
!     (add-hook 'post-command-hook 'rcirc-window-configuration-change-1)))
! 
! (defun rcirc-window-configuration-change-1 ()
!   ;; clear activity and overlay arrows
!   (let* ((old-activity rcirc-activity)
! 	 (hidden-buffers rcirc-visible-buffers))
! 
!     (setq rcirc-visible-buffers (rcirc-visible-buffers))
! 
!     (dolist (vbuf rcirc-visible-buffers)
!       (setq hidden-buffers (delq vbuf hidden-buffers))
!       ;; clear activity for all visible buffers
!       (rcirc-clear-activity vbuf))
! 
!     ;; clear unread arrow from recently hidden buffers
!     (dolist (hbuf hidden-buffers)
!       (rcirc-clear-unread hbuf))
! 
!     ;; remove any killed buffers from list
!     (setq rcirc-activity
! 	  (delq nil (mapcar (lambda (buf) (when (buffer-live-p buf) buf))
! 			    rcirc-activity)))
!     ;; update the mode-line string
!     (unless (equal old-activity rcirc-activity)
!       (rcirc-update-activity-string)))
! 
!   (remove-hook 'post-command-hook 'rcirc-window-configuration-change-1))
  
  \f
  ;;; buffer name abbreviation
***************
*** 1722,1729 ****
                                           (car (split-string channel)))))
      (rcirc-send-string process (concat "JOIN " channel))
      (when (not (eq (selected-window) (minibuffer-window)))
!       (funcall rcirc-switch-to-buffer-function buffer))))
  
  (defun-rcirc-command part (channel)
    "Part CHANNEL."
    (interactive "sPart channel: ")
--- 1848,1856 ----
                                           (car (split-string channel)))))
      (rcirc-send-string process (concat "JOIN " channel))
      (when (not (eq (selected-window) (minibuffer-window)))
!       (switch-to-buffer buffer))))
  
+ ;; TODO: /part #channel reason, or consider removing #channel altogether
  (defun-rcirc-command part (channel)
    "Part CHANNEL."
    (interactive "sPart channel: ")
***************
*** 1902,1908 ****
  		  word-boundary))
  	 (optional
  	  (and "/"
! 	       (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,{}[]()"))
  	       (char "-a-zA-Z0-9_=#$\@~`%&*+|\\/:;{}[]()")))))
    "Regexp matching URLs.  Set to nil to disable URL features in rcirc.")
  
--- 2029,2035 ----
  		  word-boundary))
  	 (optional
  	  (and "/"
! 	       (1+ (char "-a-zA-Z0-9_='!?#$\@~`%&*+|\\/:;.,{}[]()"))
  	       (char "-a-zA-Z0-9_=#$\@~`%&*+|\\/:;{}[]()")))))
    "Regexp matching URLs.  Set to nil to disable URL features in rcirc.")
  
***************
*** 1932,1969 ****
  
  \f
  (defvar rcirc-markup-text-functions
!   '(rcirc-markup-body-text
!     rcirc-markup-attributes
      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 three arguments, PROCESS, SENDER, RESPONSE
! and CHANNEL-BUFFER.  The current buffer is temporary buffer that
! contains the text to manipulate.  Each function works on the text
! in this buffer.")
! 
! (defun rcirc-markup-text (process sender response text)
!   "Return TEXT with properties added based on various patterns."
!   (let ((channel-buffer (current-buffer)))
!     (with-temp-buffer
!       (insert text)
!       (goto-char (point-min))
!       (dolist (fn rcirc-markup-text-functions)
! 	(save-excursion
! 	  (funcall fn process sender response channel-buffer)))
!       (buffer-substring (point-min) (point-max)))))
! 
! (defun rcirc-markup-body-text (process sender response channel-buffer)
!   ;; We add the text property `rcirc-text' to identify this as the
!   ;; body text.
!   (add-text-properties (point-min) (point-max)
! 		       (list 'rcirc-text (buffer-substring-no-properties
! 					  (point-min) (point-max)))))
  
! (defun rcirc-markup-attributes (process sender response channel-buffer)
    (while (re-search-forward "\\([\C-b\C-_\C-v]\\).*?\\(\\1\\|\C-o\\)" nil t)
      (rcirc-add-face (match-beginning 0) (match-end 0)
  		    (case (char-after (match-beginning 1))
--- 2059,2083 ----
  
  \f
  (defvar rcirc-markup-text-functions
!   '(rcirc-markup-attributes
      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-markup-timestamp (sender response)
!   (goto-char (point-min))
!   (insert (rcirc-facify (format-time-string rcirc-time-format) 
! 			'rcirc-timestamp)))
  
! (defun rcirc-markup-attributes (sender response)
    (while (re-search-forward "\\([\C-b\C-_\C-v]\\).*?\\(\\1\\|\C-o\\)" nil t)
      (rcirc-add-face (match-beginning 0) (match-end 0)
  		    (case (char-after (match-beginning 1))
***************
*** 1979,1997 ****
    (while (re-search-forward "\C-o+" nil t)
      (delete-region (match-beginning 0) (match-end 0))))
  
! (defun rcirc-markup-my-nick (process sender response channel-buffer)
    (with-syntax-table rcirc-nick-syntax-table
!     (while (re-search-forward (concat "\\b"
! 				      (regexp-quote (rcirc-nick process))
  				      "\\b")
  			      nil t)
        (rcirc-add-face (match-beginning 0) (match-end 0)
  		      'rcirc-nick-in-message)
        (when (string= response "PRIVMSG")
! 	(rcirc-add-face (point-min) (point-max) 'rcirc-nick-in-message-full-line)
! 	(rcirc-record-activity channel-buffer 'nick)))))
  
! (defun rcirc-markup-urls (process sender response channel-buffer)
    (while (re-search-forward rcirc-url-regexp nil t)
      (let ((start (match-beginning 0))
  	  (end (match-end 0)))
--- 2093,2113 ----
    (while (re-search-forward "\C-o+" nil t)
      (delete-region (match-beginning 0) (match-end 0))))
  
! (defun rcirc-markup-my-nick (sender response)
    (with-syntax-table rcirc-nick-syntax-table
!     (while (re-search-forward (concat "\\b" 
! 				      (regexp-quote (rcirc-nick 
! 						     (rcirc-buffer-process)))
  				      "\\b")
  			      nil t)
        (rcirc-add-face (match-beginning 0) (match-end 0)
  		      'rcirc-nick-in-message)
        (when (string= response "PRIVMSG")
! 	(rcirc-add-face (point-min) (point-max) 
! 			'rcirc-nick-in-message-full-line)
! 	(rcirc-record-activity (current-buffer) 'nick)))))
  
! (defun rcirc-markup-urls (sender response)
    (while (re-search-forward rcirc-url-regexp nil t)
      (let ((start (match-beginning 0))
  	  (end (match-end 0)))
***************
*** 1999,2028 ****
        (add-text-properties start end (list 'mouse-face 'highlight
  					   'keymap rcirc-browse-url-map))
        ;; record the url
!       (let ((url (buffer-substring-no-properties start end)))
! 	(with-current-buffer channel-buffer
! 	  (push url rcirc-urls))))))
! 
! (defun rcirc-markup-keywords (process sender response channel-buffer)
!   (let* ((target (with-current-buffer channel-buffer (or rcirc-target "")))
! 	 (keywords (delq nil (mapcar (lambda (keyword)
! 				      (when (not (string-match keyword target))
! 					keyword))
! 				    rcirc-keywords))))
!     (when keywords
!       (while (re-search-forward (regexp-opt keywords 'words) nil t)
! 	(rcirc-add-face (match-beginning 0) (match-end 0) 'rcirc-keyword)
! 	(when (and (string= response "PRIVMSG")
! 		   (not (string= sender (rcirc-nick process))))
! 	  (rcirc-record-activity channel-buffer 'keyword))))))
  
! (defun rcirc-markup-bright-nicks (process sender response channel-buffer)
    (when (and rcirc-bright-nicks
  	     (string= response "NAMES"))
      (with-syntax-table rcirc-nick-syntax-table
        (while (re-search-forward (regexp-opt rcirc-bright-nicks 'words) nil t)
  	(rcirc-add-face (match-beginning 0) (match-end 0)
  			'rcirc-bright-nick)))))
  \f
  ;;; handlers
  ;; these are called with the server PROCESS, the SENDER, which is a
--- 2115,2155 ----
        (add-text-properties start end (list 'mouse-face 'highlight
  					   'keymap rcirc-browse-url-map))
        ;; record the url
!       (push (buffer-substring-no-properties start end) rcirc-urls))))
  
! (defun rcirc-markup-keywords (sender response)
!   (when (and (string= response "PRIVMSG")
! 	     (not (string= sender (rcirc-nick (rcirc-buffer-process)))))
!     (let* ((target (or rcirc-target ""))
! 	   (keywords (delq nil (mapcar (lambda (keyword)
! 					 (when (not (string-match keyword
! 								  target))
! 					   keyword))
! 				       rcirc-keywords))))
!       (when keywords
! 	(while (re-search-forward (regexp-opt keywords 'words) nil t)
! 	  (rcirc-add-face (match-beginning 0) (match-end 0) 'rcirc-keyword)
! 	  (rcirc-record-activity (current-buffer) 'keyword))))))
! 
! (defun rcirc-markup-bright-nicks (sender response)
    (when (and rcirc-bright-nicks
  	     (string= response "NAMES"))
      (with-syntax-table rcirc-nick-syntax-table
        (while (re-search-forward (regexp-opt rcirc-bright-nicks 'words) nil t)
  	(rcirc-add-face (match-beginning 0) (match-end 0)
  			'rcirc-bright-nick)))))
+ 
+ (defun rcirc-markup-fill (sender response)
+   (when (not (string= response "372")) 	; /motd
+     (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))))
  \f
  ;;; handlers
  ;; these are called with the server PROCESS, the SENDER, which is a
***************
*** 2099,2106 ****
      ;; if the buffer is still around, make it inactive
      (let ((buffer (rcirc-get-buffer process channel)))
        (when buffer
! 	(with-current-buffer buffer
! 	  (setq rcirc-target nil))))))
  
  (defun rcirc-handler-PART (process sender args text)
    (let* ((channel (car args))
--- 2226,2232 ----
      ;; if the buffer is still around, make it inactive
      (let ((buffer (rcirc-get-buffer process channel)))
        (when buffer
! 	(rcirc-disconnect-buffer buffer)))))
  
  (defun rcirc-handler-PART (process sender args text)
    (let* ((channel (car args))
***************
*** 2169,2175 ****
          (when rcirc-auto-authenticate-flag (rcirc-authenticate))))))
  
  (defun rcirc-handler-PING (process sender args text)
!   (rcirc-send-string process (concat "PONG " (car args))))
  
  (defun rcirc-handler-PONG (process sender args text)
    ;; do nothing
--- 2295,2301 ----
          (when rcirc-auto-authenticate-flag (rcirc-authenticate))))))
  
  (defun rcirc-handler-PING (process sender args text)
!   (rcirc-send-string process (concat "PONG :" (car args))))
  
  (defun rcirc-handler-PONG (process sender args text)
    ;; do nothing
***************
*** 2289,2295 ****
  		  process
  		  (concat
  		   "PRIVMSG chanserv :identify "
! 		   (cadr args) " " (car args))))
  		((equal method 'bitlbee)
  		 (rcirc-send-string
  		  process
--- 2415,2421 ----
  		  process
  		  (concat
  		   "PRIVMSG chanserv :identify "
! 		   (car args) " " (cadr args))))
  		((equal method 'bitlbee)
  		 (rcirc-send-string
  		  process
***************
*** 2314,2320 ****
                           (format "%s sent unsupported ctcp: %s" sender text)
  			 t)
            (funcall handler process target sender args)
!           (if (not (string= request "ACTION"))
                (rcirc-print process sender "CTCP" target
  			   (format "%s" text) t))))))
  
--- 2440,2447 ----
                           (format "%s sent unsupported ctcp: %s" sender text)
  			 t)
            (funcall handler process target sender args)
!           (unless (or (string= request "ACTION")
! 		      (string= request "KEEPALIVE"))
                (rcirc-print process sender "CTCP" target
  			   (format "%s" text) t))))))

^ permalink raw reply	[flat|nested] 22+ messages in thread
* rcirc update
@ 2009-10-02  0:11 Ryan Yeske
  2009-10-15  6:50 ` Glenn Morris
  0 siblings, 1 reply; 22+ messages in thread
From: Ryan Yeske @ 2009-10-02  0:11 UTC (permalink / raw)
  To: emacs-devel

I have a couple small changes to rcirc.el.

If this could be reviewed and installed in CVS that would be great.

Thanks,
Ryan


2009-10-02  Ryan Yeske  <rcyeske@gmail.com>

	* net/rcirc.el (rcirc-view-log-file): Add command.
	(rcirc-track-minor-mode-map): Remove C-c ` binding.
	(rcirc-authenticate, rcirc-authinfo): Allow nickserv-nick to be
	specified



Index: rcirc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/rcirc.el,v
retrieving revision 1.52
diff -c -r1.52 rcirc.el
*** rcirc.el	2 Sep 2009 03:20:48 -0000	1.52
--- rcirc.el	2 Oct 2009 00:09:08 -0000
***************
*** 193,207 ****
  The valid METHOD symbols are `nickserv', `chanserv' and
  `bitlbee'.
  
! The required ARGUMENTS for each METHOD symbol are:
!   `nickserv': NICK PASSWORD
    `chanserv': NICK CHANNEL PASSWORD
    `bitlbee': NICK PASSWORD
  
! Example:
   ((\"freenode\" nickserv \"bob\" \"p455w0rd\")
    (\"freenode\" chanserv \"bob\" \"#bobland\" \"passwd99\")
!   (\"bitlbee\" bitlbee \"robert\" \"sekrit\"))"
    :type '(alist :key-type (string :tag "Server")
  		:value-type (choice (list :tag "NickServ"
  					  (const nickserv)
--- 193,208 ----
  The valid METHOD symbols are `nickserv', `chanserv' and
  `bitlbee'.
  
! The ARGUMENTS for each METHOD symbol are:
!   `nickserv': NICK PASSWORD [NICKSERV-NICK]
    `chanserv': NICK CHANNEL PASSWORD
    `bitlbee': NICK PASSWORD
  
! Examples:
   ((\"freenode\" nickserv \"bob\" \"p455w0rd\")
    (\"freenode\" chanserv \"bob\" \"#bobland\" \"passwd99\")
!   (\"bitlbee\" bitlbee \"robert\" \"sekrit\")
!   (\"dal.net\" nickserv \"bob\" \"sekrit\" \"NickServ@services.dal.net\"))"
    :type '(alist :key-type (string :tag "Server")
  		:value-type (choice (list :tag "NickServ"
  					  (const nickserv)
***************
*** 1538,1543 ****
--- 1539,1552 ----
  	(write-region (point-min) (point-max) filename t 'quiet))))
    (setq rcirc-log-alist nil))
  
+ (defun rcirc-view-log-file ()
+   "View logfile corresponding to the current buffer."
+   (interactive)
+   (find-file-other-window 
+    (expand-file-name (funcall rcirc-log-filename-function 
+ 			      (rcirc-buffer-process) rcirc-target)
+ 		     rcirc-log-directory)))
+ 
  (defun rcirc-join-channels (process channels)
    "Join CHANNELS."
    (save-window-excursion
***************
*** 1628,1634 ****
  (defvar rcirc-track-minor-mode-map (make-sparse-keymap)
    "Keymap for rcirc track minor mode.")
  
- (define-key rcirc-track-minor-mode-map (kbd "C-c `") 'rcirc-next-active-buffer)
  (define-key rcirc-track-minor-mode-map (kbd "C-c C-@") 'rcirc-next-active-buffer)
  (define-key rcirc-track-minor-mode-map (kbd "C-c C-SPC") 'rcirc-next-active-buffer)
  
--- 1637,1642 ----
***************
*** 2553,2563 ****
  	(when (and (string-match server rcirc-server)
  		   (string-match nick rcirc-nick))
  	  (cond ((equal method 'nickserv)
  		 (rcirc-send-string
  		  process
! 		  (concat
! 		   "PRIVMSG nickserv :identify "
! 		   (car args))))
  		((equal method 'chanserv)
  		 (rcirc-send-string
  		  process
--- 2561,2572 ----
  	(when (and (string-match server rcirc-server)
  		   (string-match nick rcirc-nick))
  	  (cond ((equal method 'nickserv)
+ 		 (let ((password (car args))
+ 		       (nickserv-nick (or (cadr args) "nickserv")))
  		 (rcirc-send-string
  		  process
! 		  (concat "PRIVMSG " nickserv-nick " :identify "
! 			  password))))
  		((equal method 'chanserv)
  		 (rcirc-send-string
  		  process




^ permalink raw reply	[flat|nested] 22+ messages in thread
* rcirc update
@ 2007-10-22 18:04 Ryan Yeske
  2007-10-29  1:25 ` Glenn Morris
  0 siblings, 1 reply; 22+ messages in thread
From: Ryan Yeske @ 2007-10-22 18:04 UTC (permalink / raw)
  To: emacs-devel

2007-10-22  Ryan Yeske  <rcyeske@gmail.com>

	* net/rcirc.el (rcirc-server-alist): Use coloned symbols for
	paramater names.
	(rcirc-recent-quit-alist): New function.
	(rcirc): Print a better message when there is only one connected
	server.
	(rcirc-complete-nick): Do not update the nick table here.
	(rcirc-mode-map): Add M-o.
	(rcirc-current-line): Add variable.
	(rcirc-mode): Setup variables for line based omit.
	(rcirc-edit-multiline): Strip text properties.
	(rcirc-omit-responses): Add NICK.
	(rcirc-omit-threshold): Add variable.
	(rcirc-last-quit-line, rcirc-last-line, rcirc-elapsed-lines): Add
	functions.
	(rcirc-print): Keep track of current line.  Do not fill text if
	`rcirc-fill-flag' is null.  Only omit text if the last activity
	from the sender is more than `rcirc-omit-threshold' lines ago.
	(rcirc-put-nick-channel, rcirc-handler-PRIVMSG): Track line
	numbers instead of time.
	(rcirc-channel-nicks): Sort by line numbers instead of time.
	(rcirc-omit-mode): Add `...' when omitting text and recenter.
	(rcirc-handler-JOIN): Restore the joiners linestamp.
	(rcirc-maybe-remember-nick-quit): Add function.
	(rcirc-handler-QUIT): Record sender in table of recently quit
	nicks.

Index: rcirc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/rcirc.el,v
retrieving revision 1.38
diff -c -r1.38 rcirc.el
*** rcirc.el	21 Oct 2007 00:24:31 -0000	1.38
--- rcirc.el	22 Oct 2007 18:03:34 -0000
***************
*** 93,103 ****
  when connecting to this server.  If absent, no channels will be
  connected to automatically."
    :type '(alist :key-type string
! 		:value-type (plist :options ((nick string)
! 					     (port integer)
! 					     (user-name string)
! 					     (full-name string)
! 					     (channels (repeat string)))))
    :group 'rcirc)
  
  (defcustom rcirc-default-port 6667
--- 93,103 ----
  when connecting to this server.  If absent, no channels will be
  connected to automatically."
    :type '(alist :key-type string
! 		:value-type (plist :options ((:nick string)
! 					     (:port integer)
! 					     (:user-name string)
! 					     (:full-name string)
! 					     (:channels (repeat string)))))
    :group 'rcirc)
  
  (defcustom rcirc-default-port 6667
***************
*** 323,328 ****
--- 323,331 ----
  
  (defvar rcirc-nick-table nil)
  
+ (defvar rcirc-recent-quit-alist nil
+   "Alist of nicks that have recently quit or parted the channel.")
+ 
  (defvar rcirc-nick-syntax-table
    (let ((table (make-syntax-table text-mode-syntax-table)))
      (mapc (lambda (c) (modify-syntax-entry c "w" table))
***************
*** 417,424 ****
  			      connected-servers))))))))
        (when connected-servers
  	(message "Already connected to %s"
! 		 (concat (mapconcat 'identity (butlast connected-servers) ", ")
! 			 ", and " (car (last connected-servers))))))))
  
  ;;;###autoload
  (defalias 'irc 'rcirc)
--- 420,430 ----
  			      connected-servers))))))))
        (when connected-servers
  	(message "Already connected to %s"
! 		 (if (cdr connected-servers)
! 		     (concat (mapconcat 'identity (butlast connected-servers) ", ")
! 			     ", and "
! 			     (car (last connected-servers)))
! 		   (car connected-servers)))))))
  
  ;;;###autoload
  (defalias 'irc 'rcirc)
***************
*** 763,769 ****
  					  rcirc-target))))))
    (let ((completion (car rcirc-nick-completions)))
      (when completion
-       (rcirc-put-nick-channel (rcirc-buffer-process) completion rcirc-target)
        (delete-region (+ rcirc-prompt-end-marker
  			rcirc-nick-completion-start-offset)
  		     (point))
--- 769,774 ----
***************
*** 799,804 ****
--- 804,810 ----
  (define-key rcirc-mode-map (kbd "C-c C-m") 'rcirc-cmd-msg)
  (define-key rcirc-mode-map (kbd "C-c C-r") 'rcirc-cmd-nick) ; rename
  (define-key rcirc-mode-map (kbd "C-c C-o") 'rcirc-omit-mode)
+ (define-key rcirc-mode-map (kbd "M-o") 'rcirc-omit-mode)
  (define-key rcirc-mode-map (kbd "C-c C-p") 'rcirc-cmd-part)
  (define-key rcirc-mode-map (kbd "C-c C-q") 'rcirc-cmd-query)
  (define-key rcirc-mode-map (kbd "C-c C-t") 'rcirc-cmd-topic)
***************
*** 828,833 ****
--- 834,843 ----
    "Alist of lines to log to disk when `rcirc-log-flag' is non-nil.
  Each element looks like (FILENAME . TEXT).")
  
+ (defvar rcirc-current-line 0
+   "The current number of responses printed in this channel.
+ This number is independent of the number of lines in the buffer.")
+ 
  (defun rcirc-mode (process target)
    "Major mode for IRC channel buffers.
  
***************
*** 850,861 ****
--- 860,883 ----
    (setq rcirc-last-post-time (current-time))
    (make-local-variable 'fill-paragraph-function)
    (setq fill-paragraph-function 'rcirc-fill-paragraph)
+   (make-local-variable 'rcirc-recent-quit-alist)
+   (setq rcirc-recent-quit-alist nil)
+   (make-local-variable 'rcirc-current-line)
+   (setq rcirc-current-line 0)
  
    (make-local-variable 'rcirc-short-buffer-name)
    (setq rcirc-short-buffer-name nil)
    (make-local-variable 'rcirc-urls)
    (setq use-hard-newlines t)
  
+   ;; setup for omitting responses
+   (setq buffer-invisibility-spec '())
+   (setq buffer-display-table (make-display-table))
+   (set-display-table-slot buffer-display-table 4
+ 			  (let ((glyph (make-glyph-code 
+ 					?. 'font-lock-keyword-face)))
+ 			    (make-vector 3 glyph)))
+ 
    (make-local-variable 'rcirc-decode-coding-system)
    (make-local-variable 'rcirc-encode-coding-system)
    (dolist (i rcirc-coding-system-alist)
***************
*** 879,886 ****
    (setq overlay-arrow-position (make-marker))
    (set-marker overlay-arrow-position nil)
  
-   (setq buffer-invisibility-spec '(rcirc-ignored-user))
- 
    ;; if the user changes the major mode or kills the buffer, there is
    ;; cleanup work to do
    (add-hook 'change-major-mode-hook 'rcirc-change-major-mode-hook nil t)
--- 901,906 ----
***************
*** 1005,1012 ****
  	(let ((new-buffer (get-buffer-create
  			   (rcirc-generate-new-buffer-name process target))))
  	  (with-current-buffer new-buffer
! 	    (rcirc-mode process target))
! 	  (rcirc-put-nick-channel process (rcirc-nick process) target)
  	  new-buffer)))))
  
  (defun rcirc-send-input ()
--- 1025,1033 ----
  	(let ((new-buffer (get-buffer-create
  			   (rcirc-generate-new-buffer-name process target))))
  	  (with-current-buffer new-buffer
! 	    (rcirc-mode process target)
! 	    (rcirc-put-nick-channel process (rcirc-nick process) target 
! 				    rcirc-current-line))
  	  new-buffer)))))
  
  (defun rcirc-send-input ()
***************
*** 1090,1096 ****
    (interactive)
    (let ((pos (1+ (- (point) rcirc-prompt-end-marker))))
      (goto-char (point-max))
!     (let ((text (buffer-substring rcirc-prompt-end-marker (point)))
            (parent (buffer-name)))
        (delete-region rcirc-prompt-end-marker (point))
        (setq rcirc-window-configuration (current-window-configuration))
--- 1111,1118 ----
    (interactive)
    (let ((pos (1+ (- (point) rcirc-prompt-end-marker))))
      (goto-char (point-max))
!     (let ((text (buffer-substring-no-properties rcirc-prompt-end-marker 
! 						(point)))
            (parent (buffer-name)))
        (delete-region rcirc-prompt-end-marker (point))
        (setq rcirc-window-configuration (current-window-configuration))
***************
*** 1187,1193 ****
    :group 'rcirc)
  
  (defcustom rcirc-omit-responses
!   '("JOIN" "PART" "QUIT")
    "Responses which will be hidden when `rcirc-omit-mode' is enabled."
    :type '(repeat string)
    :group 'rcirc)
--- 1209,1215 ----
    :group 'rcirc)
  
  (defcustom rcirc-omit-responses
!   '("JOIN" "PART" "QUIT" "NICK")
    "Responses which will be hidden when `rcirc-omit-mode' is enabled."
    :type '(repeat string)
    :group 'rcirc)
***************
*** 1281,1286 ****
--- 1303,1340 ----
    :type 'boolean
    :group 'rcirc)
  
+ (defcustom rcirc-omit-threshold 100
+   "Number of lines since last activity from a nick before `rcirc-omit-responses' are omitted."
+   :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))))
+ 
  (defvar rcirc-markup-text-functions
    '(rcirc-markup-attributes
      rcirc-markup-my-nick
***************
*** 1305,1311 ****
  			     (when (string-match "^\\([^/]\\w*\\)[:,]" text)
  			       (match-string 1 text)))
  			   rcirc-ignore-list))
! 	       (not (string= sender (rcirc-nick process))))
      (let* ((buffer (rcirc-target-buffer process sender response target text))
  	   (inhibit-read-only t))
        (with-current-buffer buffer
--- 1359,1366 ----
  			     (when (string-match "^\\([^/]\\w*\\)[:,]" text)
  			       (match-string 1 text)))
  			   rcirc-ignore-list))
! 	       ;; do not ignore if we sent the message
!  	       (not (string= sender (rcirc-nick process))))    
      (let* ((buffer (rcirc-target-buffer process sender response target text))
  	   (inhibit-read-only t))
        (with-current-buffer buffer
***************
*** 1340,1345 ****
--- 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
***************
*** 1350,1365 ****
  		  (save-excursion (rcirc-markup-timestamp sender response))
  		  (dolist (fn rcirc-markup-text-functions)
  		    (save-excursion (funcall fn sender response)))
! 		  (save-excursion (rcirc-markup-fill sender response)))
  
  		(when rcirc-read-only-flag
  		  (add-text-properties (point-min) (point-max)
  				       '(read-only t front-sticky t))))
  	      ;; make text omittable
! 	      (when (and (member response rcirc-omit-responses)
! 			 (> start (point-min)))
! 		(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)
--- 1408,1427 ----
  		  (save-excursion (rcirc-markup-timestamp sender response))
  		  (dolist (fn rcirc-markup-text-functions)
  		    (save-excursion (funcall fn sender response)))
! 		  (when rcirc-fill-flag
! 		    (save-excursion (rcirc-markup-fill sender response))))
  
  		(when rcirc-read-only-flag
  		  (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)
***************
*** 1470,1484 ****
      (mapcar (lambda (x) (car x))
  	    (gethash nick rcirc-nick-table))))
  
! (defun rcirc-put-nick-channel (process nick channel)
!   "Add CHANNEL to list associated with NICK."
    (let ((nick (rcirc-user-nick nick)))
      (with-rcirc-process-buffer process
        (let* ((chans (gethash nick rcirc-nick-table))
  	     (record (assoc-string channel chans t)))
  	(if record
! 	    (setcdr record (current-time))
! 	  (puthash nick (cons (cons channel (current-time))
  			      chans)
  		   rcirc-nick-table))))))
  
--- 1532,1551 ----
      (mapcar (lambda (x) (car x))
  	    (gethash nick rcirc-nick-table))))
  
! (defun rcirc-put-nick-channel (process nick channel &optional line)
!   "Add CHANNEL to list associated with NICK.
! Update the associated linestamp if LINE is non-nil.
! 
! 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))
  	     (record (assoc-string channel chans t)))
  	(if record
! 	    (when line (setcdr record line))
! 	  (puthash nick (cons (cons channel (or line 0))
  			      chans)
  		   rcirc-nick-table))))))
  
***************
*** 1514,1520 ****
  		     (setq nicks (cons (cons k (cdr record)) nicks)))))
  	     rcirc-nick-table)
  	    (mapcar (lambda (x) (car x))
! 		    (sort nicks (lambda (x y) (time-less-p (cdr y) (cdr x)))))))
        (list target))))
  
  (defun rcirc-ignore-update-automatic (nick)
--- 1581,1590 ----
  		     (setq nicks (cons (cons k (cdr record)) nicks)))))
  	     rcirc-nick-table)
  	    (mapcar (lambda (x) (car x))
! 		    (sort nicks (lambda (x y)
! 				  (let ((lx (or (cdr x) 0))
! 					(ly (or (cdr y) 0)))
! 				    (< ly lx)))))))
        (list target))))
  
  (defun rcirc-ignore-update-automatic (nick)
***************
*** 1593,1607 ****
  `rcirc-omit-responses'."
    (interactive)
    (setq rcirc-omit-mode (not rcirc-omit-mode))
!   (let ((line (1- (count-screen-lines (point) (window-start)))))
!     (if rcirc-omit-mode
! 	(progn
! 	  (add-to-invisibility-spec 'rcirc-omit)
! 	  (message "Rcirc-Omit mode enabled"))
!       (remove-from-invisibility-spec 'rcirc-omit)
!       (message "Rcirc-Omit mode disabled"))
!     (recenter line))
!   (force-mode-line-update))
  
  (defun rcirc-switch-to-server-buffer ()
    "Switch to the server buffer associated with current channel buffer."
--- 1663,1675 ----
  `rcirc-omit-responses'."
    (interactive)
    (setq rcirc-omit-mode (not rcirc-omit-mode))
!   (if rcirc-omit-mode
!       (progn
! 	(add-to-invisibility-spec '(rcirc-omit . t))
! 	(message "Rcirc-Omit mode enabled"))
!     (remove-from-invisibility-spec '(rcirc-omit . t))
!     (message "Rcirc-Omit mode disabled"))
!     (recenter (when (> (point) rcirc-prompt-start-marker) -1)))
  
  (defun rcirc-switch-to-server-buffer ()
    "Switch to the server buffer associated with current channel buffer."
***************
*** 1636,1642 ****
  	 (hipri (cdr pair)))
      (if (or (and (not arg) hipri)
  	    (and arg lopri))
! 	(switch-to-buffer (car (if arg lopri hipri)) t)
        (if (eq major-mode 'rcirc-mode)
  	  (switch-to-buffer (rcirc-non-irc-buffer))
  	(message (concat
--- 1704,1713 ----
  	 (hipri (cdr pair)))
      (if (or (and (not arg) hipri)
  	    (and arg lopri))
! 	(progn
! 	  (switch-to-buffer (car (if arg lopri hipri)))
! 	  (when (> (point) rcirc-prompt-start-marker)
! 	    (recenter -1)))
        (if (eq major-mode 'rcirc-mode)
  	  (switch-to-buffer (rcirc-non-irc-buffer))
  	(message (concat
***************
*** 2201,2209 ****
      (if (string-match "^\C-a\\(.*\\)\C-a$" message)
          (rcirc-handler-CTCP process target sender (match-string 1 message))
        (rcirc-print process sender "PRIVMSG" target message t))
!     ;; update nick timestamp
!     (if (member target (rcirc-nick-channels process sender))
!         (rcirc-put-nick-channel process sender target))))
  
  (defun rcirc-handler-NOTICE (process sender args text)
    (let ((target (car args))
--- 2272,2280 ----
      (if (string-match "^\C-a\\(.*\\)\C-a$" message)
          (rcirc-handler-CTCP process target sender (match-string 1 message))
        (rcirc-print process sender "PRIVMSG" target message t))
!     ;; update nick linestamp
!     (with-current-buffer (rcirc-get-buffer process target t)
!       (rcirc-put-nick-channel process sender target rcirc-current-line))))
  
  (defun rcirc-handler-NOTICE (process sender args text)
    (let ((target (car args))
***************
*** 2228,2248 ****
  
  (defun rcirc-handler-JOIN (process sender args text)
    (let ((channel (car args)))
!     (rcirc-get-buffer-create process channel)
      (rcirc-print process sender "JOIN" channel "")
  
      ;; print in private chat buffer if it exists
      (when (rcirc-get-buffer (rcirc-buffer-process) sender)
!       (rcirc-print process sender "JOIN" sender channel))
! 
!     (rcirc-put-nick-channel process sender channel)))
  
  ;; PART and KICK are handled the same way
  (defun rcirc-handler-PART-or-KICK (process response channel sender nick args)
    (rcirc-ignore-update-automatic nick)
    (if (not (string= nick (rcirc-nick process)))
        ;; this is someone else leaving
!       (rcirc-remove-nick-channel process nick channel)
      ;; this is us leaving
      (mapc (lambda (n)
  	    (rcirc-remove-nick-channel process n channel))
--- 2299,2327 ----
  
  (defun rcirc-handler-JOIN (process sender args text)
    (let ((channel (car args)))
!     (with-current-buffer (rcirc-get-buffer-create process channel)
!       ;; 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 "")
  
      ;; print in private chat buffer if it exists
      (when (rcirc-get-buffer (rcirc-buffer-process) sender)
!       (rcirc-print process sender "JOIN" sender channel))))
  
  ;; PART and KICK are handled the same way
  (defun rcirc-handler-PART-or-KICK (process response channel sender nick args)
    (rcirc-ignore-update-automatic nick)
    (if (not (string= nick (rcirc-nick process)))
        ;; this is someone else leaving
!       (progn
! 	(rcirc-maybe-remember-nick-quit process nick channel)
! 	(rcirc-remove-nick-channel process nick channel))
      ;; this is us leaving
      (mapc (lambda (n)
  	    (rcirc-remove-nick-channel process n channel))
***************
*** 2276,2291 ****
  
      (rcirc-handler-PART-or-KICK process "KICK" channel sender nick reason)))
  
  (defun rcirc-handler-QUIT (process sender args text)
    (rcirc-ignore-update-automatic sender)
    (mapc (lambda (channel)
! 	  (rcirc-print process sender "QUIT" channel (apply 'concat args)))
  	(rcirc-nick-channels process sender))
- 
-   ;; print in private chat buffer if it exists
-   (when (rcirc-get-buffer (rcirc-buffer-process) sender)
-     (rcirc-print process sender "QUIT" sender (apply 'concat args)))
- 
    (rcirc-nick-remove process sender))
  
  (defun rcirc-handler-NICK (process sender args text)
--- 2355,2385 ----
  
      (rcirc-handler-PART-or-KICK process "KICK" channel sender nick reason)))
  
+ (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
+ 		      (cons (cons nick line)
+ 			    rcirc-recent-quit-alist))))))))))
+ 
  (defun rcirc-handler-QUIT (process sender args text)
    (rcirc-ignore-update-automatic sender)
    (mapc (lambda (channel)
! 	  ;; broadcast quit message each channel
! 	  (rcirc-print process sender "QUIT" channel (apply 'concat args))
! 	  ;; record nick in quit table if they recently spoke
! 	  (rcirc-maybe-remember-nick-quit process sender channel))
  	(rcirc-nick-channels process sender))
    (rcirc-nick-remove process sender))
  
  (defun rcirc-handler-NICK (process sender args text)


Diffs between working revision and workfile end here.

^ permalink raw reply	[flat|nested] 22+ messages in thread
* rcirc update
@ 2007-03-07 23:14 Ryan Yeske
  0 siblings, 0 replies; 22+ messages in thread
From: Ryan Yeske @ 2007-03-07 23:14 UTC (permalink / raw)
  To: emacs-devel

2007-03-02  Ryan Yeske  <rcyeske@gmail.com>

	* net/rcirc.el (rcirc-timeout-seconds): New variable.
	(rcirc-keepalive-seconds): Remove variable.
	(rcirc-server-name, rcirc-timeout-timer, rcirc-connecting)
	(rcirc-process): New variables.
	(rcirc-connect): Initalize new variables.
	(rcirc-keepalive): Don't send keepalive pings before connection is
	completed.
	(rcirc-sentinel): Do mark all channels with activity when
	connection is dropped.  Run hook with process buffer local.
	(rcirc-reschedule-timeout, rcirc-delete-process): New functions.
	(rcirc-buffer-process): Return value of rcirc-process if
	rcirc-server-buffer is nil.
	(rcirc-server-name): Return the reported server name.
	(rcirc-update-prompt): Simplify computation of the server name.
	(rcirc-format-response-string): Likewise.
	(rcirc-handler-001): Mark server as connected, record the reported
	server name, and schedule a timeout.
	(rcirc-track-nick): Add a spec for the tty class.
	(rcirc-user-non-nick): Remove function.
	(rcirc-nick-prefix-chars): Add variable.
	(rcirc-user-nick): Use above variable.


Index: rcirc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/net/rcirc.el,v
retrieving revision 1.30
diff -c -r1.30 rcirc.el
*** rcirc.el	24 Nov 2006 10:33:22 -0000	1.30
--- rcirc.el	2 Mar 2007 22:40:28 -0000
***************
*** 312,320 ****
    "List of urls seen in the current buffer.")
  (put 'rcirc-urls 'permanent-local t)

! (defvar rcirc-keepalive-seconds 60
!   "Number of seconds between keepalive pings.
! If nil, do not send keepalive pings.")

  (defconst rcirc-id-string (concat "rcirc on GNU Emacs " emacs-version))
  \f
--- 312,319 ----
    "List of urls seen in the current buffer.")
  (put 'rcirc-urls 'permanent-local t)

! (defvar rcirc-timeout-seconds 60
!   "Kill connection after this many seconds if there is no activity.")

  (defconst rcirc-id-string (concat "rcirc on GNU Emacs " emacs-version))
  \f
***************
*** 357,363 ****
  (defvar rcirc-topic nil)
  (defvar rcirc-keepalive-timer nil)
  (defvar rcirc-last-server-message-time nil)
! (defvar rcirc-server nil)

  ;;;###autoload
  (defun rcirc-connect (&optional server port nick user-name full-name
startup-channels)
--- 356,366 ----
  (defvar rcirc-topic nil)
  (defvar rcirc-keepalive-timer nil)
  (defvar rcirc-last-server-message-time nil)
! (defvar rcirc-server nil)		; server provided by server
! (defvar rcirc-server-name nil)		; server name given by 001 response
! (defvar rcirc-timeout-timer nil)
! (defvar rcirc-connecting nil)
! (defvar rcirc-process nil)

  ;;;###autoload
  (defun rcirc-connect (&optional server port nick user-name full-name
startup-channels)
***************
*** 374,380 ****
  	   (user-name (or user-name rcirc-default-user-name))
  	   (full-name (or full-name rcirc-default-user-full-name))
  	   (startup-channels startup-channels)
!            (process (open-network-stream server nil server port-number)))
        ;; set up process
        (set-process-coding-system process 'raw-text 'raw-text)
        (switch-to-buffer (rcirc-generate-new-buffer-name process nil))
--- 377,383 ----
  	   (user-name (or user-name rcirc-default-user-name))
  	   (full-name (or full-name rcirc-default-user-full-name))
  	   (startup-channels startup-channels)
!            (process (make-network-process :name server :host server
:service port-number)))
        ;; set up process
        (set-process-coding-system process 'raw-text 'raw-text)
        (switch-to-buffer (rcirc-generate-new-buffer-name process nil))
***************
*** 382,389 ****
--- 385,396 ----
        (rcirc-mode process nil)
        (set-process-sentinel process 'rcirc-sentinel)
        (set-process-filter process 'rcirc-filter)
+       (make-local-variable 'rcirc-process)
+       (setq rcirc-process process)
        (make-local-variable 'rcirc-server)
        (setq rcirc-server server)
+       (make-local-variable 'rcirc-server-name)
+       (setq rcirc-server-name server)	; update when we get 001 response
        (make-local-variable 'rcirc-buffer-alist)
        (setq rcirc-buffer-alist nil)
        (make-local-variable 'rcirc-nick-table)
***************
*** 396,401 ****
--- 403,414 ----
        (setq rcirc-startup-channels startup-channels)
        (make-local-variable 'rcirc-last-server-message-time)
        (setq rcirc-last-server-message-time (current-time))
+       (make-local-variable 'rcirc-timeout-timer)
+       (setq rcirc-timeout-timer nil)
+       (make-local-variable 'rcirc-user-disconnect)
+       (setq rcirc-user-disconnect nil)
+       (make-local-variable 'rcirc-connecting)
+       (setq rcirc-connecting t)

        ;; identify
        (rcirc-send-string process (concat "NICK " nick))
***************
*** 404,413 ****
                                        full-name))

        ;; setup ping timer if necessary
!       (when rcirc-keepalive-seconds
! 	(unless rcirc-keepalive-timer
! 	  (setq rcirc-keepalive-timer
! 		(run-at-time 0 rcirc-keepalive-seconds 'rcirc-keepalive))))

        (message "Connecting to %s...done" server)

--- 417,425 ----
                                        full-name))

        ;; setup ping timer if necessary
!       (unless rcirc-keepalive-timer
! 	(setq rcirc-keepalive-timer
! 	      (run-at-time 0 (/ rcirc-timeout-seconds 2) 'rcirc-keepalive)))

        (message "Connecting to %s...done" server)

***************
*** 430,441 ****
  last ping."
    (if (rcirc-process-list)
        (mapc (lambda (process)
!               (with-rcirc-process-buffer process
! 		(if (> (cadr (time-since rcirc-last-server-message-time))
! 		       rcirc-keepalive-seconds)
! 		    (kill-process process)
! 		  (rcirc-send-string process (concat "PING " rcirc-server)))))
              (rcirc-process-list))
      (cancel-timer rcirc-keepalive-timer)
      (setq rcirc-keepalive-timer nil)))

--- 442,452 ----
  last ping."
    (if (rcirc-process-list)
        (mapc (lambda (process)
! 	      (with-rcirc-process-buffer process
! 		(when (not rcirc-connecting)
! 		  (rcirc-send-string process (concat "PING " (rcirc-server-name
process))))))
              (rcirc-process-list))
+     ;; no processes, clean up timer
      (cancel-timer rcirc-keepalive-timer)
      (setq rcirc-keepalive-timer nil)))

***************
*** 472,483 ****
  		       (format "%s: %s (%S)"
  			       (process-name process)
  			       sentinel
! 			       (process-status process)) t)
  	  ;; remove the prompt from buffers
  	  (let ((inhibit-read-only t))
  	    (delete-region rcirc-prompt-start-marker
! 			   rcirc-prompt-end-marker)))))
!     (run-hook-with-args 'rcirc-sentinel-hooks process sentinel)))

  (defun rcirc-process-list ()
    "Return a list of rcirc processes."
--- 483,494 ----
  		       (format "%s: %s (%S)"
  			       (process-name process)
  			       sentinel
! 			       (process-status process)) (not rcirc-target))
  	  ;; remove the prompt from buffers
  	  (let ((inhibit-read-only t))
  	    (delete-region rcirc-prompt-start-marker
! 			   rcirc-prompt-end-marker))))
!       (run-hook-with-args 'rcirc-sentinel-hooks process sentinel))))

  (defun rcirc-process-list ()
    "Return a list of rcirc processes."
***************
*** 496,501 ****
--- 507,513 ----
  (defun rcirc-filter (process output)
    "Called when PROCESS receives OUTPUT."
    (rcirc-debug process output)
+   (rcirc-reschedule-timeout process)
    (with-rcirc-process-buffer process
      (setq rcirc-last-server-message-time (current-time))
      (setq rcirc-process-output (concat rcirc-process-output output))
***************
*** 506,511 ****
--- 518,536 ----
              (split-string rcirc-process-output "[\n\r]" t))
        (setq rcirc-process-output nil))))

+ (defun rcirc-reschedule-timeout (process)
+   (with-rcirc-process-buffer process
+     (when (not rcirc-connecting)
+       (with-rcirc-process-buffer process
+ 	(when rcirc-timeout-timer (cancel-timer rcirc-timeout-timer))
+ 	(setq rcirc-timeout-timer (run-at-time rcirc-timeout-seconds nil
+ 					       'rcirc-delete-process
+ 					       process))))))
+
+ (defun rcirc-delete-process (process)
+   (message "delete process %S" process)
+   (delete-process process))
+
  (defvar rcirc-trap-errors-flag t)
  (defun rcirc-process-server-response (process text)
    (if rcirc-trap-errors-flag
***************
*** 557,571 ****
  (defun rcirc-buffer-process (&optional buffer)
    "Return the process associated with channel BUFFER.
  With no argument or nil as argument, use the current buffer."
!   (get-buffer-process (if buffer
! 			  (with-current-buffer buffer
! 			    rcirc-server-buffer)
! 			rcirc-server-buffer)))

  (defun rcirc-server-name (process)
    "Return PROCESS server name, given by the 001 response."
    (with-rcirc-process-buffer process
!     (or rcirc-server rcirc-default-server)))

  (defun rcirc-nick (process)
    "Return PROCESS nick."
--- 582,597 ----
  (defun rcirc-buffer-process (&optional buffer)
    "Return the process associated with channel BUFFER.
  With no argument or nil as argument, use the current buffer."
!   (or (get-buffer-process (if buffer
! 			      (with-current-buffer buffer
! 				rcirc-server-buffer)
! 			    rcirc-server-buffer))
!       rcirc-process))

  (defun rcirc-server-name (process)
    "Return PROCESS server name, given by the 001 response."
    (with-rcirc-process-buffer process
!     (or rcirc-server-name rcirc-default-server)))

  (defun rcirc-nick (process)
    "Return PROCESS nick."
***************
*** 790,796 ****
  	      (setq prompt
  		    (replace-regexp-in-string (car rep) (cdr rep) prompt)))
  	    (list (cons "%n" (rcirc-buffer-nick))
! 		  (cons "%s" (with-rcirc-server-buffer (or rcirc-server "")))
  		  (cons "%t" (or rcirc-target ""))))
        (save-excursion
  	(delete-region rcirc-prompt-start-marker rcirc-prompt-end-marker)
--- 816,822 ----
  	      (setq prompt
  		    (replace-regexp-in-string (car rep) (cdr rep) prompt)))
  	    (list (cons "%n" (rcirc-buffer-nick))
! 		  (cons "%s" (with-rcirc-server-buffer rcirc-server-name))
  		  (cons "%t" (or rcirc-target ""))))
        (save-excursion
  	(delete-region rcirc-prompt-start-marker rcirc-prompt-end-marker)
***************
*** 1079,1087 ****
  		   "%")
  		  ((or (eq key ?n) (eq key ?N))
  		   ;; %n/%N -- nick
! 		   (let ((nick (concat (if (string= (with-rcirc-process-buffer
! 							process
! 						      rcirc-server)
  						    sender)
  					   ""
  					 sender)
--- 1105,1111 ----
  		   "%")
  		  ((or (eq key ?n) (eq key ?N))
  		   ;; %n/%N -- nick
! 		   (let ((nick (concat (if (string= (rcirc-server-name process)
  						    sender)
  					   ""
  					 sender)
***************
*** 1302,1320 ****
  	(rcirc-cmd-join channel process)))))
  \f
  ;;; nick management
  (defun rcirc-user-nick (user)
    "Return the nick from USER.  Remove any non-nick junk."
    (save-match-data
!     (if (string-match "^[@%+]?\\([^! ]+\\)!?" (or user ""))
  	(match-string 1 user)
        user)))

- (defun rcirc-user-non-nick (user)
-   "Return the non-nick portion of USER."
-   (if (string-match "^[@+]?[^! ]+!?\\(.*\\)" (or user ""))
-       (match-string 1 user)
-     user))
-
  (defun rcirc-nick-channels (process nick)
    "Return list of channels for NICK."
    (with-rcirc-process-buffer process
--- 1326,1340 ----
  	(rcirc-cmd-join channel process)))))
  \f
  ;;; nick management
+ (defvar rcirc-nick-prefix-chars "~&@%+")
  (defun rcirc-user-nick (user)
    "Return the nick from USER.  Remove any non-nick junk."
    (save-match-data
!     (if (string-match (concat "^[" rcirc-nick-prefix-chars
! 			      "]?\\([^! ]+\\)!?") (or user ""))
  	(match-string 1 user)
        user)))

  (defun rcirc-nick-channels (process nick)
    "Return list of channels for NICK."
    (with-rcirc-process-buffer process
***************
*** 2009,2015 ****
    (rcirc-handler-generic process "001" sender args text)
    ;; set the real server name
    (with-rcirc-process-buffer process
!     (setq rcirc-server sender)
      (setq rcirc-nick (car args))
      (rcirc-update-prompt)
      (when rcirc-auto-authenticate-flag (rcirc-authenticate))
--- 2029,2037 ----
    (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)
!     (setq rcirc-server-name sender)
      (setq rcirc-nick (car args))
      (rcirc-update-prompt)
      (when rcirc-auto-authenticate-flag (rcirc-authenticate))
***************
*** 2419,2425 ****
    :group 'rcirc-faces)

  (defface rcirc-track-nick
!   '((t (:inverse-video t)))
    "The face used in the mode-line when your nick is mentioned."
    :group 'rcirc-faces)

--- 2441,2448 ----
    :group 'rcirc-faces)

  (defface rcirc-track-nick
!   '((((type tty)) (:inherit default))
!     (t (:inverse-video t)))
    "The face used in the mode-line when your nick is mentioned."
    :group 'rcirc-faces)

^ permalink raw reply	[flat|nested] 22+ messages in thread
* rcirc update
@ 2006-09-02  0:02 Ryan Yeske
  0 siblings, 0 replies; 22+ messages in thread
From: Ryan Yeske @ 2006-09-02  0:02 UTC (permalink / raw)


2006-08-31  Ryan Yeske  <rcyeske@gmail.com>

	* rcirc.el (rcirc-keywords): Add variable.
	(rcirc-bright-nicks, rcirc-dim-nicks): Add variables.
	(rcirc-bright-nick-regexp, rcirc-dim-nick-regexp): Remove
	variables.
	(rcirc-responses-no-activity): Add function.
	(rcirc-handler-generic): Check for responses in above.
	(rcirc-process-command): Add ?: character to arguments of raw
	server commands.
	(rcirc-format-response-string): Use `rcirc-bright-nicks' and
	`rcirc-dim-nicks'.
	(rcirc-gray-toggle): Remove unused variable.
	(rcirc-print): Remove some tracking logic, which is moved into
	markup functions.
	(rcirc-activity-types): Was `rcirc-activity-type', now a list of
	types.
	(rcirc-activity-string): Look for 'keyword in activity-types.
	(rcirc-window-configuration-change): Don't erase overlay-arrow
	unnecessarily.
	(rcirc-add-or-remove): Add function.
	(rcirc-cmd-ignore): Use above function.
	(rcirc-message-leader): Remove unused function.
	(rcicr-cmd-bright, rcirc-cmd-dim, rcirc-cmd-keyword): Add commands.
	(rcirc-add-face): Add function.
	(rcirc-facify): Use rcirc-add-face.
	(rcirc-url-regexp): Add parens.
	(rcirc-map-regexp): Remove function.
	(rcirc-mangle-regexp): Remove function.
	(rcirc-markup-text-functions): Add variable.
	(rcirc-markup-text): Add function (replaces `rcirc-mangle-text').
	(rcirc-markup-body-text, rcirc-markup-attributes)
	(rcirc-markup-my-nick, rcirc-markup-urls, rcirc-markup-keywords)
	(rcirc-markup-bright-nicks): Add markup handler functions.
	(rcirc-nick-in-message-full-line): Add face.
	(rcirc-track-nick): Rename from `rcirc-mode-line-nick'.
	(rcirc-track-keyword, rcirc-url, rcirc-keyword): Add faces.


*** rcirc.el	28 Aug 2006 13:12:08 -0700	1.25
--- rcirc.el	01 Sep 2006 15:12:08 -0700	
***************
*** 144,150 ****
  
  (defcustom rcirc-show-maximum-output t
    "*If non-nil, scroll buffer to keep the point at the bottom of
! the window.")
  
  (defcustom rcirc-authinfo nil
    "List of authentication passwords.
--- 144,152 ----
  
  (defcustom rcirc-show-maximum-output t
    "*If non-nil, scroll buffer to keep the point at the bottom of
! the window."
!   :type 'boolean
!   :group 'rcirc)
  
  (defcustom rcirc-authinfo nil
    "List of authentication passwords.
***************
*** 200,205 ****
--- 202,212 ----
    :initialize 'custom-initialize-default
    :group 'rcirc)
  
+ (defcustom rcirc-keywords nil
+   "List of keywords to highlight in message text."
+   :type '(repeat string)
+   :group 'rcirc)
+ 
  (defcustom rcirc-ignore-list ()
    "List of ignored nicks.
  Use /ignore to list them, use /ignore NICK to add or remove a nick."
***************
*** 212,227 ****
  Nicks will be removed from the automatic list on follow-up renamings or
  parts.")
  
! (defcustom rcirc-bright-nick-regexp nil
!   "Regexp matching nicks to be emphasized.
  See `rcirc-bright-nick' face."
!   :type 'regexp
    :group 'rcirc)
  
! (defcustom rcirc-dim-nick-regexp nil
!   "Regexp matching nicks to be deemphasized.
  See `rcirc-dim-nick' face."
!   :type 'regexp
    :group 'rcirc)
  
  (defcustom rcirc-print-hooks nil
--- 219,234 ----
  Nicks will be removed from the automatic list on follow-up renamings or
  parts.")
  
! (defcustom rcirc-bright-nicks nil
!   "List of nicks to be emphasized.
  See `rcirc-bright-nick' face."
!   :type '(repeat string)
    :group 'rcirc)
  
! (defcustom rcirc-dim-nicks nil
!   "List of nicks to be deemphasized.
  See `rcirc-dim-nick' face."
!   :type '(repeat string)
    :group 'rcirc)
  
  (defcustom rcirc-print-hooks nil
***************
*** 246,252 ****
    :group 'rcirc)
  
  (defcustom rcirc-coding-system-alist nil
!   "Alist to decide a coding system to use for a file I/O operation.
  The format is ((PATTERN . VAL) ...).
  PATTERN is either a string or a cons of strings.
  If PATTERN is a string, it is used to match a target.
--- 253,259 ----
    :group 'rcirc)
  
  (defcustom rcirc-coding-system-alist nil
!   "Alist to decide a coding system to use for a channel I/O operation.
  The format is ((PATTERN . VAL) ...).
  PATTERN is either a string or a cons of strings.
  If PATTERN is a string, it is used to match a target.
***************
*** 528,537 ****
                              process cmd sender args text)))
      (message "UNHANDLED: %s" text)))
  
! (defun rcirc-handler-generic (process command sender args text)
    "Generic server response handler."
!   (rcirc-print process sender command nil
!                (mapconcat 'identity (cdr args) " ") t))
  
  (defun rcirc-send-string (process string)
    "Send PROCESS a STRING plus a newline."
--- 535,548 ----
                              process cmd sender args text)))
      (message "UNHANDLED: %s" text)))
  
! (defvar rcirc-responses-no-activity '("305" "306")
!   "Responses that don't trigger activity in the mode-line indicator.")
! 
! (defun rcirc-handler-generic (process response sender args text)
    "Generic server response handler."
!   (rcirc-print process sender response nil
!                (mapconcat 'identity (cdr args) " ")
! 	       (not (member response rcirc-responses-no-activity))))
  
  (defun rcirc-send-string (process string)
    "Send PROCESS a STRING plus a newline."
***************
*** 748,760 ****
  
    ;; if the user changes the major mode or kills the buffer, there is
    ;; cleanup work to do
!   (make-local-variable 'change-major-mode-hook)
!   (add-hook 'change-major-mode-hook 'rcirc-change-major-mode-hook)
!   (make-local-variable 'kill-buffer-hook)
!   (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook)
  
!   (make-local-variable 'window-scroll-functions)
!   (add-hook 'window-scroll-functions 'rcirc-scroll-to-bottom)
  
    ;; add to buffer list, and update buffer abbrevs
    (when target				; skip server buffer
--- 759,768 ----
  
    ;; if the user changes the major mode or kills the buffer, there is
    ;; cleanup work to do
!   (add-hook 'change-major-mode-hook 'rcirc-change-major-mode-hook nil t)
!   (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook nil t)
  
!   (add-hook 'window-scroll-functions 'rcirc-scroll-to-bottom nil t)
  
    ;; add to buffer list, and update buffer abbrevs
    (when target				; skip server buffer
***************
*** 941,947 ****
  	(if (fboundp fun)
  	    (funcall fun args process rcirc-target)
  	  (rcirc-send-string process
! 			     (concat command " " args)))))))
  
  (defvar rcirc-parent-buffer nil)
  (defvar rcirc-window-configuration nil)
--- 949,955 ----
  	(if (fboundp fun)
  	    (funcall fun args process rcirc-target)
  	  (rcirc-send-string process
! 			     (concat command " :" args)))))))
  
  (defvar rcirc-parent-buffer nil)
  (defvar rcirc-window-configuration nil)
***************
*** 1073,1079 ****
  		   "%")
  		  ((or (eq key ?n) (eq key ?N))
  		   ;; %n/%N -- nick
! 		   (let ((nick (concat (if (string= (with-rcirc-process-buffer process
  						      rcirc-server)
  						    sender)
  					   ""
--- 1081,1088 ----
  		   "%")
  		  ((or (eq key ?n) (eq key ?N))
  		   ;; %n/%N -- nick
! 		   (let ((nick (concat (if (string= (with-rcirc-process-buffer 
! 							process
  						      rcirc-server)
  						    sender)
  					   ""
***************
*** 1084,1109 ****
  				       face
  				     (cond ((string= sender (rcirc-nick process))
  					    'rcirc-my-nick)
! 					   ((and rcirc-bright-nick-regexp
! 						 (string-match rcirc-bright-nick-regexp sender))
  					    'rcirc-bright-nick)
! 					   ((and rcirc-dim-nick-regexp
! 						 (string-match rcirc-dim-nick-regexp sender))
  					    'rcirc-dim-nick)
  					   (t
  					    'rcirc-other-nick))))))
! 		  ((eq key ?T)
  		   ;; %T -- timestamp
  		   (rcirc-facify
  		    (format-time-string rcirc-time-format (current-time))
  		    'rcirc-timestamp))
  		  ((eq key ?m)
  		   ;; %m -- message text
! 		   ;; We add the text property `rcirc-text' to identify this
! 		   ;; as the body text.
! 		   (propertize
! 		    (rcirc-mangle-text process (rcirc-facify text face))
! 		    'rcirc-text text))
  		  ((eq key ?t)
  		   ;; %t -- target
  		   (rcirc-facify (or rcirc-target "") face))
--- 1093,1118 ----
  				       face
  				     (cond ((string= sender (rcirc-nick process))
  					    'rcirc-my-nick)
! 					   ((and rcirc-bright-nicks
! 						 (string-match 
! 						  (regexp-opt rcirc-bright-nicks)
! 						  sender))
  					    'rcirc-bright-nick)
! 					   ((and rcirc-dim-nicks
! 						 (string-match
! 						  (regexp-opt rcirc-dim-nicks)
! 						  sender))
  					    'rcirc-dim-nick)
  					   (t
  					    'rcirc-other-nick))))))
! 		   ((eq key ?T)
  		   ;; %T -- timestamp
  		   (rcirc-facify
  		    (format-time-string rcirc-time-format (current-time))
  		    'rcirc-timestamp))
  		  ((eq key ?m)
  		   ;; %m -- message text
! 		   (rcirc-markup-text process sender response (rcirc-facify text face)))
  		  ((eq key ?t)
  		   ;; %t -- target
  		   (rcirc-facify (or rcirc-target "") face))
***************
*** 1152,1163 ****
  	  ((or (rcirc-get-buffer process target)
  	       (rcirc-any-buffer process))))))
  
! (defvar rcirc-activity-type nil)
! (make-variable-buffer-local 'rcirc-activity-type)
  (defvar rcirc-last-sender nil)
  (make-variable-buffer-local 'rcirc-last-sender)
- (defvar rcirc-gray-toggle nil)
- (make-variable-buffer-local 'rcirc-gray-toggle)
  
  (defun rcirc-scroll-to-bottom (window display-start)
    "Scroll window to show maximum output if `rcirc-show-maximum-output' is
--- 1161,1170 ----
  	  ((or (rcirc-get-buffer process target)
  	       (rcirc-any-buffer process))))))
  
! (defvar rcirc-activity-types nil)
! (make-variable-buffer-local 'rcirc-activity-types)
  (defvar rcirc-last-sender nil)
  (make-variable-buffer-local 'rcirc-last-sender)
  
  (defun rcirc-scroll-to-bottom (window display-start)
    "Scroll window to show maximum output if `rcirc-show-maximum-output' is
***************
*** 1261,1286 ****
  	  (buffer-enable-undo))
  
  	;; record modeline activity
! 	(when activity
! 	  (let ((nick-match
! 		 (with-syntax-table rcirc-nick-syntax-table		 
! 		   (string-match (concat "\\b"
! 					 (regexp-quote (rcirc-nick process))
! 					 "\\b")
! 				 text))))
! 	    (when (if rcirc-ignore-buffer-activity-flag
! 		      ;; - Always notice when our nick is mentioned
! 		      nick-match
! 		    ;; - unless our nick is mentioned, don't bother us
! 		    ;; - with dim-nicks
! 		    (or nick-match
! 			(not (and rcirc-dim-nick-regexp sender
! 				  (string-match rcirc-dim-nick-regexp sender)))))
! 	      (rcirc-record-activity
! 	       (current-buffer)
! 	       (when (or nick-match (and (not (rcirc-channel-p rcirc-target))
! 					 (not rcirc-low-priority-flag)))
! 		 'nick)))))
  
  	(sit-for 0)			; displayed text before hook
  	(run-hook-with-args 'rcirc-print-hooks
--- 1268,1280 ----
  	  (buffer-enable-undo))
  
  	;; record modeline activity
! 	(when (and activity
! 		   (not rcirc-ignore-buffer-activity-flag)
! 		   (not (and rcirc-dim-nicks sender
! 			     (string-match (regexp-opt rcirc-dim-nicks) sender))))
! 	      (rcirc-record-activity (current-buffer)
! 				     (when (not (rcirc-channel-p rcirc-target))
! 				       'nick)))
  
  	(sit-for 0)			; displayed text before hook
  	(run-hook-with-args 'rcirc-print-hooks
***************
*** 1501,1508 ****
  		    (let ((t1 (with-current-buffer b1 rcirc-last-post-time))
  			  (t2 (with-current-buffer b2 rcirc-last-post-time)))
  		      (time-less-p t2 t1)))))
!       (if (not rcirc-activity-type)
! 	  (setq rcirc-activity-type type))
        (rcirc-update-activity-string)))
    (run-hook-with-args 'rcirc-activity-hooks buffer))
  
--- 1495,1501 ----
  		    (let ((t1 (with-current-buffer b1 rcirc-last-post-time))
  			  (t2 (with-current-buffer b2 rcirc-last-post-time)))
  		      (time-less-p t2 t1)))))
!       (pushnew type rcirc-activity-types)
        (rcirc-update-activity-string)))
    (run-hook-with-args 'rcirc-activity-hooks buffer))
  
***************
*** 1510,1516 ****
    "Clear the BUFFER activity."
    (setq rcirc-activity (delete buffer rcirc-activity))
    (with-current-buffer buffer
!     (setq rcirc-activity-type nil)))
  
  (defun rcirc-split-activity (activity)
    "Return a cons cell with ACTIVITY split into (lopri . hipri)."
--- 1503,1509 ----
    "Clear the BUFFER activity."
    (setq rcirc-activity (delete buffer rcirc-activity))
    (with-current-buffer buffer
!     (setq rcirc-activity-types nil)))
  
  (defun rcirc-split-activity (activity)
    "Return a cons cell with ACTIVITY split into (lopri . hipri)."
***************
*** 1518,1524 ****
      (dolist (buf rcirc-activity)
        (with-current-buffer buf
  	(if (and rcirc-low-priority-flag
! 		 (not (eq rcirc-activity-type 'nick)))
  	    (add-to-list 'lopri buf t)
  	  (add-to-list 'hipri buf t))))
      (cons lopri hipri)))
--- 1511,1517 ----
      (dolist (buf rcirc-activity)
        (with-current-buffer buf
  	(if (and rcirc-low-priority-flag
! 		 (not (member 'nick rcirc-activity-types)))
  	    (add-to-list 'lopri buf t)
  	  (add-to-list 'hipri buf t))))
      (cons lopri hipri)))
***************
*** 1547,1557 ****
  
  (defun rcirc-activity-string (buffers)
    (mapconcat (lambda (b)
! 	       (let ((s (rcirc-short-buffer-name b)))
  		 (with-current-buffer b
! 		   (if (not (eq rcirc-activity-type 'nick))
! 		       s
! 		     (rcirc-facify s 'rcirc-mode-line-nick)))))
  	     buffers ","))
  
  (defun rcirc-short-buffer-name (buffer)
--- 1540,1554 ----
  
  (defun rcirc-activity-string (buffers)
    (mapconcat (lambda (b)
! 	       (let ((s (substring-no-properties (rcirc-short-buffer-name b))))
  		 (with-current-buffer b
! 		   (dolist (type rcirc-activity-types)
! 		     (rcirc-add-face 0 (length s)
! 				     (case type
! 				       ('nick 'rcirc-track-nick)
! 				       ('keyword 'rcirc-track-keyword))
! 				     s)))
! 		 s))
  	     buffers ","))
  
  (defun rcirc-short-buffer-name (buffer)
***************
*** 1566,1580 ****
    (let ((current-now-hidden t))
      (walk-windows (lambda (w)
  		    (let ((buf (window-buffer w)))
! 		      (when (eq major-mode 'rcirc-mode)
! 			(rcirc-clear-activity buf)
  			(when (eq buf rcirc-current-buffer)
! 			  (setq current-now-hidden nil))))))
      ;; add overlay arrow if the buffer isn't displayed
!     (when (and rcirc-current-buffer current-now-hidden)
        (with-current-buffer rcirc-current-buffer
! 	(when (eq major-mode 'rcirc-mode)
! 	  (marker-position overlay-arrow-position)
  	  (set-marker overlay-arrow-position nil)))))
  
    ;; remove any killed buffers from list
--- 1563,1580 ----
    (let ((current-now-hidden t))
      (walk-windows (lambda (w)
  		    (let ((buf (window-buffer w)))
! 		      (with-current-buffer buf
! 			(when (eq major-mode 'rcirc-mode)
! 			  (rcirc-clear-activity buf)))
  			(when (eq buf rcirc-current-buffer)
! 			  (setq current-now-hidden nil)))))
      ;; add overlay arrow if the buffer isn't displayed
!     (when (and current-now-hidden
! 	       rcirc-current-buffer
! 	       (buffer-live-p rcirc-current-buffer))
        (with-current-buffer rcirc-current-buffer
! 	(when (and (eq major-mode 'rcirc-mode)
! 		   (marker-position overlay-arrow-position))
  	  (set-marker overlay-arrow-position nil)))))
  
    ;; remove any killed buffers from list
***************
*** 1792,1808 ****
    (rcirc-send-string process (format "PRIVMSG %s :\C-aACTION %s\C-a"
                                       target args)))
  
  (defun-rcirc-command ignore (nick)
    "Manage the ignore list.
  Ignore NICK, unignore NICK if already ignored, or list ignored
  nicks when no NICK is given.  When listing ignored nicks, the
  ones added to the list automatically are marked with an asterisk."
    (interactive "sToggle ignoring of nick: ")
!   (when (not (string= "" nick))
!     (if (member-ignore-case nick rcirc-ignore-list)
! 	(setq rcirc-ignore-list (delete nick rcirc-ignore-list))
!       (setq rcirc-ignore-list (cons nick rcirc-ignore-list))))
!   (rcirc-print process (rcirc-nick process) "IGNORE" target 
  	       (mapconcat
  		(lambda (nick)
  		  (concat nick
--- 1792,1812 ----
    (rcirc-send-string process (format "PRIVMSG %s :\C-aACTION %s\C-a"
                                       target args)))
  
+ (defun rcirc-add-or-remove (set &optional elt)
+   (if (and elt (not (string= "" elt)))
+       (if (member-ignore-case elt set)
+ 	  (delete elt set)
+ 	(cons elt set))
+     set))
+ 
  (defun-rcirc-command ignore (nick)
    "Manage the ignore list.
  Ignore NICK, unignore NICK if already ignored, or list ignored
  nicks when no NICK is given.  When listing ignored nicks, the
  ones added to the list automatically are marked with an asterisk."
    (interactive "sToggle ignoring of nick: ")
!   (setq rcirc-ignore-list (rcirc-add-or-remove rcirc-ignore-list nick))
!   (rcirc-print process nil "IGNORE" target 
  	       (mapconcat
  		(lambda (nick)
  		  (concat nick
***************
*** 1810,1823 ****
  			      "*" "")))
  		rcirc-ignore-list " ")))
  
  \f
! (defun rcirc-message-leader (sender face)
!   "Return a string with SENDER propertized with FACE."
!   (rcirc-facify (concat "<" sender "> ") face))
  
  (defun rcirc-facify (string face)
    "Return a copy of STRING with FACE property added."
!   (propertize (or string "") 'face face 'rear-nonsticky t))
  
  (defvar rcirc-url-regexp
    (rx-to-string
--- 1814,1860 ----
  			      "*" "")))
  		rcirc-ignore-list " ")))
  
+ (defun-rcirc-command bright (nick)
+   "Manage the bright nick list."
+   (interactive "sToggle emphasis of nick: ")
+   (setq rcirc-bright-nicks (rcirc-add-or-remove rcirc-bright-nicks nick))
+   (rcirc-print process nil "BRIGHT" target 
+ 	       (mapconcat 'identity rcirc-bright-nicks " ")))
+ 
+ (defun-rcirc-command dim (nick)
+   "Manage the dim nick list."
+   (interactive "sToggle deemphasis of nick: ")
+   (setq rcirc-dim-nicks (rcirc-add-or-remove rcirc-dim-nicks nick))
+   (rcirc-print process nil "DIM" target 
+ 	       (mapconcat 'identity rcirc-dim-nicks " ")))
+ 
+ (defun-rcirc-command keyword (keyword)
+   "Manage the keyword list.
+ Mark KEYWORD, unmark KEYWORD if already marked, or list marked
+ keywords when no KEYWORD is given."
+   (interactive "sToggle highlighting of keyword: ")
+   (setq rcirc-keywords (rcirc-add-or-remove rcirc-keywords keyword))
+   (rcirc-print process nil "KEYWORD" target 
+ 	       (mapconcat 'identity rcirc-keywords " ")))
+ 
  \f
! (defun rcirc-add-face (start end name &optional object)
!   "Add face NAME to the face text property of the text from START to END."
!   (when name
!     (let ((pos start)
! 	  next prop)
!       (while (< pos end)
! 	(setq prop (get-text-property pos 'face object)
! 	      next (next-single-property-change pos 'face object end))
! 	(unless (member name (get-text-property pos 'face object))
! 	  (add-text-properties pos next (list 'face (cons name prop)) object))
! 	(setq pos next)))))
  
  (defun rcirc-facify (string face)
    "Return a copy of STRING with FACE property added."
!   (let ((string (or string "")))
!     (rcirc-add-face 0 (length string) face string)
!     string))
  
  (defvar rcirc-url-regexp
    (rx-to-string
***************
*** 1835,1842 ****
  		  word-boundary))
  	 (optional 
  	  (and "/"
! 	       (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,{}[]"))
! 	       (char "-a-zA-Z0-9_=#$\@~`%&*+|\\/:;{}[]")))))
    "Regexp matching URLs.  Set to nil to disable URL features in rcirc.")
  
  (defun rcirc-browse-url (&optional arg)
--- 1872,1879 ----
  		  word-boundary))
  	 (optional 
  	  (and "/"
! 	       (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,{}[]()"))
! 	       (char "-a-zA-Z0-9_=#$\@~`%&*+|\\/:;{}[]()")))))
    "Regexp matching URLs.  Set to nil to disable URL features in rcirc.")
  
  (defun rcirc-browse-url (&optional arg)
***************
*** 1863,1930 ****
      (with-current-buffer (window-buffer (posn-window position))
        (rcirc-browse-url-at-point (posn-point position)))))
  
! (defun rcirc-map-regexp (function regexp string)
!   "Return a copy of STRING after calling FUNCTION for each REGEXP match.
! FUNCTION takes 3 arguments, MATCH-START, MATCH-END, and STRING."
!   (let ((start 0))
!     (while (string-match regexp string start)
!       (setq start (match-end 0))
!       (funcall function (match-beginning 0) (match-end 0) string)))
!   string)
  
! (defun rcirc-mangle-text (process text)
    "Return TEXT with properties added based on various patterns."
!   ;; ^B
!   (setq text
!         (rcirc-map-regexp
! 	 (lambda (start end string)
! 	   (let ((orig-face (get-text-property start 'face string)))
! 	       (add-text-properties
! 		start end
! 		(list 'face (if (listp orig-face)
! 				(append orig-face
! 					(list 'bold))
! 			      (list orig-face 'bold))
! 		      'rear-nonsticky t)
! 		string)))
! 	   "\x02.*?\x02"
! 	   text))
!   ;; TODO: deal with ^_ and ^C colors sequences
!   (while (string-match "\\(.*\\)[\x02\x01]\\(.*\\)" text)
!     (setq text (concat (match-string 1 text)
!                        (match-string 2 text))))
!   ;; my nick
!   (setq text
!         (with-syntax-table rcirc-nick-syntax-table
!           (rcirc-map-regexp (lambda (start end string)
!                               (add-text-properties
!                                start end
!                                (list 'face 'rcirc-nick-in-message
!                                      'rear-nonsticky t)
!                                string))
!                             (concat "\\b"
!                                     (regexp-quote (rcirc-nick process))
!                                     "\\b")
!                             text)))
!   ;; urls
!   (setq text
!         (rcirc-map-regexp
! 	 (lambda (start end string)
! 	   (let ((orig-face (get-text-property start 'face string)))
! 	     (add-text-properties start end
! 				  (list 'face (if (listp orig-face)
! 						  (append orig-face
! 							  (list 'bold))
! 						(list orig-face 'bold))
! 					'rear-nonsticky t
! 					'mouse-face 'highlight
! 					'keymap rcirc-browse-url-map)
! 				  string))
! 	     (push (substring-no-properties string start end) rcirc-urls))
! 	   rcirc-url-regexp
! 	   text))
!   text)
  
  \f
  ;;; handlers
  ;; these are called with the server PROCESS, the SENDER, which is a
--- 1900,1998 ----
      (with-current-buffer (window-buffer (posn-window position))
        (rcirc-browse-url-at-point (posn-point position)))))
  
! \f
! (defvar rcirc-markup-text-functions
!   '(rcirc-markup-body-text
!     rcirc-markup-attributes
!     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 three arguments, PROCESS, SENDER, RESPONSE
! and CHANNEL-BUFFER.  The current buffer is temporary buffer that
! contains the text to manipulate.  Each function works on the text
! in this buffer.")
! 
! (defun rcirc-markup-text (process sender response text)
    "Return TEXT with properties added based on various patterns."
!   (let ((channel-buffer (current-buffer)))
!     (with-temp-buffer
!       (insert text)
!       (goto-char (point-min))
!       (dolist (fn rcirc-markup-text-functions)
! 	(save-excursion
! 	  (funcall fn process sender response channel-buffer)))
!       (buffer-substring (point-min) (point-max)))))
  
+ (defun rcirc-markup-body-text (process sender response channel-buffer)
+   ;; We add the text property `rcirc-text' to identify this as the
+   ;; body text.
+   (add-text-properties (point-min) (point-max)
+ 		       (list 'rcirc-text (buffer-substring-no-properties
+ 					  (point-min) (point-max)))))
+ 
+ (defun rcirc-markup-attributes (process sender response channel-buffer)
+   (while (re-search-forward "\\([\C-b\C-_\C-v]\\).*?\\(\\1\\|\C-o\\)" nil t)
+     (rcirc-add-face (match-beginning 0) (match-end 0)
+ 		    (case (char-after (match-beginning 1))
+ 		      (?\C-b 'bold)
+ 		      (?\C-v 'italic)
+ 		      (?\C-_ 'underline)))
+     ;; keep the ^O since it could terminate other attributes
+     (when (not (eq ?\C-o (char-before (match-end 2))))
+       (delete-region (match-beginning 2) (match-end 2)))
+     (delete-region (match-beginning 1) (match-end 1))
+     (goto-char (1+ (match-beginning 1))))
+   ;; remove the ^O characters now
+   (while (re-search-forward "\C-o+" nil t)
+     (delete-region (match-beginning 0) (match-end 0))))
+ 
+ (defun rcirc-markup-my-nick (process sender response channel-buffer)
+   (with-syntax-table rcirc-nick-syntax-table
+     (while (re-search-forward (concat "\\b" 
+ 				      (regexp-quote (rcirc-nick process))
+ 				      "\\b")
+ 			      nil t)
+       (rcirc-add-face (match-beginning 0) (match-end 0) 
+ 		      'rcirc-nick-in-message)
+       (when (string= response "PRIVMSG")
+ 	(rcirc-add-face (point-min) (point-max) 'rcirc-nick-in-message-full-line)
+ 	(rcirc-record-activity channel-buffer 'nick)))))
+ 
+ (defun rcirc-markup-urls (process sender response channel-buffer)
+   (while (re-search-forward rcirc-url-regexp nil t)
+     (let ((start (match-beginning 0))
+ 	  (end (match-end 0)))
+       (rcirc-add-face start end 'rcirc-url)
+       (add-text-properties start end (list 'mouse-face 'highlight
+ 					   'keymap rcirc-browse-url-map))
+       ;; record the url
+       (let ((url (buffer-substring-no-properties start end)))
+ 	(with-current-buffer channel-buffer
+ 	  (push url rcirc-urls))))))
+ 
+ (defun rcirc-markup-keywords (process sender response channel-buffer)
+   (let* ((target (with-current-buffer channel-buffer (or rcirc-target "")))
+ 	 (keywords (delq nil (mapcar (lambda (keyword)
+ 				      (when (not (string-match keyword target))
+ 					keyword))
+ 				    rcirc-keywords))))
+     (when keywords
+       (while (re-search-forward (regexp-opt keywords 'words) nil t)
+ 	(rcirc-add-face (match-beginning 0) (match-end 0) 'rcirc-keyword)
+ 	(when (and (string= response "PRIVMSG")
+ 		   (not (string= sender (rcirc-nick process))))
+ 	  (rcirc-record-activity channel-buffer 'keyword))))))
+ 
+ (defun rcirc-markup-bright-nicks (process sender response channel-buffer)
+   (when (and rcirc-bright-nicks
+ 	     (string= response "NAMES"))
+     (with-syntax-table rcirc-nick-syntax-table
+       (while (re-search-forward (regexp-opt rcirc-bright-nicks 'words) nil t)
+ 	(rcirc-add-face (match-beginning 0) (match-end 0)
+ 			'rcirc-bright-nick)))))
  \f
  ;;; handlers
  ;; these are called with the server PROCESS, the SENDER, which is a
***************
*** 2275,2286 ****
      (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
      (((class color) (min-colors 8)) (:foreground "magenta"))
      (t (:weight bold :underline t)))
!   "Face used for nicks matched by `rcirc-bright-nick-regexp'."
    :group 'rcirc-faces)
  
  (defface rcirc-dim-nick
    '((t :inherit default))
!   "Face used for nicks matched by `rcirc-dim-nick-regexp'."
    :group 'rcirc-faces)
  
  (defface rcirc-server			; font-lock-comment-face
--- 2343,2354 ----
      (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
      (((class color) (min-colors 8)) (:foreground "magenta"))
      (t (:weight bold :underline t)))
!   "Face used for nicks matched by `rcirc-bright-nicks'."
    :group 'rcirc-faces)
  
  (defface rcirc-dim-nick
    '((t :inherit default))
!   "Face used for nicks in `rcirc-dim-nicks'."
    :group 'rcirc-faces)
  
  (defface rcirc-server			; font-lock-comment-face
***************
*** 2329,2337 ****
      (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
      (((class color) (min-colors 8)) (:foreground "cyan" :weight bold))
      (t (:weight bold)))
!   "The face used to highlight instances of nick within messages."
    :group 'rcirc-faces)
  
  (defface rcirc-prompt			; comint-highlight-prompt
    '((((min-colors 88) (background dark)) (:foreground "cyan1"))
      (((background dark)) (:foreground "cyan"))
--- 2397,2410 ----
      (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
      (((class color) (min-colors 8)) (:foreground "cyan" :weight bold))
      (t (:weight bold)))
!   "The face used to highlight instances of your nick within messages."
    :group 'rcirc-faces)
  
+ (defface rcirc-nick-in-message-full-line
+   '((t (:bold t)))
+   "The face used emphasize the entire message when your nick is mentioned."
+   :group 'rcirc-faces)  
+ 
  (defface rcirc-prompt			; comint-highlight-prompt
    '((((min-colors 88) (background dark)) (:foreground "cyan1"))
      (((background dark)) (:foreground "cyan"))
***************
*** 2339,2347 ****
    "The face used to highlight prompts."
    :group 'rcirc-faces)
  
! (defface rcirc-mode-line-nick
    '((t (:bold t)))
!   "The face used indicate activity directed at you."
    :group 'rcirc-faces)
  
  \f
--- 2412,2435 ----
    "The face used to highlight prompts."
    :group 'rcirc-faces)
  
! (defface rcirc-track-nick
!   '((t (:inverse-video t)))
!   "The face used in the mode-line when your nick is mentioned."
!   :group 'rcirc-faces)
! 
! (defface rcirc-track-keyword
!   '((t (:bold t )))
!   "The face used in the mode-line when keywords are mentioned."
!   :group 'rcirc-faces)
! 
! (defface rcirc-url
    '((t (:bold t)))
!   "The face used to highlight urls."
!   :group 'rcirc-faces)
! 
! (defface rcirc-keyword
!   '((t (:inherit highlight)))
!   "The face used to highlight keywords."
    :group 'rcirc-faces)
  
  \f

^ permalink raw reply	[flat|nested] 22+ messages in thread
* rcirc update
@ 2006-08-20 17:50 Ryan Yeske
  2006-08-21  5:36 ` Miles Bader
  0 siblings, 1 reply; 22+ messages in thread
From: Ryan Yeske @ 2006-08-20 17:50 UTC (permalink / raw)



2006-08-20  Ryan Yeske  <rcyeske@gmail.com>

	* net/rcirc.el (rcirc-show-maximum-output): New var.
	(rcirc-buffer-process): If no buffer argument is supplied, use
	current-buffer.
	(rcirc-complete-nick): Complete to the last completed nick first.
	(rcirc-mode): Preserve the value of `rcirc-urls' across
	connections.  Setup scroll function.
	(rcirc-scroll-to-bottom): New function.
	(rcirc-print): Use nick syntax around regexp work.  Notice
	dim-nicks speaking only if they say our nick.
	(rcirc-update-activity-string): Do not show the modeline indicator
	if there are no live rcirc processes.
	(rcirc-cmd-ignore): Ignore case.
	(rcirc-browse-url-at-point): Fix off-by-one error.

Index: rcirc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/rcirc.el,v
retrieving revision 1.24
diff -c -r1.24 rcirc.el
*** rcirc.el	23 Jun 2006 13:33:08 -0000	1.24
--- rcirc.el	20 Aug 2006 17:41:14 -0000
***************
*** 40,45 ****
--- 40,47 ----
  ;; Open a new irc connection with:
  ;; M-x irc RET
  
+ ;;; Todo:
+ 
  ;;; Code:
  
  (require 'ring)
***************
*** 140,145 ****
--- 142,151 ----
  		 (integer :tag "Number of lines"))
    :group 'rcirc)
  
+ (defcustom rcirc-show-maximum-output t
+   "*If non-nil, scroll buffer to keep the point at the bottom of
+ the window.")
+ 
  (defcustom rcirc-authinfo nil
    "List of authentication passwords.
  Each element of the list is a list with a SERVER-REGEXP string
***************
*** 297,302 ****
--- 303,309 ----
  
  (defvar rcirc-urls nil
    "List of urls seen in the current buffer.")
+ (put 'rcirc-urls 'permanent-local t)
  
  (defvar rcirc-keepalive-seconds 60
    "Number of seconds between keepalive pings.
***************
*** 539,545 ****
  (defun rcirc-buffer-process (&optional buffer)
    "Return the process associated with channel BUFFER.
  With no argument or nil as argument, use the current buffer."
!   (get-buffer-process (or buffer rcirc-server-buffer)))
  
  (defun rcirc-server-name (process)
    "Return PROCESS server name, given by the 001 response."
--- 546,555 ----
  (defun rcirc-buffer-process (&optional buffer)
    "Return the process associated with channel BUFFER.
  With no argument or nil as argument, use the current buffer."
!   (get-buffer-process (if buffer
! 			  (with-current-buffer buffer
! 			    rcirc-server-buffer)
! 			rcirc-server-buffer)))
  
  (defun rcirc-server-name (process)
    "Return PROCESS server name, given by the 001 response."
***************
*** 601,610 ****
  
  (defvar rcirc-nick-completions nil)
  (defvar rcirc-nick-completion-start-offset nil)
  (defun rcirc-complete-nick ()
    "Cycle through nick completions from list of nicks in channel."
    (interactive)
!   (if (eq last-command 'rcirc-complete-nick)
        (setq rcirc-nick-completions
              (append (cdr rcirc-nick-completions)
                      (list (car rcirc-nick-completions))))
--- 611,621 ----
  
  (defvar rcirc-nick-completions nil)
  (defvar rcirc-nick-completion-start-offset nil)
+ 
  (defun rcirc-complete-nick ()
    "Cycle through nick completions from list of nicks in channel."
    (interactive)
!   (if (eq last-command this-command)
        (setq rcirc-nick-completions
              (append (cdr rcirc-nick-completions)
                      (list (car rcirc-nick-completions))))
***************
*** 626,634 ****
  					  rcirc-target))))))
    (let ((completion (car rcirc-nick-completions)))
      (when completion
        (delete-region (+ rcirc-prompt-end-marker
!                         rcirc-nick-completion-start-offset)
!                      (point))
        (insert (concat completion
                        (if (= (+ rcirc-prompt-end-marker
                                  rcirc-nick-completion-start-offset)
--- 637,646 ----
  					  rcirc-target))))))
    (let ((completion (car rcirc-nick-completions)))
      (when completion
+       (rcirc-put-nick-channel (rcirc-buffer-process) completion rcirc-target)
        (delete-region (+ rcirc-prompt-end-marker
! 			rcirc-nick-completion-start-offset)
! 		     (point))
        (insert (concat completion
                        (if (= (+ rcirc-prompt-end-marker
                                  rcirc-nick-completion-start-offset)
***************
*** 709,715 ****
    (make-local-variable 'rcirc-short-buffer-name)
    (setq rcirc-short-buffer-name nil)
    (make-local-variable 'rcirc-urls)
-   (setq rcirc-urls nil)
    (setq use-hard-newlines t)
  
    (make-local-variable 'rcirc-decode-coding-system)
--- 721,726 ----
***************
*** 742,747 ****
--- 753,761 ----
    (make-local-variable 'kill-buffer-hook)
    (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook)
  
+   (make-local-variable 'window-scroll-functions)
+   (add-hook 'window-scroll-functions 'rcirc-scroll-to-bottom)
+ 
    ;; add to buffer list, and update buffer abbrevs
    (when target				; skip server buffer
      (let ((buffer (current-buffer)))
***************
*** 1144,1149 ****
--- 1158,1172 ----
  (make-variable-buffer-local 'rcirc-last-sender)
  (defvar rcirc-gray-toggle nil)
  (make-variable-buffer-local 'rcirc-gray-toggle)
+ 
+ (defun rcirc-scroll-to-bottom (window display-start)
+   "Scroll window to show maximum output if `rcirc-show-maximum-output' is
+ non-nil."
+   (when rcirc-show-maximum-output
+     (with-selected-window window
+       (when (>= (window-point) rcirc-prompt-end-marker)
+ 	(recenter -1)))))
+ 
  (defun rcirc-print (process sender response target text &optional activity)
    "Print TEXT in the buffer associated with TARGET.
  Format based on SENDER and RESPONSE.  If ACTIVITY is non-nil,
***************
*** 1240,1255 ****
  	;; record modeline activity
  	(when activity
  	  (let ((nick-match
! 		 (string-match (concat "\\b"
! 				       (regexp-quote (rcirc-nick process))
! 				       "\\b")
! 			       text)))
  	    (when (if rcirc-ignore-buffer-activity-flag
  		      ;; - Always notice when our nick is mentioned
  		      nick-match
! 		    ;; - Never bother us if a dim-nick spoke
! 		    (not (and rcirc-dim-nick-regexp sender
! 			      (string-match rcirc-dim-nick-regexp sender))))
  	      (rcirc-record-activity
  	       (current-buffer)
  	       (when (or nick-match (and (not (rcirc-channel-p rcirc-target))
--- 1263,1281 ----
  	;; record modeline activity
  	(when activity
  	  (let ((nick-match
! 		 (with-syntax-table rcirc-nick-syntax-table		 
! 		   (string-match (concat "\\b"
! 					 (regexp-quote (rcirc-nick process))
! 					 "\\b")
! 				 text))))
  	    (when (if rcirc-ignore-buffer-activity-flag
  		      ;; - Always notice when our nick is mentioned
  		      nick-match
! 		    ;; - unless our nick is mentioned, don't bother us
! 		    ;; - with dim-nicks
! 		    (or nick-match
! 			(not (and rcirc-dim-nick-regexp sender
! 				  (string-match rcirc-dim-nick-regexp sender)))))
  	      (rcirc-record-activity
  	       (current-buffer)
  	       (when (or nick-match (and (not (rcirc-channel-p rcirc-target))
***************
*** 1504,1521 ****
  	 (lopri (car pair))
  	 (hipri (cdr pair)))
      (setq rcirc-activity-string
! 	  (if (or hipri lopri)
! 	      (concat "-"
! 		      (and hipri "[")
! 		      (rcirc-activity-string hipri)
! 		      (and hipri lopri ",")
! 		      (and lopri
! 			   (concat "("
! 				   (rcirc-activity-string lopri)
! 				   ")"))
! 		      (and hipri "]")
! 		      "-")
! 	    "-[]-"))))
  
  (defun rcirc-activity-string (buffers)
    (mapconcat (lambda (b)
--- 1530,1549 ----
  	 (lopri (car pair))
  	 (hipri (cdr pair)))
      (setq rcirc-activity-string
! 	  (cond ((or hipri lopri)
! 		 (concat "-"
! 			 (and hipri "[")
! 			 (rcirc-activity-string hipri)
! 			 (and hipri lopri ",")
! 			 (and lopri
! 			      (concat "("
! 				      (rcirc-activity-string lopri)
! 				      ")"))
! 			 (and hipri "]")
! 			 "-"))
! 		((not (null (rcirc-process-list)))
! 		 "-[]-")
! 		(t "")))))
  
  (defun rcirc-activity-string (buffers)
    (mapconcat (lambda (b)
***************
*** 1771,1777 ****
  ones added to the list automatically are marked with an asterisk."
    (interactive "sToggle ignoring of nick: ")
    (when (not (string= "" nick))
!     (if (member nick rcirc-ignore-list)
  	(setq rcirc-ignore-list (delete nick rcirc-ignore-list))
        (setq rcirc-ignore-list (cons nick rcirc-ignore-list))))
    (rcirc-print process (rcirc-nick process) "IGNORE" target 
--- 1799,1805 ----
  ones added to the list automatically are marked with an asterisk."
    (interactive "sToggle ignoring of nick: ")
    (when (not (string= "" nick))
!     (if (member-ignore-case nick rcirc-ignore-list)
  	(setq rcirc-ignore-list (delete nick rcirc-ignore-list))
        (setq rcirc-ignore-list (cons nick rcirc-ignore-list))))
    (rcirc-print process (rcirc-nick process) "IGNORE" target 
***************
*** 1800,1805 ****
--- 1828,1834 ----
  		       "://")
  		  "www.")
  	      (1+ (char "-a-zA-Z0-9_."))
+ 	      (1+ (char "-a-zA-Z0-9_"))
  	      (optional ":" (1+ (char "0-9"))))
  	     (and (1+ (char "-a-zA-Z0-9_."))
  		  (or ".com" ".net" ".org")
***************
*** 1823,1829 ****
  (defun rcirc-browse-url-at-point (point)
    "Send URL at point to `browse-url'."
    (interactive "d")
!   (let ((beg (previous-single-property-change point 'mouse-face))
  	(end (next-single-property-change point 'mouse-face)))
      (browse-url (buffer-substring-no-properties beg end))))
  
--- 1852,1858 ----
  (defun rcirc-browse-url-at-point (point)
    "Send URL at point to `browse-url'."
    (interactive "d")
!   (let ((beg (previous-single-property-change (1+ point) 'mouse-face))
  	(end (next-single-property-change point 'mouse-face)))
      (browse-url (buffer-substring-no-properties beg end))))

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2009-10-15  6:50 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-09  5:21 rcirc update Ryan Yeske
2007-06-13 20:30 ` Chong Yidong
2007-06-13 21:17   ` Stefan Monnier
2007-06-16  3:02     ` Ryan Yeske
2007-06-16  3:58       ` Miles Bader
2007-06-16  5:08         ` Ryan Yeske
2007-06-16 21:26           ` Miles Bader
2007-06-17 23:33             ` Ryan Yeske
2007-06-20 19:53               ` Ryan Yeske
2007-06-28  9:51                 ` Ryan Yeske
2007-06-29  0:54                   ` Miles Bader
2007-06-29  7:34                   ` Thien-Thi Nguyen
  -- strict thread matches above, loose matches on Subject: below --
2009-10-02  0:11 Ryan Yeske
2009-10-15  6:50 ` Glenn Morris
2007-10-22 18:04 Ryan Yeske
2007-10-29  1:25 ` Glenn Morris
2007-10-31  5:21   ` Ryan Yeske
2007-11-01  4:04     ` Glenn Morris
2007-03-07 23:14 Ryan Yeske
2006-09-02  0:02 Ryan Yeske
2006-08-20 17:50 Ryan Yeske
2006-08-21  5:36 ` Miles Bader

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).