;;; cperl-mode.el --- Perl code editing commands for Emacs
;; Copyright (C) 1985, 1986, 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-;; 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+;; 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
;; Free Software Foundation, Inc.
;; Author: Ilya Zakharevich
(defvar cperl-vc-header-alist nil)
(make-obsolete-variable
'cperl-vc-header-alist
- "use cperl-vc-rcs-header or cperl-vc-sccs-header instead.")
+ "use cperl-vc-rcs-header or cperl-vc-sccs-header instead."
+ "22.1")
(defcustom cperl-clobber-mode-lists
(not
(setq
t-font-lock-keywords
(list
- (list "[ \t]+$" 0 cperl-invalid-face t)
+ `("[ \t]+$" 0 ',cperl-invalid-face t)
(cons
(concat
"\\(^\\|[^$@%&\\]\\)\\<\\("
;; 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 '())
((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))))
(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))
(cons cons1 (car cperl-hierarchy)))))))
(end-of-line))))
-(declare-function x-popup-menu "xmenu.c" (position menu))
+(declare-function x-popup-menu "menu.c" (position menu))
(defun cperl-tags-hier-init (&optional update)
"Show hierarchical menu of classes and methods.
(let* ((pod2man-args (concat buffer-file-name " | nroff -man "))
(bufname (concat "Man " buffer-file-name))
(buffer (generate-new-buffer bufname)))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(let ((process-environment (copy-sequence process-environment)))
;; Prevent any attempt to use display terminal fanciness.
(setenv "TERM" "dumb")
(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)
(substring v (match-beginning 1) (match-end 1)))
"Version of IZ-supported CPerl package this file is based on.")
+(defun cperl-mode-unload-function ()
+ "Unload the Cperl mode library."
+ (let ((new-mode (if (eq (symbol-function 'perl-mode) 'cperl-mode)
+ 'fundamental-mode
+ 'perl-mode)))
+ (dolist (buf (buffer-list))
+ (with-current-buffer buf
+ (when (eq major-mode 'cperl-mode)
+ (funcall new-mode)))))
+ ;; continue standard unloading
+ nil)
+
(provide 'cperl-mode)
;; arch-tag: 42e5b19b-e187-4537-929f-1a7408980ce6