emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Moving my init.el to Org
Date: Tue, 02 Sep 2014 11:22:06 +0200	[thread overview]
Message-ID: <87bnqyqsw1.fsf@gmail.com> (raw)
In-Reply-To: m2ppfeph5u.fsf@polytechnique.org

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> On 2014-09-01 23:24, Thorsten Jolitz <tjolitz@gmail.com> 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."
  (save-excursion
    (let* ((mode (outorg-get-buffer-mode
		  (marker-buffer outorg-code-buffer-point-marker)))
	   (active-lang
	    (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)
	      (newline)
	      (insert (format "#+header: %s" sw)))
	    (when (org-string-nw-p args)
	      (let ((params
		     (ignore-errors
		       (org-split-string args)))
		    headers)
		(while params
		  (setq headers
			(cons
			 (format "#+header: %s %s"
				 (org-no-properties (pop params))
				 (org-no-properties (pop params)))
			 headers)))
		(newline)
		(insert (mapconcat 'identity headers "\n"))))))))))
#+END_SRC

-- 
cheers,
Thorsten

  reply	other threads:[~2014-09-02  9:22 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-31  8:37 Moving my init.el to Org Marcin Borkowski
2014-08-31  9:20 ` Thorsten Jolitz
2014-08-31 10:05   ` Thorsten Jolitz
2014-08-31 12:45   ` Alan Schmitt
2014-08-31 14:12     ` Thorsten Jolitz
2014-09-01 20:27       ` Alan Schmitt
2014-09-01 21:24         ` Thorsten Jolitz
2014-09-02  8:20           ` Alan Schmitt
2014-09-02  9:22             ` Thorsten Jolitz [this message]
2014-08-31 10:37 ` Rasmus
2014-08-31 12:41 ` Grant Rettke
2014-09-01  1:24 ` Brady Trainor
2014-09-01 15:27 ` Oleh
2014-09-02  9:01   ` Rainer M Krug
2014-09-02 12:42     ` Rasmus
2014-09-02 12:52       ` Jonathan Leech-Pepin
2014-09-03  6:49         ` Rainer M Krug
2014-09-03 11:17     ` Oleh
2014-09-03 11:48       ` Rainer M Krug
2014-09-05 14:27 ` Marcin Borkowski
2014-09-06  2:49   ` Thorsten Jolitz
2014-09-06  9:26     ` Eduardo Ochs
2014-09-06 10:10       ` Thorsten Jolitz
2014-10-30 10:19     ` OrgStruct: start with collapsed view (was: Moving my init.el to Org) Karl Voit
2014-10-30 10:32       ` OrgStruct: start with collapsed view Rasmus
2014-10-30 12:41       ` Thorsten Jolitz
2014-10-31 22:10         ` Scott Randby
2014-11-01 10:16           ` Karl Voit
2014-11-01 10:44           ` Thorsten Jolitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bnqyqsw1.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).