xemacs or Python mode
Andreas Röhler
andreas.roehler at online.de
Sun Apr 17 15:07:13 EDT 2011
Am 17.04.2011 05:22, schrieb Jerry James:
> On Fri, Apr 15, 2011 at 11:59 PM, Eric S. Johansson<esj at harvee.org> wrote:
>> In some buffers of Python code and not others when I press the backspace key, it
>> tells me:
>>
>> symbols function definition is void: looking-back.
>>
>> I'm testing out on the latest branches of Python-mode and I'm trying to figure
>> out if this is something I'm doing wrong with xemacs or it is a bug.
>>
>> What do I need to do to debug this?
>
> Options->Troubleshooting->Debug on Error
>
> Then provoke the problem and show us the backtrace. We need to know
> which code is calling the looking-back function which, as far as I
> know, has never been ported from Emacs.
Hi,
IIRC sent a patch implementing it around two years ago.
Maybe the GPLv3 question blocked it that time.
Provided it inside python-mode.el for now, so it should not be an issue
there.
Andreas
--
https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
https://code.launchpad.net/s-x-emacs-werkstatt/
;;;;;;;;;;;;
(when (featurep 'xemacs)
(unless (functionp 'looking-back)
;; from GNU Emacs subr.el
(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))))))
More information about the XEmacs-Beta
mailing list