From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kelly Dean Subject: Outline and org-mode don't insert text into folded sections logically Date: Sat, 3 Sep 2011 12:14:59 -0700 (PDT) Message-ID: <1315077299.1785.YahooMailClassic@web121520.mail.ne1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:33114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzvgF-0001ME-KF for emacs-orgmode@gnu.org; Sat, 03 Sep 2011 15:15:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QzvgE-0006Lm-Bs for emacs-orgmode@gnu.org; Sat, 03 Sep 2011 15:15:03 -0400 Received: from nm7-vm1.bullet.mail.ne1.yahoo.com ([98.138.90.250]:27938) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QzvgE-0006LM-0C for emacs-orgmode@gnu.org; Sat, 03 Sep 2011 15:15:02 -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: emacs-orgmode@gnu.org Using Emacs 23.2.1, make a buffer in outline mode and enter this: *1A Body of 1A **2A Body of 2A ***3A Body of 3A *1B Body of 1B Now, collapse all except the first item, so you have: *1A Body of 1A... *1B... Put the point at the beginning of the line "*1B...", type "test" and press enter. Now you have: *1A Body of 1A... test *1B... Which item is the new line "test" part of? It looks like it should be part of 1A, but that's impossible, due to the use of implicit item termination and the existence of items 2A and 3A. Expanding the text gives: *1A Body of 1A **2A Body of 2A ***3A Body of 3A test *1B Body of 1B So, the new line is part of 3A, which can be confirmed by hiding 3A, which will hide both the line "Body of 3A" and "test". Why is this a problem? Because it's illogical for the new line to appear on screen but go into an item which is folded away (besides that, there's not even any indication on screen of which item the line is going into). If the new line is part of the body of 3A, then shouldn't the entirety of that body (including the line "Body of 3A") be shown, rather than just part of it (the line "test")? The problem could logically be solved by _not_ printing the line onto the screen as it's typed, since it's going into a body which is folded away, but of course this would make for a very unfriendly user interface. Alternatively, upon typing the first character of the new line, the body of 3A could be automatically unfolded (and the heading of 2A unfolded above it) to make it obvious where the text is going, but this is also not very friendly, because it modifies the folding state without the user's explicit request, and causes a potentially large and disorienting change in the on-screen display when the user was just trying to type in a little bit of text. The most reasonable solution seems to be to reject the text entry attempt, and treat it as though the user is attempting to modify read-only text (which Emacs is already capable of handling); just display a message explaining that in order to enter text at the current position, the outline must be unfolded. This is reasonable (assuming implicitly terminating items by the beginning of the next item is even an appropriate model for the outline in the first place, as opposed to using an explicit termination symbol) because entering the new line "test" under the visual line "Body of 1A..." is most likely not an actual attempt by the user to enter the line into the body of 3A; it's much more likely a mistake, with the intended destination for the text being somewhere else, perhaps even the body of 1A but following the fold, due to the user failing to realize that implicit item termination makes that impossible, or forgetting that the outline mode is using implicit item termination. Org-mode exhibits the same problem which outline mode does. Put spaces after the asterisks as org-mode requires, switch to org-mode, and cycle visibility to _overview_ to get: * 1A... * 1B... Put the point at the beginning of the line "* 1B...", type "test2" and press enter. Now you have: * 1A... test2 * 1B... Cycle visibility to _show all_, and you see that "test2" has been entered into the body of 3A.