erc-goodies.el 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. ;; erc-goodies.el --- Collection of ERC modules
  2. ;; Copyright (C) 2001-2017 Free Software Foundation, Inc.
  3. ;; Author: Jorgen Schaefer <forcer@forcix.cx>
  4. ;; Maintainer: emacs-devel@gnu.org
  5. ;; Most code is taken verbatim from erc.el, see there for the original
  6. ;; authors.
  7. ;; This file is part of GNU Emacs.
  8. ;; GNU Emacs is free software: you can redistribute it and/or modify
  9. ;; it under the terms of the GNU General Public License as published by
  10. ;; the Free Software Foundation, either version 3 of the License, or
  11. ;; (at your option) any later version.
  12. ;; GNU Emacs is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;; GNU General Public License for more details.
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  18. ;;; Commentary:
  19. ;; This provides some small but still useful modes for ERC.
  20. ;;; Code:
  21. (require 'erc)
  22. ;;; Imenu support
  23. (defun erc-imenu-setup ()
  24. "Setup Imenu support in an ERC buffer."
  25. (set (make-local-variable 'imenu-create-index-function)
  26. 'erc-create-imenu-index))
  27. (add-hook 'erc-mode-hook 'erc-imenu-setup)
  28. (autoload 'erc-create-imenu-index "erc-imenu" "Imenu index creation function")
  29. ;;; Automatically scroll to bottom
  30. (defcustom erc-input-line-position nil
  31. "Specify where to position the input line when using `erc-scroll-to-bottom'.
  32. This should be an integer specifying the line of the buffer on which
  33. the input line should stay. A value of \"-1\" would keep the input
  34. line positioned on the last line in the buffer. This is passed as an
  35. argument to `recenter'."
  36. :group 'erc-display
  37. :type '(choice integer (const nil)))
  38. (define-erc-module scrolltobottom nil
  39. "This mode causes the prompt to stay at the end of the window."
  40. ((add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
  41. (dolist (buffer (erc-buffer-list))
  42. (with-current-buffer buffer
  43. (erc-add-scroll-to-bottom))))
  44. ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
  45. (dolist (buffer (erc-buffer-list))
  46. (with-current-buffer buffer
  47. (remove-hook 'post-command-hook 'erc-scroll-to-bottom t)))))
  48. (defun erc-add-scroll-to-bottom ()
  49. "A hook function for `erc-mode-hook' to recenter output at bottom of window.
  50. If you find that ERC hangs when using this function, try customizing
  51. the value of `erc-input-line-position'.
  52. This works whenever scrolling happens, so it's added to
  53. `window-scroll-functions' rather than `erc-insert-post-hook'."
  54. (add-hook 'post-command-hook 'erc-scroll-to-bottom nil t))
  55. (defun erc-scroll-to-bottom ()
  56. "Recenter WINDOW so that `point' is on the last line.
  57. This is added to `window-scroll-functions' by `erc-add-scroll-to-bottom'.
  58. You can control which line is recentered to by customizing the
  59. variable `erc-input-line-position'."
  60. ;; Temporarily bind resize-mini-windows to nil so that users who have it
  61. ;; set to a non-nil value will not suffer from premature minibuffer
  62. ;; shrinkage due to the below recenter call. I have no idea why this
  63. ;; works, but it solves the problem, and has no negative side effects.
  64. ;; (Fran Litterio, 2003/01/07)
  65. (let ((resize-mini-windows nil))
  66. (save-restriction
  67. (widen)
  68. (when (and erc-insert-marker
  69. ;; we're editing a line. Scroll.
  70. (> (point) erc-insert-marker))
  71. (save-excursion
  72. (goto-char (point-max))
  73. (recenter (or erc-input-line-position -1)))))))
  74. ;;; Make read only
  75. (define-erc-module readonly nil
  76. "This mode causes all inserted text to be read-only."
  77. ((add-hook 'erc-insert-post-hook 'erc-make-read-only)
  78. (add-hook 'erc-send-post-hook 'erc-make-read-only))
  79. ((remove-hook 'erc-insert-post-hook 'erc-make-read-only)
  80. (remove-hook 'erc-send-post-hook 'erc-make-read-only)))
  81. (defun erc-make-read-only ()
  82. "Make all the text in the current buffer read-only.
  83. Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
  84. (put-text-property (point-min) (point-max) 'read-only t)
  85. (put-text-property (point-min) (point-max) 'front-sticky t)
  86. (put-text-property (point-min) (point-max) 'rear-nonsticky t))
  87. ;;; Move to prompt when typing text
  88. (define-erc-module move-to-prompt nil
  89. "This mode causes the point to be moved to the prompt when typing text."
  90. ((add-hook 'erc-mode-hook 'erc-move-to-prompt-setup)
  91. (dolist (buffer (erc-buffer-list))
  92. (with-current-buffer buffer
  93. (erc-move-to-prompt-setup))))
  94. ((remove-hook 'erc-mode-hook 'erc-move-to-prompt-setup)
  95. (dolist (buffer (erc-buffer-list))
  96. (with-current-buffer buffer
  97. (remove-hook 'pre-command-hook 'erc-move-to-prompt t)))))
  98. (defun erc-move-to-prompt ()
  99. "Move the point to the ERC prompt if this is a self-inserting command."
  100. (when (and erc-input-marker (< (point) erc-input-marker)
  101. (eq 'self-insert-command this-command))
  102. (deactivate-mark)
  103. (push-mark)
  104. (goto-char (point-max))))
  105. (defun erc-move-to-prompt-setup ()
  106. "Initialize the move-to-prompt module for XEmacs."
  107. (add-hook 'pre-command-hook 'erc-move-to-prompt nil t))
  108. ;;; Keep place in unvisited channels
  109. (define-erc-module keep-place nil
  110. "Leave point above un-viewed text in other channels."
  111. ((add-hook 'erc-insert-pre-hook 'erc-keep-place))
  112. ((remove-hook 'erc-insert-pre-hook 'erc-keep-place)))
  113. (defun erc-keep-place (ignored)
  114. "Move point away from the last line in a non-selected ERC buffer."
  115. (when (and (not (eq (window-buffer (selected-window))
  116. (current-buffer)))
  117. (>= (point) erc-insert-marker))
  118. (deactivate-mark)
  119. (goto-char (erc-beg-of-input-line))
  120. (forward-line -1)))
  121. ;;; Distinguish non-commands
  122. (defvar erc-noncommands-list '(erc-cmd-ME
  123. erc-cmd-COUNTRY
  124. erc-cmd-SV
  125. erc-cmd-SM
  126. erc-cmd-SMV
  127. erc-cmd-LASTLOG)
  128. "List of commands that are aliases for CTCP ACTION or for ERC messages.
  129. If a command's function symbol is in this list, the typed command
  130. does not appear in the ERC buffer after the user presses ENTER.")
  131. (define-erc-module noncommands nil
  132. "This mode distinguishes non-commands.
  133. Commands listed in `erc-insert-this' know how to display
  134. themselves."
  135. ((add-hook 'erc-send-pre-hook 'erc-send-distinguish-noncommands))
  136. ((remove-hook 'erc-send-pre-hook 'erc-send-distinguish-noncommands)))
  137. (defun erc-send-distinguish-noncommands (str)
  138. "If STR is an ERC non-command, set `erc-insert-this' to nil."
  139. (let* ((command (erc-extract-command-from-line str))
  140. (cmd-fun (and command
  141. (car command))))
  142. (when (and cmd-fun
  143. (not (string-match "\n.+$" str))
  144. (memq cmd-fun erc-noncommands-list))
  145. (setq erc-insert-this nil))))
  146. ;;; IRC control character processing.
  147. (defgroup erc-control-characters nil
  148. "Dealing with control characters."
  149. :group 'erc)
  150. (defcustom erc-interpret-controls-p t
  151. "If non-nil, display IRC colors and other highlighting effects.
  152. If this is set to the symbol `remove', ERC removes all IRC colors and
  153. highlighting effects. When this variable is non-nil, it can cause Emacs to run
  154. slowly on systems lacking sufficient CPU speed. In chatty channels, or in an
  155. emergency (message flood) it can be turned off to save processing time. See
  156. `erc-toggle-interpret-controls'."
  157. :group 'erc-control-characters
  158. :type '(choice (const :tag "Highlight control characters" t)
  159. (const :tag "Remove control characters" remove)
  160. (const :tag "Display raw control characters" nil)))
  161. (defcustom erc-interpret-mirc-color nil
  162. "If non-nil, ERC will interpret mIRC color codes."
  163. :group 'erc-control-characters
  164. :type 'boolean)
  165. (defcustom erc-beep-p nil
  166. "Beep if C-g is in the server message.
  167. The value `erc-interpret-controls-p' must also be t for this to work."
  168. :group 'erc-control-characters
  169. :type 'boolean)
  170. (defface erc-bold-face '((t :weight bold))
  171. "ERC bold face."
  172. :group 'erc-faces)
  173. (defface erc-inverse-face
  174. '((t :foreground "White" :background "Black"))
  175. "ERC inverse face."
  176. :group 'erc-faces)
  177. (defface erc-underline-face '((t :underline t))
  178. "ERC underline face."
  179. :group 'erc-faces)
  180. (defface fg:erc-color-face0 '((t :foreground "White"))
  181. "ERC face."
  182. :group 'erc-faces)
  183. (defface fg:erc-color-face1 '((t :foreground "black"))
  184. "ERC face."
  185. :group 'erc-faces)
  186. (defface fg:erc-color-face2 '((t :foreground "blue4"))
  187. "ERC face."
  188. :group 'erc-faces)
  189. (defface fg:erc-color-face3 '((t :foreground "green4"))
  190. "ERC face."
  191. :group 'erc-faces)
  192. (defface fg:erc-color-face4 '((t :foreground "red"))
  193. "ERC face."
  194. :group 'erc-faces)
  195. (defface fg:erc-color-face5 '((t :foreground "brown"))
  196. "ERC face."
  197. :group 'erc-faces)
  198. (defface fg:erc-color-face6 '((t :foreground "purple"))
  199. "ERC face."
  200. :group 'erc-faces)
  201. (defface fg:erc-color-face7 '((t :foreground "orange"))
  202. "ERC face."
  203. :group 'erc-faces)
  204. (defface fg:erc-color-face8 '((t :foreground "yellow"))
  205. "ERC face."
  206. :group 'erc-faces)
  207. (defface fg:erc-color-face9 '((t :foreground "green"))
  208. "ERC face."
  209. :group 'erc-faces)
  210. (defface fg:erc-color-face10 '((t :foreground "lightblue1"))
  211. "ERC face."
  212. :group 'erc-faces)
  213. (defface fg:erc-color-face11 '((t :foreground "cyan"))
  214. "ERC face."
  215. :group 'erc-faces)
  216. (defface fg:erc-color-face12 '((t :foreground "blue"))
  217. "ERC face."
  218. :group 'erc-faces)
  219. (defface fg:erc-color-face13 '((t :foreground "deeppink"))
  220. "ERC face."
  221. :group 'erc-faces)
  222. (defface fg:erc-color-face14 '((t :foreground "gray50"))
  223. "ERC face."
  224. :group 'erc-faces)
  225. (defface fg:erc-color-face15 '((t :foreground "gray90"))
  226. "ERC face."
  227. :group 'erc-faces)
  228. (defface bg:erc-color-face0 '((t :background "White"))
  229. "ERC face."
  230. :group 'erc-faces)
  231. (defface bg:erc-color-face1 '((t :background "black"))
  232. "ERC face."
  233. :group 'erc-faces)
  234. (defface bg:erc-color-face2 '((t :background "blue4"))
  235. "ERC face."
  236. :group 'erc-faces)
  237. (defface bg:erc-color-face3 '((t :background "green4"))
  238. "ERC face."
  239. :group 'erc-faces)
  240. (defface bg:erc-color-face4 '((t :background "red"))
  241. "ERC face."
  242. :group 'erc-faces)
  243. (defface bg:erc-color-face5 '((t :background "brown"))
  244. "ERC face."
  245. :group 'erc-faces)
  246. (defface bg:erc-color-face6 '((t :background "purple"))
  247. "ERC face."
  248. :group 'erc-faces)
  249. (defface bg:erc-color-face7 '((t :background "orange"))
  250. "ERC face."
  251. :group 'erc-faces)
  252. (defface bg:erc-color-face8 '((t :background "yellow"))
  253. "ERC face."
  254. :group 'erc-faces)
  255. (defface bg:erc-color-face9 '((t :background "green"))
  256. "ERC face."
  257. :group 'erc-faces)
  258. (defface bg:erc-color-face10 '((t :background "lightblue1"))
  259. "ERC face."
  260. :group 'erc-faces)
  261. (defface bg:erc-color-face11 '((t :background "cyan"))
  262. "ERC face."
  263. :group 'erc-faces)
  264. (defface bg:erc-color-face12 '((t :background "blue"))
  265. "ERC face."
  266. :group 'erc-faces)
  267. (defface bg:erc-color-face13 '((t :background "deeppink"))
  268. "ERC face."
  269. :group 'erc-faces)
  270. (defface bg:erc-color-face14 '((t :background "gray50"))
  271. "ERC face."
  272. :group 'erc-faces)
  273. (defface bg:erc-color-face15 '((t :background "gray90"))
  274. "ERC face."
  275. :group 'erc-faces)
  276. (defun erc-get-bg-color-face (n)
  277. "Fetches the right face for background color N (0-15)."
  278. (if (stringp n) (setq n (string-to-number n)))
  279. (if (not (numberp n))
  280. (prog1 'default
  281. (erc-error "erc-get-bg-color-face: n is NaN: %S" n))
  282. (when (> n 16)
  283. (erc-log (format " Wrong color: %s" n))
  284. (setq n (mod n 16)))
  285. (cond
  286. ((and (>= n 0) (< n 16))
  287. (intern (concat "bg:erc-color-face" (number-to-string n))))
  288. (t (erc-log (format " Wrong color: %s" n)) 'default))))
  289. (defun erc-get-fg-color-face (n)
  290. "Fetches the right face for foreground color N (0-15)."
  291. (if (stringp n) (setq n (string-to-number n)))
  292. (if (not (numberp n))
  293. (prog1 'default
  294. (erc-error "erc-get-fg-color-face: n is NaN: %S" n))
  295. (when (> n 16)
  296. (erc-log (format " Wrong color: %s" n))
  297. (setq n (mod n 16)))
  298. (cond
  299. ((and (>= n 0) (< n 16))
  300. (intern (concat "fg:erc-color-face" (number-to-string n))))
  301. (t (erc-log (format " Wrong color: %s" n)) 'default))))
  302. (define-erc-module irccontrols nil
  303. "This mode enables the interpretation of IRC control chars."
  304. ((add-hook 'erc-insert-modify-hook 'erc-controls-highlight)
  305. (add-hook 'erc-send-modify-hook 'erc-controls-highlight))
  306. ((remove-hook 'erc-insert-modify-hook 'erc-controls-highlight)
  307. (remove-hook 'erc-send-modify-hook 'erc-controls-highlight)))
  308. (defun erc-controls-interpret (str)
  309. "Return a copy of STR after dealing with IRC control characters.
  310. See `erc-interpret-controls-p' and `erc-interpret-mirc-color' for options."
  311. (when str
  312. (let ((s str))
  313. (cond ((eq erc-interpret-controls-p 'remove)
  314. (erc-controls-strip s))
  315. (erc-interpret-controls-p
  316. (let ((boldp nil)
  317. (inversep nil)
  318. (underlinep nil)
  319. (fg nil)
  320. (bg nil))
  321. (while (string-match erc-controls-highlight-regexp s)
  322. (let ((control (match-string 1 s))
  323. (fg-color (match-string 2 s))
  324. (bg-color (match-string 4 s))
  325. (start (match-beginning 0))
  326. (end (+ (match-beginning 0)
  327. (length (match-string 5 s)))))
  328. (setq s (erc-replace-match-subexpression-in-string
  329. "" s control 1 start))
  330. (cond ((and erc-interpret-mirc-color (or fg-color bg-color))
  331. (setq fg fg-color)
  332. (setq bg bg-color))
  333. ((string= control "\C-b")
  334. (setq boldp (not boldp)))
  335. ((string= control "\C-v")
  336. (setq inversep (not inversep)))
  337. ((string= control "\C-_")
  338. (setq underlinep (not underlinep)))
  339. ((string= control "\C-c")
  340. (setq fg nil
  341. bg nil))
  342. ((string= control "\C-g")
  343. (when erc-beep-p
  344. (ding)))
  345. ((string= control "\C-o")
  346. (setq boldp nil
  347. inversep nil
  348. underlinep nil
  349. fg nil
  350. bg nil))
  351. (t nil))
  352. (erc-controls-propertize
  353. start end boldp inversep underlinep fg bg s)))
  354. s))
  355. (t s)))))
  356. (defun erc-controls-strip (str)
  357. "Return a copy of STR with all IRC control characters removed."
  358. (when str
  359. (let ((s str))
  360. (while (string-match erc-controls-remove-regexp s)
  361. (setq s (replace-match "" nil nil s)))
  362. s)))
  363. (defvar erc-controls-remove-regexp
  364. "\C-b\\|\C-_\\|\C-v\\|\C-g\\|\C-o\\|\C-c[0-9]?[0-9]?\\(,[0-9][0-9]?\\)?"
  365. "Regular expression which matches control characters to remove.")
  366. (defvar erc-controls-highlight-regexp
  367. (concat "\\(\C-b\\|\C-v\\|\C-_\\|\C-g\\|\C-o\\|"
  368. "\C-c\\([0-9][0-9]?\\)?\\(,\\([0-9][0-9]?\\)\\)?\\)"
  369. "\\([^\C-b\C-v\C-_\C-c\C-g\C-o\n]*\\)")
  370. "Regular expression which matches control chars and the text to highlight.")
  371. (defun erc-controls-highlight ()
  372. "Highlight IRC control chars in the buffer.
  373. This is useful for `erc-insert-modify-hook' and `erc-send-modify-hook'.
  374. Also see `erc-interpret-controls-p' and `erc-interpret-mirc-color'."
  375. (goto-char (point-min))
  376. (cond ((eq erc-interpret-controls-p 'remove)
  377. (while (re-search-forward erc-controls-remove-regexp nil t)
  378. (replace-match "")))
  379. (erc-interpret-controls-p
  380. (let ((boldp nil)
  381. (inversep nil)
  382. (underlinep nil)
  383. (fg nil)
  384. (bg nil))
  385. (while (re-search-forward erc-controls-highlight-regexp nil t)
  386. (let ((control (match-string 1))
  387. (fg-color (match-string 2))
  388. (bg-color (match-string 4))
  389. (start (match-beginning 0))
  390. (end (+ (match-beginning 0) (length (match-string 5)))))
  391. (replace-match "" nil nil nil 1)
  392. (cond ((and erc-interpret-mirc-color (or fg-color bg-color))
  393. (setq fg fg-color)
  394. (setq bg bg-color))
  395. ((string= control "\C-b")
  396. (setq boldp (not boldp)))
  397. ((string= control "\C-v")
  398. (setq inversep (not inversep)))
  399. ((string= control "\C-_")
  400. (setq underlinep (not underlinep)))
  401. ((string= control "\C-c")
  402. (setq fg nil
  403. bg nil))
  404. ((string= control "\C-g")
  405. (when erc-beep-p
  406. (ding)))
  407. ((string= control "\C-o")
  408. (setq boldp nil
  409. inversep nil
  410. underlinep nil
  411. fg nil
  412. bg nil))
  413. (t nil))
  414. (erc-controls-propertize start end
  415. boldp inversep underlinep fg bg)))))
  416. (t nil)))
  417. (defun erc-controls-propertize (from to boldp inversep underlinep fg bg
  418. &optional str)
  419. "Prepend properties from IRC control characters between FROM and TO.
  420. If optional argument STR is provided, apply to STR, otherwise prepend properties
  421. to a region in the current buffer."
  422. (font-lock-prepend-text-property
  423. from
  424. to
  425. 'font-lock-face
  426. (append (if boldp
  427. '(erc-bold-face)
  428. nil)
  429. (if inversep
  430. '(erc-inverse-face)
  431. nil)
  432. (if underlinep
  433. '(erc-underline-face)
  434. nil)
  435. (if fg
  436. (list (erc-get-fg-color-face fg))
  437. nil)
  438. (if bg
  439. (list (erc-get-bg-color-face bg))
  440. nil))
  441. str)
  442. str)
  443. (defun erc-toggle-interpret-controls (&optional arg)
  444. "Toggle interpretation of control sequences in messages.
  445. If ARG is positive, interpretation is turned on.
  446. Else interpretation is turned off."
  447. (interactive "P")
  448. (cond ((and (numberp arg) (> arg 0))
  449. (setq erc-interpret-controls-p t))
  450. (arg (setq erc-interpret-controls-p nil))
  451. (t (setq erc-interpret-controls-p (not erc-interpret-controls-p))))
  452. (message "ERC color interpretation %s"
  453. (if erc-interpret-controls-p "ON" "OFF")))
  454. ;; Smiley
  455. (define-erc-module smiley nil
  456. "This mode translates text-smileys such as :-) into pictures.
  457. This requires the function `smiley-region', which is defined in
  458. smiley.el, which is part of Gnus."
  459. ((add-hook 'erc-insert-modify-hook 'erc-smiley)
  460. (add-hook 'erc-send-modify-hook 'erc-smiley))
  461. ((remove-hook 'erc-insert-modify-hook 'erc-smiley)
  462. (remove-hook 'erc-send-modify-hook 'erc-smiley)))
  463. (defun erc-smiley ()
  464. "Smilify a region.
  465. This function should be used with `erc-insert-modify-hook'."
  466. (when (fboundp 'smiley-region)
  467. (smiley-region (point-min) (point-max))))
  468. ;; Unmorse
  469. (define-erc-module unmorse nil
  470. "This mode causes morse code in the current channel to be unmorsed."
  471. ((add-hook 'erc-insert-modify-hook 'erc-unmorse))
  472. ((remove-hook 'erc-insert-modify-hook 'erc-unmorse)))
  473. (defun erc-unmorse ()
  474. "Unmorse some text.
  475. Add this to `erc-insert-modify-hook' if you happen to be on a
  476. channel that has weird people talking in morse to each other.
  477. See also `unmorse-region'."
  478. (goto-char (point-min))
  479. (when (re-search-forward "[.-]+\\([.-]*/? *\\)+[.-]+/?" nil t)
  480. (save-restriction
  481. (narrow-to-region (match-beginning 0) (match-end 0))
  482. ;; Turn " / " into " "
  483. (goto-char (point-min))
  484. (while (re-search-forward " / " nil t)
  485. (replace-match " "))
  486. ;; Turn "/ " into "/"
  487. (goto-char (point-min))
  488. (while (re-search-forward "/ " nil t)
  489. (replace-match "/"))
  490. ;; Unmorse region
  491. (unmorse-region (point-min) (point-max)))))
  492. ;;; erc-occur
  493. (defun erc-occur (string &optional proc)
  494. "Search for STRING in all buffers related to current server.
  495. If called interactively and prefix argument is given, search on all connected
  496. servers. If called from a program, PROC specifies the server process."
  497. (interactive
  498. (list (read-string "Search for: ")
  499. (if current-prefix-arg
  500. nil erc-server-process)))
  501. (if (fboundp 'multi-occur)
  502. (multi-occur (erc-buffer-list nil proc) string)
  503. (error "`multi-occur' is not defined as a function")))
  504. (provide 'erc-goodies)
  505. ;;; erc-goodies.el ends here