From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Dunsmore Subject: Re: Bug: Refile sometimes loses the last line [7.7 (release_7.7.15.gc363)] Date: Wed, 03 Aug 2011 10:05:41 -0500 Message-ID: <8762meedru.fsf@riotblast.dunsmor.com> References: <8762mh69yj.fsf@norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:38688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qod14-0007uj-DP for emacs-orgmode@gnu.org; Wed, 03 Aug 2011 11:05:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qod13-0003Ww-6h for emacs-orgmode@gnu.org; Wed, 03 Aug 2011 11:05:50 -0400 Received: from deathroller.dunsmor.com ([98.129.169.48]:58112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qod13-0003Uf-3a for emacs-orgmode@gnu.org; Wed, 03 Aug 2011 11:05:49 -0400 In-Reply-To: <8762mh69yj.fsf@norang.ca> (Bernt Hansen's message of "Mon, 01 Aug 2011 00:18:28 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bernt Hansen Cc: emacs-orgmode@gnu.org Hi Bernt, Can you see if this patch fixes the problem? --8<---------------cut here---------------start------------->8--- diff --git a/lisp/org.el b/lisp/org.el index c7b28dd..41ac8c6 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -19212,7 +19212,9 @@ Returns the number of empty lines passed." (let ((pos (point))) (if (cdr (assoc 'heading org-blank-before-new-entry)) (skip-chars-backward " \t\n\r") - (forward-line -1)) + (unless (eq (line-number-at-pos) + (count-lines (point-min) (point-max))) + (forward-line -1))) (beginning-of-line 2) (goto-char (min (point) pos)) (count-lines (point) pos))) --8<---------------cut here---------------end--------------->8--- Thanks, Jason