[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] RFE: muse: highlight =verbatim=, similar to how *em
From: |
Allen Halsey |
Subject: |
[emacs-wiki-discuss] RFE: muse: highlight =verbatim=, similar to how *emph* and _under_ are |
Date: |
Mon, 04 Jul 2005 22:25:39 -1000 |
User-agent: |
Mozilla Thunderbird 1.0.2-6 (X11/20050513) |
These get special highlight treatment:
*empasized*
_underlined_
They get a face and the markup characters become invisible (very cool btw!)
but not so for verbatim:
=verbatim=
How come?
I played around and gave verbatim the highlight treatment with this
redefinition of muse-colors-verbatim (modelled after
muse-colors-underlined):
;; Redefined this function so that the verbatim
;; markup character, '=', behaves like the underline markup character,
;; in that it becomes invisible and applies a face. NOTE: you must go
;; into customization for Muse Colors Markup and change the locate
;; regexp from '\b=[^[:space:]=>]' to '=[^[:blank:]=]'. TODO: create
;; a muse-verbatim-face. For now, I just used an existing face,
;; dired-face-executable.
(defun muse-colors-verbatim ()
(let ((start (match-beginning 0))
multiline)
(unless (eq (get-text-property start 'invisible) 'muse)
;; beginning of line or space or symbol
(when (or (= start (point-min))
(memq (char-syntax (char-before start)) '(?\ ?\-))
(memq (char-before start)
'(?\- ?\[ ?\< ?\( ?\' ?\` ?\" ?\n)))
(save-excursion
(skip-chars-forward "^=<>\n" end)
(when (eq (char-after) ?\n)
(setq multiline t)
(skip-chars-forward "^=<>" end))
;; Abort if space exists just before end
;; or no '=' at end
(unless (or (eq (char-before (point)) ?\ )
(not (eq (char-after (point)) ?=)))
(add-text-properties start (1+ start) '(invisible muse))
(add-text-properties (1+ start) (point) '(face
dired-face-executable))
(add-text-properties (point)
(min (1+ (point)) (point-max))
'(invisible muse))
(when multiline
(add-text-properties
start (min (1+ (point)) (point-max))
'(font-lock-multiline t)))))))))
Allen
- [emacs-wiki-discuss] RFE: muse: highlight =verbatim=, similar to how *emph* and _under_ are,
Allen Halsey <=