summaryrefslogtreecommitdiff
path: root/lisp/progmodes/perl-mode.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2005-03-24 18:41:26 +0000
committerMiles Bader <miles@gnu.org>2005-03-24 18:41:26 +0000
commit5c5385965643b3b951da725c36f6d36862229876 (patch)
tree1c858c489197a9c2a43fb7726c540497c350dfa9 /lisp/progmodes/perl-mode.el
parent1bac4db5629da854a984a0e84a9469f14b6b9e76 (diff)
parentc29749e73120925796d8c741f5e12388091d6691 (diff)
downloademacs-5c5385965643b3b951da725c36f6d36862229876.tar.gz
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-29
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 192-205) - Update from CVS - Use gdb-ui breakpoint faces on ttys too - Tweak gdb-ui breakpoint faces - Tweak info/.arch-inventory to identify info/.cvsignore as source - Clean up gdb-ui breakpoint faces
Diffstat (limited to 'lisp/progmodes/perl-mode.el')
-rw-r--r--lisp/progmodes/perl-mode.el92
1 files changed, 50 insertions, 42 deletions
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 841c62f5121..0febea4450f 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -207,11 +207,11 @@ The expansion is entirely correct because it uses the C preprocessor."
'("\\<\\(local\\|my\\)\\>" . font-lock-type-face)
;;
;; Fontify function, variable and file name references.
- '("&\\(\\sw+\\)" 1 font-lock-function-name-face)
+ '("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face)
;; Additionally underline non-scalar variables. Maybe this is a bad idea.
;;'("[$@%*][#{]?\\(\\sw+\\)" 1 font-lock-variable-name-face)
- '("[$*]{?\\(\\sw+\\)" 1 font-lock-variable-name-face)
- '("\\([@%]\\|\\$#\\)\\(\\sw+\\)"
+ '("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-variable-name-face)
+ '("\\([@%]\\|\\$#\\)\\(\\sw+\\(::\\sw+\\)*\\)"
(2 (cons font-lock-variable-name-face '(underline))))
'("<\\(\\sw+\\)>" 1 font-lock-constant-face)
;;
@@ -330,30 +330,34 @@ The expansion is entirely correct because it uses the C preprocessor."
nil nil state 'syntax-table)))
;; The open/close chars are matched like () [] {} and <>.
(let ((parse-sexp-lookup-properties nil))
- (ignore-errors
- (with-syntax-table st
- (goto-char (nth 8 state)) (forward-sexp 1))
- (when twoargs
- (save-excursion
- ;; Skip whitespace and make sure that font-lock will
- ;; refontify the second part in the proper context.
- (put-text-property
- (point) (progn (forward-comment (point-max)) (point))
- 'font-lock-multiline t)
- ;;
- (unless
- (save-excursion
- (let* ((char2 (char-after))
- (st2 (perl-quote-syntax-table char2)))
- (with-syntax-table st2 (forward-sexp 1))
- (put-text-property pos (line-end-position)
- 'jit-lock-defer-multiline t)
- (looking-at "\\s-*\\sw*e")))
- (put-text-property (point) (1+ (point))
- 'syntax-table
- (if (assoc (char-after)
- perl-quote-like-pairs)
- '(15) '(7)))))))))
+ (condition-case err
+ (progn
+ (with-syntax-table st
+ (goto-char (nth 8 state)) (forward-sexp 1))
+ (when twoargs
+ (save-excursion
+ ;; Skip whitespace and make sure that font-lock will
+ ;; refontify the second part in the proper context.
+ (put-text-property
+ (point) (progn (forward-comment (point-max)) (point))
+ 'font-lock-multiline t)
+ ;;
+ (unless
+ (save-excursion
+ (with-syntax-table
+ (perl-quote-syntax-table (char-after))
+ (forward-sexp 1))
+ (put-text-property pos (line-end-position)
+ 'jit-lock-defer-multiline t)
+ (looking-at "\\s-*\\sw*e"))
+ (put-text-property (point) (1+ (point))
+ 'syntax-table
+ (if (assoc (char-after)
+ perl-quote-like-pairs)
+ '(15) '(7)))))))
+ ;; The arg(s) is not terminated, so it extends until EOB.
+ (scan-error (goto-char (point-max))))))
+ ;; Point is now right after the arg(s).
;; Erase any syntactic marks within the quoted text.
(put-text-property pos (1- (point)) 'syntax-table nil)
(when (eq (char-before (1- (point))) ?$)
@@ -649,20 +653,7 @@ changed by, or (parse-state) if line starts in a quoted string."
((looking-at (or nochange perl-nochange)) 0)
(t
(skip-chars-forward " \t\f")
- (cond ((looking-at "\\(\\w\\|\\s_\\)+:[^:]")
- (setq indent (max 1 (+ indent perl-label-offset))))
- ((= (char-syntax (following-char)) ?\))
- (setq indent
- (save-excursion
- (forward-char 1)
- (forward-sexp -1)
- (forward-char 1)
- (if (perl-hanging-paren-p)
- (- indent perl-indent-level)
- (forward-char -1)
- (current-column)))))
- ((= (following-char) ?{)
- (setq indent (+ indent perl-brace-offset))))
+ (setq indent (perl-indent-new-calculate nil indent bof))
(- indent (current-column)))))
(skip-chars-forward " \t\f")
(if (and (numberp shift-amt) (/= 0 shift-amt))
@@ -698,13 +689,30 @@ changed by, or (parse-state) if line starts in a quoted string."
(save-excursion
(skip-syntax-backward " (") (not (bolp)))))
+(defun perl-indent-new-calculate (&optional virtual default parse-start)
+ (or
+ (and virtual (save-excursion (skip-chars-backward " \t") (bolp))
+ (current-column))
+ (and (looking-at "\\(\\w\\|\\s_\\)+:[^:]")
+ (max 1 (+ (or default (perl-calculate-indent parse-start))
+ perl-label-offset)))
+ (and (= (char-syntax (following-char)) ?\))
+ (save-excursion
+ (forward-char 1)
+ (forward-sexp -1)
+ (perl-indent-new-calculate 'virtual nil parse-start)))
+ (and (and (= (following-char) ?{)
+ (save-excursion (forward-char) (perl-hanging-paren-p)))
+ (+ (or default (perl-calculate-indent parse-start))
+ perl-brace-offset))
+ (or default (perl-calculate-indent parse-start))))
+
(defun perl-calculate-indent (&optional parse-start)
"Return appropriate indentation for current line as Perl code.
In usual case returns an integer: the column to indent to.
Returns (parse-state) if line starts inside a string.
Optional argument PARSE-START should be the position of `beginning-of-defun'."
(save-excursion
- (beginning-of-line)
(let ((indent-point (point))
(case-fold-search nil)
(colon-line-end 0)