Mercurial > emacs
view lisp/url/url-irc.el @ 107653:bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01280.html
* replace.el (occur-accumulate-lines): Add optional arg `pt'.
(occur-engine): Add local variables `ret', `prev-after-lines',
`prev-lines'. Use more arguments for `occur-context-lines'.
Set first elem of its returned list to `data', and the second elem
to `prev-after-lines'. Don't print the separator line.
In the end, print remaining context after-lines.
(occur-context-lines): Add new arguments `begpt', `endpt',
`lines', `prev-lines', `prev-after-lines'. Rewrite to combine
after-lines of the previous match with before-lines of the
current match and not overlap them. Return a list with two
values: the output line and the list of context after-lines.
* search.texi (Other Repeating Search): Remove line that `occur'
can not handle multiline matches.
* occur-testsuite.el (occur-tests): Add tests for context lines.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Tue, 30 Mar 2010 19:03:08 +0300 |
parents | 1d1d5d9bd884 |
children | 5495085c9b6c 376148b31b5e |
line wrap: on
line source
;;; url-irc.el --- IRC URL interface ;; Copyright (C) 1996, 1997, 1998, 1999, 2004, ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Keywords: comm, data, processes ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;; IRC URLs are defined in http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt ;;; Code: (require 'url-vars) (require 'url-parse) (defconst url-irc-default-port 6667 "Default port for IRC connections.") (defcustom url-irc-function 'url-irc-rcirc "*Function to actually open an IRC connection. The function should take the following arguments: HOST - the hostname of the IRC server to contact PORT - the port number of the IRC server to contact CHANNEL - What channel on the server to visit right away (can be nil) USER - What username to use PASSWORD - What password to use" :type '(choice (const :tag "rcirc" :value url-irc-rcirc) (const :tag "ERC" :value url-irc-erc) (const :tag "ZEN IRC" :value url-irc-zenirc) (function :tag "Other")) :group 'url) ;; External. (declare-function zenirc "ext:zenirc" (&optional prefix)) (declare-function zenirc-send-line "ext:zenirc" ()) (defun url-irc-zenirc (host port channel user password) (let ((zenirc-buffer-name (if (and user host port) (format "%s@%s:%d" user host port) (format "%s:%d" host port))) (zenirc-server-alist (list (list host port password nil user)))) (zenirc) (goto-char (point-max)) (if (not channel) nil (insert "/join " channel) (zenirc-send-line)))) (defun url-irc-rcirc (host port channel user password) (let ((chan (when channel (concat "#" channel)))) (rcirc-connect host port user nil nil (when chan (list chan))) (when chan (switch-to-buffer (concat chan "@" host))))) (defun url-irc-erc (host port channel user password) (erc-handle-irc-url host port channel user password)) ;;;###autoload (defun url-irc (url) (let* ((host (url-host url)) (port (url-port url)) (pass (url-password url)) (user (url-user url)) (chan (url-filename url))) (if (url-target url) (setq chan (concat chan "#" (url-target url)))) (if (string-match "^/" chan) (setq chan (substring chan 1 nil))) (if (= (length chan) 0) (setq chan nil)) (funcall url-irc-function host port chan user pass) nil)) (provide 'url-irc) ;; arch-tag: 2e5eecf8-9eb3-436b-9fbd-c26f2fb2bf3e ;;; url-irc.el ends here