From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: Re: Bug: Refile sometimes loses the last line [7.7 (release_7.7.15.gc363)] Date: Thu, 04 Aug 2011 17:46:39 +0200 Message-ID: <874o1xtc0w.wl%dmaus@ictsoc.de> References: <8762mh69yj.fsf@norang.ca> <8762meedru.fsf@riotblast.dunsmor.com> <87y5zarmab.fsf@norang.ca> <877h6ti839.wl%dmaus@ictsoc.de> <87r5519rdf.fsf@riotblast.dunsmor.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Thu_Aug__4_17:46:38_2011-1"; micalg=pgp-sha256; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:52338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qp08K-0000cG-62 for emacs-orgmode@gnu.org; Thu, 04 Aug 2011 11:46:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qp08I-0007Wi-Es for emacs-orgmode@gnu.org; Thu, 04 Aug 2011 11:46:52 -0400 Received: from app1b.xlhost.de ([213.202.242.162]:45225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qp08I-0007US-54 for emacs-orgmode@gnu.org; Thu, 04 Aug 2011 11:46:50 -0400 In-Reply-To: <87r5519rdf.fsf@riotblast.dunsmor.com> 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: David Maus , emacs-orgmode@gnu.org, Bernt Hansen --pgp-sign-Multipart_Thu_Aug__4_17:46:38_2011-1 Content-Type: text/plain; charset=US-ASCII At Thu, 04 Aug 2011 09:35:24 -0500, Jason Dunsmore wrote: > > Hi David, > > > I just pushed a simplified version of the solution: No need to count > > lines, just check if point is at end of buffer. > > I just tried out your patch. The logic in your patch is slightly > different - it checks if the point is at the end of the last line in the > buffer, whereas mine checks if the point is anywhere on the last line. > I don't think it fixes the problem. Bernt, can you test it? I does it for me and should do the trick. I tracked down the problem to `org-copy-subtree' not beeing able to correctly determine the end of the subtree to copy. The problem is here: ,---- | (setq beg (point)) | (skip-chars-forward " \t\r\n") | (save-match-data | (save-excursion (outline-end-of-heading) | (setq folded (outline-invisible-p))) | (condition-case nil | (org-forward-same-level (1- n) t) | (error nil)) | (org-end-of-subtree t t)) | (org-back-over-empty-lines) `---- (org-end-of-subtree t t) moves point to either 1/ the beginning of the following sibling, 2/ the beginning of the last empty line in buffer if it is present, or 3/ to the end of the last line if an last empty line is missing. 3/ is the edge-case in question. 1/ and 2/ work with the assumption that point is /not/ inside the entry if back-over-empty-lines is called. Thus (forward-line -1) (beginning-of-line 2) for 1/ and 2/ means: Stay where you are. For 3/ it doesn't. For 3/ it moves point to the beginning of the last line in buffer, i.e. in front of the last line of content in the entry. Best, -- David -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de --pgp-sign-Multipart_Thu_Aug__4_17:46:38_2011-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAk46vt4ACgkQma24O1pEeOZSjwEAhUdqRSb9vaxrq4OBhIowsI1S bzj7iEXveKwpYkM1ODwA/2v8VLJk/1Jlfynk18rwqJTni4tthSzHqJnYsAfNFvq+ =U+ZJ -----END PGP SIGNATURE----- --pgp-sign-Multipart_Thu_Aug__4_17:46:38_2011-1--