From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [BUG]: function looking-back (XEmacs incompatibility) Date: Wed, 2 Dec 2009 06:34:15 +0100 Message-ID: <8CFE4AAA-AAA0-479D-9B14-5D326768AAFC@gmail.com> References: <878wdmw6r4.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFhrC-0005gN-5z for emacs-orgmode@gnu.org; Wed, 02 Dec 2009 00:34:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFhr4-0005fR-Jg for emacs-orgmode@gnu.org; Wed, 02 Dec 2009 00:34:28 -0500 Received: from [199.232.76.173] (port=43047 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFhr4-0005fO-Dj for emacs-orgmode@gnu.org; Wed, 02 Dec 2009 00:34:22 -0500 Received: from mail-bw0-f215.google.com ([209.85.218.215]:46583) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFhr4-0001s7-1m for emacs-orgmode@gnu.org; Wed, 02 Dec 2009 00:34:22 -0500 Received: by bwz7 with SMTP id 7so3719639bwz.26 for ; Tue, 01 Dec 2009 21:34:20 -0800 (PST) In-Reply-To: <878wdmw6r4.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Richard KLINDA Cc: emacs-orgmode@gnu.org 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