all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* require-final-newline
@ 2005-03-05 19:53 Luc Teirlinck
  2005-03-06 19:10 ` require-final-newline Richard Stallman
  0 siblings, 1 reply; 11+ messages in thread
From: Luc Teirlinck @ 2005-03-05 19:53 UTC (permalink / raw)


This is related with an issue discussed in another thread
(require-hard-newlines to use newline), but is more general.

In Emacs 21.3, Text mode did not override the default value of
require-final-newline.  In current CVS, it does via
mode-require-final-newline.  Is there a reason for that?  I can see a
reason for some specific derived modes, but these derived modes could
use mode-require-final-newline themselves, instead of letting the
parent mode do it for them.

Also, nil _is_ a valid value for mode-require-final-newline.  But the
docstring is not very explicit about that and you can not set it to
nil via Custom.  If you set it to nil outside Custom, Custom will
falsely describe the value as `ask', which is a bug.  Would it be good
to have the docstring mention this explicitly and allow it to be set
to nil via Custom with proper warning of the involved dangers (which
would fix the bug)?

Sincerely,

Luc.

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

* Re: require-final-newline
  2005-03-05 19:53 require-final-newline Luc Teirlinck
@ 2005-03-06 19:10 ` Richard Stallman
  2005-03-07  1:29   ` require-final-newline Luc Teirlinck
  2005-03-07  1:41   ` require-final-newline Luc Teirlinck
  0 siblings, 2 replies; 11+ messages in thread
From: Richard Stallman @ 2005-03-06 19:10 UTC (permalink / raw)
  Cc: emacs-devel

    In Emacs 21.3, Text mode did not override the default value of
    require-final-newline.  In current CVS, it does via
    mode-require-final-newline.  Is there a reason for that?

I don't remember the reason, but I remember there was one.
I think that specific point was discussed in this list
a few months ago.

    Also, nil _is_ a valid value for mode-require-final-newline.  But the
    docstring is not very explicit about that and you can not set it to
    nil via Custom.  If you set it to nil outside Custom, Custom will
    falsely describe the value as `ask', which is a bug.

I will fix that.

      Would it be good
    to have the docstring mention this explicitly and allow it to be set
    to nil via Custom with proper warning of the involved dangers

I don't know how to make Custom issue warnings.

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

* Re: require-final-newline
  2005-03-06 19:10 ` require-final-newline Richard Stallman
@ 2005-03-07  1:29   ` Luc Teirlinck
  2005-03-07  1:41     ` require-final-newline Stefan Monnier
  2005-03-08  2:51     ` require-final-newline Richard Stallman
  2005-03-07  1:41   ` require-final-newline Luc Teirlinck
  1 sibling, 2 replies; 11+ messages in thread
From: Luc Teirlinck @ 2005-03-07  1:29 UTC (permalink / raw)
  Cc: Stefan Monnier, emacs-devel

Richard Stallman wrote:
       
       In Emacs 21.3, Text mode did not override the default value of
       require-final-newline.  In current CVS, it does via
       mode-require-final-newline.  Is there a reason for that?

   I don't remember the reason, but I remember there was one.
   I think that specific point was discussed in this list
   a few months ago.

Actually, the decision to replace the old _way_ to override the
default value of `require-final-newline' with a new one based on
`mode-require-final-newline' was made a few months ago.  Maybe I
caused confusion by mentioning `mode-require-final-newline'.  I was
not asking about the _implementation change_.  The real question I
wanted to ask was:

       In Emacs 21.3, Text mode did not override the default value of
       require-final-newline.  In current CVS, it does.  Is there a
       reason for that?

Here, the relevant change was made more than two years ago:

2002-09-02  Stefan Monnier  <monnier@cs.yale.edu>

	    * textmodes/text-mode.el
              (paragraph-indent-text-mode-abbrev-table)
	      (paragraph-indent-text-mode-syntax-table,
              paragraph-indent-text-mode):
	      Use text-mode's syntax-table and abbrev-table.
	      (text-mode): Set require-final-newline to t.

Sincerely,

Luc.

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

* Re: require-final-newline
  2005-03-07  1:29   ` require-final-newline Luc Teirlinck
@ 2005-03-07  1:41     ` Stefan Monnier
  2005-03-08  2:51     ` require-final-newline Richard Stallman
  1 sibling, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2005-03-07  1:41 UTC (permalink / raw)
  Cc: rms, emacs-devel

>        In Emacs 21.3, Text mode did not override the default value of
>        require-final-newline.  In current CVS, it does.  Is there a
>        reason for that?

> Here, the relevant change was made more than two years ago:

> 2002-09-02  Stefan Monnier  <monnier@cs.yale.edu>

> 	    * textmodes/text-mode.el
>               (paragraph-indent-text-mode-abbrev-table)
> 	      (paragraph-indent-text-mode-syntax-table,
>               paragraph-indent-text-mode):
> 	      Use text-mode's syntax-table and abbrev-table.
> 	      (text-mode): Set require-final-newline to t.

Hmmm... I didn't expect my name to show up here.
I must say I can't remember why I set require-final-newline to t there.
And in retrospect and given all the discussions about require-final-newline,
I wouldn't mind if someone reverts this part of the above change.


        Stefan

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

* Re: require-final-newline
  2005-03-06 19:10 ` require-final-newline Richard Stallman
  2005-03-07  1:29   ` require-final-newline Luc Teirlinck
@ 2005-03-07  1:41   ` Luc Teirlinck
  1 sibling, 0 replies; 11+ messages in thread
From: Luc Teirlinck @ 2005-03-07  1:41 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:
	 
	 Would it be good
       to have the docstring mention this explicitly and allow it to be set
       to nil via Custom with proper warning of the involved dangers

   I don't know how to make Custom issue warnings.

I meant putting a warning message in the Custom buffer if nil is
chosen from the value menu, using the :doc keyword.  But on second
thought, I do not believe that such a warning is necessary.  The
docstring of `mode-require-final-newline' already says:

  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.

If the user sets the option to nil, he knows that he chooses to
arrange for that by remembering to do it manually (or by using
software that can handle files without final newline).

Sincerely,

Luc.

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

* Re: require-final-newline
  2005-03-07  1:29   ` require-final-newline Luc Teirlinck
  2005-03-07  1:41     ` require-final-newline Stefan Monnier
@ 2005-03-08  2:51     ` Richard Stallman
  1 sibling, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2005-03-08  2:51 UTC (permalink / raw)
  Cc: monnier, emacs-devel

	   In Emacs 21.3, Text mode did not override the default value of
	   require-final-newline.  In current CVS, it does.  Is there a
	   reason for that?

I think we did discuss that question leading up to my decision
to introduce mode-require-final-newline.  However, there is
probably more discussion in August or September 2002.

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

* require-final-newline
@ 2007-05-21  2:03 Trent Buck
  2007-05-22  7:34 ` require-final-newline Carsten Dominik
  2007-05-23 14:15 ` require-final-newline Carsten Dominik
  0 siblings, 2 replies; 11+ messages in thread
From: Trent Buck @ 2007-05-21  2:03 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: trentbuck


[-- Attachment #1.1: Type: text/plain, Size: 1749 bytes --]

[Please CC replies; I'm not subscribed to this list.]

I have the following in my .emacs:

  | ;;; If the last line is an item and you have a final newline,
  | ;;; collapsing item bodies will result in
  | ;;;
  | ;;;     ** eat marshmallows...
  | ;;;
  | ;;; where the ellipsis is simply eliding the final newline.  This
  | ;;; annoys me.  Rather than fix org mode, I've opted to simply
  | ;;; disable implicit adding of a final newline for this mode.
  | (add-hook 'org-mode-hook
  |   (lambda ()
  |     (set (make-local-variable 'require-final-newline) nil)))

It would be better if org mode did this automatically.  There is
a facility specifically for this:

  | mode-require-final-newline is a variable defined in `files.el'.
  | 
  | Documentation:
  | 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 often used for files that are supposed
  | to end in newlines, and the question is how to arrange that.
  | 
  | 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 do not add newlines.  That is a risky choice in this variable
  | since this value is used for modes for files that ought to have final newlines.
  | So if you set this to nil, you must explicitly check and add
  | a final newline, whenever you save a file that really needs one.

I posit that org-mode should set this variable to nil.
-- 
Trent Buck

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: require-final-newline
  2007-05-21  2:03 require-final-newline Trent Buck
@ 2007-05-22  7:34 ` Carsten Dominik
  2007-05-23  9:18   ` require-final-newline Trent Buck
  2007-05-23 14:15 ` require-final-newline Carsten Dominik
  1 sibling, 1 reply; 11+ messages in thread
From: Carsten Dominik @ 2007-05-22  7:34 UTC (permalink / raw)
  To: Trent Buck; +Cc: emacs-orgmode


On May 21, 2007, at 4:03, Trent Buck wrote:

> [Please CC replies; I'm not subscribed to this list.]
>
> I have the following in my .emacs:
>
>   | ;;; If the last line is an item and you have a final newline,
>   | ;;; collapsing item bodies will result in
>   | ;;;
>   | ;;;     ** eat marshmallows...
>   | ;;;
>   | ;;; where the ellipsis is simply eliding the final newline.  This
>   | ;;; annoys me.

I do not yet see what the problem is.  Why is this annoying you?

- Carsten


> Rather than fix org mode, I've opted to simply
>   | ;;; disable implicit adding of a final newline for this mode.
>   | (add-hook 'org-mode-hook
>   |   (lambda ()
>   |     (set (make-local-variable 'require-final-newline) nil)))
>
> It would be better if org mode did this automatically.  There is
> a facility specifically for this:
>
>   | mode-require-final-newline is a variable defined in `files.el'.
>   |
>   | Documentation:
>   | 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 often used for files that are supposed
>   | to end in newlines, and the question is how to arrange that.
>   |
>   | 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 do not add newlines.  That is a risky choice in this 
> variable
>   | since this value is used for modes for files that ought to have 
> final newlines.
>   | So if you set this to nil, you must explicitly check and add
>   | a final newline, whenever you save a file that really needs one.
>
> I posit that org-mode should set this variable to nil.
> -- 
> Trent Buck
> _______________________________________________
> Emacs-orgmode mailing list
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477

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

* Re: require-final-newline
  2007-05-22  7:34 ` require-final-newline Carsten Dominik
@ 2007-05-23  9:18   ` Trent Buck
  0 siblings, 0 replies; 11+ messages in thread
From: Trent Buck @ 2007-05-23  9:18 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2224 bytes --]

On Tue, May 22, 2007 at 09:34:53AM +0200, Carsten Dominik wrote:
> 
> On May 21, 2007, at 4:03, Trent Buck wrote:
> 
> >[Please CC replies; I'm not subscribed to this list.]
> >
> >I have the following in my .emacs:
> >
> >  | ;;; If the last line is an item and you have a final newline,
> >  | ;;; collapsing item bodies will result in
> >  | ;;;
> >  | ;;;     ** eat marshmallows...
> >  | ;;;
> >  | ;;; where the ellipsis is simply eliding the final newline.  This
> >  | ;;; annoys me.
> 
> I do not yet see what the problem is.  Why is this annoying you?

It annoys me because the ... indicate that text is being hidden, but
in fact the only hidden data is a single newline.

> - Carsten
> 
> 
> >Rather than fix org mode, I've opted to simply
> >  | ;;; disable implicit adding of a final newline for this mode.
> >  | (add-hook 'org-mode-hook
> >  |   (lambda ()
> >  |     (set (make-local-variable 'require-final-newline) nil)))
> >
> >It would be better if org mode did this automatically.  There is
> >a facility specifically for this:
> >
> >  | mode-require-final-newline is a variable defined in `files.el'.
> >  |
> >  | Documentation:
> >  | 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 often used for files that are supposed
> >  | to end in newlines, and the question is how to arrange that.
> >  |
> >  | 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 do not add newlines.  That is a risky choice in this 
> >variable
> >  | since this value is used for modes for files that ought to have 
> >final newlines.
> >  | So if you set this to nil, you must explicitly check and add
> >  | a final newline, whenever you save a file that really needs one.
> >
> >I posit that org-mode should set this variable to nil.

-- 
Trent Buck

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: require-final-newline
  2007-05-21  2:03 require-final-newline Trent Buck
  2007-05-22  7:34 ` require-final-newline Carsten Dominik
@ 2007-05-23 14:15 ` Carsten Dominik
  2007-05-23 15:20   ` require-final-newline Trent Buck
  1 sibling, 1 reply; 11+ messages in thread
From: Carsten Dominik @ 2007-05-23 14:15 UTC (permalink / raw)
  To: Trent Buck; +Cc: emacs-orgmode

To be honest, I am not sure that this is the right solution.  For some 
operations in org-mode, like structure editing, that final newline is 
good to have.  Also, this issue with the final newline is depending on 
personal preferences.

I tend to believe that the better solution is to fix outlining, so that 
it will never hide empty lines at the end of the buffer.  Hope you can 
agree if I implement that latter solution.

- Carsten

On May 21, 2007, at 4:03, Trent Buck wrote:

> [Please CC replies; I'm not subscribed to this list.]
>
> I have the following in my .emacs:
>
>   | ;;; If the last line is an item and you have a final newline,
>   | ;;; collapsing item bodies will result in
>   | ;;;
>   | ;;;     ** eat marshmallows...
>   | ;;;
>   | ;;; where the ellipsis is simply eliding the final newline.  This
>   | ;;; annoys me.  Rather than fix org mode, I've opted to simply
>   | ;;; disable implicit adding of a final newline for this mode.
>   | (add-hook 'org-mode-hook
>   |   (lambda ()
>   |     (set (make-local-variable 'require-final-newline) nil)))
>
> It would be better if org mode did this automatically.  There is
> a facility specifically for this:
>
>   | mode-require-final-newline is a variable defined in `files.el'.
>   |
>   | Documentation:
>   | 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 often used for files that are supposed
>   | to end in newlines, and the question is how to arrange that.
>   |
>   | 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 do not add newlines.  That is a risky choice in this 
> variable
>   | since this value is used for modes for files that ought to have 
> final newlines.
>   | So if you set this to nil, you must explicitly check and add
>   | a final newline, whenever you save a file that really needs one.
>
> I posit that org-mode should set this variable to nil.
> -- 
> Trent Buck
> _______________________________________________
> Emacs-orgmode mailing list
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477

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

* Re: require-final-newline
  2007-05-23 14:15 ` require-final-newline Carsten Dominik
@ 2007-05-23 15:20   ` Trent Buck
  0 siblings, 0 replies; 11+ messages in thread
From: Trent Buck @ 2007-05-23 15:20 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2540 bytes --]

On Wed, May 23, 2007 at 04:15:41PM +0200, Carsten Dominik wrote:
> To be honest, I am not sure that this is the right solution.  For some 
> operations in org-mode, like structure editing, that final newline is 
> good to have.  Also, this issue with the final newline is depending on 
> personal preferences.
> 
> I tend to believe that the better solution is to fix outlining, so that 
> it will never hide empty lines at the end of the buffer.  Hope you can 
> agree if I implement that latter solution.

Certainly.  Now you point it out, I agree that is the "more correct"
change to make.

> On May 21, 2007, at 4:03, Trent Buck wrote:
> 
> >[Please CC replies; I'm not subscribed to this list.]
> >
> >I have the following in my .emacs:
> >
> >  | ;;; If the last line is an item and you have a final newline,
> >  | ;;; collapsing item bodies will result in
> >  | ;;;
> >  | ;;;     ** eat marshmallows...
> >  | ;;;
> >  | ;;; where the ellipsis is simply eliding the final newline.  This
> >  | ;;; annoys me.  Rather than fix org mode, I've opted to simply
> >  | ;;; disable implicit adding of a final newline for this mode.
> >  | (add-hook 'org-mode-hook
> >  |   (lambda ()
> >  |     (set (make-local-variable 'require-final-newline) nil)))
> >
> >It would be better if org mode did this automatically.  There is
> >a facility specifically for this:
> >
> >  | mode-require-final-newline is a variable defined in `files.el'.
> >  |
> >  | Documentation:
> >  | 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 often used for files that are supposed
> >  | to end in newlines, and the question is how to arrange that.
> >  |
> >  | 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 do not add newlines.  That is a risky choice in this 
> >variable
> >  | since this value is used for modes for files that ought to have 
> >final newlines.
> >  | So if you set this to nil, you must explicitly check and add
> >  | a final newline, whenever you save a file that really needs one.
> >
> >I posit that org-mode should set this variable to nil.

-- 
Trent Buck

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2007-05-23 15:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-05 19:53 require-final-newline Luc Teirlinck
2005-03-06 19:10 ` require-final-newline Richard Stallman
2005-03-07  1:29   ` require-final-newline Luc Teirlinck
2005-03-07  1:41     ` require-final-newline Stefan Monnier
2005-03-08  2:51     ` require-final-newline Richard Stallman
2005-03-07  1:41   ` require-final-newline Luc Teirlinck
  -- strict thread matches above, loose matches on Subject: below --
2007-05-21  2:03 require-final-newline Trent Buck
2007-05-22  7:34 ` require-final-newline Carsten Dominik
2007-05-23  9:18   ` require-final-newline Trent Buck
2007-05-23 14:15 ` require-final-newline Carsten Dominik
2007-05-23 15:20   ` require-final-newline Trent Buck

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.