Mercurial > emacs
comparison lisp/progmodes/cperl-mode.el @ 85762:29e75576e47f
* calc/calc.el (calc-emacs-type-lucid): Remove.
(calc-digit-map, calcDigit-start, calc-read-key)
(calc-clear-unread-commands):
* calc/calc-ext.el (calc-user-key-map): Replace uses of
calc-emacs-type-lucid with (featurep 'xemacs)
* emulation/tpu-mapper.el: Replace tpu-lucid-emacs19-p with
(featurep 'xemacs).
(tpu-lucid-emacs19-p): Remove.
(tpu-map-key): Make it a function instead of using fset. Inline
tpu-emacs-map-key and tpu-lucid-map-key. Use featurep 'xemacs.
(tpu-emacs-map-key, tpu-lucid-map-key): Remove.
* ielm.el: Use featurep 'xemacs.
* progmodes/cperl-mode.el (cperl-xemacs-p): Remove.
(condition-case, cperl-can-font-lock, cperl-singly-quote-face)
(cperl-define-key, cperl-mode-map, cperl-mode, cperl-init-faces)
(cperl-write-tags, cperl-tags-hier-init, cperl-perldoc): Replace
cperl-xemacs-p with (featurep 'xemacs).
(font-lock-cache-position): Pacify byte compiler.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Mon, 29 Oct 2007 15:33:04 +0000 |
parents | 455aadb38992 |
children | 2c08ad76fc1f 880960b70474 |
comparison
equal
deleted
inserted
replaced
85761:7d711fbfe5b5 | 85762:29e75576e47f |
---|---|
76 (require 'custom) | 76 (require 'custom) |
77 (error nil)) | 77 (error nil)) |
78 (condition-case nil | 78 (condition-case nil |
79 (require 'man) | 79 (require 'man) |
80 (error nil)) | 80 (error nil)) |
81 (defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version)) | |
82 (defvar cperl-can-font-lock | 81 (defvar cperl-can-font-lock |
83 (or cperl-xemacs-p | 82 (or (featurep 'xemacs) |
84 (and (boundp 'emacs-major-version) | 83 (and (boundp 'emacs-major-version) |
85 (or window-system | 84 (or window-system |
86 (> emacs-major-version 20))))) | 85 (> emacs-major-version 20))))) |
87 (if cperl-can-font-lock | 86 (if cperl-can-font-lock |
88 (require 'font-lock)) | 87 (require 'font-lock)) |
129 `(progn | 128 `(progn |
130 (or (cperl-is-face (quote ,arg)) | 129 (or (cperl-is-face (quote ,arg)) |
131 (cperl-make-face ,arg ,descr)) | 130 (cperl-make-face ,arg ,descr)) |
132 (or (boundp (quote ,arg)) ; We use unquoted variants too | 131 (or (boundp (quote ,arg)) ; We use unquoted variants too |
133 (defvar ,arg (quote ,arg) ,descr)))) | 132 (defvar ,arg (quote ,arg) ,descr)))) |
134 (if cperl-xemacs-p | 133 (if (featurep 'xemacs) |
135 (defmacro cperl-etags-snarf-tag (file line) | 134 (defmacro cperl-etags-snarf-tag (file line) |
136 `(progn | 135 `(progn |
137 (beginning-of-line 2) | 136 (beginning-of-line 2) |
138 (list ,file ,line))) | 137 (list ,file ,line))) |
139 (defmacro cperl-etags-snarf-tag (file line) | 138 (defmacro cperl-etags-snarf-tag (file line) |
140 `(etags-snarf-tag))) | 139 `(etags-snarf-tag))) |
141 (if cperl-xemacs-p | 140 (if (featurep 'xemacs) |
142 (defmacro cperl-etags-goto-tag-location (elt) | 141 (defmacro cperl-etags-goto-tag-location (elt) |
143 ;;(progn | 142 ;;(progn |
144 ;; (switch-to-buffer (get-file-buffer (elt ,elt 0))) | 143 ;; (switch-to-buffer (get-file-buffer (elt ,elt 0))) |
145 ;; (set-buffer (get-file-buffer (elt ,elt 0))) | 144 ;; (set-buffer (get-file-buffer (elt ,elt 0))) |
146 ;; Probably will not work due to some save-excursion??? | 145 ;; Probably will not work due to some save-excursion??? |
149 `(goto-line (string-to-int (elt ,elt 1)))) | 148 `(goto-line (string-to-int (elt ,elt 1)))) |
150 ;;) | 149 ;;) |
151 (defmacro cperl-etags-goto-tag-location (elt) | 150 (defmacro cperl-etags-goto-tag-location (elt) |
152 `(etags-goto-tag-location ,elt)))) | 151 `(etags-goto-tag-location ,elt)))) |
153 | 152 |
154 (defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version)) | |
155 | |
156 (defvar cperl-can-font-lock | 153 (defvar cperl-can-font-lock |
157 (or cperl-xemacs-p | 154 (or (featurep 'xemacs) |
158 (and (boundp 'emacs-major-version) | 155 (and (boundp 'emacs-major-version) |
159 (or window-system | 156 (or window-system |
160 (> emacs-major-version 20))))) | 157 (> emacs-major-version 20))))) |
161 | 158 |
162 (defun cperl-choose-color (&rest list) | 159 (defun cperl-choose-color (&rest list) |
456 "*Face for here-docs highlighting." | 453 "*Face for here-docs highlighting." |
457 :type 'face | 454 :type 'face |
458 :group 'cperl-faces) | 455 :group 'cperl-faces) |
459 | 456 |
460 ;;; Some double-evaluation happened with font-locks... Needed with 21.2... | 457 ;;; Some double-evaluation happened with font-locks... Needed with 21.2... |
461 (defvar cperl-singly-quote-face cperl-xemacs-p) | 458 (defvar cperl-singly-quote-face (featurep 'xemacs)) |
462 | 459 |
463 (defcustom cperl-invalid-face 'underline | 460 (defcustom cperl-invalid-face 'underline |
464 "*Face for highlighting trailing whitespace." | 461 "*Face for highlighting trailing whitespace." |
465 :type 'face | 462 :type 'face |
466 :version "21.1" | 463 :version "21.1" |
1009 ;;; Portability stuff: | 1006 ;;; Portability stuff: |
1010 | 1007 |
1011 (defmacro cperl-define-key (emacs-key definition &optional xemacs-key) | 1008 (defmacro cperl-define-key (emacs-key definition &optional xemacs-key) |
1012 `(define-key cperl-mode-map | 1009 `(define-key cperl-mode-map |
1013 ,(if xemacs-key | 1010 ,(if xemacs-key |
1014 `(if cperl-xemacs-p ,xemacs-key ,emacs-key) | 1011 `(if (featurep 'xemacs) ,xemacs-key ,emacs-key) |
1015 emacs-key) | 1012 emacs-key) |
1016 ,definition)) | 1013 ,definition)) |
1017 | 1014 |
1018 (defvar cperl-del-back-ch | 1015 (defvar cperl-del-back-ch |
1019 (car (append (where-is-internal 'delete-backward-char) | 1016 (car (append (where-is-internal 'delete-backward-char) |
1022 | 1019 |
1023 (and (vectorp cperl-del-back-ch) (= (length cperl-del-back-ch) 1) | 1020 (and (vectorp cperl-del-back-ch) (= (length cperl-del-back-ch) 1) |
1024 (setq cperl-del-back-ch (aref cperl-del-back-ch 0))) | 1021 (setq cperl-del-back-ch (aref cperl-del-back-ch 0))) |
1025 | 1022 |
1026 (defun cperl-mark-active () (mark)) ; Avoid undefined warning | 1023 (defun cperl-mark-active () (mark)) ; Avoid undefined warning |
1027 (if cperl-xemacs-p | 1024 (if (featurep 'xemacs) |
1028 (progn | 1025 (progn |
1029 ;; "Active regions" are on: use region only if active | 1026 ;; "Active regions" are on: use region only if active |
1030 ;; "Active regions" are off: use region unconditionally | 1027 ;; "Active regions" are off: use region unconditionally |
1031 (defun cperl-use-region-p () | 1028 (defun cperl-use-region-p () |
1032 (if zmacs-regions (mark) t))) | 1029 (if zmacs-regions (mark) t))) |
1038 cperl-can-font-lock) | 1035 cperl-can-font-lock) |
1039 | 1036 |
1040 (defun cperl-putback-char (c) ; Emacs 19 | 1037 (defun cperl-putback-char (c) ; Emacs 19 |
1041 (set 'unread-command-events (list c))) ; Avoid undefined warning | 1038 (set 'unread-command-events (list c))) ; Avoid undefined warning |
1042 | 1039 |
1043 (if cperl-xemacs-p | 1040 (if (featurep 'xemacs) |
1044 (defun cperl-putback-char (c) ; XEmacs >= 19.12 | 1041 (defun cperl-putback-char (c) ; XEmacs >= 19.12 |
1045 (setq unread-command-events (list (eval '(character-to-event c)))))) | 1042 (setq unread-command-events (list (eval '(character-to-event c)))))) |
1046 | 1043 |
1047 (or (fboundp 'uncomment-region) | 1044 (or (fboundp 'uncomment-region) |
1048 (defun uncomment-region (beg end) | 1045 (defun uncomment-region (beg end) |
1190 [(control c) (control h) f]) | 1187 [(control c) (control h) f]) |
1191 (cperl-define-key "\C-c\C-hv" | 1188 (cperl-define-key "\C-c\C-hv" |
1192 ;;(concat (char-to-string help-char) "v") ; does not work | 1189 ;;(concat (char-to-string help-char) "v") ; does not work |
1193 'cperl-get-help | 1190 'cperl-get-help |
1194 [(control c) (control h) v])) | 1191 [(control c) (control h) v])) |
1195 (if (and cperl-xemacs-p | 1192 (if (and (featurep 'xemacs) |
1196 (<= emacs-minor-version 11) (<= emacs-major-version 19)) | 1193 (<= emacs-minor-version 11) (<= emacs-major-version 19)) |
1197 (progn | 1194 (progn |
1198 ;; substitute-key-definition is usefulness-deenhanced... | 1195 ;; substitute-key-definition is usefulness-deenhanced... |
1199 ;;;;;(cperl-define-key "\M-q" 'cperl-fill-paragraph) | 1196 ;;;;;(cperl-define-key "\M-q" 'cperl-fill-paragraph) |
1200 (cperl-define-key "\e;" 'cperl-indent-for-comment) | 1197 (cperl-define-key "\e;" 'cperl-indent-for-comment) |
1742 (setq paragraph-start (concat "^$\\|" page-delimiter)) | 1739 (setq paragraph-start (concat "^$\\|" page-delimiter)) |
1743 (make-local-variable 'paragraph-separate) | 1740 (make-local-variable 'paragraph-separate) |
1744 (setq paragraph-separate paragraph-start) | 1741 (setq paragraph-separate paragraph-start) |
1745 (make-local-variable 'paragraph-ignore-fill-prefix) | 1742 (make-local-variable 'paragraph-ignore-fill-prefix) |
1746 (setq paragraph-ignore-fill-prefix t) | 1743 (setq paragraph-ignore-fill-prefix t) |
1747 (if cperl-xemacs-p | 1744 (if (featurep 'xemacs) |
1748 (progn | 1745 (progn |
1749 (make-local-variable 'paren-backwards-message) | 1746 (make-local-variable 'paren-backwards-message) |
1750 (set 'paren-backwards-message t))) | 1747 (set 'paren-backwards-message t))) |
1751 (make-local-variable 'indent-line-function) | 1748 (make-local-variable 'indent-line-function) |
1752 (setq indent-line-function 'cperl-indent-line) | 1749 (setq indent-line-function 'cperl-indent-line) |
1833 (set 'parse-sexp-lookup-properties t) | 1830 (set 'parse-sexp-lookup-properties t) |
1834 ;; Fix broken font-lock: | 1831 ;; Fix broken font-lock: |
1835 (or (boundp 'font-lock-unfontify-region-function) | 1832 (or (boundp 'font-lock-unfontify-region-function) |
1836 (set 'font-lock-unfontify-region-function | 1833 (set 'font-lock-unfontify-region-function |
1837 'font-lock-default-unfontify-region)) | 1834 'font-lock-default-unfontify-region)) |
1838 (unless cperl-xemacs-p ; Our: just a plug for wrong font-lock | 1835 (unless (featurep 'xemacs) ; Our: just a plug for wrong font-lock |
1839 (make-local-variable 'font-lock-unfontify-region-function) | 1836 (make-local-variable 'font-lock-unfontify-region-function) |
1840 (set 'font-lock-unfontify-region-function ; not present with old Emacs | 1837 (set 'font-lock-unfontify-region-function ; not present with old Emacs |
1841 'cperl-font-lock-unfontify-region-function)) | 1838 'cperl-font-lock-unfontify-region-function)) |
1842 (make-local-variable 'cperl-syntax-done-to) | 1839 (make-local-variable 'cperl-syntax-done-to) |
1843 (setq cperl-syntax-done-to nil) ; reset syntaxification cache | 1840 (setq cperl-syntax-done-to nil) ; reset syntaxification cache |
5852 (setq | 5849 (setq |
5853 t-font-lock-keywords-1 | 5850 t-font-lock-keywords-1 |
5854 (and (fboundp 'turn-on-font-lock) ; Check for newer font-lock | 5851 (and (fboundp 'turn-on-font-lock) ; Check for newer font-lock |
5855 ;; not yet as of XEmacs 19.12, works with 21.1.11 | 5852 ;; not yet as of XEmacs 19.12, works with 21.1.11 |
5856 (or | 5853 (or |
5857 (not cperl-xemacs-p) | 5854 (not (featurep 'xemacs)) |
5858 (string< "21.1.9" emacs-version) | 5855 (string< "21.1.9" emacs-version) |
5859 (and (string< "21.1.10" emacs-version) | 5856 (and (string< "21.1.10" emacs-version) |
5860 (string< emacs-version "21.1.2"))) | 5857 (string< emacs-version "21.1.2"))) |
5861 '( | 5858 '( |
5862 ("\\(\\([@%]\\|\$#\\)[a-zA-Z_:][a-zA-Z0-9_:]*\\)" 1 | 5859 ("\\(\\([@%]\\|\$#\\)[a-zA-Z_:][a-zA-Z0-9_:]*\\)" 1 |
6013 ;; "Face to use for data types.")) | 6010 ;; "Face to use for data types.")) |
6014 ;;(or (boundp 'cperl-nonoverridable-face) | 6011 ;;(or (boundp 'cperl-nonoverridable-face) |
6015 ;; (defconst cperl-nonoverridable-face | 6012 ;; (defconst cperl-nonoverridable-face |
6016 ;; 'cperl-nonoverridable-face | 6013 ;; 'cperl-nonoverridable-face |
6017 ;; "Face to use for data types from another group.")) | 6014 ;; "Face to use for data types from another group.")) |
6018 ;;(if (not cperl-xemacs-p) nil | 6015 ;;(if (not (featurep 'xemacs)) nil |
6019 ;; (or (boundp 'font-lock-comment-face) | 6016 ;; (or (boundp 'font-lock-comment-face) |
6020 ;; (defconst font-lock-comment-face | 6017 ;; (defconst font-lock-comment-face |
6021 ;; 'font-lock-comment-face | 6018 ;; 'font-lock-comment-face |
6022 ;; "Face to use for comments.")) | 6019 ;; "Face to use for comments.")) |
6023 ;; (or (boundp 'font-lock-keyword-face) | 6020 ;; (or (boundp 'font-lock-keyword-face) |
6962 (case-fold-search (eq system-type 'emx)) | 6959 (case-fold-search (eq system-type 'emx)) |
6963 xs rel tm) | 6960 xs rel tm) |
6964 (save-excursion | 6961 (save-excursion |
6965 (cond (inbuffer nil) ; Already there | 6962 (cond (inbuffer nil) ; Already there |
6966 ((file-exists-p tags-file-name) | 6963 ((file-exists-p tags-file-name) |
6967 (if cperl-xemacs-p | 6964 (if (featurep 'xemacs) |
6968 (visit-tags-table-buffer) | 6965 (visit-tags-table-buffer) |
6969 (visit-tags-table-buffer tags-file-name))) | 6966 (visit-tags-table-buffer tags-file-name))) |
6970 (t (set-buffer (find-file-noselect tags-file-name)))) | 6967 (t (set-buffer (find-file-noselect tags-file-name)))) |
6971 (cond | 6968 (cond |
6972 (dir | 6969 (dir |
7098 ;; Only in one file | 7095 ;; Only in one file |
7099 (setcdr elt (cdr (nth 1 elt))))))) | 7096 (setcdr elt (cdr (nth 1 elt))))))) |
7100 pack name cons1 to l1 l2 l3 l4 b) | 7097 pack name cons1 to l1 l2 l3 l4 b) |
7101 ;; (setq cperl-hierarchy '(() () ())) ; Would write into '() later! | 7098 ;; (setq cperl-hierarchy '(() () ())) ; Would write into '() later! |
7102 (setq cperl-hierarchy (list l1 l2 l3)) | 7099 (setq cperl-hierarchy (list l1 l2 l3)) |
7103 (if cperl-xemacs-p ; Not checked | 7100 (if (featurep 'xemacs) ; Not checked |
7104 (progn | 7101 (progn |
7105 (or tags-file-name | 7102 (or tags-file-name |
7106 ;; Does this work in XEmacs? | 7103 ;; Does this work in XEmacs? |
7107 (call-interactively 'visit-tags-table)) | 7104 (call-interactively 'visit-tags-table)) |
7108 (message "Updating list of classes...") | 7105 (message "Updating list of classes...") |
8449 (documentation-property | 8446 (documentation-property |
8450 'cperl-short-docs | 8447 'cperl-short-docs |
8451 'variable-documentation)))) | 8448 'variable-documentation)))) |
8452 (manual-program (if is-func "perldoc -f" "perldoc"))) | 8449 (manual-program (if is-func "perldoc -f" "perldoc"))) |
8453 (cond | 8450 (cond |
8454 (cperl-xemacs-p | 8451 ((featurep 'xemacs) |
8455 (let ((Manual-program "perldoc") | 8452 (let ((Manual-program "perldoc") |
8456 (Manual-switches (if is-func (list "-f")))) | 8453 (Manual-switches (if is-func (list "-f")))) |
8457 (manual-entry word))) | 8454 (manual-entry word))) |
8458 (t | 8455 (t |
8459 (Man-getpage-in-background word))))) | 8456 (Man-getpage-in-background word))))) |
8491 (defun cperl-build-manpage () | 8488 (defun cperl-build-manpage () |
8492 "Create a virtual manpage in Emacs from the POD in the file." | 8489 "Create a virtual manpage in Emacs from the POD in the file." |
8493 (interactive) | 8490 (interactive) |
8494 (require 'man) | 8491 (require 'man) |
8495 (cond | 8492 (cond |
8496 (cperl-xemacs-p | 8493 ((featurep 'xemacs) |
8497 (let ((Manual-program "perldoc")) | 8494 (let ((Manual-program "perldoc")) |
8498 (manual-entry buffer-file-name))) | 8495 (manual-entry buffer-file-name))) |
8499 (t | 8496 (t |
8500 (let* ((manual-program "perldoc")) | 8497 (let* ((manual-program "perldoc")) |
8501 (Man-getpage-in-background buffer-file-name))))) | 8498 (Man-getpage-in-background buffer-file-name))))) |
8686 (setq c (1+ c)) | 8683 (setq c (1+ c)) |
8687 (cperl-update-syntaxification (point) (point)) | 8684 (cperl-update-syntaxification (point) (point)) |
8688 (setq delta (- (- tt (setq tt (funcall timems)))) tot (+ tot delta)) | 8685 (setq delta (- (- tt (setq tt (funcall timems)))) tot (+ tot delta)) |
8689 (message "to %s:%6s,%7s" l delta tot)) | 8686 (message "to %s:%6s,%7s" l delta tot)) |
8690 tot)) | 8687 tot)) |
8688 | |
8689 (defvar font-lock-cache-position) | |
8691 | 8690 |
8692 (defun cperl-emulate-lazy-lock (&optional window-size) | 8691 (defun cperl-emulate-lazy-lock (&optional window-size) |
8693 "Emulate `lazy-lock' without `condition-case', so `debug-on-error' works. | 8692 "Emulate `lazy-lock' without `condition-case', so `debug-on-error' works. |
8694 Start fontifying the buffer from the start (or end) using the given | 8693 Start fontifying the buffer from the start (or end) using the given |
8695 WINDOW-SIZE (units is lines). Negative WINDOW-SIZE starts at end, and | 8694 WINDOW-SIZE (units is lines). Negative WINDOW-SIZE starts at end, and |