summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-01-12 21:16:54 +0000
committerjao <jao@gnu.org>2021-01-12 21:16:54 +0000
commit0ff0270717b428de630b5dd6819ea2e3dbab3d95 (patch)
treebdb6a2942bba82f9c56555128cfa4e4af426d940
parent60e74a345c7ff8ca2ecfdf2c706b4e643c3ee499 (diff)
downloadelibs-0ff0270717b428de630b5dd6819ea2e3dbab3d95.tar.gz
elibs-0ff0270717b428de630b5dd6819ea2e3dbab3d95.tar.bz2
espotify: richer marginalia
-rw-r--r--eos/jao-minibuffer.el4
-rw-r--r--media/espotify.org14
2 files changed, 14 insertions, 4 deletions
diff --git a/eos/jao-minibuffer.el b/eos/jao-minibuffer.el
index b626151..09c94bd 100644
--- a/eos/jao-minibuffer.el
+++ b/eos/jao-minibuffer.el
@@ -1,6 +1,6 @@
;;; jao-minibuffer.el --- using the minibuffer to report status -*- lexical-binding: t; -*-
-;; Copyright (C) 2020 jao
+;; Copyright (C) 2020, 2021 jao
;; Author: jao <mail@jao.io>
;; Keywords: extensions
@@ -127,7 +127,7 @@
(setq set-message-function #'jao-minibuffer--set-message)
(setq clear-message-function #'jao-minibuffer-refresh)
-(setq resize-mini-windows nil)
+;; (setq resize-mini-windows nil)
(provide 'jao-minibuffer)
;;; jao-minibuffer.el ends here
diff --git a/media/espotify.org b/media/espotify.org
index 7b22cc0..6f001fd 100644
--- a/media/espotify.org
+++ b/media/espotify.org
@@ -311,7 +311,11 @@ Let's start with an umbrella customization group:
#+begin_src emacs-lisp
(defun espotify--format-item (x)
- (propertize (format "%s" (alist-get 'name x)) 'espotify-item x))
+ (propertize (format "%s%s"
+ (alist-get 'name x)
+ (if-let ((a (alist-get 'album x)))
+ (format " (%s)" (alist-get 'name a))))
+ 'espotify-item x))
(defun espotify--item (cand)
(get-text-property 0 'espotify-item cand))
@@ -379,11 +383,17 @@ Let's start with an umbrella customization group:
(when-let (x (espotify--item cand))
(marginalia--fields
((alist-get 'type x "") :face 'marginalia-mode :width 10)
+ ((if-let (d (alist-get 'duration_ms x))
+ (let ((secs (/ d 1000)))
+ (format "%02d:%02d" (/ secs 60) (mod secs 60)))
+ ""))
((or (alist-get 'name (car (alist-get 'artists x))) "")
:face 'marginalia-file-name :width 50)
((if-let (d (alist-get 'total_tracks x)) (format "%s tracks" d) "")
:face 'marginalia-size :width 12)
- ((if-let (d (alist-get 'release_date x)) (format "%s" d) "")
+ ((if-let (d (alist-get 'release_date (alist-get 'album x x)))
+ (format "%s" d)
+ "")
:face 'marginalia-modified :width 10))))
(add-to-list 'marginalia-annotators-heavy