/[emacs]/emacs/lisp/progmodes/perl-mode.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/perl-mode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.42 by rms, Tue Jan 22 07:17:54 2002 UTC revision 1.42.4.1 by miles, Fri Apr 4 06:20:36 2003 UTC
# Line 66  Line 66 
66  ;; Known problems (these are all caused by limitations in the Emacs Lisp  ;; Known problems (these are all caused by limitations in the Emacs Lisp
67  ;; parsing routine (parse-partial-sexp), which was not designed for such  ;; parsing routine (parse-partial-sexp), which was not designed for such
68  ;; a rich language; writing a more suitable parser would be a big job):  ;; a rich language; writing a more suitable parser would be a big job):
 ;; 1)  Regular expression delimiters do not act as quotes, so special  
 ;;       characters such as `'"#:;[](){} may need to be backslashed  
 ;;       in regular expressions and in both parts of s/// and tr///.  
69  ;; 2)  The globbing syntax <pattern> is not recognized, so special  ;; 2)  The globbing syntax <pattern> is not recognized, so special
70  ;;       characters in the pattern string must be backslashed.  ;;       characters in the pattern string must be backslashed.
71  ;; 3)  The q, qq, and << quoting operators are not recognized; see below.  ;; 3)  The << quoting operators are not recognized; see below.
72  ;; 5)  To make '$' work correctly, $' is not recognized as a variable.  ;; 5)  To make '$' work correctly, $' is not recognized as a variable.
73  ;;     Use "$'" or $POSTMATCH instead.  ;;     Use "$'" or $POSTMATCH instead.
 ;; 7)  When ' (quote) is used as a package name separator, perl-mode  
 ;;       doesn't understand, and thinks it is seeing a quoted string.  
74  ;;  ;;
75  ;; If you don't use font-lock, additional problems will appear:  ;; If you don't use font-lock, additional problems will appear:
76    ;; 1)  Regular expression delimiters do not act as quotes, so special
77    ;;       characters such as `'"#:;[](){} may need to be backslashed
78    ;;       in regular expressions and in both parts of s/// and tr///.
79    ;; 4)  The q and qq quoting operators are not recognized; see below.
80  ;; 5)  To make variables such a $' and $#array work, perl-mode treats  ;; 5)  To make variables such a $' and $#array work, perl-mode treats
81  ;;       $ just like backslash, so '$' is not treated correctly.  ;;       $ just like backslash, so '$' is not treated correctly.
82  ;; 6)  Unfortunately, treating $ like \ makes ${var} be treated as an  ;; 6)  Unfortunately, treating $ like \ makes ${var} be treated as an
83  ;;       unmatched }.  See below.  ;;       unmatched }.  See below.
84    ;; 7)  When ' (quote) is used as a package name separator, perl-mode
85    ;;       doesn't understand, and thinks it is seeing a quoted string.
86    
87  ;; Here are some ugly tricks to bypass some of these problems:  the perl  ;; Here are some ugly tricks to bypass some of these problems:  the perl
88  ;; expression /`/ (that's a back-tick) usually evaluates harmlessly,  ;; expression /`/ (that's a back-tick) usually evaluates harmlessly,
# Line 91  Line 92 
92  ;;  ;;
93  ;;     /`/; $ugly = q?"'$?; /`/;  ;;     /`/; $ugly = q?"'$?; /`/;
94  ;;  ;;
95    ;; The same trick can be used for problem 6 as in:
96    ;;     /{/; while (<${glob_me}>)
97    ;; but a simpler solution is to add a space between the $ and the {:
98    ;;     while (<$ {glob_me}>)
99    ;;
100  ;; Problem 7 is even worse, but this 'fix' does work :-(  ;; Problem 7 is even worse, but this 'fix' does work :-(
101  ;;     $DB'stop#'  ;;     $DB'stop#'
102  ;;         [$DB'line#'  ;;         [$DB'line#'
# Line 133  The expansion is entirely correct becaus Line 139  The expansion is entirely correct becaus
139    (let ((st (make-syntax-table (standard-syntax-table))))    (let ((st (make-syntax-table (standard-syntax-table))))
140      (modify-syntax-entry ?\n ">" st)      (modify-syntax-entry ?\n ">" st)
141      (modify-syntax-entry ?# "<" st)      (modify-syntax-entry ?# "<" st)
142        ;; `$' is also a prefix char so I was tempted to say "/ p",
143        ;; but the `p' thingy basically overrides the `/' :-(   --stef
144      (modify-syntax-entry ?$ "/" st)      (modify-syntax-entry ?$ "/" st)
145      (modify-syntax-entry ?% "." st)      (modify-syntax-entry ?% ". p" st)
146        (modify-syntax-entry ?@ ". p" st)
147      (modify-syntax-entry ?& "." st)      (modify-syntax-entry ?& "." st)
148      (modify-syntax-entry ?\' "\"" st)      (modify-syntax-entry ?\' "\"" st)
149      (modify-syntax-entry ?* "." st)      (modify-syntax-entry ?* "." st)
# Line 187  The expansion is entirely correct becaus Line 196  The expansion is entirely correct becaus
196     (list     (list
197      ;;      ;;
198      ;; Fontify keywords, except those fontified otherwise.      ;; Fontify keywords, except those fontified otherwise.
199  ;   (make-regexp '("if" "until" "while" "elsif" "else" "unless" "do" "dump"      (concat "\\<"
200  ;  "for" "foreach" "exit" "die"              (regexp-opt '("if" "until" "while" "elsif" "else" "unless"
201  ;  "BEGIN" "END" "return" "exec" "eval"))                            "do" "dump" "for" "foreach" "exit" "die"
202      (concat "\\<\\("                            "BEGIN" "END" "return" "exec" "eval") t)
203              "BEGIN\\|END\\|d\\(ie\\|o\\|ump\\)\\|"              "\\>")
             "e\\(ls\\(e\\|if\\)\\|val\\|x\\(ec\\|it\\)\\)\\|"  
             "for\\(\\|each\\)\\|if\\|return\\|un\\(less\\|til\\)\\|while"  
             "\\)\\>")  
204      ;;      ;;
205      ;; Fontify local and my keywords as types.      ;; Fontify local and my keywords as types.
206      '("\\<\\(local\\|my\\)\\>" . font-lock-type-face)      '("\\<\\(local\\|my\\)\\>" . font-lock-type-face)
# Line 217  The expansion is entirely correct becaus Line 223  The expansion is entirely correct becaus
223  (defvar perl-font-lock-keywords perl-font-lock-keywords-1  (defvar perl-font-lock-keywords perl-font-lock-keywords-1
224    "Default expressions to highlight in Perl mode.")    "Default expressions to highlight in Perl mode.")
225    
226    (defvar perl-quote-like-pairs
227      '((?\( . ?\)) (?\[ . ?\]) (?\{ . ?\}) (?\< . ?\>)))
228    
229    ;; FIXME: handle here-docs and regexps.
230    ;; <<EOF <<"EOF" <<'EOF' (no space)
231    ;; see `man perlop'
232    ;; ?...?
233    ;; /.../
234    ;; m [...]
235    ;; m /.../
236    ;; q /.../ = '...'
237    ;; qq /.../ = "..."
238    ;; qx /.../ = `...`
239    ;; qr /.../ = precompiled regexp =~=~ m/.../
240    ;; qw /.../
241    ;; s /.../.../
242    ;; s <...> /.../
243    ;; s '...'...'
244    ;; tr /.../.../
245    ;; y /.../.../
246    ;;
247    ;; <file*glob>
248  (defvar perl-font-lock-syntactic-keywords  (defvar perl-font-lock-syntactic-keywords
249    ;; Turn POD into b-style comments    ;; Turn POD into b-style comments
250    '(("^\\(=\\)\\(head1\\|pod\\)\\([ \t]\\|$\\)" (1 "< b"))    '(("^\\(=\\)\\sw" (1 "< b"))
251      ("^=cut[ \t]*\\(\n\\)" (1 "> b"))      ("^=cut[ \t]*\\(\n\\)" (1 "> b"))
252      ;; Catch ${ so that ${var} doesn't screw up indentation.      ;; Catch ${ so that ${var} doesn't screw up indentation.
253      ("\\(\\$\\)[{']" (1 "."))))      ;; This also catches $' to handle 'foo$', although it should really
254        ;; check that it occurs inside a '..' string.
255        ("\\(\\$\\)[{']" (1 ". p"))
256        ;; Handle funny names like $DB'stop.
257        ("\\$ ?{?^?[_a-zA-Z][_a-zA-Z0-9]*\\('\\)[_a-zA-Z]" (1 "_"))
258        ;; format statements
259        ("^[ \t]*format.*=[ \t]*\\(\n\\)" (1 '(7)))
260        ;; Funny things in sub arg specifications like `sub myfunc ($$)'
261        ("\\<sub\\s-+\\S-+\\s-*(\\([^)]+\\))" 1 '(1))
262        ;; regexp and funny quotes
263        ("[;(=!~{][ \t\n]*\\(/\\)" (1 '(7)))
264        ("[;( =!~{\t\n]\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\s-*\\([^])}> \n\t]\\)"
265         ;; Nasty cases:
266         ;; /foo/m  $a->m  $#m $m @m %m
267         ;; \s (appears often in regexps).
268         ;; -s file
269         (2 (if (assoc (char-after (match-beginning 2))
270                       perl-quote-like-pairs)
271                '(15) '(7))))))
272    
273    (defvar perl-empty-syntax-table
274      (let ((st (copy-syntax-table)))
275        ;; Make all chars be of punctuation syntax.
276        (dotimes (i 256) (aset st i '(1)))
277        (modify-syntax-entry ?\\ "\\" st)
278        st)
279      "Syntax table used internally for processing quote-like operators.")
280    
281    (defun perl-quote-syntax-table (char)
282      (let ((close (cdr (assq char perl-quote-like-pairs)))
283            (st (copy-syntax-table perl-empty-syntax-table)))
284        (if (not close)
285            (modify-syntax-entry char "\"" st)
286          (modify-syntax-entry char "(" st)
287          (modify-syntax-entry close ")" st))
288        st))
289    
290  (defun perl-font-lock-syntactic-face-function (state)  (defun perl-font-lock-syntactic-face-function (state)
291    (if (nth 3 state)    (let ((char (nth 3 state)))
292        font-lock-string-face      (cond
293      (if (nth 7 state) font-lock-doc-face font-lock-comment-face)))       ((not char)
294          ;; Comment or docstring.
295          (if (nth 7 state) font-lock-doc-face font-lock-comment-face))
296         ((and (char-valid-p char) (eq (char-syntax (nth 3 state)) ?\"))
297          ;; Normal string.
298          font-lock-string-face)
299         ((eq (nth 3 state) ?\n)
300          ;; A `format' command.
301          (save-excursion
302            (when (and (re-search-forward "^\\s *\\.\\s *$" nil t)
303                       (not (eobp)))
304              (put-text-property (point) (1+ (point)) 'syntax-table '(7)))
305            font-lock-string-face))
306         (t
307          ;; This is regexp like quote thingy.
308          (setq char (char-after (nth 8 state)))
309          (save-excursion
310            (let ((twoargs (save-excursion
311                             (goto-char (nth 8 state))
312                             (skip-syntax-backward " ")
313                             (skip-syntax-backward "w")
314                             (member (buffer-substring
315                                      (point) (progn (forward-word 1) (point)))
316                                     '("tr" "s" "y"))))
317                  (close (cdr (assq char perl-quote-like-pairs)))
318                  (pos (point))
319                  (st (perl-quote-syntax-table char)))
320              (if (not close)
321                  ;; The closing char is the same as the opening char.
322                  (with-syntax-table st
323                    (parse-partial-sexp (point) (point-max)
324                                        nil nil state 'syntax-table)
325                    (when twoargs
326                      (parse-partial-sexp (point) (point-max)
327                                          nil nil state 'syntax-table)))
328                ;; The open/close chars are matched like () [] {} and <>.
329                (let ((parse-sexp-lookup-properties nil))
330                  (ignore-errors
331                    (with-syntax-table st
332                      (goto-char (nth 8 state)) (forward-sexp 1))
333                    (when twoargs
334                      (save-excursion
335                        ;; Skip whitespace and make sure that font-lock will
336                        ;; refontify the second part in the proper context.
337                        (put-text-property
338                         (point) (progn (forward-comment (point-max)) (point))
339                         'font-lock-multiline t)
340                        ;;
341                        (unless
342                            (save-excursion
343                              (let* ((char2 (char-after))
344                                     (st2 (perl-quote-syntax-table char2)))
345                                (with-syntax-table st2 (forward-sexp 1))
346                                (put-text-property pos (line-end-position)
347                                                   'jit-lock-defer-multiline t)
348                                (looking-at "\\s-*\\sw*e")))
349                          (put-text-property (point) (1+ (point))
350                                             'syntax-table
351                                             (if (assoc (char-after)
352                                                        perl-quote-like-pairs)
353                                                 '(15) '(7)))))))))
354              ;; Erase any syntactic marks within the quoted text.
355              (put-text-property pos (1- (point)) 'syntax-table nil)
356              (when (eq (char-before (1- (point))) ?$)
357                (put-text-property (- (point) 2) (1- (point))
358                                   'syntax-table '(1)))
359              (put-text-property (1- (point)) (point)
360                                 'syntax-table (if close '(15) '(7)))
361              font-lock-string-face))))))
362                ;; (if (or twoargs (not (looking-at "\\s-*\\sw*e")))
363                ;;  font-lock-string-face
364                ;;   (font-lock-fontify-syntactically-region
365                ;;    ;; FIXME: `end' is accessed via dyn-scoping.
366                ;;    pos (min end (1- (point))) nil '(nil))
367                ;;   nil)))))))
368    
369    
370  (defcustom perl-indent-level 4  (defcustom perl-indent-level 4
371    "*Indentation of Perl statements with respect to containing block."    "*Indentation of Perl statements with respect to containing block."
# Line 297  Variables controlling indentation style: Line 435  Variables controlling indentation style:
435      regardless of where in the line point is when the TAB command is used.      regardless of where in the line point is when the TAB command is used.
436   `perl-tab-to-comment'   `perl-tab-to-comment'
437      Non-nil means that for lines which don't need indenting, TAB will      Non-nil means that for lines which don't need indenting, TAB will
438      either delete an empty comment, indent an existing comment, move      either delete an empty comment, indent an existing comment, move
439      to end-of-line, or if at end-of-line already, create a new comment.      to end-of-line, or if at end-of-line already, create a new comment.
440   `perl-nochange'   `perl-nochange'
441      Lines starting with this regular expression are not auto-indented.      Lines starting with this regular expression are not auto-indented.
# Line 397  If at end-of-line, and not in a comment Line 535  If at end-of-line, and not in a comment
535                  (or (/= last-command-char ?:)                  (or (/= last-command-char ?:)
536                      ;; Colon is special only after a label ....                      ;; Colon is special only after a label ....
537                      (looking-at "\\s-*\\(\\w\\|\\s_\\)+$"))                      (looking-at "\\s-*\\(\\w\\|\\s_\\)+$"))
538                  (let ((pps (parse-partial-sexp                  (let ((pps (parse-partial-sexp
539                              (perl-beginning-of-function) insertpos)))                              (perl-beginning-of-function) insertpos)))
540                    (not (or (nth 3 pps) (nth 4 pps) (nth 5 pps))))))                    (not (or (nth 3 pps) (nth 4 pps) (nth 5 pps))))))
541           (progn                         ; must insert, indent, delete           (progn                         ; must insert, indent, delete
# Line 484  possible action from the following list: Line 622  possible action from the following list:
622    
623  (defun perl-indent-line (&optional nochange parse-start)  (defun perl-indent-line (&optional nochange parse-start)
624    "Indent current line as Perl code.    "Indent current line as Perl code.
625  Return the amount the indentation  Return the amount the indentation
626  changed by, or (parse-state) if line starts in a quoted string."  changed by, or (parse-state) if line starts in a quoted string."
627    (let ((case-fold-search nil)    (let ((case-fold-search nil)
628          (pos (- (point-max) (point)))          (pos (- (point-max) (point)))
# Line 500  changed by, or (parse-state) if line sta Line 638  changed by, or (parse-state) if line sta
638                   (skip-chars-forward " \t\f")                   (skip-chars-forward " \t\f")
639                   (cond ((looking-at "\\(\\w\\|\\s_\\)+:[^:]")                   (cond ((looking-at "\\(\\w\\|\\s_\\)+:[^:]")
640                          (setq indent (max 1 (+ indent perl-label-offset))))                          (setq indent (max 1 (+ indent perl-label-offset))))
641                         ((= (following-char) ?})                         ((= (char-syntax (following-char)) ?\))
642                          (setq indent (- indent perl-indent-level)))                          (setq indent
643                                  (save-excursion
644                                    (forward-char 1)
645                                    (forward-sexp -1)
646                                    (forward-char 1)
647                                    (if (perl-hanging-paren-p)
648                                        (- indent perl-indent-level)
649                                      (forward-char -1)
650                                      (current-column)))))
651                         ((= (following-char) ?{)                         ((= (following-char) ?{)
652                          (setq indent (+ indent perl-brace-offset))))                          (setq indent (+ indent perl-brace-offset))))
653                   (- indent (current-column)))))                   (- indent (current-column)))))
# Line 533  changed by, or (parse-state) if line sta Line 679  changed by, or (parse-state) if line sta
679    ;; Now we get the answer.    ;; Now we get the answer.
680    (not (memq (preceding-char) '(?\; ?\} ?\{))))    (not (memq (preceding-char) '(?\; ?\} ?\{))))
681    
682    (defun perl-hanging-paren-p ()
683      "Non-nil if we are right after a hanging parenthesis-like char."
684      (and (looking-at "[ \t]*$")
685           (save-excursion
686             (skip-syntax-backward " (") (not (bolp)))))
687    
688  (defun perl-calculate-indent (&optional parse-start)  (defun perl-calculate-indent (&optional parse-start)
689    "Return appropriate indentation for current line as Perl code.    "Return appropriate indentation for current line as Perl code.
690  In usual case returns an integer: the column to indent to.  In usual case returns an integer: the column to indent to.
691  Returns (parse-state) if line starts inside a string."  Returns (parse-state) if line starts inside a string.
692    Optional argument PARSE-START should be the position of `beginning-of-defun'."
693    (save-excursion    (save-excursion
694      (beginning-of-line)      (beginning-of-line)
695      (let ((indent-point (point))      (let ((indent-point (point))
# Line 557  Returns (parse-state) if line starts ins Line 710  Returns (parse-state) if line starts ins
710          (perl-beginning-of-function))          (perl-beginning-of-function))
711        (while (< (point) indent-point)   ;repeat until right sexp        (while (< (point) indent-point)   ;repeat until right sexp
712          (setq state (parse-partial-sexp (point) indent-point 0))          (setq state (parse-partial-sexp (point) indent-point 0))
713  ; state = (depth_in_parens innermost_containing_list last_complete_sexp          ;; state = (depth_in_parens innermost_containing_list
714  ;          string_terminator_or_nil inside_commentp following_quotep          ;;          last_complete_sexp string_terminator_or_nil inside_commentp
715  ;          minimum_paren-depth_this_scan)          ;;          following_quotep minimum_paren-depth_this_scan)
716  ; Parsing stops if depth in parentheses becomes equal to third arg.          ;; Parsing stops if depth in parentheses becomes equal to third arg.
717          (setq containing-sexp (nth 1 state)))          (setq containing-sexp (nth 1 state)))
718        (cond ((nth 3 state) state)       ; In a quoted string?        (cond ((nth 3 state) state)       ; In a quoted string?
719              ((null containing-sexp)     ; Line is at top level.              ((null containing-sexp)     ; Line is at top level.
720               (skip-chars-forward " \t\f")               (skip-chars-forward " \t\f")
721               (if (= (following-char) ?{)               (if (= (following-char) ?{)
722                   0   ; move to beginning of line if it starts a function body                   0  ; move to beginning of line if it starts a function body
723                 ;; indent a little if this is a continuation line                 ;; indent a little if this is a continuation line
724                 (perl-backward-to-noncomment)                 (perl-backward-to-noncomment)
725                 (if (or (bobp)                 (if (or (bobp)
# Line 576  Returns (parse-state) if line starts ins Line 729  Returns (parse-state) if line starts ins
729               ;; line is expression, not statement:               ;; line is expression, not statement:
730               ;; indent to just after the surrounding open.               ;; indent to just after the surrounding open.
731               (goto-char (1+ containing-sexp))               (goto-char (1+ containing-sexp))
732               (if perl-indent-continued-arguments               (if (perl-hanging-paren-p)
733                   (+ perl-indent-continued-arguments (current-indentation))                   ;; We're indenting an arg of a call like:
734                 (skip-chars-forward " \t")                   ;;    $a = foobarlongnamefun (
735                 (current-column)))                   ;;             arg1
736                     ;;             arg2
737                     ;;         );
738                     (progn
739                       (skip-syntax-backward "(")
740                       (condition-case err
741                           (while (save-excursion
742                                    (skip-syntax-backward " ") (not (bolp)))
743                             (forward-sexp -1))
744                         (scan-error nil))
745                       (+ (current-column) perl-indent-level))
746                   (if perl-indent-continued-arguments
747                       (+ perl-indent-continued-arguments (current-indentation))
748                     (skip-chars-forward " \t")
749                     (current-column))))
750              (t              (t
751               ;; Statement level.  Is it a continuation or a new statement?               ;; Statement level.  Is it a continuation or a new statement?
752               (if (perl-continuation-line-p containing-sexp)               (if (perl-continuation-line-p containing-sexp)
# Line 601  Returns (parse-state) if line starts ins Line 768  Returns (parse-state) if line starts ins
768                 ;; Position at last unclosed open.                 ;; Position at last unclosed open.
769                 (goto-char containing-sexp)                 (goto-char containing-sexp)
770                 (or                 (or
771                   ;; If open paren is in col 0, close brace is special                  ;; Is line first statement after an open-brace?
772                   (and (bolp)                  ;; If no, find that first statement and indent like it.
773                        (save-excursion (goto-char indent-point)                  (save-excursion
774                                        (looking-at "[ \t]*}"))                    (forward-char 1)
775                        perl-indent-level)                    ;; Skip over comments and labels following openbrace.
776                   ;; Is line first statement after an open-brace?                    (while (progn
777                   ;; If no, find that first statement and indent like it.                             (skip-chars-forward " \t\f\n")
778                   (save-excursion                             (cond ((looking-at ";?#")
779                     (forward-char 1)                                    (forward-line 1) t)
780                     ;; Skip over comments and labels following openbrace.                                   ((looking-at "\\(\\w\\|\\s_\\)+:")
781                     (while (progn                                    (save-excursion
782                              (skip-chars-forward " \t\f\n")                                      (end-of-line)
783                              (cond ((looking-at ";?#")                                      (setq colon-line-end (point)))
784                                     (forward-line 1) t)                                    (search-forward ":")))))
785                                    ((looking-at "\\(\\w\\|\\s_\\)+:")                    ;; The first following code counts
786                                     (save-excursion                    ;; if it is before the line we want to indent.
787                                       (end-of-line)                    (and (< (point) indent-point)
788                                       (setq colon-line-end (point)))                         (if (> colon-line-end (point))
789                                     (search-forward ":")))))                             (- (current-indentation) perl-label-offset)
790                     ;; The first following code counts                           (current-column))))
791                     ;; if it is before the line we want to indent.                  ;; If no previous statement,
792                     (and (< (point) indent-point)                  ;; indent it relative to line brace is on.
793                          (if (> colon-line-end (point))                  ;; For open paren in column zero, don't let statement
794                              (- (current-indentation) perl-label-offset)                  ;; start there too.  If perl-indent-level is zero,
795                            (current-column))))                  ;; use perl-brace-offset + perl-continued-statement-offset
796                   ;; If no previous statement,                  ;; For open-braces not the first thing in a line,
797                   ;; indent it relative to line brace is on.                  ;; add in perl-brace-imaginary-offset.
798                   ;; For open paren in column zero, don't let statement                  (+ (if (and (bolp) (zerop perl-indent-level))
799                   ;; start there too.  If perl-indent-level is zero,                         (+ perl-brace-offset perl-continued-statement-offset)
800                   ;; use perl-brace-offset + perl-continued-statement-offset                       perl-indent-level)
801                   ;; For open-braces not the first thing in a line,                     ;; Move back over whitespace before the openbrace.
802                   ;; add in perl-brace-imaginary-offset.                     ;; If openbrace is not first nonwhite thing on the line,
803                   (+ (if (and (bolp) (zerop perl-indent-level))                     ;; add the perl-brace-imaginary-offset.
804                          (+ perl-brace-offset perl-continued-statement-offset)                     (progn (skip-chars-backward " \t")
805                        perl-indent-level)                            (if (bolp) 0 perl-brace-imaginary-offset))
806                      ;; Move back over whitespace before the openbrace.                     ;; If the openbrace is preceded by a parenthesized exp,
807                      ;; If openbrace is not first nonwhite thing on the line,                     ;; move to the beginning of that;
808                      ;; add the perl-brace-imaginary-offset.                     ;; possibly a different line
809                      (progn (skip-chars-backward " \t")                     (progn
810                             (if (bolp) 0 perl-brace-imaginary-offset))                       (if (eq (preceding-char) ?\))
811                      ;; If the openbrace is preceded by a parenthesized exp,                           (forward-sexp -1))
812                      ;; move to the beginning of that;                       ;; Get initial indentation of the line we are on.
813                      ;; possibly a different line                       (current-indentation))))))))))
                     (progn  
                       (if (eq (preceding-char) ?\))  
                           (forward-sexp -1))  
                       ;; Get initial indentation of the line we are on.  
                       (current-indentation))))))))))  
814    
815  (defun perl-backward-to-noncomment ()  (defun perl-backward-to-noncomment ()
816    "Move point backward to after the first non-white-space, skipping comments."    "Move point backward to after the first non-white-space, skipping comments."
817    (interactive)                         ;why??  -stef    (interactive)
818    (forward-comment (- (point-max))))    (forward-comment (- (point-max))))
819    
820  (defun perl-backward-to-start-of-continued-exp (lim)  (defun perl-backward-to-start-of-continued-exp (lim)
# Line 688  Returns (parse-state) if line starts ins Line 850  Returns (parse-state) if line starts ins
850        (while (< (point) (marker-position last-mark))        (while (< (point) (marker-position last-mark))
851          (setq delta (perl-indent-line nil (marker-position bof-mark)))          (setq delta (perl-indent-line nil (marker-position bof-mark)))
852          (if (numberp delta)             ; unquoted start-of-line?          (if (numberp delta)             ; unquoted start-of-line?
853              (progn              (progn
854                (if (eolp)                (if (eolp)
855                    (delete-horizontal-space))                    (delete-horizontal-space))
856                (setq lsexp-mark (point-marker))))                (setq lsexp-mark (point-marker))))

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.42.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26