(defun diredc-trash-assistant () "Minibuffer cheatsheet and launcher for diredc-trash functions." ;; This was the inspiration for `key-assist.el' (interactive) (let ((zz (lambda (x) (let (shortest) (dolist (key (mapcar 'key-description (where-is-internal x diredc-mode-map nil t))) (when (or (not shortest) (> (length shortest) (length key))) (setq shortest key))) shortest))) (options (list (list (if delete-by-moving-to-trash "Switch to using deletion" "Switch to using trash") 'diredc-trash-toggle) '("Jump to trash files dir" diredc-trash-view) '("Report trash size" diredc-trash-info) '("Empty the trash" diredc-trash-empty) '("Restore file at point" diredc-trash-restore))) (prompt (concat (diredc-trash-info) "\nSelect: ")) choices choice) (setq choices (mapcar (lambda(x) (format "%-23s %s" (car x) (funcall zz (cadr x)))) options)) (while (not (setq choice (cl-position (completing-read prompt choices nil t nil 'choices ) choices :test 'equal)))) (funcall (cadr (nth choice options)))))