[Top][All Lists]

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

Re: [O] Moving my init.el to Org

From: Thorsten Jolitz
Subject: Re: [O] Moving my init.el to Org
Date: Tue, 02 Sep 2014 11:22:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Alan Schmitt <address@hidden> writes:

> On 2014-09-01 23:24, Thorsten Jolitz <address@hidden> writes:
>> Thats a bug, it should be fixed now in branch tj-outorg (which should
>> actually be faster and better than master anyway and will hopefully be
>> merged in a few weeks or so).
> Great, thanks.
>> can you test it too?
> Unfortunately I install navi as a package, so it's not easy for me to
> switch branches. Let me know when you do the merge and I'll definitely
> test then. (There is no hurry as I manually converted the file to
> outshine format, which was less painful than I feared.)

Too bad, I thought I found a beta-tester for the outshine/outorg/navi
"tj" branches before merging them into master ;)

And sorry for the hassle of manual converting, the bug was actually in
this function, so in case you want to convert another org file, here is
the (hopefully) fixed version:

#+BEGIN_SRC emacs-lisp
(defun outorg-transform-active-source-block-headers ()
  "Move switches and arguments on top of block.

This functions transforms all active source-blocks, i.e. those
with the associated source-code buffer's major-mode as
language. If there are switches and header arguments after the
language specification on the #+BEGIN_SRC line, they are moved on
top of the block.

The idea behind this function is that it should be possible to
specify permanent switches and arguments even for source-code
blocks that are transformed back to code after
`outorg-copy-and-switch' is called. They will remain as comment
lines directly over their code section in the source-code buffer,
and thus be transformed to text - and thereby activated - everytime
`outorg-edit-as-org' is called."
    (let* ((mode (outorg-get-buffer-mode
                  (marker-buffer outorg-code-buffer-point-marker)))
            (outorg-get-babel-name mode 'as-strg-p)))
      (org-babel-map-src-blocks nil
        (when (string-equal active-lang lang)
          (let ((sw switches)
                (args header-args))
            (goto-char end-lang)
            (delete-region (point) (line-end-position))
            (goto-char beg-block)
            (forward-line -1)
            (when (org-string-nw-p sw)
              (insert (format "#+header: %s" sw)))
            (when (org-string-nw-p args)
              (let ((params
                       (org-split-string args)))
                (while params
                  (setq headers
                         (format "#+header: %s %s"
                                 (org-no-properties (pop params))
                                 (org-no-properties (pop params)))
                (insert (mapconcat 'identity headers "\n"))))))))))


reply via email to

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