Mercurial > emacs
changeset 68814:fe9073ac802e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73
Creator: Michael Olson <mwolson@gnu.org>
Merge from erc--emacs--0
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sun, 12 Feb 2006 12:02:53 +0000 |
parents | d065089f984a |
children | 3e8cc27a9bcf |
files | lisp/erc/ChangeLog lisp/erc/erc-dcc.el lisp/erc/erc-list.el lisp/erc/erc-match.el lisp/erc/erc-menu.el lisp/erc/erc-spelling.el lisp/erc/erc-stamp.el lisp/erc/erc-xdcc.el lisp/erc/erc.el |
diffstat | 9 files changed, 177 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/erc/ChangeLog Sun Feb 12 00:29:59 2006 +0000 +++ b/lisp/erc/ChangeLog Sun Feb 12 12:02:53 2006 +0000 @@ -1,3 +1,60 @@ +2006-02-11 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-update-modules): Make some requirements shorter, so + that it's easier to see why they are needed. + + * erc-stamp.el (erc-timestamp-use-align-to): Renamed from + `erc-timestamp-right-align-by-pixel'. Set the default based on + whether we are in Emacs 22, and using X. Improve documentation. + (erc-insert-aligned): Remove calculation of offset, since + :align-to pos works after all. Unlike the previous solution, this + one works when erc-stamp.el is compiled. + (erc-insert-timestamp-right): Don't add length of string, and then + later remove its displayed width. This puts timestamps after + erc-fill-column when erc-timestamp-right-column is nil, rather + than before it. It also fixes a subtle bug. Remove use of + `current-window', since there is no variable by that name in + Emacs21, Emacs22, or XEmacs21 beta. Check to see whether + `erc-fill-column' is non-nil before using it. + +2006-02-11 Diane Murray <disumu@x3y2z1.net> + + * erc-list.el: Define `list' module which sets the alias + `erc-cmd-LIST' to `erc-list-channels' when enabled and + `erc-list-channels-simple' when disabled. + (erc-list-channels): Was `erc-cmd-LIST', renamed. + (erc-list-channels-simple): New function. + + * erc.el (erc-modules): Added `list' to enabled modules. Moved + customization options left in source code. + + * erc-menu.el (erc-menu-definition): Use `erc-list-channels'. + + * erc-spelling.el (define-erc-module): Make sure there's a buffer + before calling `with-current-buffer'. + +2006-02-10 Michael Olson <mwolson@gnu.org> + + * Makefile (debbuild): Split from debrelease. + (debrevision-mwolson): New rule that causes a Debian revision to + be built. + + * erc.el (erc-migrate-modules): Use a better algorithm. Thanks to + Johan Bockgård. + (erc-modules): Change use of 'pcomplete to 'completion. + +2006-02-09 Diane Murray <disumu@x3y2z1.net> + + * erc.el (erc-get-parsed-vector, erc-get-parsed-vector-nick) + (erc-get-parsed-vector-type): Moved here from erc-match.el. + + * erc-match.el (erc-get-parsed-vector, erc-get-parsed-vector-nick) + (erc-get-parsed-vector-type): Moved these functions to erc.el + since they can be useful outside of the text matching module. + + * erc-dcc.el, erc-stamp.el, erc-xdcc.el: Changed "Emacs IRC Client" + to "ERC". + 2006-02-07 Michael Olson <mwolson@gnu.org> * ChangeLog.01, ChangeLog.02, ChangeLog.03, ChangeLog.04,
--- a/lisp/erc/erc-dcc.el Sun Feb 12 00:29:59 2006 +0000 +++ b/lisp/erc/erc-dcc.el Sun Feb 12 12:02:53 2006 +0000 @@ -29,7 +29,7 @@ ;;; Commentary: -;; This file provides Direct Client-to-Client support for the Emacs IRC Client. +;; This file provides Direct Client-to-Client support for ERC. ;; ;; The original code was taken from zenirc-dcc.el, heavily mangled and ;; rewritten to support the way how ERC operates. Server socket support
--- a/lisp/erc/erc-list.el Sun Feb 12 00:29:59 2006 +0000 +++ b/lisp/erc/erc-list.el Sun Feb 12 12:02:53 2006 +0000 @@ -140,12 +140,19 @@ (setq truncate-lines t) (add-hook 'post-command-hook 'erc-chanlist-post-command-hook 'append 'local)) +;; Define module: +;;;###autoload (autoload 'erc-list-mode "erc-list") +(define-erc-module list nil + "List channels nicely in a separate buffer." + ((defalias 'erc-cmd-LIST 'erc-list-channels)) + ((defalias 'erc-cmd-LIST 'erc-list-channels-simple))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Functions. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;###autoload -(defun erc-cmd-LIST (&rest channel) +(defun erc-list-channels (&rest channel) "Display a buffer containing a list of channels on the current server. Optional argument CHANNEL specifies a single channel to list (instead of every available channel)." @@ -163,6 +170,18 @@ (erc-chanlist channel)) t) +(defun erc-list-channels-simple (&optional line) + "Send the LIST command to the current server with optional channels LINE." + (when (string-match "^\\s-*\\(.*\\)$" line) + (let ((channels (match-string 1 line))) + (erc-log (format "cmd: LIST: %s" channels)) + (erc-server-send + (if (string= channels "") + "LIST" + (concat "LIST :" channels)))) + t)) +(put 'erc-list-channels-simple 'do-not-parse-args t) + ;;;###autoload (defun erc-chanlist (&optional channels) "Show a channel listing of the current server in a special mode.
--- a/lisp/erc/erc-match.el Sun Feb 12 00:29:59 2006 +0000 +++ b/lisp/erc/erc-match.el Sun Feb 12 12:02:53 2006 +0000 @@ -428,24 +428,6 @@ (or (erc-list-match fools-beg msg) (erc-list-match fools-end msg)))) -(defun erc-get-parsed-vector (point) - "Return the whole parsed vector on POINT." - (get-text-property point 'erc-parsed)) - -(defun erc-get-parsed-vector-nick (vect) - "Return nickname in the parsed vector VECT." - (let* ((untreated-nick (and vect (erc-response.sender vect))) - (maybe-nick (when untreated-nick - (car (split-string untreated-nick "!"))))) - (when (and (not (null maybe-nick)) - (erc-is-valid-nick-p maybe-nick)) - untreated-nick))) - -(defun erc-get-parsed-vector-type (vect) - "Return message type in the parsed vector VECT." - (and vect - (erc-response.command vect))) - (defun erc-match-message () "Mark certain keywords in a region. Use this defun with `erc-insert-modify-hook'."
--- a/lisp/erc/erc-menu.el Sun Feb 12 00:29:59 2006 +0000 +++ b/lisp/erc/erc-menu.el Sun Feb 12 12:02:53 2006 +0000 @@ -36,8 +36,8 @@ ["Connect to server..." erc-select t] ["Disconnect from server..." erc-quit-server erc-server-connected] "-" - ["List channels..." erc-cmd-LIST - (and erc-server-connected (fboundp 'erc-cmd-LIST))] + ["List channels..." erc-list-channels + (and erc-server-connected (fboundp 'erc-list-channels))] ["Join channel..." erc-join-channel erc-server-connected] ["Start a query..." erc-cmd-QUERY erc-server-connected] "-"
--- a/lisp/erc/erc-spelling.el Sun Feb 12 00:29:59 2006 +0000 +++ b/lisp/erc/erc-spelling.el Sun Feb 12 12:02:53 2006 +0000 @@ -41,11 +41,13 @@ ;; called AFTER the server buffer is initialized. ((add-hook 'erc-connect-pre-hook 'erc-spelling-init) (mapc (lambda (buffer) - (with-current-buffer buffer (erc-spelling-init))) + (when buffer + (with-current-buffer buffer (erc-spelling-init)))) (erc-buffer-list))) ((remove-hook 'erc-connect-pre-hook 'erc-spelling-init) (mapc (lambda (buffer) - (with-current-buffer buffer (flyspell-mode 0))) + (when buffer + (with-current-buffer buffer (flyspell-mode 0)))) (erc-buffer-list)))) (defcustom erc-spelling-dictionaries nil
--- a/lisp/erc/erc-stamp.el Sun Feb 12 00:29:59 2006 +0000 +++ b/lisp/erc/erc-stamp.el Sun Feb 12 12:02:53 2006 +0000 @@ -1,4 +1,4 @@ -;;; erc-stamp.el --- Timestamping for Emacs IRC CLient +;;; erc-stamp.el --- Timestamping for ERC messages ;; Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. @@ -180,11 +180,17 @@ (integer :tag "Column number") (const :tag "Unspecified" nil))) -(defcustom erc-timestamp-right-align-by-pixel nil - "*If non-nil, insert the right timestamp based on a pixel value. -This is needed when variable-width text precedes a timestamp. +(defcustom erc-timestamp-use-align-to (and (not (featurep 'xemacs)) + (>= emacs-major-version 22) + (eq window-system 'x)) + "*If non-nil, use the :align-to display property to align the stamp. +This gives better results when variable-width characters (like +Asian language characters and math symbols) precede a timestamp. Unfortunately, it only works in Emacs 22 and when using the X -Window System." +Window System. + +A side effect of enabling this is that there will only be one +space before a right timestamp in any saved logs." :group 'erc-stamp :type 'boolean) @@ -200,18 +206,15 @@ (insert s))) (defun erc-insert-aligned (string pos) - "Insert STRING based on a fraction of the width of the buffer. -Fraction is roughly (/ POS (window-width)). + "Insert STRING at the POSth column. -If `erc-timestamp-right-align-by-pixel' is nil, insert STRING at the -POSth column, without using pixel coordinates." - (if (not erc-timestamp-right-align-by-pixel) +If `erc-timestamp-use-align-to' is t, use the :align-to display +property to get to the POSth column." + (if (not erc-timestamp-use-align-to) (indent-to pos) (insert " ") - (let ((offset (floor (* (/ (1- pos) (window-width) 1.0) - (nth 2 (window-inside-pixel-edges)))))) - (put-text-property (1- (point)) (point) 'display - `(space :align-to (,offset))))) + (put-text-property (1- (point)) (point) 'display + (list 'space ':align-to pos))) (insert string)) (defun erc-insert-timestamp-right (string) @@ -238,30 +241,26 @@ (forward-char -1);; before the last newline (let* ((current-window (get-buffer-window (current-buffer))) (pos (cond - (erc-timestamp-right-column - (+ erc-timestamp-right-column (length string))) + (erc-timestamp-right-column erc-timestamp-right-column) ((and (boundp 'erc-fill-mode) erc-fill-mode - (boundp 'erc-fill-column)) + (boundp 'erc-fill-column) + erc-fill-column) (1+ erc-fill-column)) - (current-window - (- (window-width current-window) - 1)) (fill-column (1+ fill-column)) (t (- (window-width) + (string-width string) 1)))) (from (point)) (col (current-column)) indent) - ;; deal with variable-width characters - (setq pos (- pos (string-width string)) - ;; The following is a kludge that works with most - ;; international input. It is now only used to calculate - ;; whether to move to the next line before inserting a - ;; stamp. - col (+ col (ceiling (/ (- col (- (point) (point-at-bol))) 1.6)))) + ;; The following is a kludge used to calculate whether to move + ;; to the next line before inserting a stamp. It allows for + ;; some margin of error if what is displayed on the line differs + ;; from the number of characters on the line. + (setq col (+ col (ceiling (/ (- col (- (point) (point-at-bol))) 1.6)))) (if (< col pos) (erc-insert-aligned string pos) (newline)
--- a/lisp/erc/erc-xdcc.el Sun Feb 12 00:29:59 2006 +0000 +++ b/lisp/erc/erc-xdcc.el Sun Feb 12 12:02:53 2006 +0000 @@ -24,7 +24,7 @@ ;;; Commentary: -;; This file provides a very simple XDCC file server for the Emacs IRC Client. +;; This file provides a very simple XDCC file server for ERC. ;;; Code:
--- a/lisp/erc/erc.el Sun Feb 12 00:29:59 2006 +0000 +++ b/lisp/erc/erc.el Sun Feb 12 12:02:53 2006 +0000 @@ -1719,22 +1719,15 @@ (defun erc-migrate-modules (mods) "Migrate old names of ERC modules to new ones." ;; modify `transforms' to specify what needs to be changed - ;; each item is in the format '(new .old) - (let ((transforms '((pcomplete . completion))) - (modules (copy-alist mods))) - (dolist (transform transforms) - (let ((addp nil)) - (setq modules (erc-delete-if `(lambda (val) - (and (eq val ',(car transform)) - (setq addition t))) - modules)) - (when addp - (add-to-list 'modules (cdr transform))))) - (erc-delete-dups modules))) - -(defcustom erc-modules '(netsplit fill button match track pcomplete readonly + ;; each item is in the format '(old . new) + (let ((transforms '((pcomplete . completion)))) + (erc-delete-dups + (mapcar (lambda (m) (or (cdr (assoc m transforms)) m)) + mods)))) + +(defcustom erc-modules '(netsplit fill button match track completion readonly ring autojoin noncommands irccontrols - stamp) + stamp list) "A list of modules which erc should enable. If you set the value of this without using `customize' remember to call \(erc-update-modules) after you change it. When using `customize', modules @@ -1755,40 +1748,42 @@ ;; this test is for the case where erc hasn't been loaded yet (when (fboundp 'erc-update-modules) (erc-update-modules))) - :type '(set :greedy t - (const :tag "Set away status automatically" autoaway) - (const :tag "Join channels automatically" autojoin) - (const :tag "Integrate with Big Brother Database" bbdb) - (const :tag "Buttonize URLs, nicknames, and other text" button) - (const :tag "Wrap long lines" fill) - (const :tag "Highlight or remove IRC control characters" - irccontrols) - (const :tag "Save buffers in logs" log) - (const :tag "Highlight pals, fools, and other keywords" match) - (const :tag "Detect netsplits" netsplit) - (const :tag "Don't display non-IRC commands after evaluation" - noncommands) - (const :tag - "Notify when the online status of certain users changes" - notify) - (const :tag "Complete nicknames and commands (programmable)" - completion) - (const :tag "Complete nicknames and commands (old)" hecomplete) - (const :tag "Make displayed lines read-only" readonly) - (const :tag "Replace text in messages" replace) - (const :tag "Enable an input history" ring) - (const :tag "Scroll to the bottom of the buffer" scrolltobottom) - (const :tag "Identify to Nickserv (IRC Services) automatically" - services) - (const :tag "Convert smileys to pretty icons" smiley) - (const :tag "Play sounds when you receive CTCP SOUND requests" - sound) - (const :tag "Add timestamps to messages" stamp) - (const :tag "Check spelling" spelling) - (const :tag "Track channel activity in the mode-line" track) - (const :tag "Truncate buffers to a certain size" truncate) - (const :tag "Translate morse code in messages" unmorse) - (repeat :tag "Others" :inline t symbol)) + :type + '(set + :greedy t + (const :tag "Set away status automatically" autoaway) + (const :tag "Join channels automatically" autojoin) + (const :tag "Integrate with Big Brother Database" bbdb) + (const :tag "Buttonize URLs, nicknames, and other text" button) + (const :tag "Wrap long lines" fill) + (const :tag "Highlight or remove IRC control characters" + irccontrols) + (const :tag "Save buffers in logs" log) + (const :tag "Highlight pals, fools, and other keywords" match) + (const :tag "Detect netsplits" netsplit) + (const :tag "Don't display non-IRC commands after evaluation" + noncommands) + (const :tag + "Notify when the online status of certain users changes" + notify) + (const :tag "Complete nicknames and commands (programmable)" + completion) + (const :tag "Complete nicknames and commands (old)" hecomplete) + (const :tag "Make displayed lines read-only" readonly) + (const :tag "Replace text in messages" replace) + (const :tag "Enable an input history" ring) + (const :tag "Scroll to the bottom of the buffer" scrolltobottom) + (const :tag "Identify to Nickserv (IRC Services) automatically" + services) + (const :tag "Convert smileys to pretty icons" smiley) + (const :tag "Play sounds when you receive CTCP SOUND requests" + sound) + (const :tag "Add timestamps to messages" stamp) + (const :tag "Check spelling" spelling) + (const :tag "Track channel activity in the mode-line" track) + (const :tag "Truncate buffers to a certain size" truncate) + (const :tag "Translate morse code in messages" unmorse) + (repeat :tag "Others" :inline t symbol)) :group 'erc) (defun erc-update-modules () @@ -1799,14 +1794,11 @@ (cond ;; yuck. perhaps we should bring the filenames into sync? ((string= req "erc-completion") - (setq req "erc-pcomplete") - (setq mod 'completion)) + (setq req "erc-pcomplete")) ((string= req "erc-pcomplete") - (setq req "erc-pcomplete") (setq mod 'completion)) ((string= req "erc-autojoin") - (setq req "erc-join") - (setq mod 'autojoin))) + (setq req "erc-join"))) (condition-case nil (require (intern req)) (error nil)) @@ -6143,6 +6135,26 @@ (funcall erc-part-reason nil)) nil tgt)))) +;;; Dealing with `erc-parsed' + +(defun erc-get-parsed-vector (point) + "Return the whole parsed vector on POINT." + (get-text-property point 'erc-parsed)) + +(defun erc-get-parsed-vector-nick (vect) + "Return nickname in the parsed vector VECT." + (let* ((untreated-nick (and vect (erc-response.sender vect))) + (maybe-nick (when untreated-nick + (car (split-string untreated-nick "!"))))) + (when (and (not (null maybe-nick)) + (erc-is-valid-nick-p maybe-nick)) + untreated-nick))) + +(defun erc-get-parsed-vector-type (vect) + "Return message type in the parsed vector VECT." + (and vect + (erc-response.command vect))) + (provide 'erc) ;;; Deprecated. We might eventually stop requiring the goodies automatically.