emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Emacs 22 support
@ 2010-06-01 23:10 Bernt Hansen
  2010-06-01 23:43 ` Štěpán Němec
  0 siblings, 1 reply; 12+ messages in thread
From: Bernt Hansen @ 2010-06-01 23:10 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

* contrib/lisp/org-special-blocks.el: Emacs 22 doesn't have string-match-p
---
This patch is available at git://git.norang.ca/org-mode.git emacs22

 contrib/lisp/org-special-blocks.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/lisp/org-special-blocks.el b/contrib/lisp/org-special-blocks.el
index af50b30..4a2bc3c 100644
--- a/contrib/lisp/org-special-blocks.el
+++ b/contrib/lisp/org-special-blocks.el
@@ -51,7 +51,7 @@ seen.  This is run after a few special cases are taken care of."
   (when (or htmlp latexp)
     (goto-char (point-min))
     (while (re-search-forward "^#\\+\\(begin\\|end\\)_\\(.*\\)$" nil t)
-      (unless (string-match-p org-special-blocks-ignore-regexp (match-string 2))
+      (unless (string-match org-special-blocks-ignore-regexp (match-string 2))
 	(replace-match
 	 (if (equal (downcase (match-string 1)) "begin")
 	     (concat "ORG-" (match-string 2) "-START")
-- 
1.7.1.240.g225c

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

* Re: [PATCH] Emacs 22 support
  2010-06-01 23:10 [PATCH] Emacs 22 support Bernt Hansen
@ 2010-06-01 23:43 ` Štěpán Němec
  2010-06-02  3:03   ` Bernt Hansen
  0 siblings, 1 reply; 12+ messages in thread
From: Štěpán Němec @ 2010-06-01 23:43 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

> * contrib/lisp/org-special-blocks.el: Emacs 22 doesn't have string-match-p
> ---
> This patch is available at git://git.norang.ca/org-mode.git emacs22
>
>  contrib/lisp/org-special-blocks.el |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/contrib/lisp/org-special-blocks.el
> b/contrib/lisp/org-special-blocks.el
> index af50b30..4a2bc3c 100644
> --- a/contrib/lisp/org-special-blocks.el
> +++ b/contrib/lisp/org-special-blocks.el
> @@ -51,7 +51,7 @@ seen. This is run after a few special cases are taken care
> of."
>    (when (or htmlp latexp)
>      (goto-char (point-min))
>      (while (re-search-forward "^#\\+\\(begin\\|end\\)_\\(.*\\)$" nil t)
> - (unless (string-match-p org-special-blocks-ignore-regexp (match-string 2))
> + (unless (string-match org-special-blocks-ignore-regexp (match-string 2))
>  	(replace-match
>  	 (if (equal (downcase (match-string 1)) "begin")
>  	     (concat "ORG-" (match-string 2) "-START")

I didn't look at the code, but I doubt this is correct. The whole point
of using `string-match-p' is to not affect the match data, so I would
expect this change to possibly break the immediately following
(match-string 1) etc. (depending on the exact regexp of course -- as I
say I didn't actually check it, but in any case this is not a safe
change AFAIK). You could try wrapping the `string-match' form inside
`save-match-data' to prevent that.

   Štěpán

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

* Re: [PATCH] Emacs 22 support
  2010-06-01 23:43 ` Štěpán Němec
@ 2010-06-02  3:03   ` Bernt Hansen
  2010-06-02 11:47     ` Bernt Hansen
  0 siblings, 1 reply; 12+ messages in thread
From: Bernt Hansen @ 2010-06-02  3:03 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: emacs-orgmode

Štěpán Němec <stepnem@gmail.com> writes:

> Bernt Hansen <bernt@norang.ca> writes:
>
>> * contrib/lisp/org-special-blocks.el: Emacs 22 doesn't have string-match-p
>> ---
>> This patch is available at git://git.norang.ca/org-mode.git emacs22
>>
>>  contrib/lisp/org-special-blocks.el |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/contrib/lisp/org-special-blocks.el
>> b/contrib/lisp/org-special-blocks.el
>> index af50b30..4a2bc3c 100644
>> --- a/contrib/lisp/org-special-blocks.el
>> +++ b/contrib/lisp/org-special-blocks.el
>> @@ -51,7 +51,7 @@ seen. This is run after a few special cases are taken care
>> of."
>>    (when (or htmlp latexp)
>>      (goto-char (point-min))
>>      (while (re-search-forward "^#\\+\\(begin\\|end\\)_\\(.*\\)$" nil t)
>> - (unless (string-match-p org-special-blocks-ignore-regexp (match-string 2))
>> + (unless (string-match org-special-blocks-ignore-regexp (match-string 2))
>>  	(replace-match
>>  	 (if (equal (downcase (match-string 1)) "begin")
>>  	     (concat "ORG-" (match-string 2) "-START")
>
> I didn't look at the code, but I doubt this is correct. The whole point
> of using `string-match-p' is to not affect the match data, so I would
> expect this change to possibly break the immediately following
> (match-string 1) etc. (depending on the exact regexp of course -- as I
> say I didn't actually check it, but in any case this is not a safe
> change AFAIK). You could try wrapping the `string-match' form inside
> `save-match-data' to prevent that.

Thanks for the review.  I was just emulating what Carsten did in a
similar fix in git commit 8dd4baf without much thought of side effects.

I used this change to test a recent post about using org-special-blocks.
I don't normally use org-special-blocks in my setup and this change made
it work for me for the simple test case on the mailing list.

I'll try to post a better patch for this tomorrow.

Regards,
Bernt

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

* [PATCH] Emacs 22 support
  2010-06-02  3:03   ` Bernt Hansen
@ 2010-06-02 11:47     ` Bernt Hansen
  2010-06-03  8:32       ` Carsten Dominik
  0 siblings, 1 reply; 12+ messages in thread
From: Bernt Hansen @ 2010-06-02 11:47 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

* contrib/lisp/org-special-blocks.el (org-special-blocks-make-special-cookies):
Emacs 22 doesn't have string-match-p
---
Updated patch available at git://git.norang.ca/org-mode.git emacs22

 contrib/lisp/org-special-blocks.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/contrib/lisp/org-special-blocks.el b/contrib/lisp/org-special-blocks.el
index af50b30..a381920 100644
--- a/contrib/lisp/org-special-blocks.el
+++ b/contrib/lisp/org-special-blocks.el
@@ -51,7 +51,8 @@ seen.  This is run after a few special cases are taken care of."
   (when (or htmlp latexp)
     (goto-char (point-min))
     (while (re-search-forward "^#\\+\\(begin\\|end\\)_\\(.*\\)$" nil t)
-      (unless (string-match-p org-special-blocks-ignore-regexp (match-string 2))
+      (unless (save-match-data
+		(string-match org-special-blocks-ignore-regexp (match-string 2)))
 	(replace-match
 	 (if (equal (downcase (match-string 1)) "begin")
 	     (concat "ORG-" (match-string 2) "-START")
-- 
1.7.1.240.g225c

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

* Re: [PATCH] Emacs 22 support
  2010-06-02 11:47     ` Bernt Hansen
@ 2010-06-03  8:32       ` Carsten Dominik
  2010-06-03 12:28         ` Bernt Hansen
  0 siblings, 1 reply; 12+ messages in thread
From: Carsten Dominik @ 2010-06-03  8:32 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Hi Bernt,

can you pease rewrite the patch one more time, using the new org- 
string-match-p function?

Thanks.

- Carsten

On Jun 2, 2010, at 1:47 PM, Bernt Hansen wrote:

> * contrib/lisp/org-special-blocks.el (org-special-blocks-make- 
> special-cookies):
> Emacs 22 doesn't have string-match-p
> ---
> Updated patch available at git://git.norang.ca/org-mode.git emacs22
>
> contrib/lisp/org-special-blocks.el |    3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/contrib/lisp/org-special-blocks.el b/contrib/lisp/org- 
> special-blocks.el
> index af50b30..a381920 100644
> --- a/contrib/lisp/org-special-blocks.el
> +++ b/contrib/lisp/org-special-blocks.el
> @@ -51,7 +51,8 @@ seen.  This is run after a few special cases are  
> taken care of."
>   (when (or htmlp latexp)
>     (goto-char (point-min))
>     (while (re-search-forward "^#\\+\\(begin\\|end\\)_\\(.*\\)$" nil  
> t)
> -      (unless (string-match-p org-special-blocks-ignore-regexp  
> (match-string 2))
> +      (unless (save-match-data
> +		(string-match org-special-blocks-ignore-regexp (match-string 2)))
> 	(replace-match
> 	 (if (equal (downcase (match-string 1)) "begin")
> 	     (concat "ORG-" (match-string 2) "-START")
> -- 
> 1.7.1.240.g225c
>
>
> _______________________________________________
> 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

- Carsten

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

* Re: [PATCH] Emacs 22 support
  2010-06-03  8:32       ` Carsten Dominik
@ 2010-06-03 12:28         ` Bernt Hansen
  2010-06-03 13:10           ` [PATCH] Emacs 22 support - use org-string-match-p Bernt Hansen
  0 siblings, 1 reply; 12+ messages in thread
From: Bernt Hansen @ 2010-06-03 12:28 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> can you pease rewrite the patch one more time, using the new org- 
> string-match-p function?
>
> Thanks.

Absolutely :)  I'll send it today.

Regards,
Bernt

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

* [PATCH] Emacs 22 support - use org-string-match-p
  2010-06-03 12:28         ` Bernt Hansen
@ 2010-06-03 13:10           ` Bernt Hansen
  2010-06-03 22:07             ` Štěpán Němec
  2010-06-04 19:03             ` Carsten Dominik
  0 siblings, 2 replies; 12+ messages in thread
From: Bernt Hansen @ 2010-06-03 13:10 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

* contrib/lisp/org-special-blocks.el (org-special-blocks-make-special-cookies):
Emacs 22 doesn't have string-match-p
* lisp/org-freemind.el (org-freemind-write-mm-buffer):
(org-freemind-get-node-style):
Emacs 22 doesn't have string-match-p
* lisp/org-html.el (org-html-make-link):
Use new org-string-match-p for compatibility
---
Updated patch using org-string-match-p
This is available at git://git.norang.ca/org-mode.git emacs22

-Bernt

 contrib/lisp/org-special-blocks.el |    2 +-
 lisp/org-freemind.el               |    4 ++--
 lisp/org-html.el                   |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/lisp/org-special-blocks.el b/contrib/lisp/org-special-blocks.el
index af50b30..d97cff3 100644
--- a/contrib/lisp/org-special-blocks.el
+++ b/contrib/lisp/org-special-blocks.el
@@ -51,7 +51,7 @@ seen.  This is run after a few special cases are taken care of."
   (when (or htmlp latexp)
     (goto-char (point-min))
     (while (re-search-forward "^#\\+\\(begin\\|end\\)_\\(.*\\)$" nil t)
-      (unless (string-match-p org-special-blocks-ignore-regexp (match-string 2))
+      (unless (org-string-match-p org-special-blocks-ignore-regexp (match-string 2))
 	(replace-match
 	 (if (equal (downcase (match-string 1)) "begin")
 	     (concat "ORG-" (match-string 2) "-START")
diff --git a/lisp/org-freemind.el b/lisp/org-freemind.el
index 9aabbea..538b404 100644
--- a/lisp/org-freemind.el
+++ b/lisp/org-freemind.el
@@ -552,7 +552,7 @@ Otherwise give an error say the file exists."
 (defun org-freemind-write-mm-buffer (org-buffer mm-buffer node-at-line)
   (with-current-buffer org-buffer
     (dolist (node-style org-freemind-node-styles)
-      (when (string-match-p (car node-style) buffer-file-name)
+      (when (org-string-match-p (car node-style) buffer-file-name)
         (setq org-freemind-node-style (cadr node-style))))
     ;;(message "org-freemind-node-style =%s" org-freemind-node-style)
     (save-match-data
@@ -725,7 +725,7 @@ Otherwise give an error say the file exists."
     (dolist (style-list org-freemind-node-style)
       (let ((node-regexp (car style-list)))
         (message "node-regexp=%s node-name=%s" node-regexp node-name)
-        (when (string-match-p node-regexp node-name)
+        (when (org-string-match-p node-regexp node-name)
           ;;(setq node-style (org-freemind-do-apply-node-style style-list))
           (setq node-style (cadr style-list))
           (when node-style
diff --git a/lisp/org-html.el b/lisp/org-html.el
index f7dd1b3..d18350d 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -641,7 +641,7 @@ MAY-INLINE-P allows inlining it as an image."
 	    (let
 	       ((str (org-export-html-format-href thefile)))
 	      (if (and type (not (string= "file" type))
-		       (string-match "^//" str))
+		       (org-string-match-p "^//" str))
 		  (concat type ":" str)
 		  str)))
 
-- 
1.7.1.240.g225c

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

* Re: [PATCH] Emacs 22 support - use org-string-match-p
  2010-06-03 13:10           ` [PATCH] Emacs 22 support - use org-string-match-p Bernt Hansen
@ 2010-06-03 22:07             ` Štěpán Němec
  2010-06-03 22:09               ` Bernt Hansen
  2010-06-04 19:03             ` Carsten Dominik
  1 sibling, 1 reply; 12+ messages in thread
From: Štěpán Němec @ 2010-06-03 22:07 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode


Hello,

sorry for being difficult again ;-) 


Bernt Hansen <bernt@norang.ca> writes:

[snip]

> -		       (string-match "^//" str))
> +		       (org-string-match-p "^//" str))

Ehrm... do you really want to replace `string-match', too?

[snip]


Štěpán

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

* Re: [PATCH] Emacs 22 support - use org-string-match-p
  2010-06-03 22:07             ` Štěpán Němec
@ 2010-06-03 22:09               ` Bernt Hansen
  2010-06-03 22:29                 ` Štěpán Němec
  0 siblings, 1 reply; 12+ messages in thread
From: Bernt Hansen @ 2010-06-03 22:09 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: emacs-orgmode

Štěpán Němec <stepnem@gmail.com> writes:

> Hello,
>
> sorry for being difficult again ;-) 
>
>
> Bernt Hansen <bernt@norang.ca> writes:
>
> [snip]
>
>> -		       (string-match "^//" str))
>> +		       (org-string-match-p "^//" str))
>
> Ehrm... do you really want to replace `string-match', too?

Yes ... because it originally was a string-match-p that Carsten 
converted to string-match since Emacs 22 doesn't have a string-match-p
during an earlier bug report (by me).

Now that Carsten created org-string-match-p I'm just putting it back
closer to the original code.

Regards,
Bernt

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

* Re: [PATCH] Emacs 22 support - use org-string-match-p
  2010-06-03 22:09               ` Bernt Hansen
@ 2010-06-03 22:29                 ` Štěpán Němec
  2010-06-04  4:42                   ` Carsten Dominik
  0 siblings, 1 reply; 12+ messages in thread
From: Štěpán Němec @ 2010-06-03 22:29 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

On Thu, Jun 03, 2010 at 06:09:53PM -0400, Bernt Hansen wrote:
> > Ehrm... do you really want to replace `string-match', too?
> 
> Yes ... because it originally was a string-match-p that Carsten 
> converted to string-match since Emacs 22 doesn't have a string-match-p
> during an earlier bug report (by me).
> 
> Now that Carsten created org-string-match-p I'm just putting it back
> closer to the original code.

I see; thanks and sorry for the noise,

Štěpán

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

* Re: Re: [PATCH] Emacs 22 support - use org-string-match-p
  2010-06-03 22:29                 ` Štěpán Němec
@ 2010-06-04  4:42                   ` Carsten Dominik
  0 siblings, 0 replies; 12+ messages in thread
From: Carsten Dominik @ 2010-06-04  4:42 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: Bernt Hansen, emacs-orgmode


On Jun 4, 2010, at 12:29 AM, Štěpán Němec wrote:

> On Thu, Jun 03, 2010 at 06:09:53PM -0400, Bernt Hansen wrote:
>>> Ehrm... do you really want to replace `string-match', too?
>>
>> Yes ... because it originally was a string-match-p that Carsten
>> converted to string-match since Emacs 22 doesn't have a string- 
>> match-p
>> during an earlier bug report (by me).
>>
>> Now that Carsten created org-string-match-p I'm just putting it back
>> closer to the original code.
>
> I see; thanks and sorry for the noise,

And thank *you* for taking the time to look at patches and
commenting on them!  This is very much appreciated.

- Carsten

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

* Re: [PATCH] Emacs 22 support - use org-string-match-p
  2010-06-03 13:10           ` [PATCH] Emacs 22 support - use org-string-match-p Bernt Hansen
  2010-06-03 22:07             ` Štěpán Němec
@ 2010-06-04 19:03             ` Carsten Dominik
  1 sibling, 0 replies; 12+ messages in thread
From: Carsten Dominik @ 2010-06-04 19:03 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Applied, thanks.

- Carsten

On Jun 3, 2010, at 3:10 PM, Bernt Hansen wrote:

> * contrib/lisp/org-special-blocks.el (org-special-blocks-make- 
> special-cookies):
> Emacs 22 doesn't have string-match-p
> * lisp/org-freemind.el (org-freemind-write-mm-buffer):
> (org-freemind-get-node-style):
> Emacs 22 doesn't have string-match-p
> * lisp/org-html.el (org-html-make-link):
> Use new org-string-match-p for compatibility
> ---
> Updated patch using org-string-match-p
> This is available at git://git.norang.ca/org-mode.git emacs22
>
> -Bernt
>
> contrib/lisp/org-special-blocks.el |    2 +-
> lisp/org-freemind.el               |    4 ++--
> lisp/org-html.el                   |    2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/contrib/lisp/org-special-blocks.el b/contrib/lisp/org- 
> special-blocks.el
> index af50b30..d97cff3 100644
> --- a/contrib/lisp/org-special-blocks.el
> +++ b/contrib/lisp/org-special-blocks.el
> @@ -51,7 +51,7 @@ seen.  This is run after a few special cases are  
> taken care of."
>   (when (or htmlp latexp)
>     (goto-char (point-min))
>     (while (re-search-forward "^#\\+\\(begin\\|end\\)_\\(.*\\)$" nil  
> t)
> -      (unless (string-match-p org-special-blocks-ignore-regexp  
> (match-string 2))
> +      (unless (org-string-match-p org-special-blocks-ignore-regexp  
> (match-string 2))
> 	(replace-match
> 	 (if (equal (downcase (match-string 1)) "begin")
> 	     (concat "ORG-" (match-string 2) "-START")
> diff --git a/lisp/org-freemind.el b/lisp/org-freemind.el
> index 9aabbea..538b404 100644
> --- a/lisp/org-freemind.el
> +++ b/lisp/org-freemind.el
> @@ -552,7 +552,7 @@ Otherwise give an error say the file exists."
> (defun org-freemind-write-mm-buffer (org-buffer mm-buffer node-at- 
> line)
>   (with-current-buffer org-buffer
>     (dolist (node-style org-freemind-node-styles)
> -      (when (string-match-p (car node-style) buffer-file-name)
> +      (when (org-string-match-p (car node-style) buffer-file-name)
>         (setq org-freemind-node-style (cadr node-style))))
>     ;;(message "org-freemind-node-style =%s" org-freemind-node-style)
>     (save-match-data
> @@ -725,7 +725,7 @@ Otherwise give an error say the file exists."
>     (dolist (style-list org-freemind-node-style)
>       (let ((node-regexp (car style-list)))
>         (message "node-regexp=%s node-name=%s" node-regexp node-name)
> -        (when (string-match-p node-regexp node-name)
> +        (when (org-string-match-p node-regexp node-name)
>           ;;(setq node-style (org-freemind-do-apply-node-style style- 
> list))
>           (setq node-style (cadr style-list))
>           (when node-style
> diff --git a/lisp/org-html.el b/lisp/org-html.el
> index f7dd1b3..d18350d 100644
> --- a/lisp/org-html.el
> +++ b/lisp/org-html.el
> @@ -641,7 +641,7 @@ MAY-INLINE-P allows inlining it as an image."
> 	    (let
> 	       ((str (org-export-html-format-href thefile)))
> 	      (if (and type (not (string= "file" type))
> -		       (string-match "^//" str))
> +		       (org-string-match-p "^//" str))
> 		  (concat type ":" str)
> 		  str)))
>
> -- 
> 1.7.1.240.g225c
>
>
> _______________________________________________
> 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

- Carsten

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

end of thread, other threads:[~2010-06-04 19:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-01 23:10 [PATCH] Emacs 22 support Bernt Hansen
2010-06-01 23:43 ` Štěpán Němec
2010-06-02  3:03   ` Bernt Hansen
2010-06-02 11:47     ` Bernt Hansen
2010-06-03  8:32       ` Carsten Dominik
2010-06-03 12:28         ` Bernt Hansen
2010-06-03 13:10           ` [PATCH] Emacs 22 support - use org-string-match-p Bernt Hansen
2010-06-03 22:07             ` Štěpán Němec
2010-06-03 22:09               ` Bernt Hansen
2010-06-03 22:29                 ` Štěpán Němec
2010-06-04  4:42                   ` Carsten Dominik
2010-06-04 19:03             ` 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).