Mercurial > emacs
comparison lisp/erc/erc.el @ 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 | 2de3fcf69715 |
children | 133ba2ee7e43 |
comparison
equal
deleted
inserted
replaced
68813:d065089f984a | 68814:fe9073ac802e |
---|---|
1717 (make-variable-buffer-local 'erc-nick-change-attempt-count) | 1717 (make-variable-buffer-local 'erc-nick-change-attempt-count) |
1718 | 1718 |
1719 (defun erc-migrate-modules (mods) | 1719 (defun erc-migrate-modules (mods) |
1720 "Migrate old names of ERC modules to new ones." | 1720 "Migrate old names of ERC modules to new ones." |
1721 ;; modify `transforms' to specify what needs to be changed | 1721 ;; modify `transforms' to specify what needs to be changed |
1722 ;; each item is in the format '(new .old) | 1722 ;; each item is in the format '(old . new) |
1723 (let ((transforms '((pcomplete . completion))) | 1723 (let ((transforms '((pcomplete . completion)))) |
1724 (modules (copy-alist mods))) | 1724 (erc-delete-dups |
1725 (dolist (transform transforms) | 1725 (mapcar (lambda (m) (or (cdr (assoc m transforms)) m)) |
1726 (let ((addp nil)) | 1726 mods)))) |
1727 (setq modules (erc-delete-if `(lambda (val) | 1727 |
1728 (and (eq val ',(car transform)) | 1728 (defcustom erc-modules '(netsplit fill button match track completion readonly |
1729 (setq addition t))) | |
1730 modules)) | |
1731 (when addp | |
1732 (add-to-list 'modules (cdr transform))))) | |
1733 (erc-delete-dups modules))) | |
1734 | |
1735 (defcustom erc-modules '(netsplit fill button match track pcomplete readonly | |
1736 ring autojoin noncommands irccontrols | 1729 ring autojoin noncommands irccontrols |
1737 stamp) | 1730 stamp list) |
1738 "A list of modules which erc should enable. | 1731 "A list of modules which erc should enable. |
1739 If you set the value of this without using `customize' remember to call | 1732 If you set the value of this without using `customize' remember to call |
1740 \(erc-update-modules) after you change it. When using `customize', modules | 1733 \(erc-update-modules) after you change it. When using `customize', modules |
1741 removed from the list will be disabled." | 1734 removed from the list will be disabled." |
1742 :get (lambda (sym) | 1735 :get (lambda (sym) |
1753 (funcall f 0)))))) | 1746 (funcall f 0)))))) |
1754 (set sym val) | 1747 (set sym val) |
1755 ;; this test is for the case where erc hasn't been loaded yet | 1748 ;; this test is for the case where erc hasn't been loaded yet |
1756 (when (fboundp 'erc-update-modules) | 1749 (when (fboundp 'erc-update-modules) |
1757 (erc-update-modules))) | 1750 (erc-update-modules))) |
1758 :type '(set :greedy t | 1751 :type |
1759 (const :tag "Set away status automatically" autoaway) | 1752 '(set |
1760 (const :tag "Join channels automatically" autojoin) | 1753 :greedy t |
1761 (const :tag "Integrate with Big Brother Database" bbdb) | 1754 (const :tag "Set away status automatically" autoaway) |
1762 (const :tag "Buttonize URLs, nicknames, and other text" button) | 1755 (const :tag "Join channels automatically" autojoin) |
1763 (const :tag "Wrap long lines" fill) | 1756 (const :tag "Integrate with Big Brother Database" bbdb) |
1764 (const :tag "Highlight or remove IRC control characters" | 1757 (const :tag "Buttonize URLs, nicknames, and other text" button) |
1765 irccontrols) | 1758 (const :tag "Wrap long lines" fill) |
1766 (const :tag "Save buffers in logs" log) | 1759 (const :tag "Highlight or remove IRC control characters" |
1767 (const :tag "Highlight pals, fools, and other keywords" match) | 1760 irccontrols) |
1768 (const :tag "Detect netsplits" netsplit) | 1761 (const :tag "Save buffers in logs" log) |
1769 (const :tag "Don't display non-IRC commands after evaluation" | 1762 (const :tag "Highlight pals, fools, and other keywords" match) |
1770 noncommands) | 1763 (const :tag "Detect netsplits" netsplit) |
1771 (const :tag | 1764 (const :tag "Don't display non-IRC commands after evaluation" |
1772 "Notify when the online status of certain users changes" | 1765 noncommands) |
1773 notify) | 1766 (const :tag |
1774 (const :tag "Complete nicknames and commands (programmable)" | 1767 "Notify when the online status of certain users changes" |
1775 completion) | 1768 notify) |
1776 (const :tag "Complete nicknames and commands (old)" hecomplete) | 1769 (const :tag "Complete nicknames and commands (programmable)" |
1777 (const :tag "Make displayed lines read-only" readonly) | 1770 completion) |
1778 (const :tag "Replace text in messages" replace) | 1771 (const :tag "Complete nicknames and commands (old)" hecomplete) |
1779 (const :tag "Enable an input history" ring) | 1772 (const :tag "Make displayed lines read-only" readonly) |
1780 (const :tag "Scroll to the bottom of the buffer" scrolltobottom) | 1773 (const :tag "Replace text in messages" replace) |
1781 (const :tag "Identify to Nickserv (IRC Services) automatically" | 1774 (const :tag "Enable an input history" ring) |
1782 services) | 1775 (const :tag "Scroll to the bottom of the buffer" scrolltobottom) |
1783 (const :tag "Convert smileys to pretty icons" smiley) | 1776 (const :tag "Identify to Nickserv (IRC Services) automatically" |
1784 (const :tag "Play sounds when you receive CTCP SOUND requests" | 1777 services) |
1785 sound) | 1778 (const :tag "Convert smileys to pretty icons" smiley) |
1786 (const :tag "Add timestamps to messages" stamp) | 1779 (const :tag "Play sounds when you receive CTCP SOUND requests" |
1787 (const :tag "Check spelling" spelling) | 1780 sound) |
1788 (const :tag "Track channel activity in the mode-line" track) | 1781 (const :tag "Add timestamps to messages" stamp) |
1789 (const :tag "Truncate buffers to a certain size" truncate) | 1782 (const :tag "Check spelling" spelling) |
1790 (const :tag "Translate morse code in messages" unmorse) | 1783 (const :tag "Track channel activity in the mode-line" track) |
1791 (repeat :tag "Others" :inline t symbol)) | 1784 (const :tag "Truncate buffers to a certain size" truncate) |
1785 (const :tag "Translate morse code in messages" unmorse) | |
1786 (repeat :tag "Others" :inline t symbol)) | |
1792 :group 'erc) | 1787 :group 'erc) |
1793 | 1788 |
1794 (defun erc-update-modules () | 1789 (defun erc-update-modules () |
1795 "Run this to enable erc-foo-mode for all modules in `erc-modules'." | 1790 "Run this to enable erc-foo-mode for all modules in `erc-modules'." |
1796 (let (req) | 1791 (let (req) |
1797 (dolist (mod erc-modules) | 1792 (dolist (mod erc-modules) |
1798 (setq req (concat "erc-" (symbol-name mod))) | 1793 (setq req (concat "erc-" (symbol-name mod))) |
1799 (cond | 1794 (cond |
1800 ;; yuck. perhaps we should bring the filenames into sync? | 1795 ;; yuck. perhaps we should bring the filenames into sync? |
1801 ((string= req "erc-completion") | 1796 ((string= req "erc-completion") |
1802 (setq req "erc-pcomplete") | 1797 (setq req "erc-pcomplete")) |
1803 (setq mod 'completion)) | |
1804 ((string= req "erc-pcomplete") | 1798 ((string= req "erc-pcomplete") |
1805 (setq req "erc-pcomplete") | |
1806 (setq mod 'completion)) | 1799 (setq mod 'completion)) |
1807 ((string= req "erc-autojoin") | 1800 ((string= req "erc-autojoin") |
1808 (setq req "erc-join") | 1801 (setq req "erc-join"))) |
1809 (setq mod 'autojoin))) | |
1810 (condition-case nil | 1802 (condition-case nil |
1811 (require (intern req)) | 1803 (require (intern req)) |
1812 (error nil)) | 1804 (error nil)) |
1813 (funcall (or (intern-soft (concat "erc-" (symbol-name mod) "-mode")) | 1805 (funcall (or (intern-soft (concat "erc-" (symbol-name mod) "-mode")) |
1814 (error "`%s' is not a known ERC module" mod)) | 1806 (error "`%s' is not a known ERC module" mod)) |
6141 (let ((tgt (erc-default-target))) | 6133 (let ((tgt (erc-default-target))) |
6142 (erc-server-send (format "PART %s :%s" tgt | 6134 (erc-server-send (format "PART %s :%s" tgt |
6143 (funcall erc-part-reason nil)) | 6135 (funcall erc-part-reason nil)) |
6144 nil tgt)))) | 6136 nil tgt)))) |
6145 | 6137 |
6138 ;;; Dealing with `erc-parsed' | |
6139 | |
6140 (defun erc-get-parsed-vector (point) | |
6141 "Return the whole parsed vector on POINT." | |
6142 (get-text-property point 'erc-parsed)) | |
6143 | |
6144 (defun erc-get-parsed-vector-nick (vect) | |
6145 "Return nickname in the parsed vector VECT." | |
6146 (let* ((untreated-nick (and vect (erc-response.sender vect))) | |
6147 (maybe-nick (when untreated-nick | |
6148 (car (split-string untreated-nick "!"))))) | |
6149 (when (and (not (null maybe-nick)) | |
6150 (erc-is-valid-nick-p maybe-nick)) | |
6151 untreated-nick))) | |
6152 | |
6153 (defun erc-get-parsed-vector-type (vect) | |
6154 "Return message type in the parsed vector VECT." | |
6155 (and vect | |
6156 (erc-response.command vect))) | |
6157 | |
6146 (provide 'erc) | 6158 (provide 'erc) |
6147 | 6159 |
6148 ;;; Deprecated. We might eventually stop requiring the goodies automatically. | 6160 ;;; Deprecated. We might eventually stop requiring the goodies automatically. |
6149 ;;; IMPORTANT: This require must appear _after_ the above (provide 'erc) to | 6161 ;;; IMPORTANT: This require must appear _after_ the above (provide 'erc) to |
6150 ;;; avoid a recursive require error when byte-compiling the entire package. | 6162 ;;; avoid a recursive require error when byte-compiling the entire package. |