emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Trent Buck" <trentbuck@gmail.com>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: require-final-newline
Date: Thu, 24 May 2007 01:20:20 +1000	[thread overview]
Message-ID: <20070523152020.GA13939@baal.lan> (raw)
In-Reply-To: <31008adb289123cb43d3677063adaa58@science.uva.nl>


[-- 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

      reply	other threads:[~2007-05-23 15:20 UTC|newest]

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

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.orgmode.org/

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

  git send-email \
    --in-reply-to=20070523152020.GA13939@baal.lan \
    --to=trentbuck@gmail.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@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/org-mode.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).