[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] layout org-babel menu WAS: About org-babel menu
From: |
Rainer M Krug |
Subject: |
Re: [O] layout org-babel menu WAS: About org-babel menu |
Date: |
Tue, 10 Apr 2012 10:05:35 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/04/12 23:51, Eric Schulte wrote:
> Torsten Wagner <address@hidden> writes:
>
>> Hi,
>>
>> for me the biggest "trouble" with babel is to remember the possible keywords
>> in the header
>> for different languages. There were a lot of ongoing syntax change which did
>> not make it
>> easier for me to remember all this. Thus a menu which is organised by
>> languages offering all
>> possible settings for each language would be very helpful. | Python | | |
>> export - code -
>> result - both - none | | | tangle - no - yes- filename | | | result -
>> value - output |
>> | | ... | ...
>>
>> Not sure how effectual this would be in a main menu. It would be definitely
>> awesome in a
>> context menu
>>
>> That would be (copied from worg) [*] indicates cursor position
>>
>> #+NAME: factorial #+BEGIN_SRC haskell [*] :results silent :exports code :var
>> n=0
>>
>> a context menu would appear presenting all possible header arguments for
>> haskell
>>
>> #+NAME: factorial #+BEGIN_SRC haskell :results [*] :exports code :var n=0
>>
>> a context menu presenting all possible values for the header argument
>> :results in haskell I
>> guess that together with the possibility to call this menu by keyboard
>> strokes or
>> alternatively show the same infos in the minibuffer would be a great win for
>> babel and it
>> would make many questions here on the list unnecessary. Furthermore, any
>> change or extension
>> in the syntax for a certain language would be directly reflected to the
>> end-user. E.g., If I
>> suddenly see the menu entry :exports 3dprint, I would be curious and check
>> it out on worg and
>> the manual ;)
>>
>> Totti
>>
>
> Hi,
>
> I've put together a first pass at such support for interactive header
> argument look up. Please
> evaluate this elisp code [1] in your *scratch* buffer, then in an Org-mode
> buffer insert a code
> block like the following with the point at [*], and press tab.
>
> #+begin_src R :[*] :foo #+end_src
>
> You should see an auto-completion list showing which header arguments are
> available and (for
> those with known arguments) which arguments may be specified. This includes
> language specific
> header arguments, i.e., the R code block above suggests about twice as many
> possible header
> arguments as an elisp block. Note this "expand on tab after :" behavior is
> active on
> "#+headers:" lines as well.
>
> This makes use of the `org-babel-common-header-args-w-values' variable which
> holds header
> argument names and completions, as well as the
> org-babel-header-arg-names:lang variables.
>
> Does this seem like a good interface?
That looks really good - and I already seen a few header arguments I was not
aware of. I haven't
played a lot with it at the moment, but I would very much have it in org as
soon as possible - any
chance of adding it so that more users can try it easily?
Thanks a lot - looks really good, and I would say that with an autocomplete
like this, a menu
entry for header arguments (except help section) is not needed any more?
Cheers,
Rainer
>
> Is it missing any important functionality?
>
> Best,
>
> Footnotes: [1] ;; Add support for completing-read insertion of header
> arguments after ":"
> (defun org-babel-header-arg-expand () "Call
> `org-babel-enter-header-arg-w-completion' in
> appropriate contexts." (when (and (= (char-before) ?\:)
> (org-babel-where-is-src-block-head))
> (org-babel-enter-header-arg-w-completion (match-string 2))))
>
> (defun org-babel-enter-header-arg-w-completion (&optional lang) "Insert
> header argument
> appropriate for LANG with completion." (let* ((lang-headers-var (intern
> (concat
> "org-babel-header-arg-names:" lang))) (lang-headers (when (boundp
> lang-headers-var) (mapcar
> #'symbol-name (eval lang-headers-var)))) (headers (append (mapcar
> #'symbol-name
> org-babel-header-arg-names) lang-headers)) (header (org-completing-read
> "Header Arg: "
> headers)) (args (cdr (assoc (intern header)
> org-babel-common-header-args-w-values))) (arg (when
> (and args (listp args)) (org-completing-read (format "%s: " header) (mapcar
> #'symbol-name (car
> args)))))) (insert (concat header " " (or arg ""))) (cons header arg)))
>
> (add-hook 'org-tab-first-hook 'org-babel-header-arg-expand)
>
- --
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys.
(Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: address@hidden
Skype: RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk+D6c8ACgkQoYgNqgF2egpADACdEV42FKP0GzgsuvQmeEjHJ8d1
rWAAoImD7XHqmDlH5OCt0w9rLe0pq4K+
=ssL5
-----END PGP SIGNATURE-----
- Re: [O] layout org-babel menu WAS: About org-babel menu, (continued)
- Re: [O] layout org-babel menu WAS: About org-babel menu, Eric Schulte, 2012/04/06
- Re: [O] layout org-babel menu WAS: About org-babel menu, Thomas S. Dye, 2012/04/08
- Re: [O] layout org-babel menu WAS: About org-babel menu, Eric Schulte, 2012/04/10
- Re: [O] layout org-babel menu WAS: About org-babel menu, Rainer M Krug, 2012/04/11
- Re: [O] layout org-babel menu WAS: About org-babel menu, Eric Schulte, 2012/04/11
- Re: [O] layout org-babel menu WAS: About org-babel menu, Thomas S. Dye, 2012/04/11
- Re: [O] layout org-babel menu WAS: About org-babel menu, Eric Schulte, 2012/04/13
- [O] [bug?] Re: layout org-babel menu, Yagnesh Raghava Yakkala, 2012/04/13
- Re: [O] [bug?] Re: layout org-babel menu, Eric Schulte, 2012/04/14
- Re: [O] [bug?] Re: layout org-babel menu, Nick Dokos, 2012/04/14
- Re: [O] layout org-babel menu WAS: About org-babel menu,
Rainer M Krug <=
- Re: [O] layout org-babel menu WAS: About org-babel menu, Bastien, 2012/04/10
- Re: [O] layout org-babel menu WAS: About org-babel menu, Rainer M Krug, 2012/04/11
- Re: [O] layout org-babel menu WAS: About org-babel menu, Yagnesh Raghava Yakkala, 2012/04/11
- Re: [O] layout org-babel menu WAS: About org-babel menu, Bastien, 2012/04/11
- Re: [O] layout org-babel menu WAS: About org-babel menu, Bastien, 2012/04/11
- Re: [O] layout org-babel menu WAS: About org-babel menu, Rainer M Krug, 2012/04/11
- Re: [O] layout org-babel menu WAS: About org-babel menu, Eric Schulte, 2012/04/11
- Re: [O] layout org-babel menu WAS: About org-babel menu, Eric Schulte, 2012/04/11