emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Quote any special characters in org-make-target-link-regexp
@ 2010-12-14 15:01 Lawrence Mitchell
  2010-12-16 13:13 ` [Accepted] " Carsten Dominik
  2010-12-16 13:14 ` [PATCH] " Carsten Dominik
  0 siblings, 2 replies; 3+ messages in thread
From: Lawrence Mitchell @ 2010-12-14 15:01 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Lawrence Mitchell

* lisp/org.el (org-make-target-link-regexp): regexp-quote target
before replacing whitespace.

Previously a radio link <<<...>>> would match all three-letter words
in the buffer.  The manual indicates the radio links are meant to
match literally (modulo whitespace differences), so we should
regexp-quote all the targets to avoid over-eager matching.
---
This problem bit me when writing up some notes on CUDA, which uses
<<<...>>> to indicate a function call from a CPU onto a GPU.  I think
this is the right fix, since I can't imagine a situation where you
would want <<<foo.bar>>> to match foo.bar, rather than foo\\.bar.

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

diff --git a/lisp/org.el b/lisp/org.el
index 6d1062c..5733d67 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5424,6 +5424,7 @@ between words."
 	"\\<\\("
 	(mapconcat
 	 (lambda (x)
+	   (setq x (regexp-quote x))
 	   (while (string-match " +" x)
 	     (setq x (replace-match "\\s-+" t t x)))
 	   x)
-- 
1.7.3.3.398.g0b0cd

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

* [Accepted] Quote any special characters in org-make-target-link-regexp
  2010-12-14 15:01 [PATCH] Quote any special characters in org-make-target-link-regexp Lawrence Mitchell
@ 2010-12-16 13:13 ` Carsten Dominik
  2010-12-16 13:14 ` [PATCH] " Carsten Dominik
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2010-12-16 13:13 UTC (permalink / raw)
  To: emacs-orgmode

Patch 483 (http://patchwork.newartisans.com/patch/483/) is now "Accepted".

Maintainer comment: No comment

This relates to the following submission:

http://mid.gmane.org/%3C1292338919-22555-1-git-send-email-wence%40gmx.li%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [Orgmode] Quote any special characters in org-make-target-link-regexp
> Date: Tue, 14 Dec 2010 20:01:59 -0000
> From: Lawrence Mitchell <wence@gmx.li>
> X-Patchwork-Id: 483
> Message-Id: <1292338919-22555-1-git-send-email-wence@gmx.li>
> To: emacs-orgmode@gnu.org
> Cc: Lawrence Mitchell <wence@gmx.li>
> 
> * lisp/org.el (org-make-target-link-regexp): regexp-quote target
> before replacing whitespace.
> 
> Previously a radio link <<<...>>> would match all three-letter words
> in the buffer.  The manual indicates the radio links are meant to
> match literally (modulo whitespace differences), so we should
> regexp-quote all the targets to avoid over-eager matching.
> 
> ---
> This problem bit me when writing up some notes on CUDA, which uses
> <<<...>>> to indicate a function call from a CPU onto a GPU.  I think
> this is the right fix, since I can't imagine a situation where you
> would want <<<foo.bar>>> to match foo.bar, rather than foo\\.bar.
> 
>  lisp/org.el |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/lisp/org.el b/lisp/org.el
> index 6d1062c..5733d67 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -5424,6 +5424,7 @@ between words."
>  	"\\<\\("
>  	(mapconcat
>  	 (lambda (x)
> +	   (setq x (regexp-quote x))
>  	   (while (string-match " +" x)
>  	     (setq x (replace-match "\\s-+" t t x)))
>  	   x)
> 

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

* Re: [PATCH] Quote any special characters in org-make-target-link-regexp
  2010-12-14 15:01 [PATCH] Quote any special characters in org-make-target-link-regexp Lawrence Mitchell
  2010-12-16 13:13 ` [Accepted] " Carsten Dominik
@ 2010-12-16 13:14 ` Carsten Dominik
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2010-12-16 13:14 UTC (permalink / raw)
  To: Lawrence Mitchell; +Cc: emacs-orgmode

Lawrence,

thanks for the patch, with flawless ChangeLog and commit message!

Patch accepted.

- Carsten


On Dec 14, 2010, at 4:01 PM, Lawrence Mitchell wrote:

> * lisp/org.el (org-make-target-link-regexp): regexp-quote target
> before replacing whitespace.
>
> Previously a radio link <<<...>>> would match all three-letter words
> in the buffer.  The manual indicates the radio links are meant to
> match literally (modulo whitespace differences), so we should
> regexp-quote all the targets to avoid over-eager matching.
> ---
> This problem bit me when writing up some notes on CUDA, which uses
> <<<...>>> to indicate a function call from a CPU onto a GPU.  I think
> this is the right fix, since I can't imagine a situation where you
> would want <<<foo.bar>>> to match foo.bar, rather than foo\\.bar.
>
> lisp/org.el |    1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 6d1062c..5733d67 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -5424,6 +5424,7 @@ between words."
> 	"\\<\\("
> 	(mapconcat
> 	 (lambda (x)
> +	   (setq x (regexp-quote x))
> 	   (while (string-match " +" x)
> 	     (setq x (replace-match "\\s-+" t t x)))
> 	   x)
> -- 
> 1.7.3.3.398.g0b0cd
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-12-19 17:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-14 15:01 [PATCH] Quote any special characters in org-make-target-link-regexp Lawrence Mitchell
2010-12-16 13:13 ` [Accepted] " Carsten Dominik
2010-12-16 13:14 ` [PATCH] " Carsten Dominik

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