[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [RFC] Org Minor Mode?

From: Thorsten Jolitz
Subject: Re: [O] [RFC] Org Minor Mode?
Date: Fri, 30 May 2014 16:15:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Bastien <address@hidden> writes:

Hi Bastien,

> Thorsten Jolitz <address@hidden> 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

#+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."
       (unless (outline-on-heading-p)
       (if whole-buffer-p
           (outorg-edit-as-org '(4))
       (if funargs
           (funcall fun funargs)
         (funcall fun))

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. 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]