Although these two expressions seems to be equivalent (both works):
;; 1
(highlight-regexp "foo" "hi-green")
;; 2
(highlight-regexp "foo" 'hi-green)
Only the first one of the following loops works appropriately:
;; 1
(defun my-highlights ()
(interactive)
(let* ((ALIST '(("foo" . "hi-green")
("bar" . "hi-yellow"))))
(dolist (COUPLE LIST)
(let* ((REGEXP (car COUPLE))
(HI_FACE (cdr COUPLE)))
(highlight-regexp REGEXP HI_FACE)))))
;; 2
(defun my-highlights ()
(interactive)
(let* ((ALIST '(("foo" . 'hi-green)
("bar" . 'hi-yellow))))
(dolist (COUPLE LIST)
(let* ((REGEXP (car COUPLE))
(HI_FACE (cdr COUPLE)))
(highlight-regexp REGEXP HI_FACE)))))
In the second case the cdr of the cons cell is ignored. Why? (I'd like to use the form ("foo" . face)
.)