Skip to content

Commit

Permalink
Silence the byte compiler in Emacs 29.1 AND Emacs 30.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Zawada authored and Tobias Zawada committed Jan 30, 2024
1 parent 497bb8b commit f935779
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions adoc-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,13 @@ LANG is a string, and the returned major mode is a symbol."
(intern (concat lang "-mode"))
(intern (concat (downcase lang) "-mode")))))

(defmacro adoc-cond-let (cond binding &rest body)
"Let-bind BINDING when COND is fulfilled at compile-time.
Execute BODY like `progn'."
(declare (debug (form (&rest (symbolp form)) body)) (indent 2))
`(let ,(when (eval cond) binding)
,@body))

;; Based on `org-src-font-lock-fontify-block' from org-src.el.
(defun adoc-fontify-code-block-natively (lang start-block end-block start-src end-src)
"Fontify source code block.
Expand Down Expand Up @@ -2018,15 +2025,15 @@ START-SRC and END-SRC delimit the actual source code."
(insert string))
(unless (eq major-mode lang-mode) (funcall lang-mode))
(font-lock-ensure)
(cl-loop for int = nil
for int being the intervals property 'face
for pos = (car int)
for next = (cdr int)
for val = (get-text-property pos 'face)
when val do
(put-text-property
(+ start-src (1- pos)) (1- (+ start-src next)) 'face
val adoc-buffer)))
(adoc-cond-let (version< emacs-version "30.0") (int)
(cl-loop for int being the intervals property 'face
for pos = (car int)
for next = (cdr int)
for val = (get-text-property pos 'face)
when val do
(put-text-property
(+ start-src (1- pos)) (1- (+ start-src next)) 'face
val adoc-buffer))))
(add-text-properties start-block start-src '(face adoc-meta-face))
(add-text-properties end-src end-block '(face adoc-meta-face))
(add-text-properties
Expand Down

0 comments on commit f935779

Please sign in to comment.