]> git.eshelyaron.com Git - emacs.git/commitdiff
(cperl-imenu-name-and-position): Copy imenu-example--name-and-position
authorGlenn Morris <rgm@gnu.org>
Sat, 22 Aug 2009 19:39:54 +0000 (19:39 +0000)
committerGlenn Morris <rgm@gnu.org>
Sat, 22 Aug 2009 19:39:54 +0000 (19:39 +0000)
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
lisp/progmodes/cperl-mode.el

index 076a0a863ca7c82b49af38a020295ff239d06a99..22ec1f69ff3723748a2717a01ce339e4adb38c1e 100644 (file)
@@ -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):
index 722a31eae805fb0323b3c6f33f636512e1d77953..c7607d95861078f76696ee960d65cd075de330d6 100644 (file)
@@ -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)