;;; 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
+;; 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
;; Free Software Foundation, Inc.
;; Author: Ilya Zakharevich and Bob Olson
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
"*Indentation of CPerl statements with respect to containing block."
:type 'integer
:group 'cperl-indentation-details)
+(put 'cperl-indent-level 'safe-local-variable 'integerp)
(defcustom cperl-lineup-step nil
"*`cperl-lineup' will always lineup at multiple of this number.
(defcustom cperl-electric-keywords nil
"*Not-nil (and non-null) means keywords are electric in CPerl.
-Can be overwritten by `cperl-hairy' if nil."
+Can be overwritten by `cperl-hairy' if nil.
+
+Uses `abbrev-mode' to do the expansion. If you want to use your
+own abbrevs in cperl-mode, but do not want keywords to be
+electric, you must redefine `cperl-mode-abbrev-table': do
+\\[edit-abbrevs], search for `cperl-mode-abbrev-table', and, in
+that paragraph, delete the words that appear at the ends of lines and
+that begin with \"cperl-electric\".
+"
:type '(choice (const null) boolean)
:group 'cperl-affected-by-hairy)
(defvar cperl-use-major-mode 'cperl-mode)
(defvar cperl-font-lock-multiline-start nil)
(defvar cperl-font-lock-multiline nil)
-(defvar cperl-compilation-error-regexp-alist nil)
(defvar cperl-font-locking nil)
+;; NB as it stands the code in cperl-mode assumes this only has one
+;; element. If Xemacs 19 support were dropped, this could all be simplified.
+(defvar cperl-compilation-error-regexp-alist
+ ;; This look like a paranoiac regexp: could anybody find a better one? (which WORKS).
+ '(("^[^\n]* \\(file\\|at\\) \\([^ \t\n]+\\) [^\n]*line \\([0-9]+\\)[\\., \n]"
+ 2 3))
+ "Alist that specifies how to match errors in perl output.")
+
;;;###autoload
(defun cperl-mode ()
"Major mode for editing Perl code.
[(control c) (control h) f])))
(setq major-mode cperl-use-major-mode)
(setq mode-name "CPerl")
- (if (not cperl-mode-abbrev-table)
- (let ((prev-a-c abbrevs-changed))
- (define-abbrev-table 'cperl-mode-abbrev-table '(
+ (let ((prev-a-c abbrevs-changed))
+ (define-abbrev-table 'cperl-mode-abbrev-table '(
("if" "if" cperl-electric-keyword 0)
("elsif" "elsif" cperl-electric-keyword 0)
("while" "while" cperl-electric-keyword 0)
("over" "over" cperl-electric-pod 0)
("head1" "head1" cperl-electric-pod 0)
("head2" "head2" cperl-electric-pod 0)))
- (setq abbrevs-changed prev-a-c)))
+ (setq abbrevs-changed prev-a-c))
(setq local-abbrev-table cperl-mode-abbrev-table)
(if (cperl-val 'cperl-electric-keywords)
(abbrev-mode 1))
(cond ((boundp 'compilation-error-regexp-alist-alist);; xemacs 20.x
(make-local-variable 'compilation-error-regexp-alist-alist)
(set 'compilation-error-regexp-alist-alist
- (cons (cons 'cperl cperl-compilation-error-regexp-alist)
+ (cons (cons 'cperl (car cperl-compilation-error-regexp-alist))
(symbol-value 'compilation-error-regexp-alist-alist)))
(if (fboundp 'compilation-build-compilation-error-regexp-alist)
(let ((f 'compilation-build-compilation-error-regexp-alist))
(funcall f))
+ (make-local-variable 'compilation-error-regexp-alist)
(push 'cperl compilation-error-regexp-alist)))
((boundp 'compilation-error-regexp-alist);; xmeacs 19.x
(make-local-variable 'compilation-error-regexp-alist)
(set 'compilation-error-regexp-alist
- (cons cperl-compilation-error-regexp-alist
- (symbol-value 'compilation-error-regexp-alist)))))
+ (append cperl-compilation-error-regexp-alist
+ (symbol-value 'compilation-error-regexp-alist)))))
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults
(cond
(easy-menu-add cperl-menu)) ; A NOP in Emacs.
(run-mode-hooks 'cperl-mode-hook)
(if cperl-hook-after-change
- (progn
- (make-local-hook 'after-change-functions)
- (add-hook 'after-change-functions 'cperl-after-change-function nil t)))
+ (add-hook 'after-change-functions 'cperl-after-change-function nil t))
;; After hooks since fontification will break this
(if cperl-pod-here-scan
(or cperl-syntaxify-by-font-lock
(t 5))) ; should not happen
\f
-(defvar cperl-compilation-error-regexp-alist
- ;; This look like a paranoiac regexp: could anybody find a better one? (which WORKS).
- '(("^[^\n]* \\(file\\|at\\) \\([^ \t\n]+\\) [^\n]*line \\([0-9]+\\)[\\., \n]"
- 2 3))
- "Alist that specifies how to match errors in perl output.")
-
-
(defun cperl-windowed-init ()
"Initialization under windowed version."
(cond ((featurep 'ps-print)