Jonas Bernoulli <jo...@bernoul.li> writes:

Hi List,

> Aaron Ecay <aarone...@gmail.com> writes:
>
>> Thorsten Jolitz wrote the outshine library
>
> I know. I used it for a while and contributed a few commits.  But I
> pretty much only used the cycling functionality at the time and when
> I discovered that `org-cycle' worked for that too, I stopped using
> outshine.  It also felt a bit like re-inventing the wheel.
>
>> Sadly it’s not actively maintained ATM, but I believe it still works
>> fine,

When I was a heavy outshine user myself it was feature rich and very
stable, and I think it still should be.  So being unmaintained does not
mean you can or should not use it, it only means that I did not add any
new features the last year (and sometimes miss a bug report,
unfortunately). But the three libraries of the outshine-suite
(outshine.el, outorg.el and navi-mode.el) already have so many features
that even the main author could not remember all of them ...

> That's a bit of an understatement; if I remember correctly Thorsten
> stopped using Emacs.

Its true that events in my life kicked me out of the (enjoyable) Emacs
universe, but now I actually use Emacs again once in a while, and hope
more frequently in the future.

>> and it may be an alternative route towards the features you are
>> looking for.
>
> Well currently I am just using `org-cycle' + `outline-minor-mode', which
> works well enough for now.  But eventually I would like to also start
> using Org's navigational commands.  Unfortunately `orgstruct-mode' only
> supports org-like headings (;; * heading\n;; ** subheadng) and not
> standard Emacs headings (;;; heading\n;;;; subheading).  I hope someone
> teaches `orgstruct-mode' to support the latter too.  Otherwise I will
> probably give `outshine' another chance.

When there are problems with orgstruct - while waiting for a new
implementation based on outline-minor-mode, why not use an existing,
much more powerfull and very stable alternative based on
outline-minor-mode?

When writing an org-minor-mode (orgstruct, outshine, ...) the most
frequent FAQ is by definition:

"I want Org-mode feature XYZ in org-minor-mode too."

The org-minor-mode author then figures out quickly that

 - Org-mode is not a library engineered for reuse by other
   applications. Org functions do many things, and its often hard or
   impossible to just call them for a result or even copy&paste them
   for reuse.
 - he does not want to rewrite Org-mode

My solution for outshine was 

,----[ C-h f outshine-use-outorg RET ]
| outshine-use-outorg is a Lisp function in `outshine.el'.
| 
| (outshine-use-outorg FUN &optional WHOLE-BUFFER-P &rest FUNARGS)
| 
| Use outorg to call FUN with FUNARGS on subtree or thing at point.
| 
| FUN should be an Org-mode function that acts on the subtree or
| org-element 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.
`----

With this function potentially all Org-mode commands can easily be made
available in outshine. In practise, some Org functions are really tricky
and need some extra care, but many work out of the box.

Here is what I more or less implemented already. Especially clocking was
tricky, don't remember if it really worked in the end:

,----
| 39 matches for "^[[:space:]]*(def[maus][^eltu][a-z]*\*? " in buffer: 
outshine.el
|      30:(defun outshine-deadline (&optional arg)
|      40:(defun outshine-export-dispatch (&optional arg)
|      59:(defun outshine-insert-link ()
|      67:(defun outshine-open-at-point (&optional whole-buffer-p arg 
reference-buffer)
|      84:(defun outshine-set-tags-command ()
|      97:(defun outshine-schedule (&optional arg)
|     108:(defun outshine-todo (&optional arg)
|     148:(defun outshine-time-stamp-inactive (&optional arg)
|     213:(defun outshine-priority ()
|     228:(defun outshine-time-stamp (&optional arg)
|     254:(defun outshine-toggle-fixed-width ()
|     260:(defun outshine-toggle-comment ()
|     304:(defun outshine-sort-entries (&optional arg)
|     366:(defun outshine-previous-block ()
|     373:(defun outshine-next-block ()
|     379:(defun outshine-insert-last-stored-link ()
|     571:(defun outshine-toggle-checkbox (&optional arg)
|     596:(defun outshine-clock-in ()
|     606:(defun outshine-clock-goto ()
|     625:(defun outshine-next-link ()
|     632:(defun outshine-clock-out ()
|     644:(defun outshine-previous-link ()
|     651:(defun outshine-clock-cancel ()
|     662:(defun outshine-clock-report (&optional arg)
|     732:(defun outshine-timer-pause-or-continue (&optional arg)
|     738:(defun outshine-timer-item ()
|     744:(defun outshine-timer ()
|     750:(defun outshine-timer-start ()
|     756:(defun outshine-timer-cancel-timer ()
|     762:(defun outshine-timer-set-timer ()
|     768:(defun outshine-agenda-set-restriction-lock (&optional arg)
|     780:(defun outshine-agenda-remove-restriction-lock (&optional 
include-org-p)
|     797:(defun outshine-inc-effort ()
|     818:(defun outshine-set-property-and-value ()
|     847:(defun outshine-toggle-archive-tag ()
|     865:(defun outshine-insert-drawer ()
|     871:(defun outshine-set-effort (&optional arg)
|     878:(defun outshine-footnote-action (&optional special)
|     906:(defun outshine-set-property ()
`----

There are much more outcommented function skeletons waiting for (your?)
implementation in section

,----
| ;;; Use Outorg for calling Org
`----

of outshine.el. Here are a few implementation examples to show how
easy this is:

,----
| ;; C-c C-x d  org-insert-drawer
| (defun outshine-insert-drawer ()
|   "Call outorg to trigger `org-insert-drawer'."
|   (interactive)
|   (outshine-use-outorg 'org-insert-drawer))
| 
| ;; C-c C-x e  org-set-effort
| (defun outshine-set-effort (&optional arg)
|   "Call outorg to trigger `org-set-effort'."
|   (interactive "p")
|   (outshine-use-outorg
|    'org-set-effort nil arg))
| 
| ;; C-c C-x f  org-footnote-action
| (defun outshine-footnote-action (&optional special)
|   "Call outorg to trigger `org-footnote-action'."
|   (interactive "P")
|   (outshine-use-outorg
|    'org-footnote-action 'WHOLE-BUFFER-P special))
| 
| ;; C-c C-x p  org-set-property
| (defun outshine-set-property ()
|   "Call outorg to trigger `org-set-property'."
|   (interactive)
|   (outshine-use-outorg 'org-set-property))
`----

With these commands, you can call Org-mode functionality directly in
comment sections of programming modes like emacs-lisp-mode, e.g. add
TODOs, TAGS, Properties, timestamps, (maybe) even clock-in and out. 

Here I added, as an example, some Org-mode headline stuff to org.el,
directly in the elisp buffer (with outline-minor-mode and outshine
activated):

,----
| ;;; TODO [#C] Commentary: :urgent:
| ;;   :PROPERTIES:
| ;;   :CATEGORY: office
| ;;   :END:
| 
| ;; Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
| ;; project planning with a fast and effective plain-text system.
`----

-- 
cheers,
Thorsten


Reply via email to