diff options
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/progmodes/cperl-mode.el | 324 |
2 files changed, 169 insertions, 164 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 89a18361ddd..2e4d377684d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,15 +1,20 @@ | |||
| 1 | 2004-03-26 Masatake YAMATO <jet@gyve.org> | 1 | 2004-03-26 Masatake YAMATO <jet@gyve.org> |
| 2 | 2 | ||
| 3 | * simple.el (completion-setup-function): Emphasize the | 3 | * simple.el (completion-setup-function): Emphasize the |
| 4 | first uncommon characters in the completions;and de-emphasize | 4 | first uncommon characters in the completions; and de-emphasize |
| 5 | the common prefix substrings. | 5 | the common prefix substrings. |
| 6 | (completion-emphasis): New face. | 6 | (completion-emphasis): New face. |
| 7 | (completion-de-emphasis): New face. | 7 | (completion-de-emphasis): New face. |
| 8 | 8 | ||
| 9 | 2004-03-25 Juanma Barranquero <lektu@terra.es> | ||
| 10 | |||
| 11 | * progmodes/cperl-mode.el (cperl-indent-alist, cperl-where-am-i): | ||
| 12 | Comment out (it's unused and unfinished code). | ||
| 13 | |||
| 9 | 2004-03-25 Sam Steingold <sds@gnu.org> | 14 | 2004-03-25 Sam Steingold <sds@gnu.org> |
| 10 | 15 | ||
| 11 | * vc.el (vc-print-log): Fixed a bug in the last patch: | 16 | * vc.el (vc-print-log): Fixed a bug in the last patch: |
| 12 | backend-function may be a byte-compiled object, not a lambda | 17 | backend-function may be a byte-compiled object, not a lambda. |
| 13 | 18 | ||
| 14 | 2004-03-25 Juri Linkov <juri@jurta.org> | 19 | 2004-03-25 Juri Linkov <juri@jurta.org> |
| 15 | 20 | ||
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 155648fadb1..e13198fb240 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el | |||
| @@ -2693,168 +2693,168 @@ and closing parentheses and brackets." | |||
| 2693 | (cperl-calculate-indent)) | 2693 | (cperl-calculate-indent)) |
| 2694 | (current-indentation)))))))))))))) | 2694 | (current-indentation)))))))))))))) |
| 2695 | 2695 | ||
| 2696 | (defvar cperl-indent-alist | 2696 | ;; (defvar cperl-indent-alist |
| 2697 | '((string nil) | 2697 | ;; '((string nil) |
| 2698 | (comment nil) | 2698 | ;; (comment nil) |
| 2699 | (toplevel 0) | 2699 | ;; (toplevel 0) |
| 2700 | (toplevel-after-parenth 2) | 2700 | ;; (toplevel-after-parenth 2) |
| 2701 | (toplevel-continued 2) | 2701 | ;; (toplevel-continued 2) |
| 2702 | (expression 1)) | 2702 | ;; (expression 1)) |
| 2703 | "Alist of indentation rules for CPerl mode. | 2703 | ;; "Alist of indentation rules for CPerl mode. |
| 2704 | The values mean: | 2704 | ;; The values mean: |
| 2705 | nil: do not indent; | 2705 | ;; nil: do not indent; |
| 2706 | number: add this amount of indentation. | 2706 | ;; number: add this amount of indentation. |
| 2707 | 2707 | ||
| 2708 | Not finished, not used.") | 2708 | ;; Not finished, not used.") |
| 2709 | 2709 | ||
| 2710 | (defun cperl-where-am-i (&optional parse-start start-state) | 2710 | ;; (defun cperl-where-am-i (&optional parse-start start-state) |
| 2711 | ;; Unfinished | 2711 | ;; ;; Unfinished |
| 2712 | "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. |
| 2713 | 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'. |
| 2714 | 2714 | ||
| 2715 | Not finished, not used." | 2715 | ;; ;; Not finished, not used." |
| 2716 | (save-excursion | 2716 | ;; (save-excursion |
| 2717 | (let* ((start-point (point)) | 2717 | ;; (let* ((start-point (point)) |
| 2718 | (s-s (cperl-get-state)) | 2718 | ;; (s-s (cperl-get-state)) |
| 2719 | (start (nth 0 s-s)) | 2719 | ;; (start (nth 0 s-s)) |
| 2720 | (state (nth 1 s-s)) | 2720 | ;; (state (nth 1 s-s)) |
| 2721 | (prestart (nth 3 s-s)) | 2721 | ;; (prestart (nth 3 s-s)) |
| 2722 | (containing-sexp (car (cdr state))) | 2722 | ;; (containing-sexp (car (cdr state))) |
| 2723 | (case-fold-search nil) | 2723 | ;; (case-fold-search nil) |
| 2724 | (res (list (list 'parse-start start) (list 'parse-prestart prestart)))) | 2724 | ;; (res (list (list 'parse-start start) (list 'parse-prestart prestart)))) |
| 2725 | (cond ((nth 3 state) ; In string | 2725 | ;; (cond ((nth 3 state) ; In string |
| 2726 | (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 |
| 2727 | ((nth 4 state) ; In comment | 2727 | ;; ((nth 4 state) ; In comment |
| 2728 | (setq res (cons '(comment) res))) | 2728 | ;; (setq res (cons '(comment) res))) |
| 2729 | ((null containing-sexp) | 2729 | ;; ((null containing-sexp) |
| 2730 | ;; Line is at top level. | 2730 | ;; ;; Line is at top level. |
| 2731 | ;; Indent like the previous top level line | 2731 | ;; ;; Indent like the previous top level line |
| 2732 | ;; unless that ends in a closeparen without semicolon, | 2732 | ;; ;; unless that ends in a closeparen without semicolon, |
| 2733 | ;; in which case this line is the first argument decl. | 2733 | ;; ;; in which case this line is the first argument decl. |
| 2734 | (cperl-backward-to-noncomment (or parse-start (point-min))) | 2734 | ;; (cperl-backward-to-noncomment (or parse-start (point-min))) |
| 2735 | ;;(skip-chars-backward " \t\f\n") | 2735 | ;; ;;(skip-chars-backward " \t\f\n") |
| 2736 | (cond | 2736 | ;; (cond |
| 2737 | ((or (bobp) | 2737 | ;; ((or (bobp) |
| 2738 | (memq (preceding-char) (append ";}" nil))) | 2738 | ;; (memq (preceding-char) (append ";}" nil))) |
| 2739 | (setq res (cons (list 'toplevel start) res))) | 2739 | ;; (setq res (cons (list 'toplevel start) res))) |
| 2740 | ((eq (preceding-char) ?\) ) | 2740 | ;; ((eq (preceding-char) ?\) ) |
| 2741 | (setq res (cons (list 'toplevel-after-parenth start) res))) | 2741 | ;; (setq res (cons (list 'toplevel-after-parenth start) res))) |
| 2742 | (t | 2742 | ;; (t |
| 2743 | (setq res (cons (list 'toplevel-continued start) res))))) | 2743 | ;; (setq res (cons (list 'toplevel-continued start) res))))) |
| 2744 | ((/= (char-after containing-sexp) ?{) | 2744 | ;; ((/= (char-after containing-sexp) ?{) |
| 2745 | ;; line is expression, not statement: | 2745 | ;; ;; line is expression, not statement: |
| 2746 | ;; indent to just after the surrounding open. | 2746 | ;; ;; indent to just after the surrounding open. |
| 2747 | ;; skip blanks if we do not close the expression. | 2747 | ;; ;; skip blanks if we do not close the expression. |
| 2748 | (setq res (cons (list 'expression-blanks | 2748 | ;; (setq res (cons (list 'expression-blanks |
| 2749 | (progn | 2749 | ;; (progn |
| 2750 | (goto-char (1+ containing-sexp)) | 2750 | ;; (goto-char (1+ containing-sexp)) |
| 2751 | (or (looking-at "[ \t]*\\(#\\|$\\)") | 2751 | ;; (or (looking-at "[ \t]*\\(#\\|$\\)") |
| 2752 | (skip-chars-forward " \t")) | 2752 | ;; (skip-chars-forward " \t")) |
| 2753 | (point))) | 2753 | ;; (point))) |
| 2754 | (cons (list 'expression containing-sexp) res)))) | 2754 | ;; (cons (list 'expression containing-sexp) res)))) |
| 2755 | ((progn | 2755 | ;; ((progn |
| 2756 | ;; Containing-expr starts with \{. Check whether it is a hash. | 2756 | ;; ;; Containing-expr starts with \{. Check whether it is a hash. |
| 2757 | (goto-char containing-sexp) | 2757 | ;; (goto-char containing-sexp) |
| 2758 | (not (cperl-block-p))) | 2758 | ;; (not (cperl-block-p))) |
| 2759 | (setq res (cons (list 'expression-blanks | 2759 | ;; (setq res (cons (list 'expression-blanks |
| 2760 | (progn | 2760 | ;; (progn |
| 2761 | (goto-char (1+ containing-sexp)) | 2761 | ;; (goto-char (1+ containing-sexp)) |
| 2762 | (or (looking-at "[ \t]*\\(#\\|$\\)") | 2762 | ;; (or (looking-at "[ \t]*\\(#\\|$\\)") |
| 2763 | (skip-chars-forward " \t")) | 2763 | ;; (skip-chars-forward " \t")) |
| 2764 | (point))) | 2764 | ;; (point))) |
| 2765 | (cons (list 'expression containing-sexp) res)))) | 2765 | ;; (cons (list 'expression containing-sexp) res)))) |
| 2766 | (t | 2766 | ;; (t |
| 2767 | ;; Statement level. | 2767 | ;; ;; Statement level. |
| 2768 | (setq res (cons (list 'in-block containing-sexp) res)) | 2768 | ;; (setq res (cons (list 'in-block containing-sexp) res)) |
| 2769 | ;; Is it a continuation or a new statement? | 2769 | ;; ;; Is it a continuation or a new statement? |
| 2770 | ;; Find previous non-comment character. | 2770 | ;; ;; Find previous non-comment character. |
| 2771 | (cperl-backward-to-noncomment containing-sexp) | 2771 | ;; (cperl-backward-to-noncomment containing-sexp) |
| 2772 | ;; Back up over label lines, since they don't | 2772 | ;; ;; Back up over label lines, since they don't |
| 2773 | ;; affect whether our line is a continuation. | 2773 | ;; ;; affect whether our line is a continuation. |
| 2774 | ;; Back up comma-delimited lines too ????? | 2774 | ;; ;; Back up comma-delimited lines too ????? |
| 2775 | (while (or (eq (preceding-char) ?\,) | 2775 | ;; (while (or (eq (preceding-char) ?\,) |
| 2776 | (save-excursion (cperl-after-label))) | 2776 | ;; (save-excursion (cperl-after-label))) |
| 2777 | (if (eq (preceding-char) ?\,) | 2777 | ;; (if (eq (preceding-char) ?\,) |
| 2778 | ;; Will go to beginning of line, essentially | 2778 | ;; ;; Will go to beginning of line, essentially |
| 2779 | ;; Will ignore embedded sexpr XXXX. | 2779 | ;; ;; Will ignore embedded sexpr XXXX. |
| 2780 | (cperl-backward-to-start-of-continued-exp containing-sexp)) | 2780 | ;; (cperl-backward-to-start-of-continued-exp containing-sexp)) |
| 2781 | (beginning-of-line) | 2781 | ;; (beginning-of-line) |
| 2782 | (cperl-backward-to-noncomment containing-sexp)) | 2782 | ;; (cperl-backward-to-noncomment containing-sexp)) |
| 2783 | ;; Now we get the answer. | 2783 | ;; ;; Now we get the answer. |
| 2784 | (if (not (memq (preceding-char) (append ";}{" '(nil)))) ; Was ?\, | 2784 | ;; (if (not (memq (preceding-char) (append ";}{" '(nil)))) ; Was ?\, |
| 2785 | ;; This line is continuation of preceding line's statement. | 2785 | ;; ;; This line is continuation of preceding line's statement. |
| 2786 | (list (list 'statement-continued containing-sexp)) | 2786 | ;; (list (list 'statement-continued containing-sexp)) |
| 2787 | ;; This line starts a new statement. | 2787 | ;; ;; This line starts a new statement. |
| 2788 | ;; Position following last unclosed open. | 2788 | ;; ;; Position following last unclosed open. |
| 2789 | (goto-char containing-sexp) | 2789 | ;; (goto-char containing-sexp) |
| 2790 | ;; Is line first statement after an open-brace? | 2790 | ;; ;; Is line first statement after an open-brace? |
| 2791 | (or | 2791 | ;; (or |
| 2792 | ;; If no, find that first statement and indent like | 2792 | ;; ;; If no, find that first statement and indent like |
| 2793 | ;; it. If the first statement begins with label, do | 2793 | ;; ;; it. If the first statement begins with label, do |
| 2794 | ;; not believe when the indentation of the label is too | 2794 | ;; ;; not believe when the indentation of the label is too |
| 2795 | ;; small. | 2795 | ;; ;; small. |
| 2796 | (save-excursion | 2796 | ;; (save-excursion |
| 2797 | (forward-char 1) | 2797 | ;; (forward-char 1) |
| 2798 | (let ((colon-line-end 0)) | 2798 | ;; (let ((colon-line-end 0)) |
| 2799 | (while (progn (skip-chars-forward " \t\n" start-point) | 2799 | ;; (while (progn (skip-chars-forward " \t\n" start-point) |
| 2800 | (and (< (point) start-point) | 2800 | ;; (and (< (point) start-point) |
| 2801 | (looking-at | 2801 | ;; (looking-at |
| 2802 | "#\\|[a-zA-Z_][a-zA-Z0-9_]*:[^:]"))) | 2802 | ;; "#\\|[a-zA-Z_][a-zA-Z0-9_]*:[^:]"))) |
| 2803 | ;; Skip over comments and labels following openbrace. | 2803 | ;; ;; Skip over comments and labels following openbrace. |
| 2804 | (cond ((= (following-char) ?\#) | 2804 | ;; (cond ((= (following-char) ?\#) |
| 2805 | ;;(forward-line 1) | 2805 | ;; ;;(forward-line 1) |
| 2806 | (end-of-line)) | 2806 | ;; (end-of-line)) |
| 2807 | ;; label: | 2807 | ;; ;; label: |
| 2808 | (t | 2808 | ;; (t |
| 2809 | (save-excursion (end-of-line) | 2809 | ;; (save-excursion (end-of-line) |
| 2810 | (setq colon-line-end (point))) | 2810 | ;; (setq colon-line-end (point))) |
| 2811 | (search-forward ":")))) | 2811 | ;; (search-forward ":")))) |
| 2812 | ;; Now at the point, after label, or at start | 2812 | ;; ;; Now at the point, after label, or at start |
| 2813 | ;; of first statement in the block. | 2813 | ;; ;; of first statement in the block. |
| 2814 | (and (< (point) start-point) | 2814 | ;; (and (< (point) start-point) |
| 2815 | (if (> colon-line-end (point)) | 2815 | ;; (if (> colon-line-end (point)) |
| 2816 | ;; Before statement after label | 2816 | ;; ;; Before statement after label |
| 2817 | (if (> (current-indentation) | 2817 | ;; (if (> (current-indentation) |
| 2818 | cperl-min-label-indent) | 2818 | ;; cperl-min-label-indent) |
| 2819 | (list (list 'label-in-block (point))) | 2819 | ;; (list (list 'label-in-block (point))) |
| 2820 | ;; Do not believe: `max' is involved | 2820 | ;; ;; Do not believe: `max' is involved |
| 2821 | (list | 2821 | ;; (list |
| 2822 | (list 'label-in-block-min-indent (point)))) | 2822 | ;; (list 'label-in-block-min-indent (point)))) |
| 2823 | ;; Before statement | 2823 | ;; ;; Before statement |
| 2824 | (list 'statement-in-block (point)))))) | 2824 | ;; (list 'statement-in-block (point)))))) |
| 2825 | ;; If no previous statement, | 2825 | ;; ;; If no previous statement, |
| 2826 | ;; indent it relative to line brace is on. | 2826 | ;; ;; indent it relative to line brace is on. |
| 2827 | ;; For open brace in column zero, don't let statement | 2827 | ;; ;; For open brace in column zero, don't let statement |
| 2828 | ;; start there too. If cperl-indent-level is zero, | 2828 | ;; ;; start there too. If cperl-indent-level is zero, |
| 2829 | ;; use cperl-brace-offset + cperl-continued-statement-offset instead. | 2829 | ;; ;; use cperl-brace-offset + cperl-continued-statement-offset instead. |
| 2830 | ;; For open-braces not the first thing in a line, | 2830 | ;; ;; For open-braces not the first thing in a line, |
| 2831 | ;; add in cperl-brace-imaginary-offset. | 2831 | ;; ;; add in cperl-brace-imaginary-offset. |
| 2832 | 2832 | ||
| 2833 | ;; If first thing on a line: ????? | 2833 | ;; ;; If first thing on a line: ????? |
| 2834 | (+ (if (and (bolp) (zerop cperl-indent-level)) | 2834 | ;; (+ (if (and (bolp) (zerop cperl-indent-level)) |
| 2835 | (+ cperl-brace-offset cperl-continued-statement-offset) | 2835 | ;; (+ cperl-brace-offset cperl-continued-statement-offset) |
| 2836 | cperl-indent-level) | 2836 | ;; cperl-indent-level) |
| 2837 | ;; Move back over whitespace before the openbrace. | 2837 | ;; ;; Move back over whitespace before the openbrace. |
| 2838 | ;; If openbrace is not first nonwhite thing on the line, | 2838 | ;; ;; If openbrace is not first nonwhite thing on the line, |
| 2839 | ;; add the cperl-brace-imaginary-offset. | 2839 | ;; ;; add the cperl-brace-imaginary-offset. |
| 2840 | (progn (skip-chars-backward " \t") | 2840 | ;; (progn (skip-chars-backward " \t") |
| 2841 | (if (bolp) 0 cperl-brace-imaginary-offset)) | 2841 | ;; (if (bolp) 0 cperl-brace-imaginary-offset)) |
| 2842 | ;; If the openbrace is preceded by a parenthesized exp, | 2842 | ;; ;; If the openbrace is preceded by a parenthesized exp, |
| 2843 | ;; move to the beginning of that; | 2843 | ;; ;; move to the beginning of that; |
| 2844 | ;; possibly a different line | 2844 | ;; ;; possibly a different line |
| 2845 | (progn | 2845 | ;; (progn |
| 2846 | (if (eq (preceding-char) ?\)) | 2846 | ;; (if (eq (preceding-char) ?\)) |
| 2847 | (forward-sexp -1)) | 2847 | ;; (forward-sexp -1)) |
| 2848 | ;; Get initial indentation of the line we are on. | 2848 | ;; ;; Get initial indentation of the line we are on. |
| 2849 | ;; If line starts with label, calculate label indentation | 2849 | ;; ;; If line starts with label, calculate label indentation |
| 2850 | (if (save-excursion | 2850 | ;; (if (save-excursion |
| 2851 | (beginning-of-line) | 2851 | ;; (beginning-of-line) |
| 2852 | (looking-at "[ \t]*[a-zA-Z_][a-zA-Z_0-9]*:[^:]")) | 2852 | ;; (looking-at "[ \t]*[a-zA-Z_][a-zA-Z_0-9]*:[^:]")) |
| 2853 | (if (> (current-indentation) cperl-min-label-indent) | 2853 | ;; (if (> (current-indentation) cperl-min-label-indent) |
| 2854 | (- (current-indentation) cperl-label-offset) | 2854 | ;; (- (current-indentation) cperl-label-offset) |
| 2855 | (cperl-calculate-indent)) | 2855 | ;; (cperl-calculate-indent)) |
| 2856 | (current-indentation)))))))) | 2856 | ;; (current-indentation)))))))) |
| 2857 | res))) | 2857 | ;; res))) |
| 2858 | 2858 | ||
| 2859 | (defun cperl-calculate-indent-within-comment () | 2859 | (defun cperl-calculate-indent-within-comment () |
| 2860 | "Return the indentation amount for line, assuming that | 2860 | "Return the indentation amount for line, assuming that |