From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: [RFC] Org Minor Mode? Date: Fri, 30 May 2014 16:15:23 +0200 Message-ID: <87y4xjnyis.fsf@gmail.com> References: <87ha61f4rk.fsf@gmail.com> <8738hlkn64.fsf@gmail.com> <87zjj9g87k.fsf@gmail.com> <877g5znrgl.fsf@bzg.ath.cx> <87y4xnzif9.fsf@gmail.com> <8738ft379k.fsf@bzg.ath.cx> <878uplim22.fsf@gmail.com> <87y4xl1mh5.fsf@bzg.ath.cx> <87zji0xysn.fsf@gmail.com> <87y4xks9a7.fsf@bzg.ath.cx> <87a99zlkbi.fsf@gmail.com> <87mwdzmplh.fsf@bzg.ath.cx> <878upjpeoc.fsf@gmail.com> <87lhtj8j8t.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqNb0-0005Xa-Hw for emacs-orgmode@gnu.org; Fri, 30 May 2014 10:15:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WqNau-0006vb-Ku for emacs-orgmode@gnu.org; Fri, 30 May 2014 10:15:46 -0400 Received: from plane.gmane.org ([80.91.229.3]:41925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqNau-0006vN-7W for emacs-orgmode@gnu.org; Fri, 30 May 2014 10:15:40 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WqNas-0001gE-OS for emacs-orgmode@gnu.org; Fri, 30 May 2014 16:15:38 +0200 Received: from g231233099.adsl.alicedsl.de ([92.231.233.99]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 30 May 2014 16:15:38 +0200 Received: from tjolitz by g231233099.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 30 May 2014 16:15:38 +0200 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 Bastien writes: Hi Bastien, > Thorsten Jolitz writes: >> What will be copied to the temp-buffer? Only the comment-section at >> point? The subtree at point? The (outcommented) element at point? Won't >> some Org functions fail without the subtree/buffer context? What if text >> is inserted as side-effect? E.g state change logs when going from TODO >> to done, or even footnotes? > > Well, I don't know. Again, all this feels certainly dirty, but I'm > trying to find something that will feel less awkward than making tons > of Org regexps relative to their contexts, including the context for > non-org-mode buffers... I thought about a very low level solution, i.e. at the syntax table level, giving "^ ... $" a different meaning, but thats a bit over my head and I have my doubt if its possible at all. BTW, I think I already implemented your idea for when porting the speed commands to outshine: ,-------------------------------------------------- | (defconst outshine-speed-commands-default | '( | ("Outline Navigation") | ("n" . (outshine-speed-move-safe | 'outline-next-visible-heading)) | [...] | ("j" . (outshine-use-outorg 'org-goto)) | ("g" . (outshine-use-outorg 'org-refile)) | ("Outline Visibility") | ("c" . outline-cycle) | ("C" . outshine-cycle-buffer) | ;; FIXME needs to be improved! | (" " . (outshine-use-outorg | (lambda () | (message | "%s" (substring-no-properties | (org-display-outline-path))) | (sit-for 1)) | 'WHOLE-BUFFER-P)) | [...] `-------------------------------------------------- This `outshine-use-outorg' function does more or less what you talk about: #+begin_src emacs-lisp (eval-after-load 'outorg '(defun outshine-use-outorg (fun &optional whole-buffer-p &rest funargs) "Use outorg to call FUN with FUNARGS on subtree. FUN should be an Org-mode function that acts on the subtree at point. Optionally, with WHOLE-BUFFER-P non-nil, `outorg-edit-as-org' can be called on the whole buffer. Sets the variable `outshine-use-outorg-last-headline-marker' so that it always contains a point-marker to the last headline this function was called upon. The old marker is removed first. Then a new point-marker is created before `outorg-edit-as-org' is called on the headline." (save-excursion (unless (outline-on-heading-p) (outline-previous-heading)) (outshine--set-outorg-last-headline-marker) (if whole-buffer-p (outorg-edit-as-org '(4)) (outorg-edit-as-org)) (if funargs (funcall fun funargs) (funcall fun)) (outorg-copy-edits-and-exit)))) #+end_src So maybe I should stop insisting on an org-minor-mode, because outshine and outorg together already do the trick? I just thought it would be better, faster and more powerfull if Org's regexps would be more abstract and Org functions could act directly in the programming mode buffers. -- cheers, Thorsten