Mercurial > emacs
comparison lisp/progmodes/cperl-mode.el @ 89909:68c22ea6027c
Sync to HEAD
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 16 Apr 2004 12:51:06 +0000 |
parents | 375f2633d815 |
children | 4c90ffeb71c5 |
comparison
equal
deleted
inserted
replaced
89908:ee1402f7b568 | 89909:68c22ea6027c |
---|---|
1 ;;; cperl-mode.el --- Perl code editing commands for Emacs | 1 ;;; cperl-mode.el --- Perl code editing commands for Emacs |
2 | 2 |
3 ;; Copyright (C) 1985, 86, 87, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2003 | 3 ;; Copyright (C) 1985,86,87,91,92,93,94,95,96,97,98,99,2000,03,2004 |
4 ;; Free Software Foundation, Inc. | 4 ;; Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Ilya Zakharevich and Bob Olson | 6 ;; Author: Ilya Zakharevich and Bob Olson |
7 ;; Maintainer: Ilya Zakharevich <cperl@ilyaz.org> | 7 ;; Maintainer: Ilya Zakharevich <cperl@ilyaz.org> |
8 ;; Keywords: languages, Perl | 8 ;; Keywords: languages, Perl |
1062 (cperl-define-key "\e\C-\\" 'cperl-indent-region)) | 1062 (cperl-define-key "\e\C-\\" 'cperl-indent-region)) |
1063 (substitute-key-definition | 1063 (substitute-key-definition |
1064 'indent-sexp 'cperl-indent-exp | 1064 'indent-sexp 'cperl-indent-exp |
1065 cperl-mode-map global-map) | 1065 cperl-mode-map global-map) |
1066 (substitute-key-definition | 1066 (substitute-key-definition |
1067 'fill-paragraph 'cperl-fill-paragraph | |
1068 cperl-mode-map global-map) | |
1069 (substitute-key-definition | |
1070 'indent-region 'cperl-indent-region | 1067 'indent-region 'cperl-indent-region |
1071 cperl-mode-map global-map) | 1068 cperl-mode-map global-map) |
1072 (substitute-key-definition | 1069 (substitute-key-definition |
1073 'indent-for-comment 'cperl-indent-for-comment | 1070 'indent-for-comment 'cperl-indent-for-comment |
1074 cperl-mode-map global-map))) | 1071 cperl-mode-map global-map))) |
1084 '("Perl" | 1081 '("Perl" |
1085 ["Beginning of function" beginning-of-defun t] | 1082 ["Beginning of function" beginning-of-defun t] |
1086 ["End of function" end-of-defun t] | 1083 ["End of function" end-of-defun t] |
1087 ["Mark function" mark-defun t] | 1084 ["Mark function" mark-defun t] |
1088 ["Indent expression" cperl-indent-exp t] | 1085 ["Indent expression" cperl-indent-exp t] |
1089 ["Fill paragraph/comment" cperl-fill-paragraph t] | 1086 ["Fill paragraph/comment" fill-paragraph t] |
1090 "----" | 1087 "----" |
1091 ["Line up a construction" cperl-lineup (cperl-use-region-p)] | 1088 ["Line up a construction" cperl-lineup (cperl-use-region-p)] |
1092 ["Invert if/unless/while etc" cperl-invert-if-unless t] | 1089 ["Invert if/unless/while etc" cperl-invert-if-unless t] |
1093 ("Regexp" | 1090 ("Regexp" |
1094 ["Beautify" cperl-beautify-regexp | 1091 ["Beautify" cperl-beautify-regexp |
1462 (setq paragraph-start (concat "^$\\|" page-delimiter)) | 1459 (setq paragraph-start (concat "^$\\|" page-delimiter)) |
1463 (make-local-variable 'paragraph-separate) | 1460 (make-local-variable 'paragraph-separate) |
1464 (setq paragraph-separate paragraph-start) | 1461 (setq paragraph-separate paragraph-start) |
1465 (make-local-variable 'paragraph-ignore-fill-prefix) | 1462 (make-local-variable 'paragraph-ignore-fill-prefix) |
1466 (setq paragraph-ignore-fill-prefix t) | 1463 (setq paragraph-ignore-fill-prefix t) |
1464 (set (make-local-variable 'fill-paragraph-function) 'cperl-fill-paragraph) | |
1467 (make-local-variable 'indent-line-function) | 1465 (make-local-variable 'indent-line-function) |
1468 (setq indent-line-function 'cperl-indent-line) | 1466 (setq indent-line-function 'cperl-indent-line) |
1469 (make-local-variable 'require-final-newline) | 1467 (make-local-variable 'require-final-newline) |
1470 (setq require-final-newline t) | 1468 (setq require-final-newline t) |
1471 (make-local-variable 'comment-start) | 1469 (make-local-variable 'comment-start) |
2693 ;; Do not move `parse-data', this should | 2691 ;; Do not move `parse-data', this should |
2694 ;; be quick anyway: | 2692 ;; be quick anyway: |
2695 (cperl-calculate-indent)) | 2693 (cperl-calculate-indent)) |
2696 (current-indentation)))))))))))))) | 2694 (current-indentation)))))))))))))) |
2697 | 2695 |
2698 (defvar cperl-indent-alist | 2696 ;; (defvar cperl-indent-alist |
2699 '((string nil) | 2697 ;; '((string nil) |
2700 (comment nil) | 2698 ;; (comment nil) |
2701 (toplevel 0) | 2699 ;; (toplevel 0) |
2702 (toplevel-after-parenth 2) | 2700 ;; (toplevel-after-parenth 2) |
2703 (toplevel-continued 2) | 2701 ;; (toplevel-continued 2) |
2704 (expression 1)) | 2702 ;; (expression 1)) |
2705 "Alist of indentation rules for CPerl mode. | 2703 ;; "Alist of indentation rules for CPerl mode. |
2706 The values mean: | 2704 ;; The values mean: |
2707 nil: do not indent; | 2705 ;; nil: do not indent; |
2708 number: add this amount of indentation. | 2706 ;; number: add this amount of indentation. |
2709 | 2707 |
2710 Not finished, not used.") | 2708 ;; Not finished, not used.") |
2711 | 2709 |
2712 (defun cperl-where-am-i (&optional parse-start start-state) | 2710 ;; (defun cperl-where-am-i (&optional parse-start start-state) |
2713 ;; Unfinished | 2711 ;; ;; Unfinished |
2714 "Return a list of lists ((TYPE POS)...) of good points before the point. | 2712 ;; "Return a list of lists ((TYPE POS)...) of good points before the point. |
2715 POS may be nil if it is hard to find, say, when TYPE is `string' or `comment'. | 2713 ;; ;; POS may be nil if it is hard to find, say, when TYPE is `string' or `comment'. |
2716 | 2714 |
2717 Not finished, not used." | 2715 ;; ;; Not finished, not used." |
2718 (save-excursion | 2716 ;; (save-excursion |
2719 (let* ((start-point (point)) | 2717 ;; (let* ((start-point (point)) |
2720 (s-s (cperl-get-state)) | 2718 ;; (s-s (cperl-get-state)) |
2721 (start (nth 0 s-s)) | 2719 ;; (start (nth 0 s-s)) |
2722 (state (nth 1 s-s)) | 2720 ;; (state (nth 1 s-s)) |
2723 (prestart (nth 3 s-s)) | 2721 ;; (prestart (nth 3 s-s)) |
2724 (containing-sexp (car (cdr state))) | 2722 ;; (containing-sexp (car (cdr state))) |
2725 (case-fold-search nil) | 2723 ;; (case-fold-search nil) |
2726 (res (list (list 'parse-start start) (list 'parse-prestart prestart)))) | 2724 ;; (res (list (list 'parse-start start) (list 'parse-prestart prestart)))) |
2727 (cond ((nth 3 state) ; In string | 2725 ;; (cond ((nth 3 state) ; In string |
2728 (setq res (cons (list 'string nil (nth 3 state)) res))) ; What started string | 2726 ;; (setq res (cons (list 'string nil (nth 3 state)) res))) ; What started string |
2729 ((nth 4 state) ; In comment | 2727 ;; ((nth 4 state) ; In comment |
2730 (setq res (cons '(comment) res))) | 2728 ;; (setq res (cons '(comment) res))) |
2731 ((null containing-sexp) | 2729 ;; ((null containing-sexp) |
2732 ;; Line is at top level. | 2730 ;; ;; Line is at top level. |
2733 ;; Indent like the previous top level line | 2731 ;; ;; Indent like the previous top level line |
2734 ;; unless that ends in a closeparen without semicolon, | 2732 ;; ;; unless that ends in a closeparen without semicolon, |
2735 ;; in which case this line is the first argument decl. | 2733 ;; ;; in which case this line is the first argument decl. |
2736 (cperl-backward-to-noncomment (or parse-start (point-min))) | 2734 ;; (cperl-backward-to-noncomment (or parse-start (point-min))) |
2737 ;;(skip-chars-backward " \t\f\n") | 2735 ;; ;;(skip-chars-backward " \t\f\n") |
2738 (cond | 2736 ;; (cond |
2739 ((or (bobp) | 2737 ;; ((or (bobp) |
2740 (memq (preceding-char) (append ";}" nil))) | 2738 ;; (memq (preceding-char) (append ";}" nil))) |
2741 (setq res (cons (list 'toplevel start) res))) | 2739 ;; (setq res (cons (list 'toplevel start) res))) |
2742 ((eq (preceding-char) ?\) ) | 2740 ;; ((eq (preceding-char) ?\) ) |
2743 (setq res (cons (list 'toplevel-after-parenth start) res))) | 2741 ;; (setq res (cons (list 'toplevel-after-parenth start) res))) |
2744 (t | 2742 ;; (t |
2745 (setq res (cons (list 'toplevel-continued start) res))))) | 2743 ;; (setq res (cons (list 'toplevel-continued start) res))))) |
2746 ((/= (char-after containing-sexp) ?{) | 2744 ;; ((/= (char-after containing-sexp) ?{) |
2747 ;; line is expression, not statement: | 2745 ;; ;; line is expression, not statement: |
2748 ;; indent to just after the surrounding open. | 2746 ;; ;; indent to just after the surrounding open. |
2749 ;; skip blanks if we do not close the expression. | 2747 ;; ;; skip blanks if we do not close the expression. |
2750 (setq res (cons (list 'expression-blanks | 2748 ;; (setq res (cons (list 'expression-blanks |
2751 (progn | 2749 ;; (progn |
2752 (goto-char (1+ containing-sexp)) | 2750 ;; (goto-char (1+ containing-sexp)) |
2753 (or (looking-at "[ \t]*\\(#\\|$\\)") | 2751 ;; (or (looking-at "[ \t]*\\(#\\|$\\)") |
2754 (skip-chars-forward " \t")) | 2752 ;; (skip-chars-forward " \t")) |
2755 (point))) | 2753 ;; (point))) |
2756 (cons (list 'expression containing-sexp) res)))) | 2754 ;; (cons (list 'expression containing-sexp) res)))) |
2757 ((progn | 2755 ;; ((progn |
2758 ;; Containing-expr starts with \{. Check whether it is a hash. | 2756 ;; ;; Containing-expr starts with \{. Check whether it is a hash. |
2759 (goto-char containing-sexp) | 2757 ;; (goto-char containing-sexp) |
2760 (not (cperl-block-p))) | 2758 ;; (not (cperl-block-p))) |
2761 (setq res (cons (list 'expression-blanks | 2759 ;; (setq res (cons (list 'expression-blanks |
2762 (progn | 2760 ;; (progn |
2763 (goto-char (1+ containing-sexp)) | 2761 ;; (goto-char (1+ containing-sexp)) |
2764 (or (looking-at "[ \t]*\\(#\\|$\\)") | 2762 ;; (or (looking-at "[ \t]*\\(#\\|$\\)") |
2765 (skip-chars-forward " \t")) | 2763 ;; (skip-chars-forward " \t")) |
2766 (point))) | 2764 ;; (point))) |
2767 (cons (list 'expression containing-sexp) res)))) | 2765 ;; (cons (list 'expression containing-sexp) res)))) |
2768 (t | 2766 ;; (t |
2769 ;; Statement level. | 2767 ;; ;; Statement level. |
2770 (setq res (cons (list 'in-block containing-sexp) res)) | 2768 ;; (setq res (cons (list 'in-block containing-sexp) res)) |
2771 ;; Is it a continuation or a new statement? | 2769 ;; ;; Is it a continuation or a new statement? |
2772 ;; Find previous non-comment character. | 2770 ;; ;; Find previous non-comment character. |
2773 (cperl-backward-to-noncomment containing-sexp) | 2771 ;; (cperl-backward-to-noncomment containing-sexp) |
2774 ;; Back up over label lines, since they don't | 2772 ;; ;; Back up over label lines, since they don't |
2775 ;; affect whether our line is a continuation. | 2773 ;; ;; affect whether our line is a continuation. |
2776 ;; Back up comma-delimited lines too ????? | 2774 ;; ;; Back up comma-delimited lines too ????? |
2777 (while (or (eq (preceding-char) ?\,) | 2775 ;; (while (or (eq (preceding-char) ?\,) |
2778 (save-excursion (cperl-after-label))) | 2776 ;; (save-excursion (cperl-after-label))) |
2779 (if (eq (preceding-char) ?\,) | 2777 ;; (if (eq (preceding-char) ?\,) |
2780 ;; Will go to beginning of line, essentially | 2778 ;; ;; Will go to beginning of line, essentially |
2781 ;; Will ignore embedded sexpr XXXX. | 2779 ;; ;; Will ignore embedded sexpr XXXX. |
2782 (cperl-backward-to-start-of-continued-exp containing-sexp)) | 2780 ;; (cperl-backward-to-start-of-continued-exp containing-sexp)) |
2783 (beginning-of-line) | 2781 ;; (beginning-of-line) |
2784 (cperl-backward-to-noncomment containing-sexp)) | 2782 ;; (cperl-backward-to-noncomment containing-sexp)) |
2785 ;; Now we get the answer. | 2783 ;; ;; Now we get the answer. |
2786 (if (not (memq (preceding-char) (append ";}{" '(nil)))) ; Was ?\, | 2784 ;; (if (not (memq (preceding-char) (append ";}{" '(nil)))) ; Was ?\, |
2787 ;; This line is continuation of preceding line's statement. | 2785 ;; ;; This line is continuation of preceding line's statement. |
2788 (list (list 'statement-continued containing-sexp)) | 2786 ;; (list (list 'statement-continued containing-sexp)) |
2789 ;; This line starts a new statement. | 2787 ;; ;; This line starts a new statement. |
2790 ;; Position following last unclosed open. | 2788 ;; ;; Position following last unclosed open. |
2791 (goto-char containing-sexp) | 2789 ;; (goto-char containing-sexp) |
2792 ;; Is line first statement after an open-brace? | 2790 ;; ;; Is line first statement after an open-brace? |
2793 (or | 2791 ;; (or |
2794 ;; If no, find that first statement and indent like | 2792 ;; ;; If no, find that first statement and indent like |
2795 ;; it. If the first statement begins with label, do | 2793 ;; ;; it. If the first statement begins with label, do |
2796 ;; not believe when the indentation of the label is too | 2794 ;; ;; not believe when the indentation of the label is too |
2797 ;; small. | 2795 ;; ;; small. |
2798 (save-excursion | 2796 ;; (save-excursion |
2799 (forward-char 1) | 2797 ;; (forward-char 1) |
2800 (let ((colon-line-end 0)) | 2798 ;; (let ((colon-line-end 0)) |
2801 (while (progn (skip-chars-forward " \t\n" start-point) | 2799 ;; (while (progn (skip-chars-forward " \t\n" start-point) |
2802 (and (< (point) start-point) | 2800 ;; (and (< (point) start-point) |
2803 (looking-at | 2801 ;; (looking-at |
2804 "#\\|[a-zA-Z_][a-zA-Z0-9_]*:[^:]"))) | 2802 ;; "#\\|[a-zA-Z_][a-zA-Z0-9_]*:[^:]"))) |
2805 ;; Skip over comments and labels following openbrace. | 2803 ;; ;; Skip over comments and labels following openbrace. |
2806 (cond ((= (following-char) ?\#) | 2804 ;; (cond ((= (following-char) ?\#) |
2807 ;;(forward-line 1) | 2805 ;; ;;(forward-line 1) |
2808 (end-of-line)) | 2806 ;; (end-of-line)) |
2809 ;; label: | 2807 ;; ;; label: |
2810 (t | 2808 ;; (t |
2811 (save-excursion (end-of-line) | 2809 ;; (save-excursion (end-of-line) |
2812 (setq colon-line-end (point))) | 2810 ;; (setq colon-line-end (point))) |
2813 (search-forward ":")))) | 2811 ;; (search-forward ":")))) |
2814 ;; Now at the point, after label, or at start | 2812 ;; ;; Now at the point, after label, or at start |
2815 ;; of first statement in the block. | 2813 ;; ;; of first statement in the block. |
2816 (and (< (point) start-point) | 2814 ;; (and (< (point) start-point) |
2817 (if (> colon-line-end (point)) | 2815 ;; (if (> colon-line-end (point)) |
2818 ;; Before statement after label | 2816 ;; ;; Before statement after label |
2819 (if (> (current-indentation) | 2817 ;; (if (> (current-indentation) |
2820 cperl-min-label-indent) | 2818 ;; cperl-min-label-indent) |
2821 (list (list 'label-in-block (point))) | 2819 ;; (list (list 'label-in-block (point))) |
2822 ;; Do not believe: `max' is involved | 2820 ;; ;; Do not believe: `max' is involved |
2823 (list | 2821 ;; (list |
2824 (list 'label-in-block-min-indent (point)))) | 2822 ;; (list 'label-in-block-min-indent (point)))) |
2825 ;; Before statement | 2823 ;; ;; Before statement |
2826 (list 'statement-in-block (point)))))) | 2824 ;; (list 'statement-in-block (point)))))) |
2827 ;; If no previous statement, | 2825 ;; ;; If no previous statement, |
2828 ;; indent it relative to line brace is on. | 2826 ;; ;; indent it relative to line brace is on. |
2829 ;; For open brace in column zero, don't let statement | 2827 ;; ;; For open brace in column zero, don't let statement |
2830 ;; start there too. If cperl-indent-level is zero, | 2828 ;; ;; start there too. If cperl-indent-level is zero, |
2831 ;; use cperl-brace-offset + cperl-continued-statement-offset instead. | 2829 ;; ;; use cperl-brace-offset + cperl-continued-statement-offset instead. |
2832 ;; For open-braces not the first thing in a line, | 2830 ;; ;; For open-braces not the first thing in a line, |
2833 ;; add in cperl-brace-imaginary-offset. | 2831 ;; ;; add in cperl-brace-imaginary-offset. |
2834 | 2832 |
2835 ;; If first thing on a line: ????? | 2833 ;; ;; If first thing on a line: ????? |
2836 (+ (if (and (bolp) (zerop cperl-indent-level)) | 2834 ;; (+ (if (and (bolp) (zerop cperl-indent-level)) |
2837 (+ cperl-brace-offset cperl-continued-statement-offset) | 2835 ;; (+ cperl-brace-offset cperl-continued-statement-offset) |
2838 cperl-indent-level) | 2836 ;; cperl-indent-level) |
2839 ;; Move back over whitespace before the openbrace. | 2837 ;; ;; Move back over whitespace before the openbrace. |
2840 ;; If openbrace is not first nonwhite thing on the line, | 2838 ;; ;; If openbrace is not first nonwhite thing on the line, |
2841 ;; add the cperl-brace-imaginary-offset. | 2839 ;; ;; add the cperl-brace-imaginary-offset. |
2842 (progn (skip-chars-backward " \t") | 2840 ;; (progn (skip-chars-backward " \t") |
2843 (if (bolp) 0 cperl-brace-imaginary-offset)) | 2841 ;; (if (bolp) 0 cperl-brace-imaginary-offset)) |
2844 ;; If the openbrace is preceded by a parenthesized exp, | 2842 ;; ;; If the openbrace is preceded by a parenthesized exp, |
2845 ;; move to the beginning of that; | 2843 ;; ;; move to the beginning of that; |
2846 ;; possibly a different line | 2844 ;; ;; possibly a different line |
2847 (progn | 2845 ;; (progn |
2848 (if (eq (preceding-char) ?\)) | 2846 ;; (if (eq (preceding-char) ?\)) |
2849 (forward-sexp -1)) | 2847 ;; (forward-sexp -1)) |
2850 ;; Get initial indentation of the line we are on. | 2848 ;; ;; Get initial indentation of the line we are on. |
2851 ;; If line starts with label, calculate label indentation | 2849 ;; ;; If line starts with label, calculate label indentation |
2852 (if (save-excursion | 2850 ;; (if (save-excursion |
2853 (beginning-of-line) | 2851 ;; (beginning-of-line) |
2854 (looking-at "[ \t]*[a-zA-Z_][a-zA-Z_0-9]*:[^:]")) | 2852 ;; (looking-at "[ \t]*[a-zA-Z_][a-zA-Z_0-9]*:[^:]")) |
2855 (if (> (current-indentation) cperl-min-label-indent) | 2853 ;; (if (> (current-indentation) cperl-min-label-indent) |
2856 (- (current-indentation) cperl-label-offset) | 2854 ;; (- (current-indentation) cperl-label-offset) |
2857 (cperl-calculate-indent)) | 2855 ;; (cperl-calculate-indent)) |
2858 (current-indentation)))))))) | 2856 ;; (current-indentation)))))))) |
2859 res))) | 2857 ;; res))) |
2860 | 2858 |
2861 (defun cperl-calculate-indent-within-comment () | 2859 (defun cperl-calculate-indent-within-comment () |
2862 "Return the indentation amount for line, assuming that | 2860 "Return the indentation amount for line, assuming that |
2863 the current line is to be regarded as part of a block comment." | 2861 the current line is to be regarded as part of a block comment." |
2864 (let (end star-start) | 2862 (let (end star-start) |
4253 (delete-char -1)))))) | 4251 (delete-char -1)))))) |
4254 | 4252 |
4255 ;; Stolen from lisp-mode with a lot of improvements | 4253 ;; Stolen from lisp-mode with a lot of improvements |
4256 | 4254 |
4257 (defun cperl-fill-paragraph (&optional justify iteration) | 4255 (defun cperl-fill-paragraph (&optional justify iteration) |
4258 "Like \\[fill-paragraph], but handle CPerl comments. | 4256 "Like `fill-paragraph', but handle CPerl comments. |
4259 If any of the current line is a comment, fill the comment or the | 4257 If any of the current line is a comment, fill the comment or the |
4260 block of it that point is in, preserving the comment's initial | 4258 block of it that point is in, preserving the comment's initial |
4261 indentation and initial hashes. Behaves usually outside of comment." | 4259 indentation and initial hashes. Behaves usually outside of comment." |
4262 (interactive "P") | 4260 ;; (interactive "P") ; Only works when called from fill-paragraph. -stef |
4263 (let (;; Non-nil if the current line contains a comment. | 4261 (let (;; Non-nil if the current line contains a comment. |
4264 has-comment | 4262 has-comment |
4265 | 4263 |
4266 ;; If has-comment, the appropriate fill-prefix for the comment. | 4264 ;; If has-comment, the appropriate fill-prefix for the comment. |
4267 comment-fill-prefix | 4265 comment-fill-prefix |
4313 (save-excursion | 4311 (save-excursion |
4314 (while (progn (forward-line 1) | 4312 (while (progn (forward-line 1) |
4315 (looking-at "^[ \t]*#+[ \t]*[^ \t\n#]"))) | 4313 (looking-at "^[ \t]*#+[ \t]*[^ \t\n#]"))) |
4316 (point))) | 4314 (point))) |
4317 ;; Remove existing hashes | 4315 ;; Remove existing hashes |
4318 (goto-char (point-min)) | 4316 (save-excursion |
4319 (while (progn (forward-line 1) (< (point) (point-max))) | 4317 (goto-char (point-min)) |
4320 (skip-chars-forward " \t") | 4318 (while (progn (forward-line 1) (< (point) (point-max))) |
4321 (and (looking-at "#+") | 4319 (skip-chars-forward " \t") |
4322 (delete-char (- (match-end 0) (match-beginning 0))))) | 4320 (and (looking-at "#+") |
4321 (delete-char (- (match-end 0) (match-beginning 0)))))) | |
4323 | 4322 |
4324 ;; Lines with only hashes on them can be paragraph boundaries. | 4323 ;; Lines with only hashes on them can be paragraph boundaries. |
4325 (let ((paragraph-start (concat paragraph-start "\\|^[ \t#]*$")) | 4324 (let ((paragraph-start (concat paragraph-start "\\|^[ \t#]*$")) |
4326 (paragraph-separate (concat paragraph-start "\\|^[ \t#]*$")) | 4325 (paragraph-separate (concat paragraph-start "\\|^[ \t#]*$")) |
4327 (fill-prefix comment-fill-prefix)) | 4326 (fill-prefix comment-fill-prefix)) |
4344 (current-column)) | 4343 (current-column)) |
4345 fill-column) | 4344 fill-column) |
4346 (let ((c (save-excursion (beginning-of-line) | 4345 (let ((c (save-excursion (beginning-of-line) |
4347 (cperl-to-comment-or-eol) (point))) | 4346 (cperl-to-comment-or-eol) (point))) |
4348 (s (memq (following-char) '(?\ ?\t))) marker) | 4347 (s (memq (following-char) '(?\ ?\t))) marker) |
4349 (if (>= c (point)) nil | 4348 (if (>= c (point)) |
4349 ;; Don't break line inside code: only inside comment. | |
4350 nil | |
4350 (setq marker (point-marker)) | 4351 (setq marker (point-marker)) |
4351 (cperl-fill-paragraph) | 4352 (fill-paragraph nil) |
4352 (goto-char marker) | 4353 (goto-char marker) |
4353 ;; Is not enough, sometimes marker is a start of line | 4354 ;; Is not enough, sometimes marker is a start of line |
4354 (if (bolp) (progn (re-search-forward "#+[ \t]*") | 4355 (if (bolp) (progn (re-search-forward "#+[ \t]*") |
4355 (goto-char (match-end 0)))) | 4356 (goto-char (match-end 0)))) |
4356 ;; Following space could have gone: | 4357 ;; Following space could have gone: |
7269 (substring v (match-beginning 1) (match-end 1))) | 7270 (substring v (match-beginning 1) (match-end 1))) |
7270 "Version of IZ-supported CPerl package this file is based on.") | 7271 "Version of IZ-supported CPerl package this file is based on.") |
7271 | 7272 |
7272 (provide 'cperl-mode) | 7273 (provide 'cperl-mode) |
7273 | 7274 |
7275 ;;; arch-tag: 42e5b19b-e187-4537-929f-1a7408980ce6 | |
7274 ;;; cperl-mode.el ends here | 7276 ;;; cperl-mode.el ends here |