unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* mode-require-final-newline
@ 2005-03-31  1:21 Luc Teirlinck
  2005-03-31  2:38 ` mode-require-final-newline Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Luc Teirlinck @ 2005-03-31  1:21 UTC (permalink / raw)


This is about something I already reported on March 5, but the bug is
still present.  Custom does not allow you to set the value of
`mode-require-final-newline' to nil and if you set it to nil outside
Custom, then Custom falsely claims that the value is 'ask.  The patch
below fixes these problems.  Note also that the current first line of
the docstring is too long.  It not only looks bad in apropos, it also
looks bad in the Custom buffer.  The patch below shortens it.

I can install if desired.

Note that a value of nil for `mode-require-final-newline' makes a lot
of sense and there is no reason to discourage people from setting it
to nil.  I personally have it set to nil.  While working on a file,
a final newline signifies to me that the last paragraph or function is
finished.  Who cares whether a standard specifies that a file should
end in a newline?  Standards only apply to the final file, not to work
in progress.  If one occasionally forgets the final newline when the
file is finished, then that is no disaster at all: if the compiler
does not like it, he will tell so.

===File ~/files.el-diff-2===================================
*** files.el	28 Mar 2005 15:33:36 -0600	1.753
--- files.el	30 Mar 2005 18:43:21 -0600	
***************
*** 291,297 ****
    :group 'editing-basics)
  
  (defcustom mode-require-final-newline t
!   "*Whether to add a newline at the end of the file, in certain major modes.
  Those modes set `require-final-newline' to this value when you enable them.
  They do so because they are used for files that are supposed
  to end in newlines, and the question is how to arrange that.
--- 291,297 ----
    :group 'editing-basics)
  
  (defcustom mode-require-final-newline t
!   "*Whether to add a newline at end of file, in certain major modes.
  Those modes set `require-final-newline' to this value when you enable them.
  They do so because they are used for files that are supposed
  to end in newlines, and the question is how to arrange that.
***************
*** 303,308 ****
--- 303,309 ----
    :type '(choice (const :tag "When visiting" visit)
  		 (const :tag "When saving" t)
  		 (const :tag "When visiting or saving" visit-save)
+ 		 (const :tag "Never" nil)
  		 (other :tag "Ask" ask))
    :group 'editing-basics
    :version "22.1")
============================================================

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

* mode-require-final-newline
@ 2005-03-31  1:31 Luc Teirlinck
  0 siblings, 0 replies; 4+ messages in thread
From: Luc Teirlinck @ 2005-03-31  1:31 UTC (permalink / raw)


I believe that the docstring of `mode-require-newline' should also
explicitly mention the possibility of setting it to nil.  So now I
propose the following patch.  Compared to the previous patch, it only
adds one line to the docstring.

===File ~/files.el-diff-3===================================
*** files.el	28 Mar 2005 15:33:36 -0600	1.753
--- files.el	30 Mar 2005 19:14:26 -0600	
***************
*** 291,297 ****
    :group 'editing-basics)
  
  (defcustom mode-require-final-newline t
!   "*Whether to add a newline at the end of the file, in certain major modes.
  Those modes set `require-final-newline' to this value when you enable them.
  They do so because they are used for files that are supposed
  to end in newlines, and the question is how to arrange that.
--- 291,297 ----
    :group 'editing-basics)
  
  (defcustom mode-require-final-newline t
!   "*Whether to add a newline at end of file, in certain major modes.
  Those modes set `require-final-newline' to this value when you enable them.
  They do so because they are used for files that are supposed
  to end in newlines, and the question is how to arrange that.
***************
*** 299,308 ****
  A value of t means do this only when the file is about to be saved.
  A value of `visit' means do this right after the file is visited.
  A value of `visit-save' means do it at both of those times.
! Any other non-nil value means ask user whether to add a newline, when saving."
    :type '(choice (const :tag "When visiting" visit)
  		 (const :tag "When saving" t)
  		 (const :tag "When visiting or saving" visit-save)
  		 (other :tag "Ask" ask))
    :group 'editing-basics
    :version "22.1")
--- 299,310 ----
  A value of t means do this only when the file is about to be saved.
  A value of `visit' means do this right after the file is visited.
  A value of `visit-save' means do it at both of those times.
! Any other non-nil value means ask user whether to add a newline, when saving.
! nil means don't add newlines."
    :type '(choice (const :tag "When visiting" visit)
  		 (const :tag "When saving" t)
  		 (const :tag "When visiting or saving" visit-save)
+ 		 (const :tag "Never" nil)
  		 (other :tag "Ask" ask))
    :group 'editing-basics
    :version "22.1")
============================================================

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

* Re: mode-require-final-newline
  2005-03-31  1:21 mode-require-final-newline Luc Teirlinck
@ 2005-03-31  2:38 ` Chong Yidong
  2005-04-01  4:10   ` mode-require-final-newline Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2005-03-31  2:38 UTC (permalink / raw)
  Cc: emacs-devel

  !   "*Whether to add a newline at the end of the file, in certain major
  --- 291,297 ----
  !   "*Whether to add a newline at end of file, in certain major modes.

Grammatically, "at the end of the file" is more correct that "at end of
file".

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

* Re: mode-require-final-newline
  2005-03-31  2:38 ` mode-require-final-newline Chong Yidong
@ 2005-04-01  4:10   ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2005-04-01  4:10 UTC (permalink / raw)
  Cc: teirllm, emacs-devel

"end of file" is a customary name for a situation in I/O, so it
doesn't need article

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

end of thread, other threads:[~2005-04-01  4:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-31  1:31 mode-require-final-newline Luc Teirlinck
  -- strict thread matches above, loose matches on Subject: below --
2005-03-31  1:21 mode-require-final-newline Luc Teirlinck
2005-03-31  2:38 ` mode-require-final-newline Chong Yidong
2005-04-01  4:10   ` mode-require-final-newline Richard Stallman

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).