emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115443: Add keyword buttons to package description.


From: Teodor Zlatanov
Subject: [Emacs-diffs] trunk r115443: Add keyword buttons to package description.
Date: Mon, 09 Dec 2013 21:34:23 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115443
revision-id: address@hidden
parent: address@hidden
committer: Ted Zlatanov <address@hidden>
branch nick: quickfixes
timestamp: Mon 2013-12-09 16:35:26 -0500
message:
  Add keyword buttons to package description.
  
  * emacs-lisp/package.el: Require finder.el.
  (describe-package-1): Add keyword buttons.
  (package-make-button): New convenience function.
  (package-keyword-button-action): Keyword button action using
  `finder-list-matches'
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/package.el     package.el-20100617020707-ybavz666awsxwin6-2
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-09 17:48:01 +0000
+++ b/lisp/ChangeLog    2013-12-09 21:35:26 +0000
@@ -1,3 +1,11 @@
+2013-12-09  Teodor Zlatanov  <address@hidden>
+
+       * emacs-lisp/package.el: Require finder.el.
+       (describe-package-1): Add keyword buttons.
+       (package-make-button): New convenience function.
+       (package-keyword-button-action): Keyword button action using
+       `finder-list-matches'
+
 2013-12-09  Eli Zaretskii  <address@hidden>
 
        * autorevert.el (auto-revert-notify-add-watch): Fix a thinko in

=== modified file 'lisp/emacs-lisp/package.el'
--- a/lisp/emacs-lisp/package.el        2013-11-20 21:01:00 +0000
+++ b/lisp/emacs-lisp/package.el        2013-12-09 21:35:26 +0000
@@ -7,7 +7,7 @@
 ;; Created: 10 Mar 2007
 ;; Version: 1.0.1
 ;; Keywords: tools
-;; Package-Requires: ((tabulated-list "1.0"))
+;; Package-Requires: ((tabulated-list "1.0") (finder))
 
 ;; This file is part of GNU Emacs.
 
@@ -166,6 +166,7 @@
 (eval-when-compile (require 'cl-lib))
 
 (require 'tabulated-list)
+(require 'finder)
 
 (defgroup package nil
   "Manager for Emacs Lisp packages."
@@ -1353,7 +1354,9 @@
          (reqs (if desc (package-desc-reqs desc)))
          (version (if desc (package-desc-version desc)))
          (archive (if desc (package-desc-archive desc)))
-         (homepage (if desc (cdr (assoc :url (package-desc-extras desc)))))
+         (extras (and desc (package-desc-extras desc)))
+         (homepage (cdr (assoc :url extras)))
+         (keywords (cdr (assoc :keywords extras)))
          (built-in (eq pkg-dir 'builtin))
          (installable (and archive (not built-in)))
          (status (if desc (package-desc-status desc) "orphan"))
@@ -1392,15 +1395,10 @@
            (insert (capitalize status))
           (insert " from " (format "%s" archive))
           (insert " -- ")
-          (let ((button-text (if (display-graphic-p) "Install" "[Install]"))
-                (button-face (if (display-graphic-p)
-                                 '(:box (:line-width 2 :color "dark grey")
-                                        :background "light grey"
-                                        :foreground "black")
-                               'link)))
-            (insert-text-button button-text 'face button-face 'follow-link t
-                                'package-desc desc
-                                'action 'package-install-button-action)))
+           (package-make-button
+            "Install"
+            'action 'package-install-button-action
+            'package-desc desc))
          (t (insert (capitalize status) ".")))
     (insert "\n")
     (insert "    " (propertize "Archive" 'font-lock-face 'bold)
@@ -1433,6 +1431,15 @@
       (insert "   " (propertize "Homepage" 'font-lock-face 'bold) ": ")
       (help-insert-xref-button homepage 'help-url homepage)
       (insert "\n"))
+    (when keywords
+      (insert "   " (propertize "Keywords" 'font-lock-face 'bold) ": ")
+      (dolist (k keywords)
+        (package-make-button
+         k
+         'package-keyword k
+         'action 'package-keyword-button-action)
+        (insert " "))
+      (insert "\n"))
     (let* ((all-pkgs (append (cdr (assq name package-alist))
                              (cdr (assq name package-archive-contents))
                              (let ((bi (assq name package--builtins)))
@@ -1503,6 +1510,20 @@
       (revert-buffer nil t)
       (goto-char (point-min)))))
 
+(defun package-keyword-button-action (button)
+  (let ((pkg-keyword (button-get button 'package-keyword)))
+    (finder-list-matches pkg-keyword)))
+
+(defun package-make-button (text &rest props)
+  (let ((button-text (if (display-graphic-p) text (concat "[" text "]")))
+        (button-face (if (display-graphic-p)
+                         '(:box (:line-width 2 :color "dark grey")
+                                :background "light grey"
+                                :foreground "black")
+                       'link)))
+    (apply 'insert-text-button button-text 'face button-face 'follow-link t
+           props)))
+
 
 ;;;; Package menu mode.
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]