unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Add a name/version/synopsis heading in package-info buffers
@ 2014-10-29 16:25 Ludovic Courtès
  2014-10-29 22:13 ` Alex Kost
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2014-10-29 16:25 UTC (permalink / raw)
  To: Alex Kost; +Cc: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 48 bytes --]

Hello,

What would think of a patch like this:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2337 bytes --]

diff --git a/emacs/guix-info.el b/emacs/guix-info.el
index 551d79a..c3499e4e 100644
--- a/emacs/guix-info.el
+++ b/emacs/guix-info.el
@@ -198,13 +198,27 @@ ENTRIES should have a form of `guix-entries'."
                   entries
                   guix-info-delimiter))
 
+(defun guix-info-insert-heading (entry)
+  "Insert the heading for ENTRY, showing its name, version, and
+synopsis."
+  (guix-format-insert (concat (guix-get-key-val entry 'name)
+                              " " (guix-get-key-val entry 'version)
+                              "\n")
+                      'guix-package-info-heading)
+  (guix-format-insert (guix-get-key-val entry 'synopsis)
+                      'guix-package-info-synopsis)
+  (guix-format-insert "\n\n"))
+
 (defun guix-info-insert-entry (entry entry-type &optional indent-level)
   "Insert ENTRY of ENTRY-TYPE into the current info buffer.
 If INDENT-LEVEL is non-nil, indent displayed information by this
 number of `guix-info-indent' spaces."
   (let ((region-beg (point)))
+    (guix-info-insert-heading entry)
     (mapc (lambda (param)
-            (guix-info-insert-param param entry entry-type))
+            ;; The name, version, and synopsis are already displayed.
+            (unless (memq param '(name version synopsis))
+              (guix-info-insert-param param entry entry-type)))
           (guix-info-get-displayed-params entry-type))
     (when indent-level
       (indent-rigidly region-beg (point)
@@ -376,6 +390,12 @@ See `insert-text-button' for the meaning of PROPERTIES."
 (guix-define-buffer-type info package
   :required (id installed non-unique))
 
+(defface guix-package-info-heading
+  '((((type tty pc) (class color)) :weight bold)
+    (t :height 1.6 :weight bold :inherit variable-pitch))
+  "Face for package name and version headings."
+  :group 'guix-package-info)
+
 (defface guix-package-info-name
   '((t :inherit font-lock-keyword-face))
   "Face used for a name of a package."
@@ -392,7 +412,8 @@ See `insert-text-button' for the meaning of PROPERTIES."
   :group 'guix-package-info)
 
 (defface guix-package-info-synopsis
-  '((t :inherit font-lock-doc-face))
+  '((((type tty pc) (class color)) :weight bold)
+    (t :height 1.1 :weight bold :inherit variable-pitch))
   "Face used for a synopsis of a package."
   :group 'guix-package-info)
 

[-- Attachment #3: Type: text/plain, Size: 592 bytes --]


It changes the rendering of package-info buffers such that, instead of
displaying something like:

  Name        : coreutils
  Version     : 8.23
  Synopsis    : Core GNU utilities (file, text, shell)
  ...

it first displays the important info in a visible heading, and then goes
on with the other fields unchanged:

  coreutils 8.23
  Core GNU utilities (file, text, shell)

  Outputs:
    out       Delete
  ...

On X11, the package name and version are displayed in a large
variable-width font, and the synopsis is displayed in a slightly smaller
font.

Ludo’.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-11-02 17:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-29 16:25 [PATCH] emacs: Add a name/version/synopsis heading in package-info buffers Ludovic Courtès
2014-10-29 22:13 ` Alex Kost
2014-10-30 13:16   ` Ludovic Courtès
2014-10-30 21:38     ` Alex Kost
2014-10-30 23:20       ` Ludovic Courtès
2014-11-01 10:58         ` Alex Kost
2014-11-02 17:23           ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).