Hi Bastien

On Sat, Aug 11, 2012 at 6:55 PM, Bastien <b...@gnu.org> wrote:
> Michael Brand <michael.ch.br...@gmail.com> writes:
>> [...]
>> Also a small change against your latest patch to not stop at “%”
>> without following “(” and possibly miss a “%(” before.

This part that I changed between
http://patchwork.newartisans.com/patch/1405
and
http://patchwork.newartisans.com/patch/1408
got lost, the attached patch restores it.

> Actually we don't need the whole emacs-lisp-mode so that
> forward-sexp do something sensible.  This is enough:
>
>   (with-syntax-table emacs-lisp-mode-syntax-table ...)

Thank you for the improvement, this is a very interesting `with-'.

Michael
From 10888cbd40e3f546b9e577ff59bfa152679f9628 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.br...@gmail.com>
Date: Sat, 11 Aug 2012 20:08:35 +0200
Subject: [PATCH] Improve parsing of org-capture-inside-embedded-elisp-p

* org-capture.el (org-capture-inside-embedded-elisp-p): Improve parsing.
---
 lisp/org-capture.el |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 6882613..4d6e91d 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1539,9 +1539,12 @@ The template may still contain \"%?\" for cursor 
positioning."
   (let (beg end)
     (with-syntax-table emacs-lisp-mode-syntax-table
       (save-excursion
+       ;; `looking-at' and `search-backward' below do not match the "%(" if
+       ;; point is in its middle
+       (when (equal (char-before) ?%)
+         (backward-char))
        (save-match-data
-         (when (or (looking-at "%(")
-                   (and (search-backward "%" nil t) (looking-at "%(")))
+         (when (or (looking-at "%(") (search-backward "%(" nil t))
            (setq beg (point))
            (setq end (progn (forward-char) (forward-sexp) (1- (point)))))))
       (when (and beg end)
-- 
1.7.4.2

Reply via email to