emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [PATCH] Bug: Org capture: Invalid use of ‘\’ in replacement text [9.


From: Allen Li
Subject: [O] [PATCH] Bug: Org capture: Invalid use of ‘\’ in replacement text [9.1.14 (9.1.14-1049-g04641c-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181203/)]
Date: Fri, 7 Dec 2018 19:37:53 -0800

Attached patch fixing this.

This was caused by a bug in a feature that I did not realize existed
(prefixing each line in %i).  I have also included patches to clarify
the documentation.

On Fri, Dec 7, 2018 at 6:12 PM Allen Li <address@hidden> wrote:
>
> There's an escaping bug in Org capture:
>
> 1. emacs -Q
> 2. Evaluate:
>
> (setq org-capture-templates
>    '(("Z" "org-protocol capture" entry
>       (file "/tmp/tmp")
>       "* %?
> %(let ((x \"%:annotation\")) (if (string= x \"\") \"\" (concat x
> \"\\n\")))%i")))
>
> 3. Evaluate (require 'org-protocol)
>
> 4. Evaluate to simulate org protocol capture:
>
>     (org-protocol-capture '(:template "Z" :body "foo\nbar\n"))
>
> Causes error:
>
> (error "Capture abort: (error Invalid use of ‘\\’ in replacement text)")
>
> org-protocol is used in the example as that's where I encountered it,
> but the bug is in org-capture proper.
>
> Note that this works:
>
>     (org-protocol-capture '(:template "Z" :body "foo"))
>
> Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
>  of 2018-07-05
> Package: Org mode version 9.1.14 (9.1.14-1049-g04641c-elpaplus @
> /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181203/)

Attachment: 0002-Document-i-prefix-in-capture-templates.patch
Description: Text Data

Attachment: 0001-org-capture-Quote-regexp-for-initial-content-prefix.patch
Description: Text Data


reply via email to

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