- (cond
- ((markerp (cdr index-item))
- (if (or (< (marker-position (cdr index-item)) (point-min))
- (> (marker-position (cdr index-item)) (point-max)))
- ;; widen if outside narrowing
- (widen))
- (goto-char (marker-position (cdr index-item))))
- ((imenu--subalist-p index-item)
- (if (or (< (cdr index-item) (point-min))
- (> (cdr index-item) (point-max)))
- ;; widen if outside narrowing
- (widen))
- (goto-char (cdr index-item)))
- (t
- ;; A special item with a function.
- (let ((function (cadr index-item))
- (rest (cddr index-item)))
- (apply function (car index-item) rest)))))))
+ (let* ((is-special-item (listp (cdr index-item)))
+ (function
+ (if is-special-item
+ (caddr index-item) imenu-default-goto-function))
+ (position (if is-special-item
+ (cadr index-item) (cdr index-item)))
+ (rest (if is-special-item (cddr index-item))))
+ (apply function (car index-item) position rest)))))