From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#13291: The package description buffer needs an URL button Date: Sat, 12 Jan 2013 11:41:04 +0400 Message-ID: <50F11390.3000205@yandex.ru> References: <50DDAF17.7020602@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050909040406050205000200" X-Trace: ger.gmane.org 1357976527 32215 80.91.229.3 (12 Jan 2013 07:42:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Jan 2013 07:42:07 +0000 (UTC) Cc: 13291@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 12 08:42:24 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TtvjS-0007u9-8R for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Jan 2013 08:42:22 +0100 Original-Received: from localhost ([::1]:35465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtvjC-0005UK-Bb for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Jan 2013 02:42:06 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttvj2-0005T1-UO for bug-gnu-emacs@gnu.org; Sat, 12 Jan 2013 02:42:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ttviy-00066W-AA for bug-gnu-emacs@gnu.org; Sat, 12 Jan 2013 02:41:56 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttviy-00066R-6a for bug-gnu-emacs@gnu.org; Sat, 12 Jan 2013 02:41:52 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Ttvj8-0005YL-RZ for bug-gnu-emacs@gnu.org; Sat, 12 Jan 2013 02:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Jan 2013 07:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13291-submit@debbugs.gnu.org id=B13291.135797648621291 (code B ref 13291); Sat, 12 Jan 2013 07:42:02 +0000 Original-Received: (at 13291) by debbugs.gnu.org; 12 Jan 2013 07:41:26 +0000 Original-Received: from localhost ([127.0.0.1]:56164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TtviY-0005XL-5w for submit@debbugs.gnu.org; Sat, 12 Jan 2013 02:41:26 -0500 Original-Received: from mail-la0-f53.google.com ([209.85.215.53]:55349) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TtviT-0005X5-B1 for 13291@debbugs.gnu.org; Sat, 12 Jan 2013 02:41:23 -0500 Original-Received: by mail-la0-f53.google.com with SMTP id fn20so2425004lab.40 for <13291@debbugs.gnu.org>; Fri, 11 Jan 2013 23:41:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type; bh=aufoxHViTWsyd33g/gJsJ/2+09Xi828wdf1nDil4JLc=; b=FyA09WvxKW+I72Bi4Op7vdM+QaMdgSbc/emzbVDci9Wr+vg9YM8r6jY/klbK74aH8w IUZo23lMJ7/VP3zU0CwTE+YtJKaE/MjJyXVGw9TC1nVQQWubirGaaAqgMUzDtsStCrgT FLoK/v1ydt7qLOT3V3w6hBKI39tC8LeOTBy0jSFDD9t2yBCif222/DGBmsA4QLzt9/Hv x6o7xn0iQbWzZeqmCfEWPm5tIaj27Yl1RH88nTwB3GU2DKwrglT5NiL6N4UxPrGcuBCz vb7tcRsoIE19i8fnbYZad8n8JE3wI05sDWE0/bXK3hYam/lUnDlRnseaKx0+spKB+0S1 zbKA== X-Received: by 10.152.108.12 with SMTP id hg12mr15246500lab.43.1357976463774; Fri, 11 Jan 2013 23:41:03 -0800 (PST) Original-Received: from [127.0.0.1] ([178.252.98.87]) by mx.google.com with ESMTPS id u5sm2897722lbm.8.2013.01.11.23.41.01 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 23:41:02 -0800 (PST) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:69641 Archived-At: This is a multi-part message in MIME format. --------------050909040406050205000200 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 12.01.2013 7:28, Stefan Monnier wrote: > I don't see any problem with this idea. Terrific. Patch attached. Note that I haven't tested it with an actual package repository supporting this extension, just with modified -pkg.el and archive-contents files. >> Elpa can at least show links to the repository browser. >> Or maybe to the pages at elpa.gnu.org. > > It should point to the pages at elpa.gnu.org. > >> They basically contain the same information as the description buffer, >> though, so probably not. > > The are meant to be the "canonical page" for the package. Admittedly, > they seem to contain the same info as the description buffer, but they > already contain a bit more info (a pointer to the repository browser, a list > of past revisions) and that could grow over time. Sounds good to me. Hopefully, the code responsible for it will take care of the case when those pages are not in fact canonical, like org, auctex, etc. --------------050909040406050205000200 Content-Type: text/plain; charset=windows-1251; name="package-homepage-button.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="package-homepage-button.diff" === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-01-11 23:24:52 +0000 +++ lisp/ChangeLog 2013-01-12 07:33:28 +0000 @@ -1,3 +1,16 @@ +2013-01-12 Dmitry Gutov + + * emacs-lisp/package.el (package-desc-kind): Get the kind from the + metadata plist. + (package-desc-meta): Return metadata plist. + (define-package): Store EXTRA-PROPERTIES as the 4th element of + the package data vector. + (package--add-to-archive-contents): Instead of just package kind, + use the 4th element of the vector for the matadata. Include kind + in the metadata. + (describe-package-1): When the package metadata includes + `:homepage', display a link button for it (bug#13291). + 2013-01-11 Felix H. Dahlke * progmodes/js.el: Fix multiline declarations's indentation (bug#8576). === modified file 'lisp/emacs-lisp/package.el' --- lisp/emacs-lisp/package.el 2013-01-01 09:11:05 +0000 +++ lisp/emacs-lisp/package.el 2013-01-12 07:23:54 +0000 @@ -302,12 +302,13 @@ Each element has the form (PKG . DESC), where PKG is a package name (a symbol) and DESC is a vector that describes the package. -The vector DESC has the form [VERSION-LIST REQS DOCSTRING]. +The vector DESC has the form [VERSION-LIST REQS DOCSTRING META]. VERSION-LIST is a version list. REQS is a list of packages required by the package, each requirement having the form (NAME VL) where NAME is a string and VL is a version list. DOCSTRING is a brief description of the package. + META is a property list mapping metadata keywords to values. This variable is set automatically by `package-load-descriptor', called via `package-initialize'. To change which packages are @@ -426,6 +427,10 @@ (defsubst package-desc-kind (desc) "Extract the kind of download from an archive package description vector." + (plist-get (package-desc-meta desc) :kind)) + +(defsubst package-desc-meta (desc) + "Extract the metadata property list from a package description vector." (aref desc 3)) (defun package--dir (name version) @@ -525,7 +530,7 @@ (defun define-package (name-string version-string &optional docstring requirements - &rest _extra-properties) + &rest extra-properties) "Define a new package. NAME-STRING is the name of the package, as a string. VERSION-STRING is the version of the package, as a string. @@ -533,8 +538,8 @@ REQUIREMENTS is a list of dependencies on other packages. Each requirement is of the form (OTHER-PACKAGE OTHER-VERSION), where OTHER-VERSION is a string. - -EXTRA-PROPERTIES is currently unused." +EXTRA-PROPERTIES is a property list mapping additional metadata +keywords (e.g. `:homepage') to values." (let* ((name (intern name-string)) (version (version-to-list version-string)) (new-pkg-desc @@ -545,7 +550,8 @@ (list (car elt) (version-to-list (car (cdr elt))))) requirements) - docstring))) + docstring + extra-properties))) (old-pkg (assq name package-alist))) (cond ;; If there's no old package, just add this to `package-alist'. @@ -853,8 +859,15 @@ Also, add the originating archive to the end of the package vector." (let* ((name (car package)) (version (package-desc-vers (cdr package))) + (data (append (cdr package) nil)) + (ex-len (- (length data) 3)) + (extras (last data ex-len)) (entry (cons name - (vconcat (cdr package) (vector archive)))) + (vconcat (nbutlast data ex-len) + ;; Save the kind and any following + ;; keyword-value pairs as metadata. + (vector (cons :kind extras) + archive)))) (existing-package (assq name package-archive-contents))) (cond ((not existing-package) (add-to-list 'package-archive-contents entry)) @@ -1261,7 +1274,13 @@ (help-insert-xref-button text 'help-package name)) (insert "\n"))) (insert " " (propertize "Summary" 'font-lock-face 'bold) - ": " (if desc (package-desc-doc desc)) "\n\n") + ": " (if desc (package-desc-doc desc)) "\n") + (let ((homepage (plist-get (package-desc-meta desc) :homepage))) + (when homepage + (insert " " (propertize "Homepage" 'font-lock-face 'bold) ": ") + (help-insert-xref-button homepage 'help-url homepage) + (insert "\n"))) + (insert "\n") (if built-in ;; For built-in packages, insert the commentary. --------------050909040406050205000200--