- name))))
- (cond ((facemenu-iterate ; check if equivalent face is already in the menu
- (lambda (m) (and (listp m)
- (symbolp (car m))
- (stringp (cadr m))
- (string-equal (cadr m) color)))
- (cdr (symbol-function menu))))
- (t ; No keyboard equivalent. Figure out where to put it:
- (setq key (vector symbol)
- function 'facemenu-set-face-from-menu
- menu-val (symbol-function menu))
- (if (and facemenu-new-faces-at-end
- (> (length menu-val) 3))
- (define-key-after menu-val key (cons name function)
- (car (nth (- (length menu-val) 3) menu-val)))
- (define-key menu key (cons name function))))))
- nil) ; Return nil for facemenu-iterate
+ color)
+ symbol (intern (concat "bg:" color))))
+ (t (error "MENU should be `facemenu-foreground-menu' or `facemenu-background-menu'")))
+ (unless (facemenu-iterate ; Check if color is already in the menu.
+ (lambda (m) (and (listp m)
+ (eq (car m) symbol)))
+ (cdr (symbol-function menu)))
+ ;; Color is not in the menu. Figure out where to put it.
+ (let ((key (vector symbol))
+ (function 'facemenu-set-face-from-menu)
+ (menu-val (symbol-function menu)))
+ (if (and facemenu-new-faces-at-end
+ (> (length menu-val) 3))
+ (define-key-after menu-val key (cons color function)
+ (car (nth (- (length menu-val) 3) menu-val)))
+ (define-key menu key (cons color function)))))
+ symbol))