clean up im-unindex

This commit is contained in:
Ivan Malison 2015-11-23 00:39:05 -08:00
parent 4147b16824
commit 595da6ff68

View File

@ -596,7 +596,7 @@ The current directory is assumed to be the project's root otherwise."
(defmethod im-put ((im indexed-mapping) key value) (defmethod im-put ((im indexed-mapping) key value)
;; Handle removing the key from where it is currently indexed ;; Handle removing the key from where it is currently indexed
(im-unindex im key value) (im-unindex im key)
;; Add the key to its new position in the index ;; Add the key to its new position in the index
(oset im :index (oset im :index
(plist-put (oref im :index) (plist-put (oref im :index)
@ -605,7 +605,7 @@ The current directory is assumed to be the project's root otherwise."
(oset im :mapping (oset im :mapping
(plist-put (oref im :mapping) key value))) (plist-put (oref im :mapping) key value)))
(defmethod im-unindex ((im indexed-mapping) key value) (defmethod im-unindex ((im indexed-mapping) key)
(let* ((current-value (plist-get (oref im :mapping) key)) (let* ((current-value (plist-get (oref im :mapping) key))
(value-list (plist-get (oref im :index) current-value))) (value-list (plist-get (oref im :index) current-value)))
(when value-list (when value-list
@ -615,7 +615,7 @@ The current directory is assumed to be the project's root otherwise."
current-value value-list))))) current-value value-list)))))
(defmethod im-delete ((im indexed-mapping) key) (defmethod im-delete ((im indexed-mapping) key)
(im-unindex im key (im-get im key)) (im-unindex im key)
(oset im :mapping (oset im :mapping
(use-package-plist-delete (oref im :mapping) key))) (use-package-plist-delete (oref im :mapping) key)))