From 47e83968520f5c2766306cfeded468a3077911fd Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 22 Aug 2009 19:39:54 +0000 Subject: [PATCH] (cperl-imenu-name-and-position): Copy imenu-example--name-and-position function here for own use. (cperl-xsub-scan): Use cperl-imenu-name-and-position. (cperl-time-fontification): Use forward-line rather than goto-line. --- lisp/ChangeLog | 5 +++++ lisp/progmodes/cperl-mode.el | 20 +++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 076a0a863ca..22ec1f69ff3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2009-08-22 Glenn Morris + * progmodes/cperl-mode.el (cperl-imenu-name-and-position): + Copy imenu-example--name-and-position function here for own use. + (cperl-xsub-scan): Use cperl-imenu-name-and-position. + * bs.el (bs--redisplay): * cus-edit.el (custom-redraw): * ibuffer.el (ibuffer-bury-buffer): @@ -13,6 +17,7 @@ * progmodes/ada-mode.el (ada-compile-goto-error): * progmodes/ada-xref.el (ada-xref-find-in-modified-ali): (ebrowse-select-1st-to-9nth): + * progmodes/cperl-mode.el (cperl-time-fontification): * progmodes/ebrowse.el (ebrowse-toggle-file-name-display) * progmodes/gud.el (gud-display-line): (idlwave-shell-display-line): diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 722a31eae80..c7607d95861 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -6874,6 +6874,19 @@ by CPerl." ;; Do not introduce variable if not needed, we check it! (set 'parse-sexp-lookup-properties t)))) +;; Copied from imenu-example--name-and-position. +(defvar imenu-use-markers) + +(defun cperl-imenu-name-and-position () + "Return the current/previous sexp and its (beginning) location. +Does not move point." + (save-excursion + (forward-sexp -1) + (let ((beg (if imenu-use-markers (point-marker) (point))) + (end (progn (forward-sexp) (point)))) + (cons (buffer-substring beg end) + beg)))) + (defun cperl-xsub-scan () (require 'imenu) (let ((index-alist '()) @@ -6896,7 +6909,7 @@ by CPerl." ((not package) nil) ; C language section ((match-beginning 3) ; XSUB (goto-char (1+ (match-beginning 3))) - (setq index (imenu-example--name-and-position)) + (setq index (cperl-imenu-name-and-position)) (setq name (buffer-substring (match-beginning 3) (match-end 3))) (if (and prefix (string-match (concat "^" prefix) name)) (setq name (substring name (length prefix)))) @@ -6908,7 +6921,7 @@ by CPerl." (push index index-alist)) (t ; BOOT: section ;; (beginning-of-line) - (setq index (imenu-example--name-and-position)) + (setq index (cperl-imenu-name-and-position)) (setcar index (concat package "::BOOT:")) (push index index-alist))))) index-alist)) @@ -8758,7 +8771,8 @@ start with default arguments, then refine the slowdown regions." (let ((tt (current-time))) (+ (* 1000 (nth 1 tt)) (/ (nth 2 tt) 1000)))))) (tt (funcall timems)) (c 0) delta tot) - (goto-line l) + (goto-char (point-min)) + (forward-line (1- l)) (cperl-mode) (setq tot (- (- tt (setq tt (funcall timems))))) (message "cperl-mode at %s: %s" l tot) -- 2.39.2