emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: Jason Dunsmore <emacs-orgmode@dunsmor.com>
Cc: David Maus <dmaus@ictsoc.de>,
	emacs-orgmode@gnu.org, Bernt Hansen <bernt@norang.ca>
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	[thread overview]
Message-ID: <874o1xtc0w.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <87r5519rdf.fsf@riotblast.dunsmor.com>

[-- Attachment #1: Type: text/plain, Size: 1716 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 230 bytes --]

  reply	other threads:[~2011-08-04 15:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01  4:18 Bug: Refile sometimes loses the last line [7.7 (release_7.7.15.gc363)] Bernt Hansen
2011-08-03 15:05 ` Jason Dunsmore
2011-08-04  1:35   ` Bernt Hansen
2011-08-04 14:07     ` David Maus
2011-08-04 14:35       ` Jason Dunsmore
2011-08-04 15:46         ` David Maus [this message]
2011-08-04 23:07           ` Bernt Hansen
2011-08-16 13:17       ` Bastien
2011-08-16 16:19         ` Bastien
2011-08-16 17:18           ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874o1xtc0w.wl%dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=bernt@norang.ca \
    --cc=emacs-orgmode@dunsmor.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).