emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Richard KLINDA <rklinda@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG]: function looking-back (XEmacs incompatibility)
Date: Wed, 2 Dec 2009 06:34:15 +0100	[thread overview]
Message-ID: <8CFE4AAA-AAA0-479D-9B14-5D326768AAFC@gmail.com> (raw)
In-Reply-To: <878wdmw6r4.fsf@gmail.com>

Hi RIchard,

this code is already (and has been for a few weeks) in org-compat.el

- Carsten

On Dec 2, 2009, at 1:37 AM, Richard KLINDA wrote:

> XEmacs and older Emacs (22 and below) don't have the function  
> LOOKING-BACK.
>
> I've found a definiton of it here: http://moinmo.in/EmacsForMoinMoin
>
> ,----
> | (or (fboundp 'looking-back)
> | ; taken straight out of http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/subr.el?rev=1.530&view=auto
> |     (defun looking-back (regexp &optional limit greedy)
> |       "Return non-nil if text before point matches regular  
> expression REGEXP.
> | Like `looking-at' except matches before point, and is slower.
> | LIMIT if non-nil speeds up the search by specifying a minimum
> | starting position, to avoid checking matches that would start
> | before LIMIT.
> | If GREEDY is non-nil, extend the match backwards as far as possible,
> | stopping when a single additional previous character cannot be part
> | of a match for REGEXP."
> |       (let ((start (point))
> |             (pos
> |              (save-excursion
> |                (and (re-search-backward (concat "\\(?:" regexp "\\) 
> \\=") limit t)
> |                     (point)))))
> |         (if (and greedy pos)
> |             (save-restriction
> |               (narrow-to-region (point-min) start)
> |               (while (and (> pos (point-min))
> |                           (save-excursion
> |                             (goto-char pos)
> |                             (backward-char 1)
> |                             (looking-at (concat "\\(?:"  regexp "\ 
> \)\\'"))))
> |                 (setq pos (1- pos)))
> |               (save-excursion
> |                 (goto-char pos)
> |                 (looking-at (concat "\\(?:"  regexp "\\)\\'")))))
> |         (not (null pos)))))
> `----
>
> -- 
> Richard
>
>
> _______________________________________________
> 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

  reply	other threads:[~2009-12-02  5:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02  0:37 [BUG]: function looking-back (XEmacs incompatibility) Richard KLINDA
2009-12-02  5:34 ` Carsten Dominik [this message]
2009-12-02 12:32   ` Richard KLINDA

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=8CFE4AAA-AAA0-479D-9B14-5D326768AAFC@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rklinda@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).