From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: require-final-newline Date: Tue, 22 May 2007 09:34:53 +0200 Message-ID: <7a73d44309f7c011f5a9eb724af92096@science.uva.nl> References: <20070521020326.GA14277@baal.lan> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HqluS-0000kx-25 for emacs-orgmode@gnu.org; Wed, 23 May 2007 04:09:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HqluO-0000k8-K7 for emacs-orgmode@gnu.org; Wed, 23 May 2007 04:09:27 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HqluO-0000jy-7O for emacs-orgmode@gnu.org; Wed, 23 May 2007 04:09:24 -0400 Received: from ug-out-1314.google.com ([66.249.92.171]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HqluN-00044s-6l for emacs-orgmode@gnu.org; Wed, 23 May 2007 04:09:23 -0400 Received: by ug-out-1314.google.com with SMTP id 34so465020ugf for ; Wed, 23 May 2007 01:09:16 -0700 (PDT) In-Reply-To: <20070521020326.GA14277@baal.lan> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Trent Buck Cc: emacs-orgmode@gnu.org 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