emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] require-final-newline


From: Trent Buck
Subject: [Orgmode] require-final-newline
Date: Mon, 21 May 2007 12:03:26 +1000
User-agent: Mutt/1.5.13 (2006-08-11)

[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: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]