emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BABEL] [PATCH] Make it possible to use buffer local noweb start/end patterns
@ 2012-08-25 22:22 Sean O'Halpin
  2012-08-25 22:50 ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Sean O'Halpin @ 2012-08-25 22:22 UTC (permalink / raw)
  To: Org Mode

* lisp/ob.el (org-babel-expand-noweb-references): Capture current
noweb start and end patterns then use to set buffer locals in
(with-temp-buffer) form.

This solves the problem that using different patterns for
org-babel-noweb-wrap-start and org-babel-noweb-wrap-end could be done
only globally.

TINYCHANGE
---
 lisp/ob.el |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lisp/ob.el b/lisp/ob.el
index 7518293..f9e9ae1 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -2270,6 +2270,8 @@ block but are passed literally to the \"example-block\"."
          (info (or info (org-babel-get-src-block-info)))
          (lang (nth 0 info))
          (body (nth 1 info))
+	 (ob-nww-start org-babel-noweb-wrap-start)
+	 (ob-nww-end org-babel-noweb-wrap-end)
 	 (comment (string= "noweb" (cdr (assoc :comments (nth 2 info)))))
 	 (rx-prefix (concat "\\(" org-babel-src-name-regexp "\\|"
 			    ":noweb-ref[ \t]+" "\\)"))
@@ -2282,6 +2284,8 @@ block but are passed literally to the \"example-block\"."
 		     (org-babel-trim (buffer-string)))))
 	 index source-name evaluate prefix blocks-in-buffer)
     (with-temp-buffer
+      (org-set-local 'org-babel-noweb-wrap-start ob-nww-start)
+      (org-set-local 'org-babel-noweb-wrap-end ob-nww-end)
       (insert body) (goto-char (point-min))
       (setq index (point))
       (while (and (re-search-forward (org-babel-noweb-wrap) nil t))
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [BABEL] [PATCH] Make it possible to use buffer local noweb start/end patterns
  2012-08-25 22:22 [BABEL] [PATCH] Make it possible to use buffer local noweb start/end patterns Sean O'Halpin
@ 2012-08-25 22:50 ` Eric Schulte
  2012-08-25 23:23   ` Sean O'Halpin
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2012-08-25 22:50 UTC (permalink / raw)
  To: Sean O'Halpin; +Cc: Org Mode

Are you familiar with file local variables?

See (info "(emacs)Specifying File Variables")

"Sean O'Halpin" <sean.ohalpin@gmail.com> writes:

> * lisp/ob.el (org-babel-expand-noweb-references): Capture current
> noweb start and end patterns then use to set buffer locals in
> (with-temp-buffer) form.
>
> This solves the problem that using different patterns for
> org-babel-noweb-wrap-start and org-babel-noweb-wrap-end could be done
> only globally.
>
> TINYCHANGE
> ---
>  lisp/ob.el |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/lisp/ob.el b/lisp/ob.el
> index 7518293..f9e9ae1 100644
> --- a/lisp/ob.el
> +++ b/lisp/ob.el
> @@ -2270,6 +2270,8 @@ block but are passed literally to the \"example-block\"."
>           (info (or info (org-babel-get-src-block-info)))
>           (lang (nth 0 info))
>           (body (nth 1 info))
> +	 (ob-nww-start org-babel-noweb-wrap-start)
> +	 (ob-nww-end org-babel-noweb-wrap-end)
>  	 (comment (string= "noweb" (cdr (assoc :comments (nth 2 info)))))
>  	 (rx-prefix (concat "\\(" org-babel-src-name-regexp "\\|"
>  			    ":noweb-ref[ \t]+" "\\)"))
> @@ -2282,6 +2284,8 @@ block but are passed literally to the \"example-block\"."
>  		     (org-babel-trim (buffer-string)))))
>  	 index source-name evaluate prefix blocks-in-buffer)
>      (with-temp-buffer
> +      (org-set-local 'org-babel-noweb-wrap-start ob-nww-start)
> +      (org-set-local 'org-babel-noweb-wrap-end ob-nww-end)
>        (insert body) (goto-char (point-min))
>        (setq index (point))
>        (while (and (re-search-forward (org-babel-noweb-wrap) nil t))

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BABEL] [PATCH] Make it possible to use buffer local noweb start/end patterns
  2012-08-25 22:50 ` Eric Schulte
@ 2012-08-25 23:23   ` Sean O'Halpin
  2012-08-26 14:31     ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Sean O'Halpin @ 2012-08-25 23:23 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode

On Sat, Aug 25, 2012 at 11:50 PM, Eric Schulte <eric.schulte@gmx.com> wrote:
> Are you familiar with file local variables?
>
> See (info "(emacs)Specifying File Variables")
>

Yes. That's what I'm trying to enable. Without the patch, it seems that
the =with-temp-buffer= used in =org-babel-expand-noweb-references=
overrides any file local variables. In other words, setting
=org-babel-noweb-wrap-start= and =org-babel-noweb-wrap-end= using
file local variables doesn't work for me without this patch. Am I
missing something?

Regards,
Sean

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BABEL] [PATCH] Make it possible to use buffer local noweb start/end patterns
  2012-08-25 23:23   ` Sean O'Halpin
@ 2012-08-26 14:31     ` Eric Schulte
  2012-08-26 16:40       ` Sean O'Halpin
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2012-08-26 14:31 UTC (permalink / raw)
  To: Sean O'Halpin; +Cc: Org Mode

"Sean O'Halpin" <sean.ohalpin@gmail.com> writes:

> On Sat, Aug 25, 2012 at 11:50 PM, Eric Schulte <eric.schulte@gmx.com> wrote:
>> Are you familiar with file local variables?
>>
>> See (info "(emacs)Specifying File Variables")
>>
>
> Yes. That's what I'm trying to enable. Without the patch, it seems that
> the =with-temp-buffer= used in =org-babel-expand-noweb-references=
> overrides any file local variables. In other words, setting
> =org-babel-noweb-wrap-start= and =org-babel-noweb-wrap-end= using
> file local variables doesn't work for me without this patch. Am I
> missing something?
>

Ah, right you are.  I apologize for not thoroughly understanding your
patch before replying.  I just committed this to the git repo.

Thanks for the contribution!
(and thanks for packaging your patch so that it was easy to apply)

>
> Regards,
> Sean

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BABEL] [PATCH] Make it possible to use buffer local noweb start/end patterns
  2012-08-26 14:31     ` Eric Schulte
@ 2012-08-26 16:40       ` Sean O'Halpin
  0 siblings, 0 replies; 5+ messages in thread
From: Sean O'Halpin @ 2012-08-26 16:40 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode

On Sun, Aug 26, 2012 at 3:31 PM, Eric Schulte <eric.schulte@gmx.com> wrote:
> [snip]
> I just committed this to the git repo.
>
> Thanks for the contribution!
> (and thanks for packaging your patch so that it was easy to apply)
>
Great! Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-26 16:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-25 22:22 [BABEL] [PATCH] Make it possible to use buffer local noweb start/end patterns Sean O'Halpin
2012-08-25 22:50 ` Eric Schulte
2012-08-25 23:23   ` Sean O'Halpin
2012-08-26 14:31     ` Eric Schulte
2012-08-26 16:40       ` Sean O'Halpin

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).