From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ryan Yeske Newsgroups: gmane.emacs.devel Subject: rcirc changes Date: Tue, 14 Feb 2006 22:28:27 -0800 Message-ID: <87mzgt2l10.fsf@cut.bc.hsia.telus.net> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1139984957 19877 80.91.229.2 (15 Feb 2006 06:29:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Feb 2006 06:29:17 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 15 07:29:10 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F9G9s-0002MZ-Ax for ged-emacs-devel@m.gmane.org; Wed, 15 Feb 2006 07:29:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F9G9r-0003nr-8B for ged-emacs-devel@m.gmane.org; Wed, 15 Feb 2006 01:28:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F9G9R-0003kT-Gu for emacs-devel@gnu.org; Wed, 15 Feb 2006 01:28:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F9G9Q-0003jh-2H for emacs-devel@gnu.org; Wed, 15 Feb 2006 01:28:32 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F9G9P-0003jJ-Ih for emacs-devel@gnu.org; Wed, 15 Feb 2006 01:28:31 -0500 Original-Received: from [199.185.220.240] (helo=priv-edtnes46.telusplanet.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1F9GEF-0000af-IH for emacs-devel@gnu.org; Wed, 15 Feb 2006 01:33:31 -0500 Original-Received: from cut.bc.hsia.telus.net ([207.6.239.189]) by priv-edtnes46.telusplanet.net (InterMail vM.6.01.05.04 201-2131-123-105-20051025) with ESMTP id <20060215062828.FHYF28047.priv-edtnes46.telusplanet.net@cut.bc.hsia.telus.net> for ; Tue, 14 Feb 2006 23:28:28 -0700 Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:50555 Archived-At: Some more misc bugfixes. Index: ChangeLog =================================================================== RCS file: /sources/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.9118 diff -c -r1.9118 ChangeLog *** ChangeLog 12 Feb 2006 00:29:59 -0000 1.9118 --- ChangeLog 15 Feb 2006 06:20:04 -0000 *************** *** 1,3 **** --- 1,22 ---- + 2006-02-14 Ryan Yeske + + * net/rcirc.el (rcirc-connect): Make all arguments optional, and + default to global variable values for unsupplied args. + (rcirc-get-buffer-create): Fix bug with setting the target. + (rcirc-any-buffer): Rename from rcirc-get-any-buffer, and include + test for rcirc-always-use-server-buffer-flag here. + (rcirc-response-formats): Add %N, which is a facified nick. %n + uses the default face. Change the ACTION format string. If the + "nick" is the server, don't print anything for that field. + Comment fixes. + (rcirc-target-buffer): Don't test + rcirc-always-use-server-buffer-flag here. + (rcirc-print): Squeeze extra spaces out of the text before + message. + (rcirc-put-nick-channel): Strip potential "@" char from nick + before adding them to nick table. + (rcirc-url-regexp): Improve to match address like "foo.com". + 2006-02-12 Mathias Dahl * tumme.el (tumme-write-tag): Fix small bug (file name did not Index: net/rcirc.el =================================================================== RCS file: /sources/emacs/emacs/lisp/net/rcirc.el,v retrieving revision 1.14 diff -c -r1.14 rcirc.el *** net/rcirc.el 11 Feb 2006 21:42:23 -0000 1.14 --- net/rcirc.el 15 Feb 2006 06:20:07 -0000 *************** *** 49,55 **** (defgroup rcirc nil "Simple IRC client." :version "22.1" ! :prefix "rcirc" :group 'applications) (defcustom rcirc-server "irc.freenode.net" --- 49,55 ---- (defgroup rcirc nil "Simple IRC client." :version "22.1" ! :prefix "rcirc-" :group 'applications) (defcustom rcirc-server "irc.freenode.net" *************** *** 295,310 **** (defvar rcirc-topic nil) (defvar rcirc-keepalive-timer nil) (defvar rcirc-last-server-message-time nil) ! (defun rcirc-connect (server port nick user-name full-name startup-channels) (add-hook 'window-configuration-change-hook 'rcirc-window-configuration-change) (save-excursion (message "Connecting to %s..." server) (let* ((inhibit-eol-conversion) ! (port-number (if (stringp port) ! (string-to-number port) ! port)) (process (open-network-stream server nil server port-number))) ;; set up process (set-process-coding-system process 'raw-text 'raw-text) --- 295,317 ---- (defvar rcirc-topic nil) (defvar rcirc-keepalive-timer nil) (defvar rcirc-last-server-message-time nil) ! (defun rcirc-connect (&optional server port nick user-name full-name startup-channels) (add-hook 'window-configuration-change-hook 'rcirc-window-configuration-change) (save-excursion (message "Connecting to %s..." server) (let* ((inhibit-eol-conversion) ! (port-number (if port ! (if (stringp port) ! (string-to-number port) ! port) ! rcirc-port)) ! (server (or server rcirc-server)) ! (nick (or nick rcirc-nick)) ! (user-name (or user-name rcirc-user-name)) ! (full-name (or full-name rcirc-user-full-name)) ! (startup-channels (or startup-channels (rcirc-startup-channels server))) (process (open-network-stream server nil server port-number))) ;; set up process (set-process-coding-system process 'raw-text 'raw-text) *************** *** 758,766 **** Create the buffer if it doesn't exist." (let ((buffer (rcirc-get-buffer process target))) (if buffer ! (progn (when (not rcirc-target) ! (setq rcirc-target target)) buffer) ;; create the buffer (with-rcirc-process-buffer process --- 765,773 ---- Create the buffer if it doesn't exist." (let ((buffer (rcirc-get-buffer process target))) (if buffer ! (with-current-buffer buffer (when (not rcirc-target) ! (setq rcirc-target target)) buffer) ;; create the buffer (with-rcirc-process-buffer process *************** *** 896,915 **** (kill-buffer (current-buffer)) (set-window-configuration rcirc-window-configuration)) ! (defun rcirc-get-any-buffer (process) "Return a buffer for PROCESS, either the one selected or the process buffer." ! (let ((buffer (window-buffer (selected-window)))) ! (if (and buffer ! (with-current-buffer buffer ! (and (eq major-mode 'rcirc-mode) ! (eq rcirc-process process)))) ! buffer ! (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")) --- 903,924 ---- (kill-buffer (current-buffer)) (set-window-configuration rcirc-window-configuration)) ! (defun rcirc-any-buffer (process) "Return a buffer for PROCESS, either the one selected or the process buffer." ! (if rcirc-always-use-server-buffer-flag ! (process-buffer process) ! (let ((buffer (window-buffer (selected-window)))) ! (if (and buffer ! (with-current-buffer buffer ! (and (eq major-mode 'rcirc-mode) ! (eq rcirc-process process)))) ! buffer ! (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")) *************** *** 921,927 **** the of the following escape sequences replaced by the described values: %m The message text ! %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 --- 930,937 ---- the of the following escape sequences replaced by the described values: %m The message text ! %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 *************** *** 957,1014 **** (setq chunk (substring chunk 1))) (setq repl (cond ((eq key ?%) ! ;; %% -- literal % character ; "%") ! ((eq key ?n) ! ;; %n -- nick ; ! (rcirc-facify (concat (rcirc-abbrev-nick sender) ! (and target (concat "," target))) ! (if (string= sender (rcirc-nick process)) ! 'rcirc-my-nick ! '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)) ((eq key ?r) ! ;; %r -- response ; (rcirc-facify response face)) ((eq key ?f) ! ;; %f -- change face ; (setq face-key (aref chunk 0)) (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 1))))) (setq chunk (substring chunk 1)) "") (t ! ;; just insert the key literally ; (rcirc-facify (substring chunk 0 1) face)))) (setq result (concat result repl (rcirc-facify chunk face)))) result)) --- 967,1031 ---- (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= (with-rcirc-process-buffer ! process rcirc-server) ! sender) ! "" ! (rcirc-abbrev-nick sender)) ! (and target (concat "," target))))) ! (rcirc-facify nick ! (if (eq key ?n) ! face ! (if (string= sender (rcirc-nick process)) ! 'rcirc-my-nick ! '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)) ((eq key ?r) ! ;; %r -- response (rcirc-facify response face)) ((eq key ?f) ! ;; %f -- change face (setq face-key (aref chunk 0)) (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 -- server face (setq face 'rcirc-server)) ((eq face-key ?-) ! ;; %f- -- default 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 1))))) (setq chunk (substring chunk 1)) "") (t ! ;; just insert the key literally (rcirc-facify (substring chunk 0 1) face)))) (setq result (concat result repl (rcirc-facify chunk face)))) result)) *************** *** 1018,1026 **** (assert (not (bufferp target))) (with-rcirc-process-buffer process (cond ((not target) ! (if rcirc-always-use-server-buffer-flag ! (process-buffer process) ! (rcirc-get-any-buffer process))) ((not (rcirc-channel-p target)) ;; message from another user (if (string= response "PRIVMSG") --- 1035,1041 ---- (assert (not (bufferp target))) (with-rcirc-process-buffer process (cond ((not target) ! (rcirc-any-buffer process)) ((not (rcirc-channel-p target)) ;; message from another user (if (string= response "PRIVMSG") *************** *** 1029,1035 **** sender)) (rcirc-get-buffer process target t))) ((or (rcirc-get-buffer process target) ! (rcirc-get-any-buffer process)))))) (defvar rcirc-activity-type nil) (make-variable-buffer-local 'rcirc-activity-type) --- 1044,1050 ---- sender)) (rcirc-get-buffer process target t))) ((or (rcirc-get-buffer process target) ! (rcirc-any-buffer process)))))) (defvar rcirc-activity-type nil) (make-variable-buffer-local 'rcirc-activity-type) *************** *** 1072,1093 **** (set-marker-insertion-type rcirc-prompt-start-marker nil) (set-marker-insertion-type rcirc-prompt-end-marker nil) ! ;; 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 ! (or (next-single-property-change 0 'rcirc-text ! fmted-text) ! 8) ! ?\s))) ! (fill-column (cond ((eq rcirc-fill-column 'frame-width) ! (1- (frame-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 --- 1087,1112 ---- (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) ! (point-max))) ! ;; 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))) ! (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 *************** *** 1178,1191 **** (defun rcirc-put-nick-channel (process nick channel) "Add CHANNEL to list associated with 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))))) (defun rcirc-nick-remove (process nick) "Remove NICK from table." --- 1197,1211 ---- (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)))))) (defun rcirc-nick-remove (process nick) "Remove NICK from table." *************** *** 1616,1630 **** (propertize (or string "") 'face face 'rear-nonsticky t)) (defvar rcirc-url-regexp ! (rx word-boundary ! (or "www." ! (and (or "http" "https" "ftp" "file" "gopher" "news" "telnet" "wais" ! "mailto") ! "://" ! (1+ (char "a-zA-Z0-9_.")) ! (optional ":" (1+ (char "0-9"))))) ! (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) --- 1636,1656 ---- (propertize (or string "") 'face face 'rear-nonsticky t)) (defvar rcirc-url-regexp ! (rx-to-string ! `(and word-boundary ! (or "www." ! (and (or "http" "https" "ftp" "file" "gopher" "news" "telnet" ! "wais" "mailto") ! "://" ! (1+ (char "-a-zA-Z0-9_.")) ! (optional ":" (1+ (char "0-9")))) ! (and (1+ (char "-a-zA-Z0-9_.")) ! (or ".com" ".net" ".org") ! 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)