Re: [O] Multi-step ledger org-capture template

2018-08-23 Thread Stefan Huchler
Hmm I seem to be unable to access the data from the org-table.

org-element-map seems to be pretty poorly documented, I get the data but
in a strange format, (length row) returns 8 despite the table having
only 6 rows.

Also somehow I can't get to the data with cdr or nth or similar sequence
functions.

Is there some magic trick to get data (cells) from a org-table?


%(progn
   (with-current-buffer (org-capture-get :original-buffer)
 (call-interactively 'copy-region-as-kill))
   (with-temp-buffer
 "*deissenhof-import-temp*"
 (erase-buffer)
 (yank)
 (org-table-convert-region (buffer-end -1) (buffer-end 1) 2)
 (org-element-map (org-element-parse-buffer) 'table-row
   (lambda (row)
 (print "ROW ")
 (print (length row))
 (print " ROW"))
   nil t)
 (buffer-string)))




Re: [O] How to font-lock diffs?

2018-08-23 Thread Marcin Borkowski


On 2018-08-22, at 14:52, Nick Dokos  wrote:

> Marcin Borkowski  writes:
>
>> Hi all,
>>
>> I hoped this:
>>
>> #+begin_src diff
>>   @@ -1,5 +1,5 @@
>>   -lorem
>>   +Lorem
>>ipsum
>>dolor
>>sit
>>   -amet
>>   +amet.
>> #+end_src
>>
>> would Just Work™, i.e., the diff would be font-locked like in
>> diff-mode.  Well, it is not.  How do I convince Org-mode to color my
>> diffs?
>>
>
> By somehow elimintating the indentation perhaps?

Thanks Nick (and John, in previous message).  This works indeed.

However, double C-c ' on the source block reintroduces the
indentation...

Still, I can live with it as-is.

Best,

-- 
Marcin Borkowski
http://mbork.pl



Re: [O] How to font-lock diffs?

2018-08-23 Thread Leslie Watter
Hi Marcin,

You can configure this behaviour of org-mode (setting the identation of
source blocks to 0) using the following code: (put it in your emacs config
file)

(setq org-edit-src-content-indentation 0)

Hope it helps.

Cheers,

LEslie


On Thu, Aug 23, 2018 at 4:05 PM Marcin Borkowski  wrote:

>
> On 2018-08-22, at 14:52, Nick Dokos  wrote:
>
> > Marcin Borkowski  writes:
> >
> >> Hi all,
> >>
> >> I hoped this:
> >>
> >> #+begin_src diff
> >>   @@ -1,5 +1,5 @@
> >>   -lorem
> >>   +Lorem
> >>ipsum
> >>dolor
> >>sit
> >>   -amet
> >>   +amet.
> >> #+end_src
> >>
> >> would Just Work™, i.e., the diff would be font-locked like in
> >> diff-mode.  Well, it is not.  How do I convince Org-mode to color my
> >> diffs?
> >>
> >
> > By somehow elimintating the indentation perhaps?
>
> Thanks Nick (and John, in previous message).  This works indeed.
>
> However, double C-c ' on the source block reintroduces the
> indentation...
>
> Still, I can live with it as-is.
>
> Best,
>
> --
> Marcin Borkowski
> http://mbork.pl
>
>

-- 
Leslie H. Watter


Re: [O] How to font-lock diffs?

2018-08-23 Thread Samuel Wales
i ran into this type of thing years ago and wrote this summary in
comments to remind myself of the issues.  maybe it will be useful to
somebody.

;; when you edit a source or data block, org will by default
;; remove some leading whitespace and then add 2 spaces, so the
;; whole block in org is indented by 2.
;;
;; (the deleted rectangle seems to be the maximum amount of
;; whitespace common to all lines in each block.)
;;
;; initial tabs get converted to spaces, which breaks things.
;; example blocks get unindented during export incorrectly.
;; mistakes are possible.
;;
;; this as non-nil prevents all that.
;;
;; we EITHER unindent all and set this non-nil, OR put up with
;; stripping of leading whitespace from blocks.
;;
;; /i prefer t./ it is not possible in babel to indent without
;; having the special feature of removing the whitespace
;; rectangle.
;;
;; you can use -i to locally do t.  there isn't the reverse of
;; -i.  there are no long options.
;;
;; source blocks might actually work without indentation even
;; with the default value, but then when you edit it indents.
(setq org-src-preserve-indentation t)

-- 
The Kafka Pandemic: 

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

"You’ve really gotta quit this and get moving, because this is murder
by neglect." ---
.



Re: [O] coderef link should support external file path link.

2018-08-23 Thread numbch...@gmail.com
Maybe I forgot it. Could be another suggestion because I have not found it
in my recorded issues. (addded it now)
Hmm. Recently I don't have time to check it out. If I got time to do this,
I will update it here. It's not urgent, if you don't have time too, leave
it opened is fine.

[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Wed, Aug 22, 2018 at 8:46 PM Nicolas Goaziou 
wrote:

> Hello,
>
> stardiviner  writes:
>
> > When I use ~org-store-link~ in an opened src block to create a coderef
> > link, then I ~org-insert-link-global~ in another Org file, but it only
> > has "~(use formdata to send url with params)~" in link source (without
> > file path). It should contains the source file path like following. (I
> > have to manually fix this long path to make it work correctly).
> >
> > #+begin_src org
> >
> [[file:~/Org/Wiki/Web%20Scraping.org::(use%20formdata%20to%20send%20url%20with%20params)][use
> formdata to send url with params]]
> > #+end_src
>
> You suggested the very same idea some time ago. I answered I was open to
> patches in this direction. Do you feel like implementing it?
>
> Regards,
>
> --
> Nicolas Goaziou
>