Fix require-final-newline interaction with read-only buffers.

* lisp/files.el (after-find-file): Do not try to add a final newline
if the buffer is read-only.

Fixes: debbugs:11156
This commit is contained in:
Christopher Schmidt 2012-04-18 14:24:13 +08:00 committed by Chong Yidong
parent 5f6530ea79
commit c09c46b263
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2012-04-18 Christopher Schmidt <christopher@ch.ristopher.com>
* files.el (after-find-file): Do not try to add a final newline if
the buffer is read-only (Bug#11156).
2012-04-17 Richard Stallman <rms@gnu.org>
* mail/rmail.el (rmail-start-mail):
@ -9,7 +14,7 @@
(rmail-forward): Pass the Rmail buffer, not nil, for replybuffer.
* mail/sendmail.el (mail-bury): Choose the first rmail-mode
buffer, not the last. Reject temp buffers. Use the rmail-mode
buffer, not the last. Reject temp buffers. Use the rmail-mode
buffer, not newbuf.
2012-04-17 Juanma Barranquero <lekktu@gmail.com>

View file

@ -2152,6 +2152,7 @@ unless NOMODES is non-nil."
(/= (char-after (1- (point-max))) ?\n)
(not (and (eq selective-display t)
(= (char-after (1- (point-max))) ?\r)))
(not buffer-read-only)
(save-excursion
(goto-char (point-max))
(insert "\n")))