Function: ex-cmd-assoc

ex-cmd-assoc is a byte-compiled function defined in viper-ex.el.gz.

Signature

(ex-cmd-assoc KEY LIST)

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-ex.el.gz
;; Returns the alist entry for the appropriate key.
;; Tries to complete the key before using it in the alist.
;; If there is no appropriate key (no match or duplicate matches) return nil
(defun ex-cmd-assoc (key list)
  (let ((entry (try-completion key list))
	result)
    (setq result (cond
		  ((eq entry t)     (assoc key list))
		  ((stringp entry)  (or (ex-splice-args-in-1-letr-cmd key list)
					(assoc entry list)))
		  ((eq entry nil)   (ex-splice-args-in-1-letr-cmd key list))
		  (t nil)
		  ))
    ;; If we end up with an alias, look up the alias...
    (if (stringp (cadr result))
        (setq result (ex-cmd-assoc (cadr result) list)))
    ;; and return the corresponding alist entry
    result
    ))