unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11156: 24.0.95; require-final-newline and read-only files
@ 2012-04-02 21:52 Christopher Schmidt
  2012-04-14 13:49 ` Christopher Schmidt
  0 siblings, 1 reply; 9+ messages in thread
From: Christopher Schmidt @ 2012-04-02 21:52 UTC (permalink / raw)
  To: 11156

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

Hi,

I think I hit on a bug in GNU Emacs 24.0.95.1 (x86_64-unknown-linux-gnu,
GTK+ Version 2.24.10) of 2012-04-02.

Recipe:
cd /tmp
echo -n rms > rms
chmod u=r rms
emacs -q
eval: (setq require-final-newline 'visit)
C-x C-f /tmp/rms RET

There is a new buffer but no window displays it.  The *Messages*-buffer
contains `find-file-noselect-1: Buffer is read-only: #<buffer rms>'

Emacs tries to add a newline to the (read-only) buffer.  Here's a quick
fix:

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 775 bytes --]

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-04-02 16:32:06 +0000
+++ lisp/ChangeLog	2012-04-02 21:28:06 +0000
@@ -1,3 +1,8 @@
+2012-04-02  Christopher Schmidt  <christopher@ch.ristopher.com>
+
+	* files.el (after-find-file): Do not add a newline at the end when
+	buffer is read-only.
+
 2012-04-02  Glenn Morris  <rgm@gnu.org>
 
 	* emacs-lisp/authors.el (authors-aliases): Another addition.

=== modified file 'lisp/files.el'
--- lisp/files.el	2012-04-01 02:44:24 +0000
+++ lisp/files.el	2012-04-02 21:45:36 +0000
@@ -2152,6 +2152,7 @@
 	 (/= (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")))


[-- Attachment #3: Type: text/plain, Size: 21 bytes --]


        Christopher

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-09-07 10:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02 21:52 bug#11156: 24.0.95; require-final-newline and read-only files Christopher Schmidt
2012-04-14 13:49 ` Christopher Schmidt
2012-04-14 18:56   ` martin rudalics
2012-04-15 13:48     ` Christopher Schmidt
2012-04-18  6:25       ` Chong Yidong
2012-05-01 17:02         ` Christopher Schmidt
2012-05-06  5:01           ` Chong Yidong
2012-09-02 18:55         ` bug#11156: 24.2.50; require-final-newline and read-only files (was: bug#11156: 24.0.95; require-final-newline and read-only files) Christopher Schmidt
2012-09-07 10:53           ` bug#11156: 24.2.50; require-final-newline and read-only files Chong Yidong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).