emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Add the capture feature "%(sexp)" to org-feed
Date: Sat, 11 Aug 2012 20:11:47 +0200	[thread overview]
Message-ID: <CALn3zoiT4EmWA17ty+otReVHFNmfdKY+EYtA8iyYVz3-7zPgHg@mail.gmail.com> (raw)
In-Reply-To: <87obmhv04u.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

Hi Bastien

On Sat, Aug 11, 2012 at 6:55 PM, Bastien <bzg@gnu.org> wrote:
> Michael Brand <michael.ch.brand@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

[-- Attachment #2: 0001-Improve-parsing-of-org-capture-inside-embedded-elisp.patch.txt --]
[-- Type: text/plain, Size: 1174 bytes --]

From 10888cbd40e3f546b9e577ff59bfa152679f9628 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@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	other threads:[~2012-08-11 18:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-16 15:53 Add the capture feature "%(sexp)" to org-feed Michael Brand
2012-06-17  2:07 ` Nick Dokos
2012-06-24 17:51   ` Michael Brand
2012-08-07 23:05     ` Bastien
2012-08-09 14:07       ` Michael Brand
2012-08-09 14:53         ` Bastien
2012-08-09 18:00           ` Michael Brand
2012-08-10  8:53             ` Bastien
2012-08-11 15:31               ` Michael Brand
2012-08-11 16:55                 ` Bastien
2012-08-11 18:11                   ` Michael Brand [this message]
2012-08-11 21:59                     ` Bastien
2012-08-12  9:37                       ` Michael Brand
2012-08-12 10:12                         ` Bastien
2012-08-09 21:09           ` Ivan Andrus
2012-08-10  4:48             ` Michael Brand
2012-08-10  7:24               ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALn3zoiT4EmWA17ty+otReVHFNmfdKY+EYtA8iyYVz3-7zPgHg@mail.gmail.com \
    --to=michael.ch.brand@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).