X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/e66ba1dfc4cf2e12100191d2c24436c42d097268..ab422c4d6899b1442cb6954c1829c1fb656b006c:/lisp/org/org-irc.el diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el index c4ad32146d..afacae3ec3 100644 --- a/lisp/org/org-irc.el +++ b/lisp/org/org-irc.el @@ -1,6 +1,6 @@ ;;; org-irc.el --- Store links to IRC sessions ;; -;; Copyright (C) 2008-2011 Free Software Foundation, Inc. +;; Copyright (C) 2008-2013 Free Software Foundation, Inc. ;; ;; Author: Philip Jackson ;; Keywords: erc, irc, link, org @@ -59,7 +59,7 @@ (declare-function erc-server-buffer "erc" ()) (declare-function erc-get-server-nickname-list "erc" ()) (declare-function erc-cmd-JOIN "erc" (channel &optional key)) -(declare-function org-pop-to-buffer-same-window +(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) (defvar org-irc-client 'erc @@ -81,10 +81,10 @@ "Parse LINK and dispatch to the correct function based on the client found." (let ((link (org-irc-parse-link link))) (cond - ((eq org-irc-client 'erc) - (org-irc-visit-erc link)) - (t - (error "erc only known client"))))) + ((eq org-irc-client 'erc) + (org-irc-visit-erc link)) + (t + (error "ERC only known client"))))) (defun org-irc-parse-link (link) "Parse an IRC LINK and return the attributes found. @@ -102,8 +102,8 @@ attributes that are found." (defun org-irc-store-link () "Dispatch to the appropriate function to store a link to an IRC session." (cond - ((eq major-mode 'erc-mode) - (org-irc-erc-store-link)))) + ((eq major-mode 'erc-mode) + (org-irc-erc-store-link)))) (defun org-irc-elipsify-description (string &optional after) "Remove unnecessary white space from STRING and add ellipses if necessary. @@ -140,9 +140,9 @@ result is a cons of the filename and search string." (when (search-backward-regexp "^[^ ]" nil t) (buffer-substring-no-properties (point-at-bol) (point-at-eol)))) - (when (search-backward erc-line nil t) - (buffer-substring-no-properties (point-at-bol) - (point-at-eol))))))) + (when (search-backward erc-line nil t) + (buffer-substring-no-properties (point-at-bol) + (point-at-eol))))))) (defun org-irc-erc-store-link () "Store a link to the IRC log file or the session itself. @@ -164,27 +164,27 @@ the session itself." :link (concat "file:" (car parsed-line) "::" (cadr parsed-line))) t) - (error "This ERC session is not being logged"))) - (let* ((link-text (org-irc-get-erc-link)) - (link (org-irc-parse-link link-text))) - (if link-text - (progn - (org-store-link-props - :type "irc" - :link (org-make-link "irc:/" link-text) - :description (concat "irc session '" link-text "'") - :server (car (car link)) - :port (or (string-to-number (cadr (pop link))) erc-default-port) - :nick (pop link)) - t) - (error "Failed to create ('irc:/' style) ERC link"))))) + (error "This ERC session is not being logged"))) + (let* ((link-text (org-irc-get-erc-link)) + (link (org-irc-parse-link link-text))) + (if link-text + (progn + (org-store-link-props + :type "irc" + :link (concat "irc:/" link-text) + :description (concat "irc session '" link-text "'") + :server (car (car link)) + :port (or (string-to-number (cadr (pop link))) erc-default-port) + :nick (pop link)) + t) + (error "Failed to create ('irc:/' style) ERC link"))))) (defun org-irc-get-erc-link () "Return an org compatible irc:/ link from an ERC buffer." (let* ((session-port (if (numberp erc-session-port) (number-to-string erc-session-port) - erc-session-port)) - (link (concat erc-session-server ":" session-port))) + erc-session-port)) + (link (concat erc-session-server ":" session-port))) (concat link "/" (if (and (erc-default-target) (erc-channel-p (erc-default-target)) @@ -192,19 +192,19 @@ the session itself." ;; we can get a nick (let ((nick (car (get-text-property (point) 'erc-data)))) (concat (erc-default-target) "/" nick)) - (erc-default-target))))) + (erc-default-target))))) (defun org-irc-get-current-erc-port () "Return the current port as a number. Return the current port number or, if none is set, return the ERC default." (cond - ((stringp erc-session-port) - (string-to-number erc-session-port)) - ((numberp erc-session-port) - erc-session-port) - (t - erc-default-port))) + ((stringp erc-session-port) + (string-to-number erc-session-port)) + ((numberp erc-session-port) + erc-session-port) + (t + erc-default-port))) (defun org-irc-visit-erc (link) "Visit an ERC buffer based on criteria found in LINK." @@ -242,14 +242,18 @@ default." (progn (goto-char (point-max)) (insert (concat nick ": "))) - (error "%s not found in %s" nick chan-name))))) - (progn - (org-pop-to-buffer-same-window server-buffer) - (erc-cmd-JOIN chan-name)))) - (org-pop-to-buffer-same-window server-buffer))) - ;; no server match, make new connection - (erc-select :server server :port port)))) + (error "%s not found in %s" nick chan-name))))) + (progn + (org-pop-to-buffer-same-window server-buffer) + (erc-cmd-JOIN chan-name)))) + (org-pop-to-buffer-same-window server-buffer))) + ;; no server match, make new connection + (erc-select :server server :port port)))) (provide 'org-irc) +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + ;;; org-irc.el ends here