Browse Source

Use navigel-defmethod to simplify code

master
Damien Cassou 4 months ago
parent
commit
69e2f36b86
Signed by: Damien Cassou <damien@cassou.me> GPG Key ID: B68746238E59B548
5 changed files with 21 additions and 21 deletions
  1. +4
    -4
      mpdel-core.el
  2. +3
    -3
      mpdel-playlist.el
  3. +2
    -2
      mpdel-song.el
  4. +11
    -11
      mpdel-tablist.el
  5. +1
    -1
      mpdel.el

+ 4
- 4
mpdel-core.el View File

@@ -33,16 +33,16 @@
;;; `navigel' general configuration

(cl-defmethod navigel-name (entity &context (navigel-app mpdel))
(navigel-method mpdel navigel-name (entity)
(libmpdel-entity-name entity))

(cl-defmethod navigel-children (entity callback &context (navigel-app mpdel))
(navigel-method mpdel navigel-children (entity callback   )
(libmpdel-list entity callback))

(cl-defmethod navigel-equal (entity1 entity2 &context (navigel-app mpdel))
(navigel-method mpdel navigel-equal (entity1 entity2)
(libmpdel-equal entity1 entity2))

(cl-defmethod navigel-parent (entity &context (navigel-app mpdel))
(navigel-method mpdel navigel-parent (entity)
(libmpdel-entity-parent entity))


+ 3
- 3
mpdel-playlist.el View File

@@ -45,13 +45,13 @@
;;; `navigel' major-mode configuration

(cl-defmethod navigel-entity-tablist-mode ((_entity (eql current-playlist)) &context (navigel-app mpdel))
(navigel-method mpdel navigel-entity-tablist-mode ((_entity (eql current-playlist)))
(mpdel-playlist-current-playlist-mode))

(cl-defmethod navigel-entity-tablist-mode ((_entity libmpdel-stored-playlist) &context (navigel-app mpdel))
(navigel-method mpdel navigel-entity-tablist-mode ((_entity libmpdel-stored-playlist))
(mpdel-playlist-stored-playlist-mode))

(cl-defmethod navigel-delete ((songs list) &context (navigel-app mpdel) (major-mode mpdel-playlist-mode) &optional _callback)
(navigel-method mpdel navigel-delete ((songs list) &context (major-mode mpdel-playlist-mode) &optional _callback)
(libmpdel-playlist-delete songs navigel-entity))


+ 2
- 2
mpdel-song.el View File

@@ -82,10 +82,10 @@ when the song changes.")
;;; `navigel' configuration

(cl-defmethod navigel-open ((song libmpdel-song) _target &context (navigel-app mpdel))
(navigel-method mpdel navigel-open ((song libmpdel-song) _target)
(mpdel-song-open song))

(cl-defmethod navigel-entity-at-point (&context (navigel-app mpdel) (major-mode mpdel-song-mode))
(navigel-method mpdel navigel-entity-at-point (&context (major-mode mpdel-song-mode))
mpdel-song-song)


+ 11
- 11
mpdel-tablist.el View File

@@ -66,16 +66,16 @@
;;; `navigel' major-mode configuration

(cl-defmethod navigel-entity-tablist-mode ((_entity (eql artists)) &context (navigel-app mpdel))
(navigel-method mpdel navigel-entity-tablist-mode ((_entity (eql artists)))
(mpdel-tablist-mode))

(cl-defmethod navigel-entity-tablist-mode ((_entity libmpdel-search-criteria) &context (navigel-app mpdel))
(navigel-method mpdel navigel-entity-tablist-mode ((_entity libmpdel-search-criteria))
(mpdel-tablist-mode))

(cl-defmethod navigel-entity-tablist-mode ((_entity libmpdel-album) &context (navigel-app mpdel))
(navigel-method mpdel navigel-entity-tablist-mode ((_entity libmpdel-album))
(mpdel-tablist-mode))

(cl-defmethod navigel-entity-tablist-mode ((_entity libmpdel-album) &context (navigel-app mpdel))
(navigel-method mpdel navigel-entity-tablist-mode ((_entity libmpdel-album))
(mpdel-tablist-mode))


@@ -96,11 +96,11 @@
(list "Date" 5 t)
(list "Artist" 0 t)))

(cl-defmethod navigel-entity-to-columns ((entity libmpdel-album) &context (navigel-app mpdel))
(navigel-method mpdel navigel-entity-to-columns ((entity libmpdel-album))
(vector (libmpdel-entity-name entity)
(libmpdel-artist-name entity)))

(cl-defmethod navigel-entity-to-columns ((song libmpdel-song))
(navigel-method mpdel navigel-entity-to-columns ((song libmpdel-song))
(vector
(propertize (or (libmpdel-entity-name song) "") 'face 'mpdel-tablist-song-name-face)
(propertize (or (libmpdel-song-track song) "") 'face 'mpdel-tablist-track-face)
@@ -109,19 +109,19 @@
(propertize (or (libmpdel-entity-date song) "") 'face 'mpdel-tablist-date-face)
(propertize (or (libmpdel-artist-name song) "") 'face 'mpdel-tablist-artist-face)))

(cl-defmethod navigel-tablist-format ((_entity libmpdel-artist) &context (navigel-app mpdel))
(navigel-method mpdel navigel-tablist-format ((_entity libmpdel-artist))
(mpdel-tablist--album-format))

(cl-defmethod navigel-tablist-format ((_entity libmpdel-album) &context (navigel-app mpdel))
(navigel-method mpdel navigel-tablist-format ((_entity libmpdel-album))
(mpdel-tablist--song-format))

(cl-defmethod navigel-tablist-format ((_entity libmpdel-search-criteria) &context (navigel-app mpdel))
(navigel-method mpdel navigel-tablist-format ((_entity libmpdel-search-criteria))
(mpdel-tablist--song-format))

(cl-defmethod navigel-tablist-format ((_entity (eql current-playlist)) &context (navigel-app mpdel))
(navigel-method mpdel navigel-tablist-format ((_entity (eql current-playlist)))
(mpdel-tablist--song-format))

(cl-defmethod navigel-tablist-format ((_entity libmpdel-stored-playlist) &context (navigel-app mpdel))
(navigel-method mpdel navigel-tablist-format ((_entity libmpdel-stored-playlist))
(mpdel-tablist--song-format))


+ 1
- 1
mpdel.el View File

@@ -5,7 +5,7 @@
;; Author: Damien Cassou <damien@cassou.me>
;; Keywords: multimedia
;; Url: https://gitlab.petton.fr/mpdel/mpdel
;; Package-requires: ((emacs "25.1") (libmpdel "1.0.0") (navigel "0.5.0"))
;; Package-requires: ((emacs "25.1") (libmpdel "1.0.0") (navigel "0.6.0"))
;; Version: 1.0.0

;; This program is free software; you can redistribute it and/or modify

Loading…
Cancel
Save