Skip to content

Commit

Permalink
Use a list for blockquote display characters
Browse files Browse the repository at this point in the history
With this commit, `markdown-blockquote-display-char` is permitted to
be a list.  The default value is now a sequence of possible strings
and the first one that is displayable will be used.

This is part of a series of changes to improve the load time by
deferring calls to `char-displayable-p`.  See GH-264.
  • Loading branch information
jrblevin committed Nov 10, 2017
1 parent b985fa6 commit 6e0ee2b
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1297,15 +1297,12 @@ be used."
:package-version '(markdown-mode . "2.3"))

(defcustom markdown-blockquote-display-char
(cond
((char-displayable-p ?▌) "▌")
((char-displayable-p ?┃) "┃")
((char-displayable-p ?│) "│")
((char-displayable-p ?|) "|")
(t ">"))
"Character for hiding blockquote markup."
'("▌" "┃" ">")
"String to display when hiding blockquote markup."
:type 'string
:safe 'stringp
:type '(choice
(string :tag "Single blockquote display string")
(repeat :tag "List of possible blockquote display strings" string))
:package-version '(markdown-mode . "2.3"))

(defcustom markdown-hr-display-char
Expand Down Expand Up @@ -4229,17 +4226,16 @@ SEQ may be an atom or a sequence."
(defun markdown-fontify-blockquotes (last)
"Apply font-lock properties to blockquotes from point to LAST."
(when (markdown-match-blockquotes last)
(add-text-properties
(match-beginning 1) (match-end 1)
(if markdown-hide-markup
`(face markdown-blockquote-face
display ,markdown-blockquote-display-char)
`(face markdown-markup-face
,@(when markdown-hide-markup
`(display ,markdown-blockquote-display-char)))))
(font-lock-append-text-property
(match-beginning 0) (match-end 0) 'face 'markdown-blockquote-face)
t))
(let ((display-string
(markdown--first-displayable markdown-blockquote-display-char)))
(add-text-properties
(match-beginning 1) (match-end 1)
(if markdown-hide-markup
`(face markdown-blockquote-face display ,display-string)
`(face markdown-markup-face)))
(font-lock-append-text-property
(match-beginning 0) (match-end 0) 'face 'markdown-blockquote-face)
t)))

(defun markdown-fontify-list-items (last)
"Apply font-lock properties to list markers from point to LAST."
Expand Down

0 comments on commit 6e0ee2b

Please sign in to comment.