Mercurial > emacs
comparison lisp/progmodes/cperl-mode.el @ 91015:b83d0dadb2a7
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 857-865)
- Update from CVS
- Merge from emacs--rel--22
- Update from CVS: lisp/emacs-lisp/avl-tree.el: New file.
- Remove RCS keywords
* emacs--rel--22 (patch 97-100)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 246-247)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-252
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 29 Aug 2007 05:03:40 +0000 |
parents | aaccdab0ee26 92ccd83174e6 |
children | bdb3fe0ba9fa |
comparison
equal
deleted
inserted
replaced
91014:2392e6a45952 | 91015:b83d0dadb2a7 |
---|---|
94 (or (fboundp 'defgroup) | 94 (or (fboundp 'defgroup) |
95 (defmacro defgroup (name val doc &rest arr) | 95 (defmacro defgroup (name val doc &rest arr) |
96 nil)) | 96 nil)) |
97 (or (fboundp 'custom-declare-variable) | 97 (or (fboundp 'custom-declare-variable) |
98 (defmacro defcustom (name val doc &rest arr) | 98 (defmacro defcustom (name val doc &rest arr) |
99 (` (defvar (, name) (, val) (, doc))))) | 99 `(defvar ,name ,val ,doc))) |
100 (or (and (fboundp 'custom-declare-variable) | 100 (or (and (fboundp 'custom-declare-variable) |
101 (string< "19.31" emacs-version)) ; Checked with 19.30: defface does not work | 101 (string< "19.31" emacs-version)) ; Checked with 19.30: defface does not work |
102 (defmacro defface (&rest arr) | 102 (defmacro defface (&rest arr) |
103 nil)) | 103 nil)) |
104 ;; Avoid warning (tmp definitions) | 104 ;; Avoid warning (tmp definitions) |
105 (or (fboundp 'x-color-defined-p) | 105 (or (fboundp 'x-color-defined-p) |
106 (defmacro x-color-defined-p (col) | 106 (defmacro x-color-defined-p (col) |
107 (cond ((fboundp 'color-defined-p) (` (color-defined-p (, col)))) | 107 (cond ((fboundp 'color-defined-p) `(color-defined-p ,col)) |
108 ;; XEmacs >= 19.12 | 108 ;; XEmacs >= 19.12 |
109 ((fboundp 'valid-color-name-p) (` (valid-color-name-p (, col)))) | 109 ((fboundp 'valid-color-name-p) `(valid-color-name-p ,col)) |
110 ;; XEmacs 19.11 | 110 ;; XEmacs 19.11 |
111 ((fboundp 'x-valid-color-name-p) (` (x-valid-color-name-p (, col)))) | 111 ((fboundp 'x-valid-color-name-p) `(x-valid-color-name-p ,col)) |
112 (t '(error "Cannot implement color-defined-p"))))) | 112 (t '(error "Cannot implement color-defined-p"))))) |
113 (defmacro cperl-is-face (arg) ; Takes quoted arg | 113 (defmacro cperl-is-face (arg) ; Takes quoted arg |
114 (cond ((fboundp 'find-face) | 114 (cond ((fboundp 'find-face) |
115 (` (find-face (, arg)))) | 115 `(find-face ,arg)) |
116 (;;(and (fboundp 'face-list) | 116 (;;(and (fboundp 'face-list) |
117 ;; (face-list)) | 117 ;; (face-list)) |
118 (fboundp 'face-list) | 118 (fboundp 'face-list) |
119 (` (member (, arg) (and (fboundp 'face-list) | 119 `(member ,arg (and (fboundp 'face-list) |
120 (face-list))))) | 120 (face-list)))) |
121 (t | 121 (t |
122 (` (boundp (, arg)))))) | 122 `(boundp ,arg)))) |
123 (defmacro cperl-make-face (arg descr) ; Takes unquoted arg | 123 (defmacro cperl-make-face (arg descr) ; Takes unquoted arg |
124 (cond ((fboundp 'make-face) | 124 (cond ((fboundp 'make-face) |
125 (` (make-face (quote (, arg))))) | 125 `(make-face (quote ,arg))) |
126 (t | 126 (t |
127 (` (defvar (, arg) (quote (, arg)) (, descr)))))) | 127 `(defvar ,arg (quote ,arg) ,descr)))) |
128 (defmacro cperl-force-face (arg descr) ; Takes unquoted arg | 128 (defmacro cperl-force-face (arg descr) ; Takes unquoted arg |
129 (` (progn | 129 `(progn |
130 (or (cperl-is-face (quote (, arg))) | 130 (or (cperl-is-face (quote ,arg)) |
131 (cperl-make-face (, arg) (, descr))) | 131 (cperl-make-face ,arg ,descr)) |
132 (or (boundp (quote (, arg))) ; We use unquoted variants too | 132 (or (boundp (quote ,arg)) ; We use unquoted variants too |
133 (defvar (, arg) (quote (, arg)) (, descr)))))) | 133 (defvar ,arg (quote ,arg) ,descr)))) |
134 (if cperl-xemacs-p | 134 (if cperl-xemacs-p |
135 (defmacro cperl-etags-snarf-tag (file line) | 135 (defmacro cperl-etags-snarf-tag (file line) |
136 (` (progn | 136 `(progn |
137 (beginning-of-line 2) | 137 (beginning-of-line 2) |
138 (list (, file) (, line))))) | 138 (list ,file ,line))) |
139 (defmacro cperl-etags-snarf-tag (file line) | 139 (defmacro cperl-etags-snarf-tag (file line) |
140 (` (etags-snarf-tag)))) | 140 `(etags-snarf-tag))) |
141 (if cperl-xemacs-p | 141 (if cperl-xemacs-p |
142 (defmacro cperl-etags-goto-tag-location (elt) | 142 (defmacro cperl-etags-goto-tag-location (elt) |
143 (`;;(progn | 143 ;;(progn |
144 ;; (switch-to-buffer (get-file-buffer (elt (, elt) 0))) | 144 ;; (switch-to-buffer (get-file-buffer (elt ,elt 0))) |
145 ;; (set-buffer (get-file-buffer (elt (, elt) 0))) | 145 ;; (set-buffer (get-file-buffer (elt ,elt 0))) |
146 ;; Probably will not work due to some save-excursion??? | 146 ;; Probably will not work due to some save-excursion??? |
147 ;; Or save-file-position? | 147 ;; Or save-file-position? |
148 ;; (message "Did I get to line %s?" (elt (, elt) 1)) | 148 ;; (message "Did I get to line %s?" (elt ,elt 1)) |
149 (goto-line (string-to-int (elt (, elt) 1))))) | 149 `(goto-line (string-to-int (elt ,elt 1)))) |
150 ;;) | 150 ;;) |
151 (defmacro cperl-etags-goto-tag-location (elt) | 151 (defmacro cperl-etags-goto-tag-location (elt) |
152 (` (etags-goto-tag-location (, elt)))))) | 152 `(etags-goto-tag-location ,elt)))) |
153 | 153 |
154 (defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version)) | 154 (defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version)) |
155 | 155 |
156 (defvar cperl-can-font-lock | 156 (defvar cperl-can-font-lock |
157 (or cperl-xemacs-p | 157 (or cperl-xemacs-p |
231 | 231 |
232 (defcustom cperl-indent-level 2 | 232 (defcustom cperl-indent-level 2 |
233 "*Indentation of CPerl statements with respect to containing block." | 233 "*Indentation of CPerl statements with respect to containing block." |
234 :type 'integer | 234 :type 'integer |
235 :group 'cperl-indentation-details) | 235 :group 'cperl-indentation-details) |
236 (put 'cperl-indent-level 'safe-local-variable 'integerp) | 236 |
237 ;; Is is not unusual to put both perl-indent-level and | |
238 ;; cperl-indent-level in the local variable section of a file. If only | |
239 ;; one of perl-mode and cperl-mode is in use, a warning will be issued | |
240 ;; about the variable. Autoload this here, so that no warning is | |
241 ;; issued when using either perl-mode or cperl-mode. | |
242 ;;;###autoload(put 'cperl-indent-level 'safe-local-variable 'integerp) | |
237 | 243 |
238 (defcustom cperl-lineup-step nil | 244 (defcustom cperl-lineup-step nil |
239 "*`cperl-lineup' will always lineup at multiple of this number. | 245 "*`cperl-lineup' will always lineup at multiple of this number. |
240 If nil, the value of `cperl-indent-level' will be used." | 246 If nil, the value of `cperl-indent-level' will be used." |
241 :type '(choice (const nil) integer) | 247 :type '(choice (const nil) integer) |
1786 (make-local-variable 'vc-sccs-header) | 1792 (make-local-variable 'vc-sccs-header) |
1787 (set 'vc-sccs-header cperl-vc-sccs-header) | 1793 (set 'vc-sccs-header cperl-vc-sccs-header) |
1788 ;; This one is obsolete... | 1794 ;; This one is obsolete... |
1789 (make-local-variable 'vc-header-alist) | 1795 (make-local-variable 'vc-header-alist) |
1790 (set 'vc-header-alist (or cperl-vc-header-alist ; Avoid warning | 1796 (set 'vc-header-alist (or cperl-vc-header-alist ; Avoid warning |
1791 (` ((SCCS (, (car cperl-vc-sccs-header))) | 1797 `((SCCS ,(car cperl-vc-sccs-header)) |
1792 (RCS (, (car cperl-vc-rcs-header))))))) | 1798 (RCS ,(car cperl-vc-rcs-header))))) |
1793 (cond ((boundp 'compilation-error-regexp-alist-alist);; xemacs 20.x | 1799 (cond ((boundp 'compilation-error-regexp-alist-alist);; xemacs 20.x |
1794 (make-local-variable 'compilation-error-regexp-alist-alist) | 1800 (make-local-variable 'compilation-error-regexp-alist-alist) |
1795 (set 'compilation-error-regexp-alist-alist | 1801 (set 'compilation-error-regexp-alist-alist |
1796 (cons (cons 'cperl (car cperl-compilation-error-regexp-alist)) | 1802 (cons (cons 'cperl (car cperl-compilation-error-regexp-alist)) |
1797 (symbol-value 'compilation-error-regexp-alist-alist))) | 1803 (symbol-value 'compilation-error-regexp-alist-alist))) |
5949 (1 font-lock-variable-name-face) | 5955 (1 font-lock-variable-name-face) |
5950 (2 '(restart 2 nil) nil t))) | 5956 (2 '(restart 2 nil) nil t))) |
5951 nil t))) ; local variables, multiple | 5957 nil t))) ; local variables, multiple |
5952 (font-lock-anchored | 5958 (font-lock-anchored |
5953 ;; 1=my_etc, 2=white? 3=(+white? 4=white? 5=var | 5959 ;; 1=my_etc, 2=white? 3=(+white? 4=white? 5=var |
5954 (` ((, (concat "\\<\\(my\\|local\\|our\\)" | 5960 `(,(concat "\\<\\(my\\|local\\|our\\)" |
5955 cperl-maybe-white-and-comment-rex | 5961 cperl-maybe-white-and-comment-rex |
5956 "\\((" | 5962 "\\((" |
5957 cperl-maybe-white-and-comment-rex | 5963 cperl-maybe-white-and-comment-rex |
5958 "\\)?\\([$@%*]\\([a-zA-Z0-9_:]+\\|[^a-zA-Z0-9_]\\)\\)")) | 5964 "\\)?\\([$@%*]\\([a-zA-Z0-9_:]+\\|[^a-zA-Z0-9_]\\)\\)") |
5959 (5 (, (if cperl-font-lock-multiline | 5965 (5 ,(if cperl-font-lock-multiline |
5960 'font-lock-variable-name-face | 5966 'font-lock-variable-name-face |
5961 '(progn (setq cperl-font-lock-multiline-start | 5967 '(progn (setq cperl-font-lock-multiline-start |
5962 (match-beginning 0)) | 5968 (match-beginning 0)) |
5963 'font-lock-variable-name-face)))) | 5969 'font-lock-variable-name-face))) |
5964 ((, (concat "\\=" | 5970 (,(concat "\\=" |
5965 cperl-maybe-white-and-comment-rex | 5971 cperl-maybe-white-and-comment-rex |
5966 "," | 5972 "," |
5967 cperl-maybe-white-and-comment-rex | 5973 cperl-maybe-white-and-comment-rex |
5968 "\\([$@%*]\\([a-zA-Z0-9_:]+\\|[^a-zA-Z0-9_]\\)\\)")) | 5974 "\\([$@%*]\\([a-zA-Z0-9_:]+\\|[^a-zA-Z0-9_]\\)\\)") |
5969 ;; Bug in font-lock: limit is used not only to limit | 5975 ;; Bug in font-lock: limit is used not only to limit |
5970 ;; searches, but to set the "extend window for | 5976 ;; searches, but to set the "extend window for |
5971 ;; facification" property. Thus we need to minimize. | 5977 ;; facification" property. Thus we need to minimize. |
5972 (, (if cperl-font-lock-multiline | 5978 ,(if cperl-font-lock-multiline |
5973 '(if (match-beginning 3) | 5979 '(if (match-beginning 3) |
5974 (save-excursion | 5980 (save-excursion |
5975 (goto-char (match-beginning 3)) | 5981 (goto-char (match-beginning 3)) |
5976 (condition-case nil | 5982 (condition-case nil |
5977 (forward-sexp 1) | 5983 (forward-sexp 1) |
5981 (error nil)))) ; typeahead | 5987 (error nil)))) ; typeahead |
5982 (1- (point))) ; report limit | 5988 (1- (point))) ; report limit |
5983 (forward-char -2)) ; disable continued expr | 5989 (forward-char -2)) ; disable continued expr |
5984 '(if (match-beginning 3) | 5990 '(if (match-beginning 3) |
5985 (point-max) ; No limit for continuation | 5991 (point-max) ; No limit for continuation |
5986 (forward-char -2)))) ; disable continued expr | 5992 (forward-char -2))) ; disable continued expr |
5987 (, (if cperl-font-lock-multiline | 5993 ,(if cperl-font-lock-multiline |
5988 nil | 5994 nil |
5989 '(progn ; Do at end | 5995 '(progn ; Do at end |
5990 ;; "my" may be already fontified (POD), | 5996 ;; "my" may be already fontified (POD), |
5991 ;; so cperl-font-lock-multiline-start is nil | 5997 ;; so cperl-font-lock-multiline-start is nil |
5992 (if (or (not cperl-font-lock-multiline-start) | 5998 (if (or (not cperl-font-lock-multiline-start) |
5995 (point)))) | 6001 (point)))) |
5996 nil | 6002 nil |
5997 (put-text-property | 6003 (put-text-property |
5998 (1+ cperl-font-lock-multiline-start) (point) | 6004 (1+ cperl-font-lock-multiline-start) (point) |
5999 'syntax-type 'multiline)) | 6005 'syntax-type 'multiline)) |
6000 (setq cperl-font-lock-multiline-start nil)))) | 6006 (setq cperl-font-lock-multiline-start nil))) |
6001 (3 font-lock-variable-name-face))))) | 6007 (3 font-lock-variable-name-face)))) |
6002 (t '("^[ \t{}]*\\(my\\|local\\|our\\)[ \t]*\\(([ \t]*\\)?\\([$@%*][a-zA-Z0-9_:]+\\)" | 6008 (t '("^[ \t{}]*\\(my\\|local\\|our\\)[ \t]*\\(([ \t]*\\)?\\([$@%*][a-zA-Z0-9_:]+\\)" |
6003 3 font-lock-variable-name-face))) | 6009 3 font-lock-variable-name-face))) |
6004 '("\\<for\\(each\\)?\\([ \t]+\\(my\\|local\\|our\\)\\)?[ \t]*\\(\\$[a-zA-Z_][a-zA-Z_0-9]*\\)[ \t]*(" | 6010 '("\\<for\\(each\\)?\\([ \t]+\\(my\\|local\\|our\\)\\)?[ \t]*\\(\\$[a-zA-Z_][a-zA-Z_0-9]*\\)[ \t]*(" |
6005 4 font-lock-variable-name-face) | 6011 4 font-lock-variable-name-face) |
6006 ;; Avoid $!, and s!!, qq!! etc. when not fontifying syntaxically | 6012 ;; Avoid $!, and s!!, qq!! etc. when not fontifying syntaxically |