From: Christopher Schmidt Date: Wed, 18 Apr 2012 06:24:13 +0000 (+0800) Subject: Fix require-final-newline interaction with read-only buffers. X-Git-Tag: emacs-24.2.90~471^2~347^2~1 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c09c46b263a4c47806775c57bea391612cad4404;p=emacs.git 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 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 75b1c7799c4..eff89ba08c0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-04-18 Christopher Schmidt + + * 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 * 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 diff --git a/lisp/files.el b/lisp/files.el index fb4662e7ea8..d757e1a277c 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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")))