diff options
| author | Joakim Verona | 2012-12-05 17:50:10 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-12-05 17:50:10 +0100 |
| commit | a8b4c5ff4258a3709c2f273277f331801fdc5cba (patch) | |
| tree | 7cec211af6a1d1440a376f7dc807799d7c515b4f | |
| parent | ac4736620b33f102dcd93ae290f7783ab36cedc0 (diff) | |
| parent | 5602a53a2c1b65a22fcf055e4aae6080e4134905 (diff) | |
| download | emacs-a8b4c5ff4258a3709c2f273277f331801fdc5cba.tar.gz emacs-a8b4c5ff4258a3709c2f273277f331801fdc5cba.zip | |
auto upstream
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 34 |
2 files changed, 31 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cbc0e743183..c2e9609451c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-12-05 Deniz Dogan <deniz@dogan.se> | ||
| 2 | |||
| 3 | * net/rcirc.el (rcirc-urls): Update documentation. | ||
| 4 | (rcirc-condition-filter): New function. | ||
| 5 | (rcirc-browse-url, rcirc-markup-urls): Use only URLs before point | ||
| 6 | and exclude consecutive duplicate URLs (Bug#6082). | ||
| 7 | |||
| 1 | 2012-12-05 Michael Albinus <michael.albinus@gmx.de> | 8 | 2012-12-05 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 9 | ||
| 3 | * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): | 10 | * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): |
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index e9828c5f813..fa5bc4a9822 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -406,7 +406,8 @@ will be killed." | |||
| 406 | "The channel or user associated with this buffer.") | 406 | "The channel or user associated with this buffer.") |
| 407 | 407 | ||
| 408 | (defvar rcirc-urls nil | 408 | (defvar rcirc-urls nil |
| 409 | "List of urls seen in the current buffer.") | 409 | "List of URLs seen in the current buffer and the position in |
| 410 | the buffer where the URL starts.") | ||
| 410 | (put 'rcirc-urls 'permanent-local t) | 411 | (put 'rcirc-urls 'permanent-local t) |
| 411 | 412 | ||
| 412 | (defvar rcirc-timeout-seconds 600 | 413 | (defvar rcirc-timeout-seconds 600 |
| @@ -2392,12 +2393,23 @@ keywords when no KEYWORD is given." | |||
| 2392 | "\\)") | 2393 | "\\)") |
| 2393 | "Regexp matching URLs. Set to nil to disable URL features in rcirc.") | 2394 | "Regexp matching URLs. Set to nil to disable URL features in rcirc.") |
| 2394 | 2395 | ||
| 2396 | (defun rcirc-condition-filter (condp lst) | ||
| 2397 | "Given a condition and a list, returns the list with elements | ||
| 2398 | that do not satisfy the condition removed." | ||
| 2399 | (delq nil (mapcar (lambda (x) (and (funcall condp x) x)) lst))) | ||
| 2400 | |||
| 2395 | (defun rcirc-browse-url (&optional arg) | 2401 | (defun rcirc-browse-url (&optional arg) |
| 2396 | "Prompt for URL to browse based on URLs in buffer." | 2402 | "Prompt for URL to browse based on URLs in buffer before point. |
| 2403 | |||
| 2404 | If ARG is given, opens the URL in a new browser window." | ||
| 2397 | (interactive "P") | 2405 | (interactive "P") |
| 2398 | (let ((completions (mapcar (lambda (x) (cons x nil)) rcirc-urls)) | 2406 | (let* ((point (point)) |
| 2399 | (initial-input (car rcirc-urls)) | 2407 | (filtered (rcirc-condition-filter |
| 2400 | (history (cdr rcirc-urls))) | 2408 | (lambda (x) (>= point (cdr x))) |
| 2409 | rcirc-urls)) | ||
| 2410 | (completions (mapcar (lambda (x) (car x)) filtered)) | ||
| 2411 | (initial-input (caar filtered)) | ||
| 2412 | (history (mapcar (lambda (x) (car x)) (cdr filtered)))) | ||
| 2401 | (browse-url (completing-read "rcirc browse-url: " | 2413 | (browse-url (completing-read "rcirc browse-url: " |
| 2402 | completions nil nil initial-input 'history) | 2414 | completions nil nil initial-input 'history) |
| 2403 | arg))) | 2415 | arg))) |
| @@ -2441,17 +2453,19 @@ keywords when no KEYWORD is given." | |||
| 2441 | (defun rcirc-markup-urls (sender response) | 2453 | (defun rcirc-markup-urls (sender response) |
| 2442 | (while (and rcirc-url-regexp ;; nil means disable URL catching | 2454 | (while (and rcirc-url-regexp ;; nil means disable URL catching |
| 2443 | (re-search-forward rcirc-url-regexp nil t)) | 2455 | (re-search-forward rcirc-url-regexp nil t)) |
| 2444 | (let ((start (match-beginning 0)) | 2456 | (let* ((start (match-beginning 0)) |
| 2445 | (end (match-end 0)) | 2457 | (end (match-end 0)) |
| 2446 | (url (match-string-no-properties 0))) | 2458 | (url (match-string-no-properties 0)) |
| 2459 | (link-text (buffer-substring-no-properties start end))) | ||
| 2447 | (make-button start end | 2460 | (make-button start end |
| 2448 | 'face 'rcirc-url | 2461 | 'face 'rcirc-url |
| 2449 | 'follow-link t | 2462 | 'follow-link t |
| 2450 | 'rcirc-url url | 2463 | 'rcirc-url url |
| 2451 | 'action (lambda (button) | 2464 | 'action (lambda (button) |
| 2452 | (browse-url (button-get button 'rcirc-url)))) | 2465 | (browse-url (button-get button 'rcirc-url)))) |
| 2453 | ;; record the url | 2466 | ;; record the url if it is not already the latest stored url |
| 2454 | (push url rcirc-urls)))) | 2467 | (when (not (string= link-text (caar rcirc-urls))) |
| 2468 | (push (cons link-text start) rcirc-urls))))) | ||
| 2455 | 2469 | ||
| 2456 | (defun rcirc-markup-keywords (sender response) | 2470 | (defun rcirc-markup-keywords (sender response) |
| 2457 | (when (and (string= response "PRIVMSG") | 2471 | (when (and (string= response "PRIVMSG") |