bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11156: 24.0.95; require-final-newline and read-only files


From: Christopher Schmidt
Subject: bug#11156: 24.0.95; require-final-newline and read-only files
Date: Sun, 15 Apr 2012 15:48:24 +0200

martin rudalics <address@hidden> writes:

> `after-find-file' shouldn't try adding a newline if `buffer-read-only'
> is non-nil.  And the values 'visit and 'visit-save should be
> documented in the Elisp manual.

=== modified file 'doc/lispref/ChangeLog'
--- doc/lispref/ChangeLog       2012-04-15 07:28:01 +0000
+++ doc/lispref/ChangeLog       2012-04-15 13:37:35 +0000
@@ -1,3 +1,8 @@
+2012-04-15  Christopher Schmidt  <address@hidden>
+
+       * files.texi (Saving Buffers): Document the values visit and
+       visit-save for require-final-newline.
+
 2012-04-15  Glenn Morris  <address@hidden>
 
        * processes.texi (Processes, Subprocess Creation, Shell Arguments):

=== modified file 'doc/lispref/files.texi'
--- doc/lispref/files.texi      2012-04-14 01:59:01 +0000
+++ doc/lispref/files.texi      2012-04-15 13:47:26 +0000
@@ -489,11 +489,13 @@
 @defopt require-final-newline
 This variable determines whether files may be written out that do
 @emph{not} end with a newline.  If the value of the variable is
address@hidden, then @code{save-buffer} silently adds a newline at the end of
-the file whenever the buffer being saved does not already end in one.
-If the value of the variable is address@hidden, but not @code{t}, then
address@hidden asks the user whether to add a newline each time the
-case arises.
address@hidden, then @code{save-buffer} silently adds a newline at the end
+of the buffer whenever it does not already end in one.  If the value
+is @code{visit}, a newline is added at the end of buffer that doesn't
+have one, just after the file is visited.  If the value is
address@hidden, a newline is added both on visiting and on saving.
+For every other address@hidden value, @code{save-buffer} asks the user
+whether to add a newline each time the case arises.
 
 If the value of the variable is @code{nil}, then @code{save-buffer}
 doesn't add newlines at all.  @code{nil} is the default value, but a few

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog      2012-04-15 09:16:50 +0000
+++ lisp/ChangeLog      2012-04-15 13:17:00 +0000
@@ -445,6 +445,11 @@
 
        * notifications.el (notifications-notify): Fix docstring.
 
+2012-04-02  Christopher Schmidt  <address@hidden>
+
+       * files.el (after-find-file): Do not add a newline at the end when
+       buffer is read-only.
+
 2012-04-02  Glenn Morris  <address@hidden>
 
        * emacs-lisp/authors.el (authors-aliases): Another addition.

=== modified file 'lisp/files.el'
--- lisp/files.el       2012-04-14 01:46:06 +0000
+++ lisp/files.el       2012-04-15 13:15:13 +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")))

        Christopher

reply via email to

[Prev in Thread] Current Thread [Next in Thread]