emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: "Štěpán Němec" <stepnem@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Emacs 22 support
Date: Tue, 01 Jun 2010 23:03:06 -0400	[thread overview]
Message-ID: <87mxvem905.fsf@gollum.intra.norang.ca> (raw)
In-Reply-To: <87hblmfhe5.fsf@gmail.com> ("Štěpán Němec"'s message of "Wed\, 02 Jun 2010 01\:43\:46 +0200")

Š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

  reply	other threads:[~2010-06-02  3:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=87mxvem905.fsf@gollum.intra.norang.ca \
    --to=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=stepnem@gmail.com \
    /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).