GNU bug report logs -
#16297
24.3; Maybe wrong regexp in python.el (24.3)
Previous Next
Reported by: François Pinard <pinard <at> iro.umontreal.ca>
Date: Mon, 30 Dec 2013 02:08:02 UTC
Severity: normal
Tags: moreinfo
Found in version 24.3
Done: fgallina <at> gnu.org (Fabián Ezequiel Gallina)
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
François Pinard <pinard <at> iro.umontreal.ca> writes:
> Well, I was adapting some of my Emacs Lisp from python-mode.el to use
> Fabian Gallina's python.el instead. After loading python.el in Emacs
> 24.3, the value of python-nav-beginning-of-defun-regexp is:
>
> "^[[:space:]]*\\_<\\(?:class\\|def\\)\\_>[[:space:]]+\\([_[:alpha:]][_[:word:]]*\\)"
>
> Maybe I merely miss the meaning of "?:" in this regexp, if any. Yet, by
> removing "?:" from the above value solved my problem, so maybe the value
> as defined by Emacs has problem?
>
> François
>
The "?:" meaning is that the grouping will not be accessible by
`match-string' and friends and that's intended. It doesn't change
regexp's behavior for matching a beginning of defun, but you can't get
the type easily.
If getting the type is the issue for you, one way to do it is:
(when (looking-at python-nav-beginning-of-defun)
(let* ((match (split-string (match-string-no-properties 0)))
(type (car match)))
(name (cadr match))
(list type name)))
Regards,
Fabián.
This bug report was last modified 11 years and 146 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.