Fix 'hack-local-variables' when EOL conversion is inhibited

* lisp/files.el (hack-local-variables--find-variables): Replace
CRs with newlines only if the original buffer is under explicit
selective-display.  (Bug#61321)
This commit is contained in:
Eli Zaretskii 2023-02-06 18:28:21 +02:00
parent 013655811a
commit 7f8f19da24

View file

@ -4017,6 +4017,7 @@ major-mode."
(forward-line 1)
(let ((startpos (point))
endpos
(selective-p (eq selective-display t))
(thisbuf (current-buffer)))
(save-excursion
(unless (let ((case-fold-search t))
@ -4033,7 +4034,8 @@ major-mode."
(with-temp-buffer
(insert-buffer-substring thisbuf startpos endpos)
(goto-char (point-min))
(subst-char-in-region (point) (point-max) ?\^m ?\n)
(if selective-p
(subst-char-in-region (point) (point-max) ?\r ?\n))
(while (not (eobp))
;; Discard the prefix.
(if (looking-at prefix)