mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-28 01:00:52 -07:00
Fix test of whether to insert lexical-binding cookies in custom files
* lisp/cus-edit.el (custom-save-all): Test whether the buffer is empty, not whether point is at EOB.
This commit is contained in:
parent
b990c37b9a
commit
6d4179957a
1 changed files with 14 additions and 6 deletions
|
|
@ -4970,12 +4970,20 @@ if only the first line of the docstring is shown."))
|
|||
;; can cause problems when read back, so print them
|
||||
;; readably. (Bug#52554)
|
||||
(print-escape-control-characters t))
|
||||
(atomic-change-group
|
||||
(when (eobp)
|
||||
(insert ";;; -*- lexical-binding: t -*-\n"))
|
||||
(custom-save-variables)
|
||||
(custom-save-faces)
|
||||
(custom-save-icons)))
|
||||
(save-restriction
|
||||
(widen)
|
||||
(atomic-change-group
|
||||
;; The previous test `eobp' was written with an appalling
|
||||
;; lack of forethought or testing, being easily misled if
|
||||
;; the user should have left point at eob in a buffer
|
||||
;; visiting the custom file.
|
||||
(when (eq (point-min) (point-max))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(insert ";;; -*- lexical-binding: t -*-\n")))
|
||||
(custom-save-variables)
|
||||
(custom-save-faces)
|
||||
(custom-save-icons))))
|
||||
(let ((file-precious-flag t))
|
||||
(save-buffer))
|
||||
(if old-buffer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue