From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: Bug: Refile sometimes loses the last line [7.7 (release_7.7.15.gc363)] Date: Wed, 03 Aug 2011 21:35:40 -0400 Message-ID: <87y5zarmab.fsf@norang.ca> References: <8762mh69yj.fsf@norang.ca> <8762meedru.fsf@riotblast.dunsmor.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:38565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qomql-0006rn-Py for emacs-orgmode@gnu.org; Wed, 03 Aug 2011 21:35:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qomqk-0006ze-Hu for emacs-orgmode@gnu.org; Wed, 03 Aug 2011 21:35:51 -0400 Received: from mho-04-ewr.mailhop.org ([204.13.248.74]:18029 helo=mho-02-ewr.mailhop.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qomqk-0006z6-G8 for emacs-orgmode@gnu.org; Wed, 03 Aug 2011 21:35:50 -0400 In-Reply-To: <8762meedru.fsf@riotblast.dunsmor.com> (Jason Dunsmore's message of "Wed, 03 Aug 2011 10:05:41 -0500") 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: Jason Dunsmore Cc: emacs-orgmode@gnu.org Jason Dunsmore writes: > Hi Bernt, > > Can you see if this patch fixes the problem? > > 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))) This patch fixes it for me. Thanks!! Regards, Bernt