Mercurial > emacs
changeset 104544:5a7504ff8b85
(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.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 22 Aug 2009 19:39:54 +0000 |
parents | da8b3e61b182 |
children | 6a56db2e5756 |
files | lisp/ChangeLog lisp/progmodes/cperl-mode.el |
diffstat | 2 files changed, 22 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sat Aug 22 19:29:18 2009 +0000 +++ b/lisp/ChangeLog Sat Aug 22 19:39:54 2009 +0000 @@ -1,5 +1,9 @@ 2009-08-22 Glenn Morris <rgm@gnu.org> + * 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):
--- a/lisp/progmodes/cperl-mode.el Sat Aug 22 19:29:18 2009 +0000 +++ b/lisp/progmodes/cperl-mode.el Sat Aug 22 19:39:54 2009 +0000 @@ -6874,6 +6874,19 @@ ;; 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 @@ ((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 @@ (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 @@ (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)