aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net/rcirc.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/net/rcirc.el')
-rw-r--r--lisp/net/rcirc.el37
1 files changed, 9 insertions, 28 deletions
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index f7f5f61fafe..9e04abb8cd5 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -935,14 +935,6 @@ IRC command completion is performed only if '/' is the first input char."
935 map) 935 map)
936 "Keymap for rcirc mode.") 936 "Keymap for rcirc mode.")
937 937
938(defvar rcirc-browse-url-map
939 (let ((map (make-sparse-keymap)))
940 (define-key map (kbd "RET") 'rcirc-browse-url-at-point)
941 (define-key map (kbd "<mouse-2>") 'rcirc-browse-url-at-mouse)
942 (define-key map [follow-link] 'mouse-face)
943 map)
944 "Keymap used for browsing URLs in `rcirc-mode'.")
945
946(defvar rcirc-short-buffer-name nil 938(defvar rcirc-short-buffer-name nil
947 "Generated abbreviation to use to indicate buffer activity.") 939 "Generated abbreviation to use to indicate buffer activity.")
948 940
@@ -2351,21 +2343,6 @@ keywords when no KEYWORD is given."
2351 (browse-url (completing-read "rcirc browse-url: " 2343 (browse-url (completing-read "rcirc browse-url: "
2352 completions nil nil initial-input 'history) 2344 completions nil nil initial-input 'history)
2353 arg))) 2345 arg)))
2354
2355(defun rcirc-browse-url-at-point (point)
2356 "Send URL at point to `browse-url'."
2357 (interactive "d")
2358 (let ((beg (previous-single-property-change (1+ point) 'mouse-face))
2359 (end (next-single-property-change point 'mouse-face)))
2360 (browse-url (buffer-substring-no-properties beg end))))
2361
2362(defun rcirc-browse-url-at-mouse (event)
2363 "Send URL at mouse click to `browse-url'."
2364 (interactive "e")
2365 (let ((position (event-end event)))
2366 (with-current-buffer (window-buffer (posn-window position))
2367 (rcirc-browse-url-at-point (posn-point position)))))
2368
2369 2346
2370(defun rcirc-markup-timestamp (sender response) 2347(defun rcirc-markup-timestamp (sender response)
2371 (goto-char (point-min)) 2348 (goto-char (point-min))
@@ -2406,12 +2383,16 @@ keywords when no KEYWORD is given."
2406 (while (and rcirc-url-regexp ;; nil means disable URL catching 2383 (while (and rcirc-url-regexp ;; nil means disable URL catching
2407 (re-search-forward rcirc-url-regexp nil t)) 2384 (re-search-forward rcirc-url-regexp nil t))
2408 (let ((start (match-beginning 0)) 2385 (let ((start (match-beginning 0))
2409 (end (match-end 0))) 2386 (end (match-end 0))
2410 (rcirc-add-face start end 'rcirc-url) 2387 (url (match-string-no-properties 0)))
2411 (add-text-properties start end (list 'mouse-face 'highlight 2388 (make-button start end
2412 'keymap rcirc-browse-url-map)) 2389 'face 'rcirc-url
2390 'follow-link t
2391 'rcirc-url url
2392 'action (lambda (button)
2393 (browse-url (button-get button 'rcirc-url))))
2413 ;; record the url 2394 ;; record the url
2414 (push (buffer-substring-no-properties start end) rcirc-urls)))) 2395 (push url rcirc-urls))))
2415 2396
2416(defun rcirc-markup-keywords (sender response) 2397(defun rcirc-markup-keywords (sender response)
2417 (when (and (string= response "PRIVMSG") 2398 (when (and (string= response "PRIVMSG")