]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/which-func.el
Merge from trunk; up to 2014-02-23T23:41:17Z!lekktu@gmail.com.
[gnu-emacs] / lisp / progmodes / which-func.el
index 4819149bdf6d980f5b14a4ddfd72d8e6d6d6ef85..aa68f9fcc1ad3dcf2efe5992e05fb10729d94f33 100644 (file)
@@ -1,6 +1,7 @@
 ;;; which-func.el --- print current function in mode line
 
-;; Copyright (C) 1994, 1997-1998, 2001-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1997-1998, 2001-2014 Free Software Foundation,
+;; Inc.
 
 ;; Author:   Alex Rezinsky <alexr@msil.sps.mot.com>
 ;;           (doesn't seem to be responsive any more)
@@ -182,7 +183,8 @@ and you want to simplify them for the mode line
 (defconst which-func-current
   '(:eval (replace-regexp-in-string
           "%" "%%"
-          (gethash (selected-window) which-func-table which-func-unknown))))
+          (or (gethash (selected-window) which-func-table)
+               which-func-unknown))))
 ;;;###autoload (put 'which-func-current 'risky-local-variable t)
 
 (defvar which-func-mode nil
@@ -288,7 +290,7 @@ If no function name is found, return nil."
     (when (and (null name)
               (boundp 'imenu--index-alist) (null imenu--index-alist)
               (null which-function-imenu-failed))
-      (imenu--make-index-alist t)
+      (ignore-errors (imenu--make-index-alist t))
       (unless imenu--index-alist
         (set (make-local-variable 'which-function-imenu-failed) t)))
     ;; If we have an index alist, use it.
@@ -317,7 +319,9 @@ If no function name is found, return nil."
                     namestack (cons (car pair) namestack)
                     alist     (cdr pair)))
 
-             ((number-or-marker-p (setq mark (cdr pair)))
+             ((or (number-or-marker-p (setq mark (cdr pair)))
+                 (and (overlayp mark)
+                      (setq mark (overlay-start mark))))
               (when (and (>= (setq offset (- (point) mark)) 0)
                          (< offset minoffset)) ; Find the closest item.
                 (setq minoffset offset
@@ -339,6 +343,10 @@ If no function name is found, return nil."
 \f
 ;;; Integration with other packages
 
+(defvar ediff-window-A)
+(defvar ediff-window-B)
+(defvar ediff-window-C)
+
 (defun which-func-update-ediff-windows ()
   "Update Which-Function mode display for Ediff windows.
 This function is meant to be called from `ediff-select-hook'."