From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: BUG: Navigating table to change fields Date: Tue, 21 Apr 2009 09:44:53 +0200 Message-ID: <7535DA7F-33B6-4732-A12F-9F7BDE742CBE@gmail.com> References: <87myabyz2y.fsf@gollum.intra.norang.ca> <87iqkzyytv.fsf@gollum.intra.norang.ca> <87eivnyuux.fsf@gollum.intra.norang.ca> <75583D30-8CE7-4E7F-A22D-DA2F1C36E1ED@gmail.com> <0F844E46-FB8E-4118-9034-E7A9C12168EE@gmail.com> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LwBBQ-0003l4-NZ for emacs-orgmode@gnu.org; Tue, 21 Apr 2009 04:18:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LwBBL-0003jh-M9 for emacs-orgmode@gnu.org; Tue, 21 Apr 2009 04:18:24 -0400 Received: from [199.232.76.173] (port=40098 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LwBBL-0003jc-G9 for emacs-orgmode@gnu.org; Tue, 21 Apr 2009 04:18:19 -0400 Received: from mx20.gnu.org ([199.232.41.8]:55692) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LwBBL-0000vU-3q for emacs-orgmode@gnu.org; Tue, 21 Apr 2009 04:18:19 -0400 Received: from mail-qy0-f116.google.com ([209.85.221.116]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LwBBK-00064x-62 for emacs-orgmode@gnu.org; Tue, 21 Apr 2009 04:18:18 -0400 Received: by qyk14 with SMTP id 14so4330568qyk.14 for ; Tue, 21 Apr 2009 01:18:17 -0700 (PDT) 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: Eric Schulte Cc: emacs-orgmode@gnu.org On Apr 21, 2009, at 12:02 AM, Eric Schulte wrote: > Maybe a list rather than a hook, say `org-cycle-actions'. Each > element > of the list could be called in the current context until one returns a > non-nil result. Something like... > > (let ((pending org-cycle-actions) > finished) > (while (not finished) > (setq finished (funcall (car pending))) > (setq pending (cdr pending)))) > > If the existing org-cycle actions (fold headline, org-cycle-table, > etc...) were implemented using the list then users could have the > options of putting their actions before or after (after being good if > say they have a very expensive check which shouldn't be run every time > tab is hit). > > Does that sound appropriate? -- Eric This would be a very general solution. However, maybe this is more than we need, it is not so easy to implement because org-cycle handles a number of special cases which have grown into it over the years. I guess a good solution will to to make several hooks which I have done now. I believe yasnippet should hook itself into the third one. Here are the hooks: (defvar org-tab-first-hook nil "Hook for functions to attach themselves to TAB. See `org-ctrl-c-ctrl-c-hook' for more information. This hook runs as the first action when TAB is pressed. If any function in this hook returns t, not other actions like table field motion visibility cycling will be done.") (defvar org-tab-after-check-for-table-hook nil "Hook for functions to attach themselves to TAB. See `org-ctrl-c-ctrl-c-hook' for more information. This hook runs after it has been established that the cursor is not in a table, but before checking if the cursor is in a headline or if global cycling should be done. If any function in this hook returns t, not other actions like visibility cycling will be done.") (defvar org-tab-after-check-for-cycling-hook nil "Hook for functions to attach themselves to TAB. See `org-ctrl-c-ctrl-c-hook' for more information. This hook runs after it has been established that not table field motion and not visibility should be done because of current context. This is probably the place where a package like yasnippets can hook in.") > > Carsten Dominik writes: > >> So what would be the right place to call it? Which context checks >> should com before the hook, and which after? >> >> - Carsten >> >> On Apr 20, 2009, at 11:02 PM, Eric Schulte wrote: >> >>> A hook in org-cycle could be useful aside from yasnippets. I >>> recently >>> found myself writing a defadvice for org-cycle in a situation >>> where a >>> hook would have been preferable. -- Eric >>> >>> Carsten Dominik writes: >>> >>>> Maybe we should have a hook in org-cycle where yasnippet can >>>> hook into, instead of overruling the TAB key...... >>>> >>>> - Carsten >>>> >>>> On Apr 20, 2009, at 9:43 PM, Bernt Hansen wrote: >>>> >>>>> Nevermind. It works. >>>>> >>>>> Gah. Sorry for the noise. This turns out to be my yasnippet setup >>>>> messing up the TAB key in tables. :/ It works fine for a minimal >>>>> emacs >>>>> test. >>>>> >>>>> -Bernt >>>>> >>>>> Bernt Hansen writes: >>>>> >>>>>> Okay I think this is a bug. If I traverse the table FORWARDS >>>>>> with >>>>>> TAB >>>>>> and type it inserts in front of the field that is there. If I >>>>>> traverse >>>>>> it BACKWARDS with S-TAB it clears the field when I type. >>>>>> >>>>>> This seems inconsistent (and I really like the blank the field as >>>>>> soon >>>>>> as you type behaviour) >>>>>> >>>>>> -Bernt >>>>>> >>>>>> >>>>>> Bernt Hansen writes: >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> Did the user interface for tables change recently? When I TAB >>>>>>> between >>>>>>> fields in a table entering anything normally blanks out the >>>>>>> field >>>>>>> and >>>>>>> replaces it with whatever new I am typing. >>>>>>> >>>>>>> Today it always seems to insert in front of whatever is already >>>>>>> there. >>>>>>> >>>>>>> I'm just wondering if this was an intentional change or if >>>>>>> it's a >>>>>>> bug. >>>>>>> I didn't notice anything in the release notes about this (but >>>>>>> maybe I >>>>>>> just missed it). >>>>>>> >>>>>>> -Bernt >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> 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 >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> 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 >>>>> >>>>> >>>>> _______________________________________________ >>>>> 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 >>>> >>>> >>>> >>>> _______________________________________________ >>>> 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 >>> >>> >>> _______________________________________________ >>> 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