문제

I'm looking for a regexp to highlight differently one asterisk (e.g., red), and two asterisks (e.g., blue), and three asterisks (yellow). I have a working example of three (3) all together. Defining just one, however, would affect everything unless there is a regexp exclusion.

* -- red

** -- blue

*** -- yellow

(defvar lawlist-yellow-jacket-face (make-face 'lawlist-yellow-jacket-face))
(set-face-attribute 'lawlist-yellow-jacket-face nil
  :background "black" :foreground "yellow" :underline "red" :bold t)

(add-hook 'text-mode-hook (lambda ()
  (font-lock-add-keywords nil (list
    (list (concat "lawlist\\|\\*\\*\\*")
      '(0 lawlist-yellow-jacket-face t))
     ))
  ))
도움이 되었습니까?

해결책

If I understand correctly what you are asking, this does it:

(add-hook 'text-mode-hook
          (lambda ()
            (font-lock-add-keywords
             nil
             '(("lawlist\\|\\*\\*\\*"
                (0 lawlist-yellow-jacket-face))
                ("lawlist\\|\\*\\*"
                (0 'link keep))
               ("lawlist\\|\\*"
                (0 'warning keep))))))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top