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

2018-08-21 Thread stardiviner
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

--
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] 'foo' in '# [[foo]]' not underlined

2018-08-21 Thread Samuel Wales
  ;; make links in org comments fontified
  (highlight-regexp org-any-link-re 'org-link)
  ;; fixme maybe a different re here
  (highlight-regexp org-ts-regexp3 'org-date)
  ;; fixme in comments -- fixme refactor
  ;; fixme is this needed?
  (highlight-regexp "fixme" 'red)



Re: [O] 'foo' in '# [[foo]]' not underlined

2018-08-21 Thread Samuel Wales
On 8/21/18, Nicolas Goaziou  wrote:
> Indeed. If any volunteer wants to tweak the fontification code. Here be
> dragons...

i know it is possible at least as a kludge, because in maint, links in
comments show and work.  that's probably because i have a hook that
highlights them or something.

dunno where it is in my .emacs though.



Re: [O] decimal hours for clocking

2018-08-21 Thread Samuel Wales
seems to work in maint now.  :]

On 8/21/18, Nicolas Goaziou  wrote:
> Org maint is more or less outdated. It was mainly used for merge with
> Emacs. Now we are waiting for Org 9.2 to be released so that master can
> become the new maint branch.



Re: [O] Bug: org-indent-boundary-char doesn't have org-indent face [9.1.9 (release_9.1.9-65-g5e4542 @ c:/Program Files/emacs-26.1-x86_64/share/emacs/26.1/lisp/org/)]

2018-08-21 Thread Nicolas Goaziou
Hello,

HIRATA Tadashi  writes:

> I found a bug that org-indent-boundary-char doens't have
> org-indent face property in org-indent-mode. This causes an
> appearance issue when you use org-mode with whitespace-mode
> that you can't control org-indent-boundary-char's face
> neither whitespace-space face nor org-indent face.
>
> Here is a quick patch to fix the problem. (though I test it
> in 9.1.9, but it should work well in the latest version).

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] decimal hours for clocking

2018-08-21 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> i used to be able to do (setq org-duration-format '(("h" . nil)
> (special . 2)) to get decimal hours for clocking, like 43.22h meaning
> 43 hours and 22/60 minutes.
>
> in recent org maint, this seems to show up like 2d 11:22.

Org maint is more or less outdated. It was mainly used for merge with
Emacs. Now we are waiting for Org 9.2 to be released so that master can
become the new maint branch.

Could you try again with master branch? If it doesn't work, please send
an ECM.

Regards,

-- 
Nicolas Goaziou



Re: [O] [Bug] org-attach-set-directory

2018-08-21 Thread Nicolas Goaziou
Hello,

Florian Lindner  writes:

> doing C-a s  on an entry with an existing attachement produces
>
> make-directory: Die Datei existiert bereits: /home/florian/test/data/
>
> (translation: File already exists)
>
> Actually, I implemented this functionality with the help of Nicolas Goaziou, 
> but it seems an org mode or emacs upgrade broke it.
>
> I will try to debug that further, but right now, my time is very limited, 
> only undershot by my elisp knowledge.
>
> Maybe someone can more quickly fix that... ;-)
>
> Best,
> Florian
>
> Backtrace:
>
> Debugger entered--Lisp error: (file-already-exists "Die Datei existiert 
> bereits" "/home/florian/test/mydata")
>   make-directory-internal("/home/florian/test/mydata")
>   make-directory("/home/florian/test/mydata" nil)
>   
> copy-directory("/home/florian/test/data/c1/32d552-b7bb-43b1-b0d8-c57c00d61f9b"
> "/home/florian/test/mydata" t nil t)


It looks like "/home/florian/test/mydata" is not a valid directory name.
It should end with a forward slash.


Regards,

-- 
Nicolas Goaziou



Re: [O] Problem jumping back & forth between foonote ref and def with 'C-c C-c'

2018-08-21 Thread Nicolas Goaziou
Hello,

alain.coch...@unistra.fr writes:

> Now, I visit a file which contains only
>
>* head
>foo[fn:1] bar
>* Footnotes
>
>[fn:1] tnote
>
> If the cursor is anywhere within the 1st instance of '[fn:1] ' (that
> is, including the space) and I type 'C-c C-c' the cursor ends up on
> the 1st letter of 'tnote'.
>
> I am not sure if this corresponds to what the manual says but, if I
> type 'C-c C-c' again, I get
>
>user-error: `C-c C-c' can do nothing useful here
>
> i.e., I don't "jump back."  By contrast, with
>
>emacs -Q
>
> which gives
>
>Emacs : GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version
>3.18.9) of 2016-04-11 on buildvm-25.phx2.fedoraproject.org Package:
>Org-mode version 8.2.10 (release_8.2.10 @
>/usr/share/emacs/24.5/lisp/org/)
>
> if the cursor is anywhere within the 1st instance of '[fn:1]' and I
> type 'C-c C-c' the cursor ends up on the space before 'tnote'.  A 2nd
> 'C-c C-c' brings the cursor back to the 1st '[' of the 1st '[fn:1]'.
> This does correspond to what I would qualify as "jumping back."
>
> In other words, version 8.2.10 behaves as I expect, not the master
> version.  Am I doing/understanding something wrong?

As strange as it may sound, I think both are correct. 

In 9.1, Org puts point at the location where you can start to edit the
definition right away. If you want to "jump back", you can use the Org
mark ring, or simply move backward -- a single character is enough but
you can also move to the beginning of the line -- and use `C-c C-c'
again.

In 8.2, point is at a location where `C-c C-c' operates right away, but
you still have to move forward to start editing the definition.

My gut feelings is the current behaviour is slightly better, but YWWV.

WDYT?

> PS: note the typo in the manual excerpt: "If it is a the
> definition...".

This typo is not present in the latest manual.

Regards,

-- 
Nicolas Goaziou



Re: [O] ob-lilypond and 'Symbol’s function definition is void: org-babel-get-header'

2018-08-21 Thread Nicolas Goaziou
Hello,

Henrik Frisk  writes:

> I have been trying out ob-lilypond and it works really well, except for the
> arrange mode. Any attempt to run ly-tangle results in 'Symbol’s function
> definition is void: org-babel-get-header' and so does an attempt to export
> a file, such as the example file, in basic mode to html for instance.
>
> I was thinking it was related to sh/shell since this appears to be a common
> issue with regard to this error, but the ob-lilypond does not appear to use
> any reference to sh (the doc for ob-lilypond does). I also tried to load
> ob-core as was suggested in some post but that didn't work either.
>
> Other tangle other languages works fine.
>
> Any suggestions?

`org-babel-get-header' was removed in Org 9.0 and current ob-lilypond.el
doesn't call this function. My guess is you are mixing a new Org release
with an old "ob-lilypond.el".

Regards,

-- 
Nicolas Goaziou



Re: [O] 'foo' in '# [[foo]]' not underlined

2018-08-21 Thread Nicolas Goaziou
Hello,

Eric S Fraga  writes:

> On Wednesday,  4 Jul 2018 at 07:37, alain.coch...@unistra.fr wrote:
>> Hello.
>>
>> In the comment line
>>
>># [[foo]]
>>
>> there is only 'foo' which remains visible (which I understand), but
>> 'foo' is not even underlined.  
>
> This is probably because the face for comment lines overrides the face
> for links?  I see the same behaviour.

Indeed. If any volunteer wants to tweak the fontification code. Here be
dragons...

Regards,

-- 
Nicolas Goaziou



Re: [O] Request - make comments `bracket-dumb'

2018-08-21 Thread Nicolas Goaziou
Hello,

Colin Baxter  writes:

> If I launch emacs -q, create an org-mode file and enter a comment as
>
> # Blah blah  [[bib:blah]] blah blah.
>
> then the  brackets close up such that only one pair is visible. If I
> want both pairs visible then I have to write [ [bib:blah] ]. If I use
> #+begin_comment then the bracket content is also highlighted, as if it
> were active. Both pairs of brackets disappear if `bib:blah' is not present.
>
> This seems to me to be contrary to what a Comment should be - namely a
> piece of wholly dumb text. Could this not be achieved?

This is simply a fontification issue. Patches are welcome.

Regards,

-- 
Nicolas Goaziou



[O] Multi-step ledger org-capture template

2018-08-21 Thread Stefan Huchler
I want to insert a table from a email (gnus) into org-mode but before it
gets saved it should first be converted.

I can do it manually, copy the ascii table to a org-file:
mark it then use that command:

#+begin_src emacs-lisp
(defun my-make-table ()
  "docstring"
  (interactive)
  (org-table-convert-region (region-beginning)
(region-end) 2))
#+end_src
   
to convert it to a org-table (2 spaces or more is a seperator)
then use the following to create ledger style transaction:

#+begin_src emacs-lisp :var mapping=food-name-mapping data=import-table
  (let* ((rev-mapping
  (mapcar (lambda (x)
(list (nth 1 x) (car x)))
  mapping)))
(mapconcat
 (lambda (line)
   (format "%s \t\t%s St {=€%s}"
   (car (assoc-default (nth 1 line) rev-mapping))
   (nth 0 line)
   (nth 4 line)))
 data "\n"))
#+end_src

it uses this mapping table:

#+NAME: food-name-mapping
| expenses:food:vegetable:bananas | Bananas 125g |
| |  |

To map the names of the items of the shop to the ones I use in ledger.
First step would be to create a capture that at least imports it as
org-table something like that:

#+begin_src emacs-lisp
  ("K" "import Transaction" plain
   (file+function "~/notes/finanzen.org"
  (lambda () ""
(progn (org-babel-goto-named-src-block "balance")   
   (org-babel-goto-src-block-head)(forward-line
   "%(copy-region-as-kill) %(switch-buffer \"temp-ledger-import\") %(yank) 
%(mark-buffer)
  %(org-table-create-or-convert-from-region) %(buffer-string)" 
   :jump-to-captured t
   :empty-lines-after 1
   :immediate-finish nil)
#+end_src

But I would want to do both convertions before I want to capture it in
the end.  Can I do that or do I need to work with org-capture-hooks?
Any suggestions?