unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Schmidt <christopher@ch.ristopher.com>
To: 11156@debbugs.gnu.org
Subject: bug#11156: 24.0.95; require-final-newline and read-only files
Date: Sun, 15 Apr 2012 15:48:24 +0200	[thread overview]
Message-ID: <20120415134821.0001E20235@saturn.ch.ristopher.com> (raw)
In-Reply-To: <4F89C879.6070209@gmx.at> (martin rudalics's message of "Sat, 14 Apr 2012 20:56:57 +0200")

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

martin rudalics <rudalics@gmx.at> 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.


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

=== 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  <christopher@ch.ristopher.com>
+
+	* files.texi (Saving Buffers): Document the values visit and
+	visit-save for require-final-newline.
+
 2012-04-15  Glenn Morris  <rgm@gnu.org>
 
 	* 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
-@code{t}, 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 non-@code{nil}, but not @code{t}, then
-@code{save-buffer} asks the user whether to add a newline each time the
-case arises.
+@code{t}, 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
+@code{visit-save}, a newline is added both on visiting and on saving.
+For every other non-@code{nil} 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  <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-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")))


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


        Christopher

  reply	other threads:[~2012-04-15 13:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120415134821.0001E20235@saturn.ch.ristopher.com \
    --to=christopher@ch.ristopher.com \
    --cc=11156@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).