Mercurial > emacs
comparison lisp/progmodes/python.el @ 90999:35e3789db058
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 839-842)
- Update from CVS
- Change capitalization of VC backend names for new backends
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-240
| author | Miles Bader <miles@gnu.org> |
|---|---|
| date | Fri, 03 Aug 2007 05:27:05 +0000 |
| parents | 539530fa389c bda0322e3767 |
| children | 424b655804ca |
comparison
equal
deleted
inserted
replaced
| 90998:539530fa389c | 90999:35e3789db058 |
|---|---|
| 1003 (defun python-which-func () | 1003 (defun python-which-func () |
| 1004 (let ((function-name (python-current-defun python-which-func-length-limit))) | 1004 (let ((function-name (python-current-defun python-which-func-length-limit))) |
| 1005 (set-text-properties 0 (length function-name) nil function-name) | 1005 (set-text-properties 0 (length function-name) nil function-name) |
| 1006 function-name)) | 1006 function-name)) |
| 1007 | 1007 |
| 1008 | 1008 |
| 1009 ;;;; Imenu. | 1009 ;;;; Imenu. |
| 1010 | 1010 |
| 1011 (defvar python-recursing) | 1011 (defvar python-recursing) |
| 1012 (defun python-imenu-create-index () | 1012 (defun python-imenu-create-index () |
| 1013 "`imenu-create-index-function' for Python. | 1013 "`imenu-create-index-function' for Python. |
| 1826 (defun python-current-defun (&optional length-limit) | 1826 (defun python-current-defun (&optional length-limit) |
| 1827 "`add-log-current-defun-function' for Python." | 1827 "`add-log-current-defun-function' for Python." |
| 1828 (save-excursion | 1828 (save-excursion |
| 1829 ;; Move up the tree of nested `class' and `def' blocks until we | 1829 ;; Move up the tree of nested `class' and `def' blocks until we |
| 1830 ;; get to zero indentation, accumulating the defined names. | 1830 ;; get to zero indentation, accumulating the defined names. |
| 1831 (let ((start t) | 1831 (let ((accum) |
| 1832 (accum) | |
| 1833 (length -1)) | 1832 (length -1)) |
| 1834 (while (and (or start (> (current-indentation) 0)) | 1833 (catch 'done |
| 1835 (or (null length-limit) | 1834 (while (or (null length-limit) |
| 1836 (null (cdr accum)) | 1835 (null (cdr accum)) |
| 1837 (< length length-limit))) | 1836 (< length length-limit)) |
| 1838 (setq start nil) | 1837 (setq start nil) |
| 1839 (python-beginning-of-block) | 1838 (let ((started-from (point))) |
| 1840 (end-of-line) | 1839 (python-beginning-of-block) |
| 1841 (beginning-of-defun) | 1840 (end-of-line) |
| 1842 (when (looking-at (rx (0+ space) (or "def" "class") (1+ space) | 1841 (beginning-of-defun) |
| 1843 (group (1+ (or word (syntax symbol)))))) | 1842 (when (= (point) started-from) |
| 1844 (push (match-string 1) accum) | 1843 (throw 'done nil))) |
| 1845 (setq length (+ length 1 (length (car accum)))))) | 1844 (when (looking-at (rx (0+ space) (or "def" "class") (1+ space) |
| 1845 (group (1+ (or word (syntax symbol)))))) | |
| 1846 (push (match-string 1) accum) | |
| 1847 (setq length (+ length 1 (length (car accum))))) | |
| 1848 (when (= (current-indentation) 0) | |
| 1849 (throw 'done nil)))) | |
| 1846 (when accum | 1850 (when accum |
| 1847 (when (and length-limit (> length length-limit)) | 1851 (when (and length-limit (> length length-limit)) |
| 1848 (setcar accum "..")) | 1852 (setcar accum "..")) |
| 1849 (mapconcat 'identity accum "."))))) | 1853 (mapconcat 'identity accum "."))))) |
| 1850 | 1854 |
