I sometimes use Emacs with python-mode. I've modified my .emacs
file so that .ptl files are edited and highlighted in python-mode.
Good so far, but ...
The templates in a .ptl file do not show up under the IM-Python menu.
Does anyone have a modification to python-mode.el that will fix
this?
In python-mode.el, I tried changing:
(defvar py-imenu-method-regexp
(concat ; <>
"\\(" ;
"^[ \t]*" ; new line and maybe whitespace
"\\(def[ \t]+" ; function definitions start with
def
"\\([a-zA-Z0-9_]+\\)" ; name is here
; function arguments...
;; "[ \t]*(\\([-+/a-zA-Z0-9_=,\* \t\n.()\"'#]*\\))"
"[ \t]*(\\([^:#]*\\))"
"\\)" ; end of def
"[ \t]*:" ; and then the :
"\\)" ; >>methods and functions<<
)
"Regexp for Python methods/functions for use with the Imenu
package."
)
to:
(defvar py-imenu-method-regexp
(concat ; <>
"\\(" ;
"^[ \t]*" ; new line and maybe whitespace
"\\(\\(def|template\\)[ \t]+" ; function
definitions start with def
"\\([a-zA-Z0-9_]+\\)" ; name is here
; function arguments...
;; "[ \t]*(\\([-+/a-zA-Z0-9_=,\* \t\n.()\"'#]*\\))"
"[ \t]*(\\([^:#]*\\))"
"\\)" ; end of def
"[ \t]*:" ; and then the :
"\\)" ; >>methods and functions<<
)
"Regexp for Python methods/functions for use with the Imenu
package."
)
Nope. So, I tried copying the above defvar, renaming it, and
replacing "def" with "template". Then I added the following:
(defvar py-imenu-generic-expression
(cons
(concat
py-imenu-class-regexp
"\\|" ; or...
py-imenu-method-regexp
; also recognize Quixote templates
"\\|" ; or...
py-imenu-template-regexp
)
py-imenu-method-no-arg-parens)
o
o
o
But, still no joy. Suggestions?
- Dave
--
Dave Kuhlman
dkuhlman@rexx.com
http://www.rexx.com/~dkuhlman