Skip to content

Commit

Permalink
[Fix #749] Make font-locking compatible with font-lock-mode
Browse files Browse the repository at this point in the history
See jlr/rainbow-delimiters#33 for details.
  • Loading branch information
Bozhidar Batsov committed Sep 14, 2014
1 parent b5e5538 commit 401e819
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions cider-doc.el
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ and line wrap."
(when (search-forward-regexp "```\n" nil t)
(replace-match "")
(cider-font-lock-region-as mode beg (point))
(overlay-put (make-overlay beg (point)) 'face bg)
(overlay-put (make-overlay beg (point)) 'font-lock-face bg)
(put-text-property beg (point) 'block 'code)))))))

(defun cider-docview-fontify-literals (buffer)
Expand All @@ -222,7 +222,7 @@ Preformatted code text blocks are ignored."
(let ((beg (point)))
(when (search-forward "`" (line-end-position) t)
(replace-match "")
(put-text-property beg (point) 'face 'cider-docview-literal-face)))))))))
(put-text-property beg (point) 'font-lock-face 'cider-docview-literal-face)))))))))

(defun cider-docview-fontify-emphasis (buffer)
"Font lock BUFFER emphasized text and remove markdown characters.
Expand All @@ -241,7 +241,7 @@ Preformatted code text blocks are ignored."
'cider-docview-emphasis-face)))
(when (search-forward-regexp "\\(\\w\\)\\*+" (line-end-position) t)
(replace-match "\\1")
(put-text-property beg (point) 'face face)))))))))
(put-text-property beg (point) 'font-lock-face face)))))))))

(defun cider-docview-format-tables (buffer)
"Align BUFFER tables and dim borders.
Expand All @@ -255,7 +255,7 @@ Tables are marked to be ignored by line wrap."
(org-table-align)
(goto-char (org-table-begin))
(while (search-forward-regexp "[+|-]" (org-table-end) t)
(put-text-property (match-beginning 0) (match-end 0) 'face border))
(put-text-property (match-beginning 0) (match-end 0) 'font-lock-face border))
(put-text-property (org-table-begin) (org-table-end) 'block 'table)))))))

(defun cider-docview-wrap-text (buffer)
Expand Down
2 changes: 1 addition & 1 deletion cider-inspector.el
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
(cider-propertize-region
(list 'cider-value-idx idx
'mouse-face 'highlight
'face 'font-lock-keyword-face)
'font-lock-face 'font-lock-keyword-face)
(cider-irender-el* value)))


Expand Down
4 changes: 2 additions & 2 deletions cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ If location could not be found, return nil."
(let ((face (nth 3 info))
(note (nth 4 info)))
(overlay-put overlay 'cider-note-p t)
(overlay-put overlay 'face face)
(overlay-put overlay 'font-lock-face face)
(overlay-put overlay 'cider-note note)
(overlay-put overlay 'help-echo note)
(overlay-put overlay 'modification-hooks
Expand Down Expand Up @@ -1683,7 +1683,7 @@ under point, prompts for a var."
(setq pos (match-end 0))
(put-text-property (match-beginning 0)
(match-end 0)
'face apropos-match-face doc)))
'font-lock-face apropos-match-face doc)))
doc)

(defun cider-apropos-result (result query docs-p)
Expand Down
8 changes: 4 additions & 4 deletions cider-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ client process connection. Unless NO-BANNER is non-nil, insert a banner."
"Insert REPL banner and REPL prompt in BUFFER."
(with-current-buffer buffer
(when (zerop (buffer-size))
(insert (propertize (cider-repl--banner) 'face 'font-lock-comment-face)))
(insert (propertize (cider-repl--banner) 'font-lock-face 'font-lock-comment-face)))
(goto-char (point-max))
(cider-repl--mark-output-start)
(cider-repl--mark-input-start)
Expand Down Expand Up @@ -447,7 +447,7 @@ If BOL is non-nil insert at the beginning of the line."
(goto-char cider-repl-input-start-mark)
(when (and bol (not (bolp)))
(insert-before-markers "\n"))
(insert-before-markers (propertize cider-repl-result-prefix 'face 'font-lock-comment-face))
(insert-before-markers (propertize cider-repl-result-prefix 'font-lock-face 'font-lock-comment-face))
(if cider-repl-use-clojure-font-lock
(insert-before-markers (cider-font-lock-as-clojure string))
(cider-propertize-region
Expand Down Expand Up @@ -542,7 +542,7 @@ If NEWLINE is true then add a newline at the end of the input."
;; These properties are on an overlay so that they won't be taken
;; by kill/yank.
(overlay-put overlay 'read-only t)
(overlay-put overlay 'face 'cider-repl-input-face))))
(overlay-put overlay 'font-lock-face 'cider-repl-input-face))))
(let* ((input (cider-repl--current-input))
(form (if (and (not (string-match "\\`[ \t\r\n]*\\'" input))
cider-repl-use-pretty-printing)
Expand Down Expand Up @@ -652,7 +652,7 @@ text property `cider-old-input'."
(save-excursion
(goto-char start)
(insert
(propertize ";;; output cleared" 'face 'font-lock-comment-face)))))))
(propertize ";;; output cleared" 'font-lock-face 'font-lock-comment-face)))))))

(defun cider-repl-set-ns (ns)
"Switch the namespace of the REPL buffer to NS.
Expand Down
16 changes: 8 additions & 8 deletions cider-stacktrace.el
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ searching and update the hidden count text."
(face (funcall get-face (if filter
(member filter filters)
filters))))
(button-put button 'face face)))
(button-put button 'font-lock-face face)))
(goto-char (or (next-property-change (point))
(point-max)))))
;; Update hidden count
Expand Down Expand Up @@ -465,14 +465,14 @@ This associates text properties to enable filtering and source navigation."
'flags flags 'follow-link t
'action 'cider-stacktrace-navigate
'help-echo "View source at this location"
'face 'cider-stacktrace-face)
'font-lock-face 'cider-stacktrace-face)
(save-excursion
(let ((p4 (point))
(p1 (search-backward " "))
(p2 (search-forward "/"))
(p3 (search-forward-regexp "[^/$]+")))
(put-text-property p1 p4 'face 'cider-stacktrace-ns-face)
(put-text-property p2 p3 'face 'cider-stacktrace-fn-face)))
(put-text-property p1 p4 'font-lock-face 'cider-stacktrace-ns-face)
(put-text-property p2 p3 'font-lock-face 'cider-stacktrace-fn-face)))
(newline)))))

(defun cider-stacktrace-render-cause (buffer cause num note)
Expand All @@ -486,13 +486,13 @@ This associates text properties to enable filtering and source navigation."
;; Detail level 0: exception class
(cider-propertize-region '(detail 0)
(insert (format "%d. " num)
(propertize note 'face 'font-lock-comment-face) " "
(propertize class 'face class-face))
(propertize note 'font-lock-face 'font-lock-comment-face) " "
(propertize class 'font-lock-face class-face))
(newline))
;; Detail level 1: message + ex-data
(cider-propertize-region '(detail 1)
(cider-stacktrace-emit-indented
(propertize (or message "(No message)") 'face message-face) indent t)
(propertize (or message "(No message)") 'font-lock-face message-face) indent t)
(newline)
(when data
(cider-stacktrace-emit-indented
Expand All @@ -504,7 +504,7 @@ This associates text properties to enable filtering and source navigation."
(bg `(:background ,cider-stacktrace-frames-background-color)))
(dolist (frame stacktrace)
(cider-stacktrace-render-frame buffer frame))
(overlay-put (make-overlay beg (point)) 'face bg)))
(overlay-put (make-overlay beg (point)) 'font-lock-face bg)))
;; Add line break between causes, even when collapsed.
(cider-propertize-region '(detail 0)
(newline)))))))
Expand Down
2 changes: 1 addition & 1 deletion cider-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
(let ((beg (point)))
(forward-sexp)
(let ((overlay (make-overlay beg (point))))
(overlay-put overlay 'face (cider-test-type-face type))
(overlay-put overlay 'font-lock-face (cider-test-type-face type))
(overlay-put overlay 'type type)
(overlay-put overlay 'help-echo message)
(overlay-put overlay 'message message)
Expand Down
2 changes: 1 addition & 1 deletion cider-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ PROP is the name of a text property."

(defun cider-insert (text &optional face break more-text)
"Insert TEXT with FACE, optionally followed by a line BREAK and MORE-TEXT."
(insert (if face (propertize text 'face face) text))
(insert (if face (propertize text 'font-lock-face face) text))
(when more-text (insert more-text))
(when break (insert "\n")))

Expand Down
2 changes: 1 addition & 1 deletion nrepl-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ number of buffer shrinking operations.")
(head (format "(%s" (car object)))
(foreground (and id (nth id nrepl--message-colors))))
(cl-flet ((color (str)
(propertize str 'face `(:weight ultra-bold :foreground ,foreground))))
(propertize str 'font-lock-face `(:weight ultra-bold :foreground ,foreground))))
(insert (color head))
(let ((indent (+ 2 (- (current-column) (length head)))))
(if (null (cdr object))
Expand Down

0 comments on commit 401e819

Please sign in to comment.