Make c-emacs-features use the proper binding of parse-sexp-lookup-properties

This is relevant for bug #58558, although it does not fix it.  Due to a wrong
ordering of with-current-buffer and a let form, the function overwrote the
global value of parse-sexp-lookup-properties and two other variables.

* lisp/progmodes/cc-defs.el (c-emacs-features): Change the nesting of
with-current-buffer and let so that the let bindings get used.
This commit is contained in:
Alan Mackenzie 2023-04-14 10:33:03 +00:00 committed by Stefan Monnier
parent c9e2a5ec26
commit 09bf476836

View file

@ -2153,20 +2153,13 @@ non-nil, a caret is prepended to invert the set."
;; Record whether the `category' text property works.
(if c-use-category (setq list (cons 'category-properties list)))
(let ((buf (generate-new-buffer " test"))
parse-sexp-lookup-properties
parse-sexp-ignore-comments
lookup-syntax-properties) ; XEmacs
(let ((buf (generate-new-buffer " test")))
(with-current-buffer buf
(let ((parse-sexp-lookup-properties t)
(parse-sexp-ignore-comments t)
(lookup-syntax-properties t))
(set-syntax-table (make-syntax-table))
;; For some reason we have to set some of these after the
;; buffer has been made current. (Specifically,
;; `parse-sexp-ignore-comments' in Emacs 21.)
(setq parse-sexp-lookup-properties t
parse-sexp-ignore-comments t
lookup-syntax-properties t)
;; Find out if the `syntax-table' text property works.
(modify-syntax-entry ?< ".")
(modify-syntax-entry ?> ".")
@ -2232,7 +2225,7 @@ non-nil, a caret is prepended to invert the set."
(setq list (cons 'col-0-paren list)))))
(set-buffer-modified-p nil))
(kill-buffer buf))
(kill-buffer buf)))
;; Check how many elements `parse-partial-sexp' returns.
(let ((ppss-size (or (c-safe (length