Re: [Orgmode] Re: [PATCH] Emacs 22 support - use org-string-match-p

2010-06-03 Thread Carsten Dominik


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




___
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


[Orgmode] Re: [PATCH] Emacs 22 support - use org-string-match-p

2010-06-03 Thread Štěpán Němec
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

___
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


[Orgmode] Re: [PATCH] Emacs 22 support - use org-string-match-p

2010-06-03 Thread Bernt Hansen
Štěpán Němec  writes:

> Hello,
>
> sorry for being difficult again ;-) 
>
>
> Bernt Hansen  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

___
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


[Orgmode] Re: [PATCH] Emacs 22 support - use org-string-match-p

2010-06-03 Thread Štěpán Němec

Hello,

sorry for being difficult again ;-) 


Bernt Hansen  writes:

[snip]

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

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

[snip]


Štěpán

___
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


[Orgmode] Re: [PATCH] Emacs 22 support

2010-06-01 Thread Bernt Hansen
Štěpán Němec  writes:

> Bernt Hansen  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


___
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


[Orgmode] Re: [PATCH] Emacs 22 support

2010-06-01 Thread Štěpán Němec
Bernt Hansen  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

___
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