[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r110963: Fix Imenu regression.
From: |
Fabián Ezequiel Gallina |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r110963: Fix Imenu regression. |
Date: |
Mon, 26 Nov 2012 18:45:58 -0300 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110963
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: emacs-24
timestamp: Mon 2012-11-26 18:45:58 -0300
message:
Fix Imenu regression.
* progmodes/python.el:
(python-nav-beginning-of-defun): Fix forward movement when
statement(s) separates point from defun.
(python-imenu-prev-index-position): New function.
modified:
lisp/ChangeLog
lisp/progmodes/python.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-11-26 17:12:44 +0000
+++ b/lisp/ChangeLog 2012-11-26 21:45:58 +0000
@@ -1,3 +1,11 @@
+2012-11-26 Fabián Ezequiel Gallina <address@hidden>
+
+ Fix Imenu regression.
+ * progmodes/python.el:
+ (python-nav-beginning-of-defun): Fix forward movement when
+ statement(s) separates point from defun.
+ (python-imenu-prev-index-position): New function.
+
2012-11-26 Eli Zaretskii <address@hidden>
* subr.el (buffer-file-type): Declare with defvar-local. Doc fix.
=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el 2012-11-12 13:26:50 +0000
+++ b/lisp/progmodes/python.el 2012-11-26 21:45:58 +0000
@@ -33,7 +33,7 @@
;; Implements Syntax highlighting, Indentation, Movement, Shell
;; interaction, Shell completion, Shell virtualenv support, Pdb
;; tracking, Symbol completion, Skeletons, FFAP, Code Check, Eldoc,
-;; imenu.
+;; Imenu.
;; Syntax highlighting: Fontification of code is provided and supports
;; python's triple quoted strings properly.
@@ -169,10 +169,12 @@
;; might guessed you should run `python-shell-send-buffer' from time
;; to time to get better results too.
-;; imenu: This mode supports imenu in its most basic form, letting it
+;; Imenu: This mode supports Imenu in its most basic form, letting it
;; build the necessary alist via `imenu-default-create-index-function'
;; by having set `imenu-extract-index-name-function' to
-;; `python-info-current-defun'.
+;; `python-info-current-defun' and
+;; `imenu-prev-index-position-function' to
+;; `python-imenu-prev-index-position'.
;; If you used python-mode.el you probably will miss auto-indentation
;; when inserting newlines. To achieve the same behavior you have
@@ -1087,12 +1089,12 @@
(beg-indentation
(and (> arg 0)
(save-excursion
- (and (python-info-current-line-empty-p)
- (python-util-forward-comment -1))
- (python-nav-beginning-of-statement)
- (if (python-info-looking-at-beginning-of-defun)
- (+ (current-indentation) python-indent-offset)
- (current-indentation)))))
+ (while (and
+ (not (python-info-looking-at-beginning-of-defun))
+ (python-nav-backward-block)))
+ (or (and (python-info-looking-at-beginning-of-defun)
+ (+ (current-indentation) python-indent-offset))
+ 0))))
(found
(progn
(when (and (< arg 0)
@@ -2870,6 +2872,19 @@
"^Eldoc needs an inferior Python process running.")
+;;; Imenu
+
+(defun python-imenu-prev-index-position ()
+ "Python mode's `imenu-prev-index-position-function'."
+ (let ((found))
+ (while (and (setq found
+ (re-search-backward python-nav-beginning-of-defun-regexp
nil t))
+ (not (python-info-looking-at-beginning-of-defun))))
+ (and found
+ (python-info-looking-at-beginning-of-defun)
+ (python-info-current-defun))))
+
+
;;; Misc helpers
(defun python-info-current-defun (&optional include-type)
@@ -3214,6 +3229,9 @@
(set (make-local-variable 'imenu-extract-index-name-function)
#'python-info-current-defun)
+ (set (make-local-variable 'imenu-prev-index-position-function)
+ #'python-imenu-prev-index-position)
+
(set (make-local-variable 'add-log-current-defun-function)
#'python-info-current-defun)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r110963: Fix Imenu regression.,
Fabián Ezequiel Gallina <=