Mercurial > emacs
annotate lisp/org/org-irc.el @ 104617:abce8d2d9707
(vc-git-stash, vc-git-stash-show): New functions.
(vc-git-extra-menu-map): Bind them.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Wed, 26 Aug 2009 07:01:09 +0000 |
parents | ac1a55cc2c38 |
children | 86b7fe7d1d8f |
rev | line source |
---|---|
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1 ;;; org-irc.el --- Store links to IRC sessions |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
2 ;; |
101458
36abe982e7cd
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100908
diff
changeset
|
3 ;; Copyright (C) 2008, 2009 Free Software Foundation, Inc. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
4 ;; |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5 ;; Author: Philip Jackson <emacs@shellarchive.co.uk> |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6 ;; Keywords: erc, irc, link, org |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
7 ;; Version: 6.29c |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
8 ;; |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
10 ;; |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94414
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94414
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94414
diff
changeset
|
14 ;; (at your option) any later version. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
15 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
20 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94414
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
23 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
24 ;;; Commentary: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
25 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
26 ;; This file implements links to an IRC session from within Org-mode. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
27 ;; Org-mode loads this module by default - if this is not what you want, |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
28 ;; configure the variable `org-modules'. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
29 ;; |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
30 ;; Please customize the variable `org-modules' to select |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
31 ;; extensions you would like to use, and to deselect those which you don't |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
32 ;; want. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
33 ;; |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
34 ;; Please note that at the moment only ERC is supported. Other clients |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
35 ;; shouldn't be difficult to add though. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
36 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
37 ;; Then set `org-irc-link-to-logs' to non-nil if you would like a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
38 ;; file:/ type link to be created to the current line in the logs or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
39 ;; to t if you would like to create an irc:/ style link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
40 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
41 ;; Links within an org buffer might look like this: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
42 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
43 ;; [[irc:/irc.freenode.net/#emacs/bob][chat with bob in #emacs on freenode]] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
44 ;; [[irc:/irc.freenode.net/#emacs][#emacs on freenode]] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
45 ;; [[irc:/irc.freenode.net/]] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
46 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
47 ;; If, when the resulting link is visited, there is no connection to a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
48 ;; requested server then one will be created. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
49 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
50 ;;; Code: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
51 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
52 (require 'org) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
53 |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
54 ;; Declare the function form ERC that we use. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
55 (declare-function erc-current-logfile "erc-log" (&optional buffer)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
56 (declare-function erc-prompt "erc" ()) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
57 (declare-function erc-default-target "erc" ()) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
58 (declare-function erc-channel-p "erc" (channel)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
59 (declare-function erc-buffer-filter "erc" (predicate &optional proc)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
60 (declare-function erc-server-buffer "erc" ()) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
61 (declare-function erc-get-server-nickname-list "erc" ()) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
62 (declare-function erc-cmd-JOIN "erc" (channel &optional key)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
63 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
64 (defvar org-irc-client 'erc |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
65 "The IRC client to act on.") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
66 (defvar org-irc-link-to-logs nil |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
67 "Non-nil will store a link to the logs, nil will store an irc: style link.") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
68 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
69 (defvar erc-default-port) ; dynamically scoped from erc.el |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
70 (defvar erc-session-port) ; dynamically scoped form erc-backend.el |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
71 (defvar erc-session-server) ; dynamically scoped form erc-backend.el |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
72 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
73 ;; Generic functions/config (extend these for other clients) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
74 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
75 (add-to-list 'org-store-link-functions 'org-irc-store-link) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
76 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
77 (org-add-link-type "irc" 'org-irc-visit nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
78 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
79 (defun org-irc-visit (link) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
80 "Parse LINK and dispatch to the correct function based on the client found." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
81 (let ((link (org-irc-parse-link link))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
82 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
83 ((eq org-irc-client 'erc) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
84 (org-irc-visit-erc link)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
85 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
86 (error "erc only known client"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
87 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
88 (defun org-irc-parse-link (link) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
89 "Parse an IRC LINK and return the attributes found. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
90 Parse a LINK that looks like server:port/chan/user (port, chan |
94767
8634b4393320
(org-irc-parse-link): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
91 and user being optional) and return any of the port, channel or user |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
92 attributes that are found." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
93 (let* ((parts (split-string link "/" t)) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
94 (len (length parts))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
95 (when (or (< len 1) (> len 3)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
96 (error "Failed to parse link needed 1-3 parts, got %d" len)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
97 (setcar parts (split-string (car parts) ":" t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
98 parts)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
99 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
100 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
101 (defun org-irc-store-link () |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
102 "Dispatch to the appropriate function to store a link to an IRC session." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
103 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
104 ((eq major-mode 'erc-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
105 (org-irc-erc-store-link)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
106 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
107 (defun org-irc-elipsify-description (string &optional after) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
108 "Remove unnecessary white space from STRING and add ellipses if necessary. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
109 Strip starting and ending white space from STRING and replace any |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
110 chars that the value AFTER with '...'" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
111 (let* ((after (number-to-string (or after 30))) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
112 (replace-map (list (cons "^[ \t]*" "") |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
113 (cons "[ \t]*$" "") |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
114 (cons (concat "^\\(.\\{" after |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
115 "\\}\\).*") "\\1...")))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
116 (mapc (lambda (x) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
117 (when (string-match (car x) string) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
118 (setq string (replace-match (cdr x) nil nil string)))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
119 replace-map) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
120 string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
121 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
122 ;; ERC specific functions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
123 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
124 (defun org-irc-erc-get-line-from-log (erc-line) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
125 "Find the best line to link to from the ERC logs given ERC-LINE as a start. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
126 If the user is on the ERC-prompt then search backward for the |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
127 first non-blank line, otherwise return the current line. The |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
128 result is a cons of the filename and search string." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
129 (erc-save-buffer-in-logs) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
130 (require 'erc-log) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
131 (with-current-buffer (find-file-noselect (erc-current-logfile)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
132 (goto-char (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
133 (list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
134 (abbreviate-file-name buffer-file-name) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
135 ;; can we get a '::' part? |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
136 (if (string= erc-line (erc-prompt)) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
137 (progn |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
138 (goto-char (point-at-bol)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
139 (when (search-backward-regexp "^[^ ]" nil t) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
140 (buffer-substring-no-properties (point-at-bol) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
141 (point-at-eol)))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
142 (when (search-backward erc-line nil t) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
143 (buffer-substring-no-properties (point-at-bol) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
144 (point-at-eol))))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
145 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
146 (defun org-irc-erc-store-link () |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
147 "Store a link to the IRC log file or the session itself. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
148 Depending on the variable `org-irc-link-to-logs' store either a |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
149 link to the log file for the current session or an irc: link to |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
150 the session itself." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
151 (require 'erc-log) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
152 (if org-irc-link-to-logs |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
153 (let* ((erc-line (buffer-substring-no-properties |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
154 (point-at-bol) (point-at-eol))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
155 (parsed-line (org-irc-erc-get-line-from-log erc-line))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
156 (if (erc-logging-enabled nil) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
157 (progn |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
158 (org-store-link-props |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
159 :type "file" |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
160 :description (concat "'" (org-irc-elipsify-description |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
161 (cadr parsed-line) 20) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
162 "' from an IRC conversation") |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
163 :link (concat "file:" (car parsed-line) "::" |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
164 (cadr parsed-line))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
165 t) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
166 (error "This ERC session is not being logged"))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
167 (let* ((link-text (org-irc-get-erc-link)) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
168 (link (org-irc-parse-link link-text))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
169 (if link-text |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
170 (progn |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
171 (org-store-link-props |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
172 :type "irc" |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
173 :link (org-make-link "irc:/" link-text) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
174 :description (concat "irc session '" link-text "'") |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
175 :server (car (car link)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
176 :port (or (string-to-number (cadr (pop link))) erc-default-port) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
177 :nick (pop link)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
178 t) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
179 (error "Failed to create ('irc:/' style) ERC link"))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
180 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
181 (defun org-irc-get-erc-link () |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
182 "Return an org compatible irc:/ link from an ERC buffer." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
183 (let* ((session-port (if (numberp erc-session-port) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
184 (number-to-string erc-session-port) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
185 erc-session-port)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
186 (link (concat erc-session-server ":" session-port))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
187 (concat link "/" |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
188 (if (and (erc-default-target) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
189 (erc-channel-p (erc-default-target)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
190 (car (get-text-property (point) 'erc-data))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
191 ;; we can get a nick |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
192 (let ((nick (car (get-text-property (point) 'erc-data)))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
193 (concat (erc-default-target) "/" nick)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
194 (erc-default-target))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
195 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
196 (defun org-irc-get-current-erc-port () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
197 "Return the current port as a number. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
198 Return the current port number or, if none is set, return the ERC |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
199 default." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
200 (cond |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
201 ((stringp erc-session-port) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
202 (string-to-number erc-session-port)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
203 ((numberp erc-session-port) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
204 erc-session-port) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
205 (t |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
206 erc-default-port))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
207 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
208 (defun org-irc-visit-erc (link) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
209 "Visit an ERC buffer based on criteria found in LINK." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
210 (require 'erc) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
211 (require 'erc-log) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
212 (let* ((server (car (car link))) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
213 (port (or (string-to-number (cadr (pop link))) erc-default-port)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
214 (server-buffer) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
215 (buffer-list |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
216 (erc-buffer-filter |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
217 (lambda nil |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
218 (let ((tmp-server-buf (erc-server-buffer))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
219 (and tmp-server-buf |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
220 (with-current-buffer tmp-server-buf |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
221 (and |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
222 (eq (org-irc-get-current-erc-port) port) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
223 (string= erc-session-server server) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
224 (setq server-buffer tmp-server-buf))))))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
225 (if buffer-list |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
226 (let ((chan-name (pop link))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
227 ;; if we got a channel name then switch to it or join it |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
228 (if chan-name |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
229 (let ((chan-buf (catch 'found |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
230 (dolist (x buffer-list) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
231 (if (string= (buffer-name x) chan-name) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
232 (throw 'found x)))))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
233 (if chan-buf |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
234 (progn |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
235 (switch-to-buffer chan-buf) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
236 ;; if we got a nick, and they're in the chan, |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
237 ;; then start a chat with them |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
238 (let ((nick (pop link))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
239 (when nick |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
240 (if (member nick (erc-get-server-nickname-list)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
241 (progn |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
242 (goto-char (point-max)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
243 (insert (concat nick ": "))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
244 (error "%s not found in %s" nick chan-name))))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
245 (progn |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
246 (switch-to-buffer server-buffer) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
247 (erc-cmd-JOIN chan-name)))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
248 (switch-to-buffer server-buffer))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
249 ;; no server match, make new connection |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
250 (erc-select :server server :port port)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
251 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
252 (provide 'org-irc) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
253 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
254 ;; arch-tag: 018d7dda-53b8-4a35-ba92-6670939e525a |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94767
diff
changeset
|
255 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
256 ;;; org-irc.el ends here |