From abc8b4410adf05d185c5f9293150d25980567181 Mon Sep 17 00:00:00 2001 From: Felix Dietrich Date: Thu, 10 Mar 2022 04:43:45 +0100 Subject: [PATCH 09/10] Clean-up, rename variables, remove comments --- lisp/net/mailcap.el | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index 72d292c3e4..5d60e7ece4 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -719,22 +719,21 @@ to supply to the test." (defun mailcap-add-mailcap-entry (major minor info &optional storage) (let* ((storage (or storage 'mailcap--computed-mime-data)) - (old-major (assoc major (symbol-value storage))) - (cur-minor (assoc minor old-major)) - (new-minor-entry (cons minor info)) - new-major) + (major-entry (assoc major (symbol-value storage))) + (new-minor-entry (cons minor info)) + minor-entry) (cond - ((null old-major) ; New major area - (setq new-major (list major new-minor-entry)) - (push new-major (symbol-value storage))) - ((and cur-minor - (not (assq 'test info)) ; No test info, replace completely - (not (assq 'test cur-minor)) - (equal (assq 'viewer info) ; Keep alternative viewer - (assq 'viewer cur-minor))) - (setf (cdr cur-minor) info)) + ((null major-entry) + (setf major-entry (list major new-minor-entry)) + (push major-entry (symbol-value storage))) + ((and (setf minor-entry (assoc minor major-entry)) + (not (assq 'test info)) + (not (assq 'test minor-entry)) + (equal (assq 'viewer info) + (assq 'viewer minor-entry))) + (setf (cdr minor-entry) info)) (t - (push new-minor-entry (cdr old-major)))))) + (push new-minor-entry (cdr major-entry)))))) (defun mailcap-add (type viewer &optional test) "Add VIEWER as a handler for TYPE. -- 2.35.1