[Python-mode] xemacs or Python mode
Andreas Röhler
andreas.roehler at online.de
Sat Apr 16 19:31:55 CEST 2011
Am 16.04.2011 18:11, schrieb Eric S. Johansson:
> (I originally sent this to the xemacs list and forgot to send it here)
>
> Only Your friendly list mates can tell for sure
>
> 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?
>
> --- eric
> _______________________________________________
> Python-mode mailing list
> Python-mode at python.org
> http://mail.python.org/mailman/listinfo/python-mode
>
XEmacs should implement it.
Here it is for the moment:
(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 Python-mode
mailing list