summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-07-28 16:01:45 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-07-28 16:01:45 +0200
commitefc6301068b53ab319aa6a8a1b5607273e4d5b17 (patch)
treef57e806695781a35760da5a1ab0c56c677fa07ff /lisp/emacs-lisp
parenta32e1feb438e793a8378671c7124d226b58f65f0 (diff)
downloademacs-efc6301068b53ab319aa6a8a1b5607273e4d5b17.tar.gz
emacs-efc6301068b53ab319aa6a8a1b5607273e4d5b17.tar.bz2
emacs-efc6301068b53ab319aa6a8a1b5607273e4d5b17.zip
Make URLs in package descriptions into links
* lisp/emacs-lisp/package.el (describe-package-1): Make the URLs in package descriptions into links (bug#23480).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/package.el78
1 files changed, 41 insertions, 37 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 15f0f93cf5b..e7e0bd11247 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -151,6 +151,7 @@
(require 'tabulated-list)
(require 'macroexp)
(require 'url-handlers)
+(require 'browse-url)
(defgroup package nil
"Manager for Emacs Lisp packages."
@@ -2504,44 +2505,47 @@ The description is read from the installed package files."
(insert "\n")
- (if built-in
- ;; For built-in packages, get the description from the
- ;; Commentary header.
- (let ((fn (locate-file (format "%s.el" name) load-path
- load-file-rep-suffixes))
- (opoint (point)))
- (insert (or (lm-commentary fn) ""))
- (save-excursion
- (goto-char opoint)
- (when (re-search-forward "^;;; Commentary:\n" nil t)
- (replace-match ""))
- (while (re-search-forward "^\\(;+ ?\\)" nil t)
- (replace-match ""))))
-
- (if (package-installed-p desc)
- ;; For installed packages, get the description from the
- ;; installed files.
- (insert (package--get-description desc))
-
- ;; For non-built-in, non-installed packages, get description from
- ;; the archive.
- (let* ((basename (format "%s-readme.txt" name))
- readme-string)
-
- (package--with-response-buffer (package-archive-base desc)
- :file basename :noerror t
+ (let ((start-of-description (point)))
+ (if built-in
+ ;; For built-in packages, get the description from the
+ ;; Commentary header.
+ (let ((fn (locate-file (format "%s.el" name) load-path
+ load-file-rep-suffixes))
+ (opoint (point)))
+ (insert (or (lm-commentary fn) ""))
(save-excursion
- (goto-char (point-max))
- (unless (bolp)
- (insert ?\n)))
- (cl-assert (not enable-multibyte-characters))
- (setq readme-string
- ;; The readme.txt files are defined to contain utf-8 text.
- (decode-coding-region (point-min) (point-max) 'utf-8 t))
- t)
- (insert (or readme-string
- "This package does not provide a description.")))
- ))))
+ (goto-char opoint)
+ (when (re-search-forward "^;;; Commentary:\n" nil t)
+ (replace-match ""))
+ (while (re-search-forward "^\\(;+ ?\\)" nil t)
+ (replace-match ""))))
+
+ (if (package-installed-p desc)
+ ;; For installed packages, get the description from the
+ ;; installed files.
+ (insert (package--get-description desc))
+
+ ;; For non-built-in, non-installed packages, get description from
+ ;; the archive.
+ (let* ((basename (format "%s-readme.txt" name))
+ readme-string)
+
+ (package--with-response-buffer (package-archive-base desc)
+ :file basename :noerror t
+ (save-excursion
+ (goto-char (point-max))
+ (unless (bolp)
+ (insert ?\n)))
+ (cl-assert (not enable-multibyte-characters))
+ (setq readme-string
+ ;; The readme.txt files are defined to contain utf-8 text.
+ (decode-coding-region (point-min) (point-max) 'utf-8 t))
+ t)
+ (insert (or readme-string
+ "This package does not provide a description.")))))
+ ;; Make URLs in the description into links.
+ (goto-char start-of-description)
+ (browse-url-add-buttons))))
(defun package-install-button-action (button)
(let ((pkg-desc (button-get button 'package-desc)))