From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: bug? in orgstruct-mode Date: Sun, 22 Feb 2009 18:39:23 +0100 Message-ID: References: Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: multipart/mixed; boundary="===============1798291702==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LbIIb-0007a9-1e for emacs-orgmode@gnu.org; Sun, 22 Feb 2009 12:39:29 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LbIIZ-0007Zn-5S for emacs-orgmode@gnu.org; Sun, 22 Feb 2009 12:39:28 -0500 Received: from [199.232.76.173] (port=50246 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LbIIZ-0007Zk-1N for emacs-orgmode@gnu.org; Sun, 22 Feb 2009 12:39:27 -0500 Received: from nf-out-0910.google.com ([64.233.182.187]:55119) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LbIIY-0005Gu-Hm for emacs-orgmode@gnu.org; Sun, 22 Feb 2009 12:39:26 -0500 Received: by nf-out-0910.google.com with SMTP id d3so370171nfc.26 for ; Sun, 22 Feb 2009 09:39:25 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Austin Frank Cc: emacs-orgmode@gnu.org --===============1798291702== Content-Type: multipart/alternative; boundary=Apple-Mail-2--680873784 --Apple-Mail-2--680873784 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Hi Austin, yes, this is something I have been missing myself. However, the problem is the following: orgstruct-mode is a mode that steals away bindings from the major mode and overrules them in certain contexts. In general, it does make sense to keep the regions where this applies small, so that the normal functions bound to the same keys can do there thing everywhere else. You are describing here a case, where you actually never want to use the original function of that key M-RET, right? In this case you can just totally rebind that key with something like (defun org-run-insert-heading () (interactive) (run-like-in-org-mode 'org-insert-heading)) and binding it to M-RET in the major mode map. What I have now done as well is to extend orgstruct++-mode so that it will do what you ask for. You neet to pull the git version for this change. - Carsten On Feb 22, 2009, at 12:23 AM, Austin Frank wrote: > Hi all-- > > In normal org buffers, creating a new list item works fine at the > end of > a multi-line list item, or on the line following a multi-line list > item, > even if the multi-line item covers lots of lines. In orgstruct- > mode, it > seems that new items can't be inserted unless the current line is a > list > item. > > Can orgstruct-mode be made to be as good as org-mode at recognizing > when > it's in a plain list? It'd be nice to be able to create a new list > item > after a multi-line item in orgstruct-mode. > > Steps to reproduce: > 1. emacs -Q -nw test.txt > 2. `M-:' (require 'org-install) > 3. `M-x orgstruct-mode' > 4. Create a list item like > > --8<---------------cut here---------------start------------->8--- > - item 1 > --8<---------------cut here---------------end--------------->8--- > > 5. `M-return' to get a new list item > 6. `C-u C-4 C-0 x SPC C-u C-4 C-0 x' to get two long "words" > 7. `M-q' to wrap the long list item. Now looks like: > > --8<---------------cut here---------------start------------->8--- > - item 1 > - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > --8<---------------cut here---------------end--------------->8--- > > 8a. At the end of the third line, try to add a new list item with > `M-return'. I get the message: > > #v+ > orgstruct-error: This key has no function outside structure elements > #v- > > 8b. At the beginning of a new line below the third line, hit > `M-return'. Same error. > > Expected behavior: > Following the same sequence in org-mode, steps 8a and 8b will both > result in a new list item being created correctly. > > > This took me longer to figure out than it should have, but this also > has > an unpleasant interaction with the default keybindings for message- > mode. > If I am writing an email and try to insert a new list item after a > wrapped like using `M-return' I end up invoking > `message-newline-and-reformat', which moves me down a line and then > inserts four blank lines-- not what I wanted to do! If orgstruct-mode > learns to recognize when it's in plain list context, this problem will > disappear :) > > Thanks! > /au > > > -- > Austin Frank > http://aufrank.net > GPG Public Key (D7398C2F): http://aufrank.net/personal.asc > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Apple-Mail-2--680873784 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi = Austin,

yes, this is something I have been missing = myself.

However, the problem is the = following:

orgstruct-mode is a mode that steals = away bindings from the major mode
and overrules them in = certain contexts.  In general, it does make sense
to keep = the regions where this applies small, so that the = normal
functions bound to the same keys can do there thing = everywhere else.

You are describing here a = case, where you actually never want to use
the original = function of that key M-RET, right?

In this case = you can just totally rebind that key with something = like

(defun org-run-insert-heading = ()
   (interactive)
   = (run-like-in-org-mode 'org-insert-heading))

and = binding it to M-RET in the major mode map.

What = I have now done as well is to extend orgstruct++-mode so that it = will
do what you ask for.  You neet to pull the git = version for this change.

- = Carsten


On Feb 22, 2009, at 12:23 = AM, Austin Frank wrote:

Hi = all--

In normal org buffers, creating a new list item works fine = at the end of
a multi-line list item, or on the line following a = multi-line list item,
even if the multi-line item covers lots of = lines.  In orgstruct-mode, it
seems that new items can't be = inserted unless the current line is a list
item.

Can = orgstruct-mode be made to be as good as org-mode at recognizing = when
it's in a plain list?  It'd be nice to be able to create a = new list item
after a multi-line item in orgstruct-mode.

Steps = to reproduce:
1. emacs -Q -nw test.txt
2. `M-:' (require = 'org-install)
3. `M-x orgstruct-mode'
4. Create a list item = like

--8<---------------cut = here---------------start------------->8---
- item = 1
--8<---------------cut = here---------------end--------------->8---

5. `M-return' to get a = new list item
6. `C-u C-4 C-0 x SPC C-u C-4 C-0 x' to get two long = "words"
7. `M-q' to wrap the long list item.  Now looks = like:

--8<---------------cut = here---------------start------------->8---
- item 1
- = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
=  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--8<---------------cu= t here---------------end--------------->8---

8a. At the end of = the third line, try to add a new list item with
=    `M-return'.  I get the = message:

#v+
orgstruct-error: This key has no function outside = structure elements
#v-

8b. At the beginning of a new line = below the third line, hit
   `M-return'.  Same = error.

Expected behavior:
Following the same sequence in = org-mode, steps 8a and 8b will both
result in a new list item being = created correctly.


This took me longer to figure out than it = should have, but this also has
an unpleasant interaction with the = default keybindings for message-mode.
If I am writing an email and = try to insert a new list item after a
wrapped like using `M-return' I = end up invoking
`message-newline-and-reformat', which moves me down a = line and then
inserts four blank lines-- not what I wanted to do! =  If orgstruct-mode
learns to recognize when it's in plain list = context, this problem will
disappear = :)

Thanks!
/au


--
Austin Frank
http://aufrank.net
GPG Public Key = (D7398C2F): = http://aufrank.net/personal.asc
_______________________________________= ________
Emacs-orgmode mailing list
Remember: use `Reply All' to = send replies to the = list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/em= acs-orgmode

= --Apple-Mail-2--680873784-- --===============1798291702== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1798291702==--