diff options
| author | Stefan Monnier | 2003-02-23 02:19:02 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-02-23 02:19:02 +0000 |
| commit | f739b53bdabc67f724a874dcc663270d5c6a3d2e (patch) | |
| tree | d1b185d39de54a6037651043d077678bd0ef7e64 | |
| parent | 83261a2f134a3fbb8c5d4977b8e96e9fb136b744 (diff) | |
| download | emacs-f739b53bdabc67f724a874dcc663270d5c6a3d2e.tar.gz emacs-f739b53bdabc67f724a874dcc663270d5c6a3d2e.zip | |
Merge changes from CPerl-5.0.
(toplevel): Require man.
(condition-case): Don't autoload tmm-prompt (it's in loaddefs.el).
(cperl-electric-backspace-untabify): New var.
(cperl-electric-backspace): Use it.
(cperl-vc-header-alist): Extract numeric version from the Id.
(cperl-build-manpage): New fun.
(cperl-menu): Use it. Add toggle-autohelp.
(cperl-mode) <defun-prompt_regexp>: Understand prototypes.
(cperl-electric-brace): Use `cperl-after-block-p' for detection.
(cperl-electric-keyword): Make $if (etc: "$@%&*") non-electric.
'(' after keyword would insert a doubled paren.
(cperl-calculate-indent): Update syntaxification before checks.
Fix wrong indent of blocks starting with POD.
(cperl-find-pods-heres): If no end of HERE-doc found, mark to the end
of buffer. This enables recognition of end of HERE-doc "as one types".
Require "\n" after trailing tag of HERE-doc.
\( made non-quoting outside of string/comment (gdj-contributed).
Likewise for \$. Remove `here-doc-group' text property at start
(makes this property reliable).
Text property `first-format-line' ==> t.
Do not recognize $opt_s and $opt::s as s///.
(cperl-after-block-p): Optional arg pre-block to check for a pre-block
Recognize `continue' blocks too.
(cperl-after-expr-p): Update syntaxification before checks. Work after
here-docs, formats, and PODs too (affects many electric constructs).
(cperl-fix-line-spacing): Allow "_" in $vars of foreach etc.
(cperl-perldoc): Use case-sensitive search.
| -rw-r--r-- | lisp/progmodes/cperl-mode.el | 387 |
1 files changed, 263 insertions, 124 deletions
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 4084f824eaa..6ce9bd3d685 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el | |||
| @@ -69,6 +69,9 @@ | |||
| 69 | 69 | ||
| 70 | ;; Some macros are needed for `defcustom' | 70 | ;; Some macros are needed for `defcustom' |
| 71 | (eval-when-compile | 71 | (eval-when-compile |
| 72 | (condition-case nil | ||
| 73 | (require 'man) | ||
| 74 | (error nil)) | ||
| 72 | (defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version)) | 75 | (defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version)) |
| 73 | (defvar cperl-can-font-lock | 76 | (defvar cperl-can-font-lock |
| 74 | (or cperl-xemacs-p | 77 | (or cperl-xemacs-p |
| @@ -120,8 +123,7 @@ | |||
| 120 | `(goto-line (string-to-int (elt ,elt 1)))) | 123 | `(goto-line (string-to-int (elt ,elt 1)))) |
| 121 | ;;) | 124 | ;;) |
| 122 | (defmacro cperl-etags-goto-tag-location (elt) | 125 | (defmacro cperl-etags-goto-tag-location (elt) |
| 123 | `(etags-goto-tag-location ,elt))) | 126 | `(etags-goto-tag-location ,elt)))) |
| 124 | (autoload 'tmm-prompt "tmm")) | ||
| 125 | 127 | ||
| 126 | (defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version)) | 128 | (defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version)) |
| 127 | 129 | ||
| @@ -321,6 +323,11 @@ Can be overwritten by `cperl-hairy' if nil." | |||
| 321 | :type '(choice (const null) boolean) | 323 | :type '(choice (const null) boolean) |
| 322 | :group 'cperl-affected-by-hairy) | 324 | :group 'cperl-affected-by-hairy) |
| 323 | 325 | ||
| 326 | (defcustom cperl-electric-backspace-untabify t | ||
| 327 | "*Not-nil means electric-backspace will untabify in CPerl." | ||
| 328 | :type 'boolean | ||
| 329 | :group 'cperl-autoinsert-details) | ||
| 330 | |||
| 324 | (defcustom cperl-hairy nil | 331 | (defcustom cperl-hairy nil |
| 325 | "*Not-nil means most of the bells and whistles are enabled in CPerl. | 332 | "*Not-nil means most of the bells and whistles are enabled in CPerl. |
| 326 | Affects: `cperl-font-lock', `cperl-electric-lbrace-space', | 333 | Affects: `cperl-font-lock', `cperl-electric-lbrace-space', |
| @@ -335,8 +342,8 @@ Affects: `cperl-font-lock', `cperl-electric-lbrace-space', | |||
| 335 | :type 'integer | 342 | :type 'integer |
| 336 | :group 'cperl-indentation-details) | 343 | :group 'cperl-indentation-details) |
| 337 | 344 | ||
| 338 | (defcustom cperl-vc-header-alist '((SCCS "$sccs = '%W\%' ;") | 345 | (defcustom cperl-vc-header-alist '((SCCS "($sccs) = ('%W\%' =~ /(\\d+(\\.\\d+)+)/) ;") |
| 339 | (RCS "$rcs = ' $Id\$ ' ;")) | 346 | (RCS "($rcs) = (' $Id\$ ' =~ /(\\d+(\\.\\d+)+)/) ;")) |
| 340 | "*What to use as `vc-header-alist' in CPerl." | 347 | "*What to use as `vc-header-alist' in CPerl." |
| 341 | :type '(repeat (list symbol string)) | 348 | :type '(repeat (list symbol string)) |
| 342 | :group 'cperl) | 349 | :group 'cperl) |
| @@ -1128,57 +1135,58 @@ the faces: please specify bold, italic, underline, shadow and box.) | |||
| 1128 | ;;; ["Add tags for Perl files in (sub)directories" | 1135 | ;;; ["Add tags for Perl files in (sub)directories" |
| 1129 | ;;; (cperl-etags t 'recursive) t]) | 1136 | ;;; (cperl-etags t 'recursive) t]) |
| 1130 | ;;;; cperl-write-tags (&optional file erase recurse dir inbuffer) | 1137 | ;;;; cperl-write-tags (&optional file erase recurse dir inbuffer) |
| 1131 | ["Create tags for current file" (cperl-write-tags nil t) t] | 1138 | ["Create tags for current file" (cperl-write-tags nil t) t] |
| 1132 | ["Add tags for current file" (cperl-write-tags) t] | 1139 | ["Add tags for current file" (cperl-write-tags) t] |
| 1133 | ["Create tags for Perl files in directory" | 1140 | ["Create tags for Perl files in directory" |
| 1134 | (cperl-write-tags nil t nil t) t] | 1141 | (cperl-write-tags nil t nil t) t] |
| 1135 | ["Add tags for Perl files in directory" | 1142 | ["Add tags for Perl files in directory" |
| 1136 | (cperl-write-tags nil nil nil t) t] | 1143 | (cperl-write-tags nil nil nil t) t] |
| 1137 | ["Create tags for Perl files in (sub)directories" | 1144 | ["Create tags for Perl files in (sub)directories" |
| 1138 | (cperl-write-tags nil t t t) t] | 1145 | (cperl-write-tags nil t t t) t] |
| 1139 | ["Add tags for Perl files in (sub)directories" | 1146 | ["Add tags for Perl files in (sub)directories" |
| 1140 | (cperl-write-tags nil nil t t) t])) | 1147 | (cperl-write-tags nil nil t t) t])) |
| 1141 | ("Perl docs" | 1148 | ("Perl docs" |
| 1142 | ["Define word at point" imenu-go-find-at-position | 1149 | ["Define word at point" imenu-go-find-at-position |
| 1143 | (fboundp 'imenu-go-find-at-position)] | 1150 | (fboundp 'imenu-go-find-at-position)] |
| 1144 | ["Help on function" cperl-info-on-command t] | 1151 | ["Help on function" cperl-info-on-command t] |
| 1145 | ["Help on function at point" cperl-info-on-current-command t] | 1152 | ["Help on function at point" cperl-info-on-current-command t] |
| 1146 | ["Help on symbol at point" cperl-get-help t] | 1153 | ["Help on symbol at point" cperl-get-help t] |
| 1147 | ["Perldoc" cperl-perldoc t] | 1154 | ["Perldoc" cperl-perldoc t] |
| 1148 | ["Perldoc on word at point" cperl-perldoc-at-point t] | 1155 | ["Perldoc on word at point" cperl-perldoc-at-point t] |
| 1149 | ["View manpage of POD in this file" cperl-pod-to-manpage t] | 1156 | ["View manpage of POD in this file" cperl-build-manpage t] |
| 1150 | ["Auto-help on" cperl-lazy-install | 1157 | ["Auto-help on" cperl-lazy-install |
| 1151 | (and (fboundp 'run-with-idle-timer) | 1158 | (and (fboundp 'run-with-idle-timer) |
| 1152 | (not cperl-lazy-installed))] | 1159 | (not cperl-lazy-installed))] |
| 1153 | ["Auto-help off" (eval '(cperl-lazy-unstall)) | 1160 | ["Auto-help off" cperl-lazy-unstall |
| 1154 | (and (fboundp 'run-with-idle-timer) | 1161 | (and (fboundp 'run-with-idle-timer) |
| 1155 | cperl-lazy-installed)]) | 1162 | cperl-lazy-installed)]) |
| 1156 | ("Toggle..." | 1163 | ("Toggle..." |
| 1157 | ["Auto newline" cperl-toggle-auto-newline t] | 1164 | ["Auto newline" cperl-toggle-auto-newline t] |
| 1158 | ["Electric parens" cperl-toggle-electric t] | 1165 | ["Electric parens" cperl-toggle-electric t] |
| 1159 | ["Electric keywords" cperl-toggle-abbrev t] | 1166 | ["Electric keywords" cperl-toggle-abbrev t] |
| 1160 | ["Fix whitespace on indent" cperl-toggle-construct-fix t] | 1167 | ["Fix whitespace on indent" cperl-toggle-construct-fix t] |
| 1161 | ["Auto fill" auto-fill-mode t]) | 1168 | ["Auto-help on Perl constructs" cperl-toggle-autohelp t] |
| 1162 | ("Indent styles..." | 1169 | ["Auto fill" auto-fill-mode t]) |
| 1163 | ["CPerl" (cperl-set-style "CPerl") t] | 1170 | ("Indent styles..." |
| 1164 | ["PerlStyle" (cperl-set-style "PerlStyle") t] | 1171 | ["CPerl" (cperl-set-style "CPerl") t] |
| 1165 | ["GNU" (cperl-set-style "GNU") t] | 1172 | ["PerlStyle" (cperl-set-style "PerlStyle") t] |
| 1166 | ["C++" (cperl-set-style "C++") t] | 1173 | ["GNU" (cperl-set-style "GNU") t] |
| 1167 | ["FSF" (cperl-set-style "FSF") t] | 1174 | ["C++" (cperl-set-style "C++") t] |
| 1168 | ["BSD" (cperl-set-style "BSD") t] | 1175 | ["FSF" (cperl-set-style "FSF") t] |
| 1169 | ["Whitesmith" (cperl-set-style "Whitesmith") t] | 1176 | ["BSD" (cperl-set-style "BSD") t] |
| 1170 | ["Current" (cperl-set-style "Current") t] | 1177 | ["Whitesmith" (cperl-set-style "Whitesmith") t] |
| 1171 | ["Memorized" (cperl-set-style-back) cperl-old-style]) | 1178 | ["Current" (cperl-set-style "Current") t] |
| 1172 | ("Micro-docs" | 1179 | ["Memorized" (cperl-set-style-back) cperl-old-style]) |
| 1173 | ["Tips" (describe-variable 'cperl-tips) t] | 1180 | ("Micro-docs" |
| 1174 | ["Problems" (describe-variable 'cperl-problems) t] | 1181 | ["Tips" (describe-variable 'cperl-tips) t] |
| 1175 | ["Speed" (describe-variable 'cperl-speed) t] | 1182 | ["Problems" (describe-variable 'cperl-problems) t] |
| 1176 | ["Praise" (describe-variable 'cperl-praise) t] | 1183 | ["Speed" (describe-variable 'cperl-speed) t] |
| 1177 | ["Faces" (describe-variable 'cperl-tips-faces) t] | 1184 | ["Praise" (describe-variable 'cperl-praise) t] |
| 1178 | ["CPerl mode" (describe-function 'cperl-mode) t] | 1185 | ["Faces" (describe-variable 'cperl-tips-faces) t] |
| 1179 | ["CPerl version" | 1186 | ["CPerl mode" (describe-function 'cperl-mode) t] |
| 1180 | (message "The version of master-file for this CPerl is %s-emacs" | 1187 | ["CPerl version" |
| 1181 | cperl-version) t])))) | 1188 | (message "The version of master-file for this CPerl is %s-Emacs" |
| 1189 | cperl-version) t])))) | ||
| 1182 | (error nil)) | 1190 | (error nil)) |
| 1183 | 1191 | ||
| 1184 | (autoload 'c-macro-expand "cmacexp" | 1192 | (autoload 'c-macro-expand "cmacexp" |
| @@ -1469,7 +1477,7 @@ or as help on variables `cperl-tips', `cperl-problems', | |||
| 1469 | (make-local-variable 'comment-start-skip) | 1477 | (make-local-variable 'comment-start-skip) |
| 1470 | (setq comment-start-skip "#+ *") | 1478 | (setq comment-start-skip "#+ *") |
| 1471 | (make-local-variable 'defun-prompt-regexp) | 1479 | (make-local-variable 'defun-prompt-regexp) |
| 1472 | (setq defun-prompt-regexp "^[ \t]*sub[ \t]+\\([^ \t\n{(;]+\\)[ \t]*") | 1480 | (setq defun-prompt-regexp "^[ \t]*sub[ \t]+\\([^ \t\n{(;]+\\)\\([ \t]*([^()]*)[ \t]*\\)?[ \t]*") |
| 1473 | (make-local-variable 'comment-indent-function) | 1481 | (make-local-variable 'comment-indent-function) |
| 1474 | (setq comment-indent-function 'cperl-comment-indent) | 1482 | (setq comment-indent-function 'cperl-comment-indent) |
| 1475 | (make-local-variable 'parse-sexp-ignore-comments) | 1483 | (make-local-variable 'parse-sexp-ignore-comments) |
| @@ -1692,7 +1700,9 @@ char is \"{\", insert extra newline before only if | |||
| 1692 | (save-excursion | 1700 | (save-excursion |
| 1693 | (up-list (- (prefix-numeric-value arg))) | 1701 | (up-list (- (prefix-numeric-value arg))) |
| 1694 | ;;(cperl-after-block-p (point-min)) | 1702 | ;;(cperl-after-block-p (point-min)) |
| 1695 | (cperl-after-expr-p nil "{;)")) | 1703 | (or (cperl-after-expr-p nil "{;)") |
| 1704 | ;; after sub, else, continue | ||
| 1705 | (cperl-after-block-p nil 'pre))) | ||
| 1696 | (error nil)))) | 1706 | (error nil)))) |
| 1697 | ;; Just insert the guy | 1707 | ;; Just insert the guy |
| 1698 | (self-insert-command (prefix-numeric-value arg)) | 1708 | (self-insert-command (prefix-numeric-value arg)) |
| @@ -1772,7 +1782,8 @@ char is \"{\", insert extra newline before only if | |||
| 1772 | (goto-char pos))))) | 1782 | (goto-char pos))))) |
| 1773 | 1783 | ||
| 1774 | (defun cperl-electric-paren (arg) | 1784 | (defun cperl-electric-paren (arg) |
| 1775 | "Insert a matching pair of parentheses." | 1785 | "Insert an opening parenthesis or a matching pair of parentheses. |
| 1786 | See `cperl-electric-parens'." | ||
| 1776 | (interactive "P") | 1787 | (interactive "P") |
| 1777 | (let ((beg (save-excursion (beginning-of-line) (point))) | 1788 | (let ((beg (save-excursion (beginning-of-line) (point))) |
| 1778 | (other-end (if (and cperl-electric-parens-mark | 1789 | (other-end (if (and cperl-electric-parens-mark |
| @@ -1807,7 +1818,8 @@ char is \"{\", insert extra newline before only if | |||
| 1807 | 1818 | ||
| 1808 | (defun cperl-electric-rparen (arg) | 1819 | (defun cperl-electric-rparen (arg) |
| 1809 | "Insert a matching pair of parentheses if marking is active. | 1820 | "Insert a matching pair of parentheses if marking is active. |
| 1810 | If not, or if we are not at the end of marking range, would self-insert." | 1821 | If not, or if we are not at the end of marking range, would self-insert. |
| 1822 | Affected by `cperl-electric-parens'." | ||
| 1811 | (interactive "P") | 1823 | (interactive "P") |
| 1812 | (let ((beg (save-excursion (beginning-of-line) (point))) | 1824 | (let ((beg (save-excursion (beginning-of-line) (point))) |
| 1813 | (other-end (if (and cperl-electric-parens-mark | 1825 | (other-end (if (and cperl-electric-parens-mark |
| @@ -1867,6 +1879,8 @@ to nil." | |||
| 1867 | (not (eq (get-text-property (point) | 1879 | (not (eq (get-text-property (point) |
| 1868 | 'syntax-type) | 1880 | 'syntax-type) |
| 1869 | 'pod)))))) | 1881 | 'pod)))))) |
| 1882 | (save-excursion (forward-sexp -1) | ||
| 1883 | (not (memq (following-char) (append "$@%&*" nil)))) | ||
| 1870 | (progn | 1884 | (progn |
| 1871 | (and (eq (preceding-char) ?y) | 1885 | (and (eq (preceding-char) ?y) |
| 1872 | (progn ; "foreachmy" | 1886 | (progn ; "foreachmy" |
| @@ -1896,7 +1910,11 @@ to nil." | |||
| 1896 | (if my | 1910 | (if my |
| 1897 | (forward-char 1) | 1911 | (forward-char 1) |
| 1898 | (delete-char 1))) | 1912 | (delete-char 1))) |
| 1899 | (search-backward ")")) | 1913 | (search-backward ")") |
| 1914 | (if (eq last-command-char ?\() | ||
| 1915 | (progn ; Avoid "if (())" | ||
| 1916 | (delete-backward-char 1) | ||
| 1917 | (delete-backward-char -1)))) | ||
| 1900 | (if delete | 1918 | (if delete |
| 1901 | (cperl-putback-char cperl-del-back-ch)) | 1919 | (cperl-putback-char cperl-del-back-ch)) |
| 1902 | (if cperl-message-electric-keyword | 1920 | (if cperl-message-electric-keyword |
| @@ -2185,8 +2203,8 @@ If in POD, insert appropriate lines." | |||
| 2185 | (self-insert-command (prefix-numeric-value arg))))) | 2203 | (self-insert-command (prefix-numeric-value arg))))) |
| 2186 | 2204 | ||
| 2187 | (defun cperl-electric-backspace (arg) | 2205 | (defun cperl-electric-backspace (arg) |
| 2188 | "Backspace-untabify, or remove the whitespace around the point inserted | 2206 | "Backspace, or remove the whitespace around the point inserted by an electric |
| 2189 | by an electric key." | 2207 | key. Will untabify if `cperl-electric-backspace-untabify' is non-nil." |
| 2190 | (interactive "p") | 2208 | (interactive "p") |
| 2191 | (if (and cperl-auto-newline | 2209 | (if (and cperl-auto-newline |
| 2192 | (memq last-command '(cperl-electric-semi | 2210 | (memq last-command '(cperl-electric-semi |
| @@ -2210,7 +2228,9 @@ by an electric key." | |||
| 2210 | (setq p (point)) | 2228 | (setq p (point)) |
| 2211 | (skip-chars-backward " \t\n") | 2229 | (skip-chars-backward " \t\n") |
| 2212 | (delete-region (point) p)) | 2230 | (delete-region (point) p)) |
| 2213 | (backward-delete-char-untabify arg)))) | 2231 | (if cperl-electric-backspace-untabify |
| 2232 | (backward-delete-char-untabify arg) | ||
| 2233 | (delete-backward-char arg))))) | ||
| 2214 | 2234 | ||
| 2215 | (defun cperl-inside-parens-p () | 2235 | (defun cperl-inside-parens-p () |
| 2216 | (condition-case () | 2236 | (condition-case () |
| @@ -2370,6 +2390,7 @@ Returns nil if line starts inside a string, t if in a comment. | |||
| 2370 | 2390 | ||
| 2371 | Will not correct the indentation for labels, but will correct it for braces | 2391 | Will not correct the indentation for labels, but will correct it for braces |
| 2372 | and closing parentheses and brackets." | 2392 | and closing parentheses and brackets." |
| 2393 | (cperl-update-syntaxification (point) (point)) | ||
| 2373 | (save-excursion | 2394 | (save-excursion |
| 2374 | (if (or | 2395 | (if (or |
| 2375 | (and (memq (get-text-property (point) 'syntax-type) | 2396 | (and (memq (get-text-property (point) 'syntax-type) |
| @@ -2467,7 +2488,8 @@ and closing parentheses and brackets." | |||
| 2467 | (progn | 2488 | (progn |
| 2468 | (forward-sexp -1) | 2489 | (forward-sexp -1) |
| 2469 | (skip-chars-backward " \t") | 2490 | (skip-chars-backward " \t") |
| 2470 | (looking-at "[ \t]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:")))) | 2491 | (looking-at "[ \t]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:"))) |
| 2492 | (get-text-property (point) 'first-format-line)) | ||
| 2471 | (progn | 2493 | (progn |
| 2472 | (if (and parse-data | 2494 | (if (and parse-data |
| 2473 | (not (eq char-after ?\C-j))) | 2495 | (not (eq char-after ?\C-j))) |
| @@ -2545,7 +2567,8 @@ and closing parentheses and brackets." | |||
| 2545 | (append (if is-block " ;{" " ,;{") '(nil))) | 2567 | (append (if is-block " ;{" " ,;{") '(nil))) |
| 2546 | (and (eq (preceding-char) ?\}) | 2568 | (and (eq (preceding-char) ?\}) |
| 2547 | (cperl-after-block-and-statement-beg | 2569 | (cperl-after-block-and-statement-beg |
| 2548 | containing-sexp)))) | 2570 | containing-sexp)) |
| 2571 | (get-text-property (point) 'first-format-line))) | ||
| 2549 | ;; This line is continuation of preceding line's statement; | 2572 | ;; This line is continuation of preceding line's statement; |
| 2550 | ;; indent `cperl-continued-statement-offset' more than the | 2573 | ;; indent `cperl-continued-statement-offset' more than the |
| 2551 | ;; previous line of the statement. | 2574 | ;; previous line of the statement. |
| @@ -2586,11 +2609,16 @@ and closing parentheses and brackets." | |||
| 2586 | (forward-char 1) | 2609 | (forward-char 1) |
| 2587 | (setq old-indent (current-indentation)) | 2610 | (setq old-indent (current-indentation)) |
| 2588 | (let ((colon-line-end 0)) | 2611 | (let ((colon-line-end 0)) |
| 2589 | (while (progn (skip-chars-forward " \t\n") | 2612 | (while |
| 2590 | (looking-at "#\\|[a-zA-Z0-9_$]*:[^:]")) | 2613 | (progn (skip-chars-forward " \t\n") |
| 2614 | (looking-at "#\\|[a-zA-Z0-9_$]*:[^:]\\|=[a-zA-Z]")) | ||
| 2591 | ;; Skip over comments and labels following openbrace. | 2615 | ;; Skip over comments and labels following openbrace. |
| 2592 | (cond ((= (following-char) ?\#) | 2616 | (cond ((= (following-char) ?\#) |
| 2593 | (forward-line 1)) | 2617 | (forward-line 1)) |
| 2618 | ((= (following-char) ?\=) | ||
| 2619 | (goto-char | ||
| 2620 | (or (next-single-property-change (point) 'in-pod) | ||
| 2621 | (point-max)))) ; do not loop if no syntaxification | ||
| 2594 | ;; label: | 2622 | ;; label: |
| 2595 | (t | 2623 | (t |
| 2596 | (save-excursion (end-of-line) | 2624 | (save-excursion (end-of-line) |
| @@ -3050,7 +3078,8 @@ Returns true if comment is found." | |||
| 3050 | ;; The body is marked `syntax-type' ==> `here-doc' | 3078 | ;; The body is marked `syntax-type' ==> `here-doc' |
| 3051 | ;; The delimiter is marked `syntax-type' ==> `here-doc-delim' | 3079 | ;; The delimiter is marked `syntax-type' ==> `here-doc-delim' |
| 3052 | ;; c) FORMATs: | 3080 | ;; c) FORMATs: |
| 3053 | ;; After-initial-line--to-end is marked `syntax-type' ==> `format' | 3081 | ;; First line (to =) marked `first-format-line' ==> t |
| 3082 | ;; After-this--to-end is marked `syntax-type' ==> `format' | ||
| 3054 | ;; d) 'Q'uoted string: | 3083 | ;; d) 'Q'uoted string: |
| 3055 | ;; part between markers inclusive is marked `syntax-type' ==> `string' | 3084 | ;; part between markers inclusive is marked `syntax-type' ==> `string' |
| 3056 | ;; part between `q' and the first marker is marked `syntax-type' ==> `prestring' | 3085 | ;; part between `q' and the first marker is marked `syntax-type' ==> `prestring' |
| @@ -3147,7 +3176,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3147 | "\\([^\"'`\n]*\\)" ; 3 + 1 | 3176 | "\\([^\"'`\n]*\\)" ; 3 + 1 |
| 3148 | "\\3" | 3177 | "\\3" |
| 3149 | "\\|" | 3178 | "\\|" |
| 3150 | ;; Second variant: Identifier or \ID or empty | 3179 | ;; Second variant: Identifier or \ID (same as 'ID') or empty |
| 3151 | "\\\\?\\(\\([a-zA-Z_][a-zA-Z_0-9]*\\)?\\)" ; 4 + 1, 5 + 1 | 3180 | "\\\\?\\(\\([a-zA-Z_][a-zA-Z_0-9]*\\)?\\)" ; 4 + 1, 5 + 1 |
| 3152 | ;; Do not have <<= or << 30 or <<30 or << $blah. | 3181 | ;; Do not have <<= or << 30 or <<30 or << $blah. |
| 3153 | ;; "\\([^= \t0-9$@%&]\\|[ \t]+[^ \t\n0-9$@%&]\\)" ; 6 + 1 | 3182 | ;; "\\([^= \t0-9$@%&]\\|[ \t]+[^ \t\n0-9$@%&]\\)" ; 6 + 1 |
| @@ -3178,7 +3207,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3178 | "__\\(END\\|DATA\\)__" | 3207 | "__\\(END\\|DATA\\)__" |
| 3179 | ;; 1+6+2+1+1+2+1+1+1=16 extra () before this: | 3208 | ;; 1+6+2+1+1+2+1+1+1=16 extra () before this: |
| 3180 | "\\|" | 3209 | "\\|" |
| 3181 | "\\\\\\(['`\"]\\)") | 3210 | "\\\\\\(['`\"($]\\)") |
| 3182 | "")))) | 3211 | "")))) |
| 3183 | (unwind-protect | 3212 | (unwind-protect |
| 3184 | (progn | 3213 | (progn |
| @@ -3195,6 +3224,8 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3195 | cperl-postpone t | 3224 | cperl-postpone t |
| 3196 | syntax-subtype t | 3225 | syntax-subtype t |
| 3197 | rear-nonsticky t | 3226 | rear-nonsticky t |
| 3227 | here-doc-group t | ||
| 3228 | first-format-line t | ||
| 3198 | indentable t)) | 3229 | indentable t)) |
| 3199 | ;; Need to remove face as well... | 3230 | ;; Need to remove face as well... |
| 3200 | (goto-char min) | 3231 | (goto-char min) |
| @@ -3239,7 +3270,9 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3239 | max e '(syntax-type t in-pod t syntax-table t | 3270 | max e '(syntax-type t in-pod t syntax-table t |
| 3240 | cperl-postpone t | 3271 | cperl-postpone t |
| 3241 | syntax-subtype t | 3272 | syntax-subtype t |
| 3273 | here-doc-group t | ||
| 3242 | rear-nonsticky t | 3274 | rear-nonsticky t |
| 3275 | first-format-line t | ||
| 3243 | indentable t)) | 3276 | indentable t)) |
| 3244 | (setq tmpend tb))) | 3277 | (setq tmpend tb))) |
| 3245 | (put-text-property b e 'in-pod t) | 3278 | (put-text-property b e 'in-pod t) |
| @@ -3287,6 +3320,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3287 | ;;"<<" | 3320 | ;;"<<" |
| 3288 | ;; "\\(" ; 1 + 1 | 3321 | ;; "\\(" ; 1 + 1 |
| 3289 | ;; ;; First variant "BLAH" or just ``. | 3322 | ;; ;; First variant "BLAH" or just ``. |
| 3323 | ;; "[ \t]*" ; Yes, whitespace is allowed! | ||
| 3290 | ;; "\\([\"'`]\\)" ; 2 + 1 | 3324 | ;; "\\([\"'`]\\)" ; 2 + 1 |
| 3291 | ;; "\\([^\"'`\n]*\\)" ; 3 + 1 | 3325 | ;; "\\([^\"'`\n]*\\)" ; 3 + 1 |
| 3292 | ;; "\\3" | 3326 | ;; "\\3" |
| @@ -3328,30 +3362,34 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3328 | (setq b (point)) | 3362 | (setq b (point)) |
| 3329 | ;; We do not search to max, since we may be called from | 3363 | ;; We do not search to max, since we may be called from |
| 3330 | ;; some hook of fontification, and max is random | 3364 | ;; some hook of fontification, and max is random |
| 3331 | (cond ((re-search-forward (concat "^" qtag "$") | 3365 | (or (and (re-search-forward (concat "^" qtag "$") |
| 3332 | stop-point 'toend) | 3366 | stop-point 'toend) |
| 3333 | (if cperl-pod-here-fontify | 3367 | (eq (following-char) ?\n)) |
| 3334 | (progn | 3368 | (progn ; Pretend we matched at the end |
| 3335 | ;; Highlight the ending delimiter | 3369 | (goto-char (point-max)) |
| 3336 | (cperl-postpone-fontification (match-beginning 0) (match-end 0) | 3370 | (re-search-forward "\\'") |
| 3337 | 'face font-lock-constant-face) | 3371 | (message "End of here-document `%s' not found." tag) |
| 3338 | (cperl-put-do-not-fontify b (match-end 0) t) | 3372 | (or (car err-l) (setcar err-l b)))) |
| 3339 | ;; Highlight the HERE-DOC | 3373 | (if cperl-pod-here-fontify |
| 3340 | (cperl-postpone-fontification b (match-beginning 0) | 3374 | (progn |
| 3341 | 'face here-face))) | 3375 | ;; Highlight the ending delimiter |
| 3342 | (setq e1 (cperl-1+ (match-end 0))) | 3376 | (cperl-postpone-fontification (match-beginning 0) (match-end 0) |
| 3343 | (put-text-property b (match-beginning 0) | 3377 | 'face font-lock-constant-face) |
| 3344 | 'syntax-type 'here-doc) | 3378 | (cperl-put-do-not-fontify b (match-end 0) t) |
| 3345 | (put-text-property (match-beginning 0) e1 | 3379 | ;; Highlight the HERE-DOC |
| 3346 | 'syntax-type 'here-doc-delim) | 3380 | (cperl-postpone-fontification b (match-beginning 0) |
| 3347 | (put-text-property b e1 | 3381 | 'face here-face))) |
| 3348 | 'here-doc-group t) | 3382 | (setq e1 (cperl-1+ (match-end 0))) |
| 3349 | (cperl-commentify b e1 nil) | 3383 | (put-text-property b (match-beginning 0) |
| 3350 | (cperl-put-do-not-fontify b (match-end 0) t) | 3384 | 'syntax-type 'here-doc) |
| 3351 | (if (> e1 max) | 3385 | (put-text-property (match-beginning 0) e1 |
| 3352 | (setq tmpend tb))) | 3386 | 'syntax-type 'here-doc-delim) |
| 3353 | (t (message "End of here-document `%s' not found." tag) | 3387 | (put-text-property b e1 |
| 3354 | (or (car err-l) (setcar err-l b)))))) | 3388 | 'here-doc-group t) |
| 3389 | (cperl-commentify b e1 nil) | ||
| 3390 | (cperl-put-do-not-fontify b (match-end 0) t) | ||
| 3391 | (if (> e1 max) | ||
| 3392 | (setq tmpend tb)))) | ||
| 3355 | ;; format | 3393 | ;; format |
| 3356 | ((match-beginning 8) | 3394 | ((match-beginning 8) |
| 3357 | ;; 1+6=7 extra () before this: | 3395 | ;; 1+6=7 extra () before this: |
| @@ -3363,6 +3401,10 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3363 | "") | 3401 | "") |
| 3364 | tb (match-beginning 0)) | 3402 | tb (match-beginning 0)) |
| 3365 | (setq argument nil) | 3403 | (setq argument nil) |
| 3404 | (put-text-property (save-excursion | ||
| 3405 | (beginning-of-line) | ||
| 3406 | (point)) | ||
| 3407 | b 'first-format-line 't) | ||
| 3366 | (if cperl-pod-here-fontify | 3408 | (if cperl-pod-here-fontify |
| 3367 | (while (and (eq (forward-line) 0) | 3409 | (while (and (eq (forward-line) 0) |
| 3368 | (not (looking-at "^[.;]$"))) | 3410 | (not (looking-at "^[.;]$"))) |
| @@ -3415,13 +3457,21 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3415 | bb (char-after (1- (match-beginning b1))) ; tmp holder | 3457 | bb (char-after (1- (match-beginning b1))) ; tmp holder |
| 3416 | ;; bb == "Not a stringy" | 3458 | ;; bb == "Not a stringy" |
| 3417 | bb (if (eq b1 10) ; user variables/whatever | 3459 | bb (if (eq b1 10) ; user variables/whatever |
| 3418 | (or | 3460 | (and (memq bb (append "$@%*#_:-&>" nil)) ; $#y) |
| 3419 | (memq bb '(?\$ ?\@ ?\% ?\* ?\#)) ; $#y | 3461 | (cond ((eq bb ?-) (eq c ?s)) ; -s file test |
| 3420 | (and (eq bb ?-) (eq c ?s)) ; -s file test | 3462 | ((eq bb ?\:) ; $opt::s |
| 3421 | (and (eq bb ?\&) | 3463 | (eq (char-after |
| 3422 | (not (eq (char-after ; &&m/blah/ | 3464 | (- (match-beginning b1) 2)) |
| 3423 | (- (match-beginning b1) 2)) | 3465 | ?\:)) |
| 3424 | ?\&)))) | 3466 | ((eq bb ?\>) ; $foo->s |
| 3467 | (eq (char-after | ||
| 3468 | (- (match-beginning b1) 2)) | ||
| 3469 | ?\-)) | ||
| 3470 | ((eq bb ?\&) | ||
| 3471 | (not (eq (char-after ; &&m/blah/ | ||
| 3472 | (- (match-beginning b1) 2)) | ||
| 3473 | ?\&))) | ||
| 3474 | (t t))) | ||
| 3425 | ;; <file> or <$file> | 3475 | ;; <file> or <$file> |
| 3426 | (and (eq c ?\<) | 3476 | (and (eq c ?\<) |
| 3427 | ;; Do not stringify <FH>, <$fh> : | 3477 | ;; Do not stringify <FH>, <$fh> : |
| @@ -3434,6 +3484,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3434 | (or bb | 3484 | (or bb |
| 3435 | (if (eq b1 11) ; bare /blah/ or ?blah? or <foo> | 3485 | (if (eq b1 11) ; bare /blah/ or ?blah? or <foo> |
| 3436 | (setq argument "" | 3486 | (setq argument "" |
| 3487 | b1 nil | ||
| 3437 | bb ; Not a regexp? | 3488 | bb ; Not a regexp? |
| 3438 | (progn | 3489 | (progn |
| 3439 | (not | 3490 | (not |
| @@ -3472,16 +3523,58 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3472 | (looking-at "\\s|"))))))) | 3523 | (looking-at "\\s|"))))))) |
| 3473 | b (1- b)) | 3524 | b (1- b)) |
| 3474 | ;; s y tr m | 3525 | ;; s y tr m |
| 3475 | ;; Check for $a->y | 3526 | ;; Check for $a -> y |
| 3476 | (if (and (eq (preceding-char) ?>) | 3527 | (setq b1 (preceding-char) |
| 3477 | (eq (char-after (- (point) 2)) ?-)) | 3528 | go (point)) |
| 3529 | (if (and (eq b1 ?>) | ||
| 3530 | (eq (char-after (- go 2)) ?-)) | ||
| 3478 | ;; Not a regexp | 3531 | ;; Not a regexp |
| 3479 | (setq bb t)))) | 3532 | (setq bb t)))) |
| 3480 | (or bb (setq state (parse-partial-sexp | 3533 | (or bb (setq state (parse-partial-sexp |
| 3481 | state-point b nil nil state) | 3534 | state-point b nil nil state) |
| 3482 | state-point b)) | 3535 | state-point b)) |
| 3536 | (setq bb (or bb (nth 3 state) (nth 4 state))) | ||
| 3483 | (goto-char b) | 3537 | (goto-char b) |
| 3484 | (if (or bb (nth 3 state) (nth 4 state)) | 3538 | (or bb |
| 3539 | (progn | ||
| 3540 | (if (looking-at "[ \t\n\f]+\\(#[^\n]*\n[ \t\n\f]*\\)+") | ||
| 3541 | (goto-char (match-end 0)) | ||
| 3542 | (skip-chars-forward " \t\n\f")) | ||
| 3543 | (cond ((and (eq (following-char) ?\}) | ||
| 3544 | (eq b1 ?\{)) | ||
| 3545 | ;; Check for $a[23]->{ s }, @{s} and *{s::foo} | ||
| 3546 | (goto-char (1- go)) | ||
| 3547 | (skip-chars-backward " \t\n\f") | ||
| 3548 | (if (memq (preceding-char) (append "$@%&*" nil)) | ||
| 3549 | (setq bb t) ; @{y} | ||
| 3550 | (condition-case nil | ||
| 3551 | (forward-sexp -1) | ||
| 3552 | (error nil))) | ||
| 3553 | (if (or bb | ||
| 3554 | (looking-at ; $foo -> {s} | ||
| 3555 | "[$@]\\$*\\([a-zA-Z0-9_:]+\\|[^{]\\)\\([ \t\n]*->\\)?[ \t\n]*{") | ||
| 3556 | (and ; $foo[12] -> {s} | ||
| 3557 | (memq (following-char) '(?\{ ?\[)) | ||
| 3558 | (progn | ||
| 3559 | (forward-sexp 1) | ||
| 3560 | (looking-at "\\([ \t\n]*->\\)?[ \t\n]*{")))) | ||
| 3561 | (setq bb t) | ||
| 3562 | (goto-char b))) | ||
| 3563 | ((and (eq (following-char) ?=) | ||
| 3564 | (eq (char-after (1+ (point))) ?\>)) | ||
| 3565 | ;; Check for { foo => 1, s => 2 } | ||
| 3566 | ;; Apparently s=> is never a substitution... | ||
| 3567 | (setq bb t)) | ||
| 3568 | ((and (eq (following-char) ?:) | ||
| 3569 | (eq b1 ?\{) ; Check for $ { s::bar } | ||
| 3570 | (looking-at "::[a-zA-Z0-9_:]*[ \t\n\f]*}") | ||
| 3571 | (progn | ||
| 3572 | (goto-char (1- go)) | ||
| 3573 | (skip-chars-backward " \t\n\f") | ||
| 3574 | (memq (preceding-char) | ||
| 3575 | (append "$@%&*" nil)))) | ||
| 3576 | (setq bb t))))) | ||
| 3577 | (if bb | ||
| 3485 | (goto-char i) | 3578 | (goto-char i) |
| 3486 | ;; Skip whitespace and comments... | 3579 | ;; Skip whitespace and comments... |
| 3487 | (if (looking-at "[ \t\n\f]+\\(#[^\n]*\n[ \t\n\f]*\\)+") | 3580 | (if (looking-at "[ \t\n\f]+\\(#[^\n]*\n[ \t\n\f]*\\)+") |
| @@ -3703,7 +3796,8 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3703 | (cperl-commentify b bb nil) | 3796 | (cperl-commentify b bb nil) |
| 3704 | (setq end t)) | 3797 | (setq end t)) |
| 3705 | (goto-char bb)) | 3798 | (goto-char bb)) |
| 3706 | ((match-beginning 17) ; "\\\\\\(['`\"]\\)" | 3799 | ((match-beginning 17) ; "\\\\\\(['`\"($]\\)" |
| 3800 | ;; Trailing backslash ==> non-quoting outside string/comment | ||
| 3707 | (setq bb (match-end 0) | 3801 | (setq bb (match-end 0) |
| 3708 | b (match-beginning 0)) | 3802 | b (match-beginning 0)) |
| 3709 | (goto-char b) | 3803 | (goto-char b) |
| @@ -3752,19 +3846,22 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', | |||
| 3752 | (if (< p (point)) (goto-char p)) | 3846 | (if (< p (point)) (goto-char p)) |
| 3753 | (setq stop t))))))) | 3847 | (setq stop t))))))) |
| 3754 | 3848 | ||
| 3755 | (defun cperl-after-block-p (lim) | 3849 | (defun cperl-after-block-p (lim &optional pre-block) |
| 3850 | "Return true if the preceeding } ends a block or a following { starts one. | ||
| 3851 | Would not look before LIM. If PRE-BLOCK is nil checks preceeding }. | ||
| 3852 | otherwise following {." | ||
| 3756 | ;; We suppose that the preceding char is }. | 3853 | ;; We suppose that the preceding char is }. |
| 3757 | (save-excursion | 3854 | (save-excursion |
| 3758 | (condition-case nil | 3855 | (condition-case nil |
| 3759 | (progn | 3856 | (progn |
| 3760 | (forward-sexp -1) | 3857 | (or pre-block (forward-sexp -1)) |
| 3761 | (cperl-backward-to-noncomment lim) | 3858 | (cperl-backward-to-noncomment lim) |
| 3762 | (or (eq (point) lim) | 3859 | (or (eq (point) lim) |
| 3763 | (eq (preceding-char) ?\) ) ; if () {} sub f () {} | 3860 | (eq (preceding-char) ?\) ) ; if () {} sub f () {} |
| 3764 | (if (eq (char-syntax (preceding-char)) ?w) ; else {} | 3861 | (if (eq (char-syntax (preceding-char)) ?w) ; else {} |
| 3765 | (save-excursion | 3862 | (save-excursion |
| 3766 | (forward-sexp -1) | 3863 | (forward-sexp -1) |
| 3767 | (or (looking-at "\\(else\\|grep\\|map\\|BEGIN\\|END\\|CHECK\\|INIT\\)\\>") | 3864 | (or (looking-at "\\(else\\|continue\\|grep\\|map\\|BEGIN\\|END\\|CHECK\\|INIT\\)\\>") |
| 3768 | ;; sub f {} | 3865 | ;; sub f {} |
| 3769 | (progn | 3866 | (progn |
| 3770 | (cperl-backward-to-noncomment lim) | 3867 | (cperl-backward-to-noncomment lim) |
| @@ -3781,15 +3878,28 @@ TEST is the expression to evaluate at the found position. If absent, | |||
| 3781 | CHARS is a string that contains good characters to have before us (however, | 3878 | CHARS is a string that contains good characters to have before us (however, |
| 3782 | `}' is treated \"smartly\" if it is not in the list)." | 3879 | `}' is treated \"smartly\" if it is not in the list)." |
| 3783 | (let ((lim (or lim (point-min))) | 3880 | (let ((lim (or lim (point-min))) |
| 3784 | stop p) | 3881 | stop p pr) |
| 3882 | (cperl-update-syntaxification (point) (point)) | ||
| 3785 | (save-excursion | 3883 | (save-excursion |
| 3786 | (while (and (not stop) (> (point) lim)) | 3884 | (while (and (not stop) (> (point) lim)) |
| 3787 | (skip-chars-backward " \t\n\f" lim) | 3885 | (skip-chars-backward " \t\n\f" lim) |
| 3788 | (setq p (point)) | 3886 | (setq p (point)) |
| 3789 | (beginning-of-line) | 3887 | (beginning-of-line) |
| 3888 | ;;(memq (setq pr (get-text-property (point) 'syntax-type)) | ||
| 3889 | ;; '(pod here-doc here-doc-delim)) | ||
| 3890 | (if (get-text-property (point) 'here-doc-group) | ||
| 3891 | (progn | ||
| 3892 | (goto-char | ||
| 3893 | (previous-single-property-change (point) 'here-doc-group)) | ||
| 3894 | (beginning-of-line 0))) | ||
| 3895 | (if (get-text-property (point) 'in-pod) | ||
| 3896 | (progn | ||
| 3897 | (goto-char | ||
| 3898 | (previous-single-property-change (point) 'in-pod)) | ||
| 3899 | (beginning-of-line 0))) | ||
| 3790 | (if (looking-at "^[ \t]*\\(#\\|$\\)") nil ; Only comment, skip | 3900 | (if (looking-at "^[ \t]*\\(#\\|$\\)") nil ; Only comment, skip |
| 3791 | ;; Else: last iteration, or a label | 3901 | ;; Else: last iteration, or a label |
| 3792 | (cperl-to-comment-or-eol) | 3902 | (cperl-to-comment-or-eol) ; Will not move past "." after a format |
| 3793 | (skip-chars-backward " \t") | 3903 | (skip-chars-backward " \t") |
| 3794 | (if (< p (point)) (goto-char p)) | 3904 | (if (< p (point)) (goto-char p)) |
| 3795 | (setq p (point)) | 3905 | (setq p (point)) |
| @@ -3808,7 +3918,10 @@ CHARS is a string that contains good characters to have before us (however, | |||
| 3808 | (if test (eval test) | 3918 | (if test (eval test) |
| 3809 | (or (memq (preceding-char) (append (or chars "{;") nil)) | 3919 | (or (memq (preceding-char) (append (or chars "{;") nil)) |
| 3810 | (and (eq (preceding-char) ?\}) | 3920 | (and (eq (preceding-char) ?\}) |
| 3811 | (cperl-after-block-p lim))))))))) | 3921 | (cperl-after-block-p lim)) |
| 3922 | (and (eq (following-char) ?.) ; in format: see comment above | ||
| 3923 | (eq (get-text-property (point) 'syntax-type) | ||
| 3924 | 'format))))))))) | ||
| 3812 | 3925 | ||
| 3813 | (defun cperl-backward-to-start-of-continued-exp (lim) | 3926 | (defun cperl-backward-to-start-of-continued-exp (lim) |
| 3814 | (if (memq (preceding-char) (append ")]}\"'`" nil)) | 3927 | (if (memq (preceding-char) (append ")]}\"'`" nil)) |
| @@ -3931,7 +4044,7 @@ Returns some position at the last line." | |||
| 3931 | (if (looking-at | 4044 | (if (looking-at |
| 3932 | "[ \t]*\\<for\\(each\\)?[ \t]+\\(my\\|local\\|our\\)[ \t]*\\$[_a-zA-Z0-9]+\\(\t*\\|[ \t][ \t]+\\)[^ \t\n#]") | 4045 | "[ \t]*\\<for\\(each\\)?[ \t]+\\(my\\|local\\|our\\)[ \t]*\\$[_a-zA-Z0-9]+\\(\t*\\|[ \t][ \t]+\\)[^ \t\n#]") |
| 3933 | (progn | 4046 | (progn |
| 3934 | (forward-word 3) | 4047 | (forward-sexp 3) |
| 3935 | (delete-horizontal-space) | 4048 | (delete-horizontal-space) |
| 3936 | (insert | 4049 | (insert |
| 3937 | (make-string cperl-indent-region-fix-constructs ?\ )) | 4050 | (make-string cperl-indent-region-fix-constructs ?\ )) |
| @@ -5394,13 +5507,13 @@ in subdirectories too." | |||
| 5394 | (if (cperl-val 'cperl-electric-parens) "" "not "))) | 5507 | (if (cperl-val 'cperl-electric-parens) "" "not "))) |
| 5395 | 5508 | ||
| 5396 | (defun cperl-toggle-autohelp () | 5509 | (defun cperl-toggle-autohelp () |
| 5397 | "Toggle the state of automatic help message in CPerl mode. | 5510 | "Toggle the state of Auto-Help on Perl constructs (put in the message area). |
| 5398 | See `cperl-lazy-help-time' too." | 5511 | Delay of auto-help controlled by `cperl-lazy-help-time'." |
| 5399 | (interactive) | 5512 | (interactive) |
| 5400 | (if (fboundp 'run-with-idle-timer) | 5513 | (if (fboundp 'run-with-idle-timer) |
| 5401 | (progn | 5514 | (progn |
| 5402 | (if cperl-lazy-installed | 5515 | (if cperl-lazy-installed |
| 5403 | (eval '(cperl-lazy-unstall)) | 5516 | (cperl-lazy-unstall) |
| 5404 | (cperl-lazy-install)) | 5517 | (cperl-lazy-install)) |
| 5405 | (message "Perl help messages will %sbe automatically shown now." | 5518 | (message "Perl help messages will %sbe automatically shown now." |
| 5406 | (if cperl-lazy-installed "" "not "))) | 5519 | (if cperl-lazy-installed "" "not "))) |
| @@ -6131,12 +6244,13 @@ than a line. Your contribution to update/shorten it is appreciated." | |||
| 6131 | (defvar cperl-short-docs 'please-ignore-this-line | 6244 | (defvar cperl-short-docs 'please-ignore-this-line |
| 6132 | ;; Perl4 version was written by Johan Vromans (jvromans@squirrel.nl) | 6245 | ;; Perl4 version was written by Johan Vromans (jvromans@squirrel.nl) |
| 6133 | "# based on '@(#)@ perl-descr.el 1.9 - describe-perl-symbol' [Perl 5] | 6246 | "# based on '@(#)@ perl-descr.el 1.9 - describe-perl-symbol' [Perl 5] |
| 6247 | ... Range (list context); flip/flop [no flop when flip] (scalar context). | ||
| 6134 | ! ... Logical negation. | 6248 | ! ... Logical negation. |
| 6135 | ... != ... Numeric inequality. | 6249 | ... != ... Numeric inequality. |
| 6136 | ... !~ ... Search pattern, substitution, or translation (negated). | 6250 | ... !~ ... Search pattern, substitution, or translation (negated). |
| 6137 | $! In numeric context: errno. In a string context: error string. | 6251 | $! In numeric context: errno. In a string context: error string. |
| 6138 | $\" The separator which joins elements of arrays interpolated in strings. | 6252 | $\" The separator which joins elements of arrays interpolated in strings. |
| 6139 | $# The output format for printed numbers. Initial value is %.15g or close. | 6253 | $# The output format for printed numbers. Default is %.15g or close. |
| 6140 | $$ Process number of this script. Changes in the fork()ed child process. | 6254 | $$ Process number of this script. Changes in the fork()ed child process. |
| 6141 | $% The current page number of the currently selected output channel. | 6255 | $% The current page number of the currently selected output channel. |
| 6142 | 6256 | ||
| @@ -6163,7 +6277,7 @@ $, The output field separator for the print operator. | |||
| 6163 | $- The number of lines left on the page. | 6277 | $- The number of lines left on the page. |
| 6164 | $. The current input line number of the last filehandle that was read. | 6278 | $. The current input line number of the last filehandle that was read. |
| 6165 | $/ The input record separator, newline by default. | 6279 | $/ The input record separator, newline by default. |
| 6166 | $0 Name of the file containing the perl script being executed. May be set. | 6280 | $0 Name of the file containing the current perl script (read/write). |
| 6167 | $: String may be broken after these characters to fill ^-lines in a format. | 6281 | $: String may be broken after these characters to fill ^-lines in a format. |
| 6168 | $; Subscript separator for multi-dim array emulation. Default \"\\034\". | 6282 | $; Subscript separator for multi-dim array emulation. Default \"\\034\". |
| 6169 | $< The real uid of this process. | 6283 | $< The real uid of this process. |
| @@ -6240,12 +6354,12 @@ $~ The name of the current report format. | |||
| 6240 | -x File is executable by effective uid. | 6354 | -x File is executable by effective uid. |
| 6241 | -z File has zero size. | 6355 | -z File has zero size. |
| 6242 | . Concatenate strings. | 6356 | . Concatenate strings. |
| 6243 | .. Alternation, also range operator. | 6357 | .. Range (list context); flip/flop (scalar context) operator. |
| 6244 | .= Concatenate assignment strings | 6358 | .= Concatenate assignment strings |
| 6245 | ... / ... Division. /PATTERN/ioxsmg Pattern match | 6359 | ... / ... Division. /PATTERN/ioxsmg Pattern match |
| 6246 | ... /= ... Division assignment. | 6360 | ... /= ... Division assignment. |
| 6247 | /PATTERN/ioxsmg Pattern match. | 6361 | /PATTERN/ioxsmg Pattern match. |
| 6248 | ... < ... Numeric less than. <pattern> Glob. See <NAME>, <> as well. | 6362 | ... < ... Numeric less than. <pattern> Glob. See <NAME>, <> as well. |
| 6249 | <NAME> Reads line from filehandle NAME (a bareword or dollar-bareword). | 6363 | <NAME> Reads line from filehandle NAME (a bareword or dollar-bareword). |
| 6250 | <pattern> Glob (Unless pattern is bareword/dollar-bareword - see <NAME>). | 6364 | <pattern> Glob (Unless pattern is bareword/dollar-bareword - see <NAME>). |
| 6251 | <> Reads line from union of files in @ARGV (= command line) and STDIN. | 6365 | <> Reads line from union of files in @ARGV (= command line) and STDIN. |
| @@ -6263,7 +6377,7 @@ $~ The name of the current report format. | |||
| 6263 | ?PATTERN? One-time pattern match. | 6377 | ?PATTERN? One-time pattern match. |
| 6264 | @ARGV Command line arguments (not including the command name - see $0). | 6378 | @ARGV Command line arguments (not including the command name - see $0). |
| 6265 | @INC List of places to look for perl scripts during do/include/use. | 6379 | @INC List of places to look for perl scripts during do/include/use. |
| 6266 | @_ Parameter array for subroutines. Also used by split unless in array context. | 6380 | @_ Parameter array for subroutines; result of split() unless in list context. |
| 6267 | \\ Creates reference to what follows, like \$var, or quotes non-\w in strings. | 6381 | \\ Creates reference to what follows, like \$var, or quotes non-\w in strings. |
| 6268 | \\0 Octal char, e.g. \\033. | 6382 | \\0 Octal char, e.g. \\033. |
| 6269 | \\E Case modification terminator. See \\Q, \\L, and \\U. | 6383 | \\E Case modification terminator. See \\Q, \\L, and \\U. |
| @@ -6969,14 +7083,21 @@ We suppose that the regexp is scanned already." | |||
| 6969 | default-entry) | 7083 | default-entry) |
| 6970 | input)))) | 7084 | input)))) |
| 6971 | (require 'man) | 7085 | (require 'man) |
| 6972 | (let* ((is-func (and | 7086 | (let* ((case-fold-search nil) |
| 7087 | (is-func (and | ||
| 6973 | (string-match "^[a-z]+$" word) | 7088 | (string-match "^[a-z]+$" word) |
| 6974 | (string-match (concat "^" word "\\>") | 7089 | (string-match (concat "^" word "\\>") |
| 6975 | (documentation-property | 7090 | (documentation-property |
| 6976 | 'cperl-short-docs | 7091 | 'cperl-short-docs |
| 6977 | 'variable-documentation)))) | 7092 | 'variable-documentation)))) |
| 6978 | (manual-program (if is-func "perldoc -f" "perldoc"))) | 7093 | (manual-program (if is-func "perldoc -f" "perldoc"))) |
| 6979 | (Man-getpage-in-background word))) | 7094 | (cond |
| 7095 | (cperl-xemacs-p | ||
| 7096 | (let ((Manual-program "perldoc") | ||
| 7097 | (Manual-switches (if is-func (list "-f")))) | ||
| 7098 | (manual-entry word))) | ||
| 7099 | (t | ||
| 7100 | (Man-getpage-in-background word))))) | ||
| 6980 | 7101 | ||
| 6981 | (defun cperl-perldoc-at-point () | 7102 | (defun cperl-perldoc-at-point () |
| 6982 | "Run a `perldoc' on the word around point." | 7103 | "Run a `perldoc' on the word around point." |
| @@ -7006,6 +7127,19 @@ We suppose that the regexp is scanned already." | |||
| 7006 | (format (cperl-pod2man-build-command) pod2man-args)) | 7127 | (format (cperl-pod2man-build-command) pod2man-args)) |
| 7007 | 'Man-bgproc-sentinel))))) | 7128 | 'Man-bgproc-sentinel))))) |
| 7008 | 7129 | ||
| 7130 | ;;; Updated version by him too | ||
| 7131 | (defun cperl-build-manpage () | ||
| 7132 | "Create a virtual manpage in Emacs from the POD in the file." | ||
| 7133 | (interactive) | ||
| 7134 | (require 'man) | ||
| 7135 | (cond | ||
| 7136 | (cperl-xemacs-p | ||
| 7137 | (let ((Manual-program "perldoc")) | ||
| 7138 | (manual-entry buffer-file-name))) | ||
| 7139 | (t | ||
| 7140 | (let* ((manual-program "perldoc")) | ||
| 7141 | (Man-getpage-in-background buffer-file-name))))) | ||
| 7142 | |||
| 7009 | (defun cperl-pod2man-build-command () | 7143 | (defun cperl-pod2man-build-command () |
| 7010 | "Builds the entire background manpage and cleaning command." | 7144 | "Builds the entire background manpage and cleaning command." |
| 7011 | (let ((command (concat pod2man-program " %s 2>/dev/null")) | 7145 | (let ((command (concat pod2man-program " %s 2>/dev/null")) |
| @@ -7024,6 +7158,7 @@ We suppose that the regexp is scanned already." | |||
| 7024 | command)) | 7158 | command)) |
| 7025 | 7159 | ||
| 7026 | (defun cperl-lazy-install ()) ; Avoid a warning | 7160 | (defun cperl-lazy-install ()) ; Avoid a warning |
| 7161 | (defun cperl-lazy-unstall ()) ; Avoid a warning | ||
| 7027 | 7162 | ||
| 7028 | (if (fboundp 'run-with-idle-timer) | 7163 | (if (fboundp 'run-with-idle-timer) |
| 7029 | (progn | 7164 | (progn |
| @@ -7034,6 +7169,8 @@ We suppose that the regexp is scanned already." | |||
| 7034 | "Non-nil means that the lazy-help handlers are installed now.") | 7169 | "Non-nil means that the lazy-help handlers are installed now.") |
| 7035 | 7170 | ||
| 7036 | (defun cperl-lazy-install () | 7171 | (defun cperl-lazy-install () |
| 7172 | "Switches on Auto-Help on Perl constructs (put in the message area). | ||
| 7173 | Delay of auto-help controlled by `cperl-lazy-help-time'." | ||
| 7037 | (interactive) | 7174 | (interactive) |
| 7038 | (make-variable-buffer-local 'cperl-help-shown) | 7175 | (make-variable-buffer-local 'cperl-help-shown) |
| 7039 | (if (and (cperl-val 'cperl-lazy-help-time) | 7176 | (if (and (cperl-val 'cperl-lazy-help-time) |
| @@ -7047,6 +7184,8 @@ We suppose that the regexp is scanned already." | |||
| 7047 | (setq cperl-lazy-installed t)))) | 7184 | (setq cperl-lazy-installed t)))) |
| 7048 | 7185 | ||
| 7049 | (defun cperl-lazy-unstall () | 7186 | (defun cperl-lazy-unstall () |
| 7187 | "Switches off Auto-Help on Perl constructs (put in the message area). | ||
| 7188 | Delay of auto-help controlled by `cperl-lazy-help-time'." | ||
| 7050 | (interactive) | 7189 | (interactive) |
| 7051 | (remove-hook 'post-command-hook 'cperl-lazy-hook) | 7190 | (remove-hook 'post-command-hook 'cperl-lazy-hook) |
| 7052 | (cancel-function-timers 'cperl-get-help-defer) | 7191 | (cancel-function-timers 'cperl-get-help-defer) |
| @@ -7123,7 +7262,7 @@ We suppose that the regexp is scanned already." | |||
| 7123 | (cperl-fontify-syntaxically to))))) | 7262 | (cperl-fontify-syntaxically to))))) |
| 7124 | 7263 | ||
| 7125 | (defvar cperl-version | 7264 | (defvar cperl-version |
| 7126 | (let ((v "Revision: 4.35")) | 7265 | (let ((v "Revision: 5.0")) |
| 7127 | (string-match ":\\s *\\([0-9.]+\\)" v) | 7266 | (string-match ":\\s *\\([0-9.]+\\)" v) |
| 7128 | (substring v (match-beginning 1) (match-end 1))) | 7267 | (substring v (match-beginning 1) (match-end 1))) |
| 7129 | "Version of IZ-supported CPerl package this file is based on.") | 7268 | "Version of IZ-supported CPerl package this file is based on.") |