Skip to content

Commit

Permalink
Fix invalid alias definition for `syntax-class-to-char'
Browse files Browse the repository at this point in the history
`eval-when-compile' defines the alias symbol only at compile time and
not when the program is loaded and thus results in a void error at
runtime.

Fixes #1204
  • Loading branch information
juergenhoetzel committed Apr 16, 2024
1 parent 2fc9456 commit 8e4130d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions smartparens.el
Original file line number Diff line number Diff line change
Expand Up @@ -1858,12 +1858,13 @@ P is the point at which we run `syntax-ppss'"
(list p (point-min) (point-max))
(sp-state-last-syntax-ppss-result sp-state) (syntax-ppss p)))))

(eval-when-compile
(defalias 'sp--syntax-class-to-char 'syntax-class-to-char)
(when (version< emacs-version "28.1")
;; `syntax-class-to-char' is new in Emacs 28.1.
(defalias 'sp--syntax-class-to-char
(if (fboundp 'syntax-class-to-char)
#'syntax-class-to-char
;; Ripped from Emacs 27.0 subr.el.
;; See Github Issue#946 and Emacs bug#31692.
(defun sp--syntax-class-to-char (syntax)
(lambda (syntax)
"Return the syntax char of CLASS, described by an integer.
For example, if SYNTAX is word constituent (the integer 2), the
character ‘w’ (119) is returned.
Expand Down

0 comments on commit 8e4130d

Please sign in to comment.