diff options
| author | Harald Jörg | 2024-07-29 21:24:14 +0200 |
|---|---|---|
| committer | Harald Jörg | 2024-07-29 21:30:55 +0200 |
| commit | cfadd047a27f5f7e96af3b3ff8947f32b048cb0c (patch) | |
| tree | 3dd56bf16e490c689791024555bfa0208877bd08 | |
| parent | 63e609f6aa1e058c709b84cf132fab7ce7ecb5ee (diff) | |
| download | emacs-cfadd047a27f5f7e96af3b3ff8947f32b048cb0c.tar.gz emacs-cfadd047a27f5f7e96af3b3ff8947f32b048cb0c.zip | |
; cperl-mode.el: Make it checkdoc clean
This commit does only docstrings, no functional changes at all.
* lisp/progmodes/cperl-mode.el: Docstrings are added where missing.
All parameters are documented. The first line is a complete sentence.
All docstring lines are 80 characters or less.
| -rw-r--r-- | lisp/progmodes/cperl-mode.el | 326 |
1 files changed, 226 insertions, 100 deletions
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 3353bffdf05..7b6381b02f6 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el | |||
| @@ -88,6 +88,9 @@ | |||
| 88 | (defvar vc-sccs-header) | 88 | (defvar vc-sccs-header) |
| 89 | 89 | ||
| 90 | (defun cperl-choose-color (&rest list) | 90 | (defun cperl-choose-color (&rest list) |
| 91 | "Old-fashioned way to set colors for syntax highlighting. | ||
| 92 | Affects faces specific to `cperl-mode` only. | ||
| 93 | Optional argument LIST defines the attribute list for the face." | ||
| 91 | (let (answer) | 94 | (let (answer) |
| 92 | (while list | 95 | (while list |
| 93 | (or answer | 96 | (or answer |
| @@ -139,8 +142,9 @@ indentation styles." | |||
| 139 | 142 | ||
| 140 | 143 | ||
| 141 | (defcustom cperl-extra-newline-before-brace nil | 144 | (defcustom cperl-extra-newline-before-brace nil |
| 142 | "Non-nil means that if, elsif, while, until, else, for, foreach | 145 | "Non-nil means that code blocks start on a new line. |
| 143 | and do constructs look like: | 146 | This affects if, elsif, while, until, else, for, foreach and do |
| 147 | constructs look like: | ||
| 144 | 148 | ||
| 145 | if () | 149 | if () |
| 146 | { | 150 | { |
| @@ -155,8 +159,9 @@ instead of: | |||
| 155 | 159 | ||
| 156 | (defcustom cperl-extra-newline-before-brace-multiline | 160 | (defcustom cperl-extra-newline-before-brace-multiline |
| 157 | cperl-extra-newline-before-brace | 161 | cperl-extra-newline-before-brace |
| 158 | "Non-nil means the same as `cperl-extra-newline-before-brace', but | 162 | "Non-nil means the same as `cperl-extra-newline-before-brace'. |
| 159 | for constructs with multiline if/unless/while/until/for/foreach condition." | 163 | It is effective for constructs with multiline |
| 164 | if/unless/while/until/for/foreach condition." | ||
| 160 | :type 'boolean | 165 | :type 'boolean |
| 161 | :group 'cperl-autoinsert-details) | 166 | :group 'cperl-autoinsert-details) |
| 162 | 167 | ||
| @@ -254,11 +259,11 @@ This applies to, for example, hash values." | |||
| 254 | :group 'cperl-indentation-details) | 259 | :group 'cperl-indentation-details) |
| 255 | 260 | ||
| 256 | (defcustom cperl-auto-newline nil | 261 | (defcustom cperl-auto-newline nil |
| 257 | "Non-nil means automatically newline before and after braces, | 262 | "Non-nil means automatically insert a newline between phrases. |
| 258 | and after colons and semicolons, inserted in CPerl code. The following | 263 | This happens before and after braces and after colons and semicolons, |
| 259 | \\[cperl-electric-backspace] will remove the inserted whitespace. | 264 | inserted in CPerl code. The following \\[cperl-electric-backspace] will |
| 260 | Insertion after colons requires both this variable and | 265 | remove the inserted whitespace. Insertion after colons requires both |
| 261 | `cperl-auto-newline-after-colon' set." | 266 | this variable and `cperl-auto-newline-after-colon' set." |
| 262 | :type 'boolean | 267 | :type 'boolean |
| 263 | :group 'cperl-autoinsert-details) | 268 | :group 'cperl-autoinsert-details) |
| 264 | 269 | ||
| @@ -275,8 +280,9 @@ Subject to `cperl-auto-newline' setting." | |||
| 275 | :group 'cperl-autoinsert-details) | 280 | :group 'cperl-autoinsert-details) |
| 276 | 281 | ||
| 277 | (defcustom cperl-tab-always-indent t | 282 | (defcustom cperl-tab-always-indent t |
| 278 | "Non-nil means TAB in CPerl mode should always reindent the current line, | 283 | "Non-nil means TAB in CPerl mode should always reindent the current line. |
| 279 | regardless of where in the line point is when the TAB command is used." | 284 | This does not depend on where in the line point is when the TAB command |
| 285 | is used." | ||
| 280 | :type 'boolean | 286 | :type 'boolean |
| 281 | :group 'cperl-indentation-details) | 287 | :group 'cperl-indentation-details) |
| 282 | 288 | ||
| @@ -311,7 +317,8 @@ Default is yes if there is visual feedback on mark." | |||
| 311 | :group 'cperl-autoinsert-details) | 317 | :group 'cperl-autoinsert-details) |
| 312 | 318 | ||
| 313 | (defcustom cperl-electric-linefeed nil | 319 | (defcustom cperl-electric-linefeed nil |
| 314 | "If true, LFD should be hairy in CPerl, otherwise C-c LFD is hairy. | 320 | "If true, LFD should be hairy in CPerl. |
| 321 | Otherwise, \\<cperl-mode-map>\\[newline-and-indent] is hairy. | ||
| 315 | In any case these two mean plain and hairy linefeeds together. | 322 | In any case these two mean plain and hairy linefeeds together. |
| 316 | Can be overwritten by `cperl-hairy' if nil." | 323 | Can be overwritten by `cperl-hairy' if nil." |
| 317 | :type '(choice (const null) boolean) | 324 | :type '(choice (const null) boolean) |
| @@ -366,7 +373,7 @@ Affects: `cperl-font-lock', `cperl-electric-lbrace-space', | |||
| 366 | 373 | ||
| 367 | (defcustom cperl-info-on-command-no-prompt nil | 374 | (defcustom cperl-info-on-command-no-prompt nil |
| 368 | "Not-nil (and non-null) means not to prompt on \\[cperl-info-on-command]. | 375 | "Not-nil (and non-null) means not to prompt on \\[cperl-info-on-command]. |
| 369 | The opposite behavior is always available if prefixed with C-c. | 376 | The opposite behavior is always available if prefixed with Control-c. |
| 370 | Can be overwritten by `cperl-hairy' if nil." | 377 | Can be overwritten by `cperl-hairy' if nil." |
| 371 | :type '(choice (const null) boolean) | 378 | :type '(choice (const null) boolean) |
| 372 | :group 'cperl-affected-by-hairy) | 379 | :group 'cperl-affected-by-hairy) |
| @@ -519,27 +526,29 @@ Values other than 1 and nil will probably not work." | |||
| 519 | :group 'cperl-indentation-details) | 526 | :group 'cperl-indentation-details) |
| 520 | 527 | ||
| 521 | (defcustom cperl-break-one-line-blocks-when-indent t | 528 | (defcustom cperl-break-one-line-blocks-when-indent t |
| 522 | "Non-nil means that one-line if/unless/while/until/for/foreach BLOCKs | 529 | "Non-nil means that one-line blocks are reformatted when indenting. |
| 523 | need to be reformatted into multiline ones when indenting a region." | 530 | Code blocks after if/unless/while/until/for/foreach need to be |
| 531 | reformatted into multiline ones when indenting a region." | ||
| 524 | :type 'boolean | 532 | :type 'boolean |
| 525 | :group 'cperl-indentation-details) | 533 | :group 'cperl-indentation-details) |
| 526 | 534 | ||
| 527 | (defcustom cperl-fix-hanging-brace-when-indent t | 535 | (defcustom cperl-fix-hanging-brace-when-indent t |
| 528 | "Non-nil means that BLOCK-end `}' may be put on a separate line | 536 | "Non-nil means that BLOCK-end `}' may be put on a separate line. |
| 529 | when indenting a region. | 537 | This happens when indenting a region. Braces followed by |
| 530 | Braces followed by else/elsif/while/until are excepted." | 538 | else/elsif/while/until are excepted." |
| 531 | :type 'boolean | 539 | :type 'boolean |
| 532 | :group 'cperl-indentation-details) | 540 | :group 'cperl-indentation-details) |
| 533 | 541 | ||
| 534 | (defcustom cperl-merge-trailing-else t | 542 | (defcustom cperl-merge-trailing-else t |
| 535 | "Non-nil means that BLOCK-end `}' followed by else/elsif/continue | 543 | "Controls indentation of block-end `}' followed by else/elsif/continue. |
| 536 | may be merged to be on the same line when indenting a region." | 544 | If non-nil, then these block-end braces may be merged to be on the same |
| 545 | line when indenting a region." | ||
| 537 | :type 'boolean | 546 | :type 'boolean |
| 538 | :group 'cperl-indentation-details) | 547 | :group 'cperl-indentation-details) |
| 539 | 548 | ||
| 540 | (defcustom cperl-indent-parens-as-block nil | 549 | (defcustom cperl-indent-parens-as-block nil |
| 541 | "Non-nil means that non-block ()-, {}- and []-groups are indented as blocks, | 550 | "Non-nil means that non-block ()-, {}- and []-groups are indented as blocks. |
| 542 | but for trailing \",\" inside the group, which won't increase indentation. | 551 | However, trailing \",\" inside the group, won't increase indentation. |
| 543 | One should tune up `cperl-close-paren-offset' as well." | 552 | One should tune up `cperl-close-paren-offset' as well." |
| 544 | :type 'boolean | 553 | :type 'boolean |
| 545 | :group 'cperl-indentation-details) | 554 | :group 'cperl-indentation-details) |
| @@ -551,7 +560,8 @@ One should tune up `cperl-close-paren-offset' as well." | |||
| 551 | 560 | ||
| 552 | (defcustom cperl-syntaxify-unwind | 561 | (defcustom cperl-syntaxify-unwind |
| 553 | t | 562 | t |
| 554 | "Non-nil means that CPerl unwinds to a start of a long construction | 563 | "Controls the accuracy of syntaxification. |
| 564 | Non-nil means that CPerl unwinds to a start of a long construction | ||
| 555 | when syntaxifying a chunk of buffer." | 565 | when syntaxifying a chunk of buffer." |
| 556 | :type 'boolean | 566 | :type 'boolean |
| 557 | :group 'cperl-speed) | 567 | :group 'cperl-speed) |
| @@ -644,7 +654,9 @@ imenu entries." | |||
| 644 | ;;; Short extra-docs. | 654 | ;;; Short extra-docs. |
| 645 | 655 | ||
| 646 | (defvar cperl-tips 'please-ignore-this-line | 656 | (defvar cperl-tips 'please-ignore-this-line |
| 647 | "If your Emacs does not default to `cperl-mode' on Perl files, and you | 657 | "Some tips for using `cperl-mode'. |
| 658 | |||
| 659 | If your Emacs does not default to `cperl-mode' on Perl files, and you | ||
| 648 | want it to: put the following into your .emacs file: | 660 | want it to: put the following into your .emacs file: |
| 649 | 661 | ||
| 650 | (add-to-list \\='major-mode-remap-alist \\='(perl-mode . cperl-mode)) | 662 | (add-to-list \\='major-mode-remap-alist \\='(perl-mode . cperl-mode)) |
| @@ -669,7 +681,7 @@ editing, sometimes it may be lost. Fix this by | |||
| 669 | 681 | ||
| 670 | In cases of more severe confusion sometimes it is helpful to do | 682 | In cases of more severe confusion sometimes it is helpful to do |
| 671 | 683 | ||
| 672 | \\[load-library] cperl-mode RET | 684 | \\[load-library] `cperl-mode' RET |
| 673 | \\[normal-mode] | 685 | \\[normal-mode] |
| 674 | 686 | ||
| 675 | Before reporting (non-)problems look in the problem section of online | 687 | Before reporting (non-)problems look in the problem section of online |
| @@ -682,7 +694,8 @@ paragraph. It also triggers a bug in some versions of Emacs (CPerl tries | |||
| 682 | to detect it and bulk out).") | 694 | to detect it and bulk out).") |
| 683 | 695 | ||
| 684 | (defvar cperl-problems-old-emaxen 'please-ignore-this-line | 696 | (defvar cperl-problems-old-emaxen 'please-ignore-this-line |
| 685 | "This used to contain a description of problems in CPerl mode | 697 | "Obsolete hints for outdated Emacs versions. |
| 698 | This used to contain a description of problems in CPerl mode | ||
| 686 | specific for very old Emacs versions. This is no longer relevant | 699 | specific for very old Emacs versions. This is no longer relevant |
| 687 | and has been removed.") | 700 | and has been removed.") |
| 688 | (make-obsolete-variable 'cperl-problems-old-emaxen nil "28.1") | 701 | (make-obsolete-variable 'cperl-problems-old-emaxen nil "28.1") |
| @@ -775,8 +788,12 @@ line-breaks/spacing between elements of the construct. | |||
| 775 | 11) Syntax-highlight, indentation, sexp-recognition inside regular expressions.") | 788 | 11) Syntax-highlight, indentation, sexp-recognition inside regular expressions.") |
| 776 | 789 | ||
| 777 | (defvar cperl-speed 'please-ignore-this-line | 790 | (defvar cperl-speed 'please-ignore-this-line |
| 778 | "This is an incomplete compendium of what is available in other parts | 791 | "Considerations about performance of `cperl-mode'. |
| 779 | of CPerl documentation. (Please inform me if I skipped anything.) | 792 | |
| 793 | This is an incomplete compendium of what is available in other parts | ||
| 794 | of CPerl documentation. Nowadays the performance of `cperl-mode' | ||
| 795 | is not as relevant as it used to be when this was written. | ||
| 796 | \(Please inform me if I skipped anything.) | ||
| 780 | 797 | ||
| 781 | There is a perception that CPerl is slower than alternatives. This part | 798 | There is a perception that CPerl is slower than alternatives. This part |
| 782 | of documentation is designed to overcome this misconception. | 799 | of documentation is designed to overcome this misconception. |
| @@ -858,7 +875,8 @@ In regular expressions (including character classes): | |||
| 858 | we couldn't match, misplaced quantifiers, | 875 | we couldn't match, misplaced quantifiers, |
| 859 | unrecognized escape sequences | 876 | unrecognized escape sequences |
| 860 | `cperl-nonoverridable-face' Modifiers, as gism in m/REx/gism | 877 | `cperl-nonoverridable-face' Modifiers, as gism in m/REx/gism |
| 861 | `font-lock-type-face' escape sequences with arguments (\\x \\23 \\p \\N) | 878 | `font-lock-type-face' escape sequences with arguments |
| 879 | (\\x \\23 \\p \\N) | ||
| 862 | and others match-a-char escape sequences | 880 | and others match-a-char escape sequences |
| 863 | `font-lock-keyword-face' Capturing parens, and | | 881 | `font-lock-keyword-face' Capturing parens, and | |
| 864 | `font-lock-function-name-face' Special symbols: $ ^ . [ ] [^ ] (?{ }) (??{ }) | 882 | `font-lock-function-name-face' Special symbols: $ ^ . [ ] [^ ] (?{ }) (??{ }) |
| @@ -883,11 +901,13 @@ In regular expressions (including character classes): | |||
| 883 | (setq cperl-del-back-ch (aref cperl-del-back-ch 0))) | 901 | (setq cperl-del-back-ch (aref cperl-del-back-ch 0))) |
| 884 | 902 | ||
| 885 | (defun cperl-putback-char (c) | 903 | (defun cperl-putback-char (c) |
| 904 | "Obsolete. Put C back to the event loop." | ||
| 886 | (declare (obsolete nil "29.1")) | 905 | (declare (obsolete nil "29.1")) |
| 887 | (push c unread-command-events)) | 906 | (push c unread-command-events)) |
| 888 | 907 | ||
| 889 | (defsubst cperl-put-do-not-fontify (from to &optional post) | 908 | (defsubst cperl-put-do-not-fontify (from to &optional post) |
| 890 | ;; If POST, do not do it with postponed fontification | 909 | "Pretend that text between FROM and TO is already fontified. |
| 910 | If POST, do not do it with postponed fontification" | ||
| 891 | (if (and post cperl-syntaxify-by-font-lock) | 911 | (if (and post cperl-syntaxify-by-font-lock) |
| 892 | nil | 912 | nil |
| 893 | (put-text-property (max (point-min) (1- from)) | 913 | (put-text-property (max (point-min) (1- from)) |
| @@ -903,6 +923,9 @@ In regular expressions (including character classes): | |||
| 903 | 923 | ||
| 904 | ;; Make customization possible "in reverse" | 924 | ;; Make customization possible "in reverse" |
| 905 | (defsubst cperl-val (symbol &optional default hairy) | 925 | (defsubst cperl-val (symbol &optional default hairy) |
| 926 | "Internal feature to distinguish SYMBOL between \"uncustomized\" and nil. | ||
| 927 | Apply DEFAULT if nil, use HAIRY if `cperl-hairy' is non-nil. Use the | ||
| 928 | symbol's value otherwise." | ||
| 906 | (cond | 929 | (cond |
| 907 | ((eq (symbol-value symbol) 'null) default) | 930 | ((eq (symbol-value symbol) 'null) default) |
| 908 | (cperl-hairy (or hairy t)) | 931 | (cperl-hairy (or hairy t)) |
| @@ -1574,7 +1597,8 @@ Should contain exactly one group.") | |||
| 1574 | "Match the text after `sub' in a subroutine declaration. | 1597 | "Match the text after `sub' in a subroutine declaration. |
| 1575 | If NAMED is nil, allows anonymous subroutines. Matches up to the first \":\" | 1598 | If NAMED is nil, allows anonymous subroutines. Matches up to the first \":\" |
| 1576 | of attributes (if present), or end of the name or prototype (whatever is | 1599 | of attributes (if present), or end of the name or prototype (whatever is |
| 1577 | the last)." | 1600 | the last). |
| 1601 | If ATTR is non-nil, also capture the attributes." | ||
| 1578 | (concat ; Assume n groups before this... | 1602 | (concat ; Assume n groups before this... |
| 1579 | "\\(" ; n+1=name-group | 1603 | "\\(" ; n+1=name-group |
| 1580 | cperl-white-and-comment-rex ; n+2=pre-name | 1604 | cperl-white-and-comment-rex ; n+2=pre-name |
| @@ -1658,11 +1682,14 @@ the last)." | |||
| 1658 | "Syntax table in use in CPerl mode string-like chunks.") | 1682 | "Syntax table in use in CPerl mode string-like chunks.") |
| 1659 | 1683 | ||
| 1660 | (defsubst cperl-1- (p) | 1684 | (defsubst cperl-1- (p) |
| 1685 | "Decreases a position from P, but does not go before `point-min'." | ||
| 1661 | (max (point-min) (1- p))) | 1686 | (max (point-min) (1- p))) |
| 1662 | 1687 | ||
| 1663 | (defsubst cperl-1+ (p) | 1688 | (defsubst cperl-1+ (p) |
| 1689 | "Increases a position from P, but does not go beyond `point-max'." | ||
| 1664 | (min (point-max) (1+ p))) | 1690 | (min (point-max) (1+ p))) |
| 1665 | 1691 | ||
| 1692 | |||
| 1666 | 1693 | ||
| 1667 | (defvar cperl-faces-init nil) | 1694 | (defvar cperl-faces-init nil) |
| 1668 | ;; Fix for msb.el | 1695 | ;; Fix for msb.el |
| @@ -1825,7 +1852,7 @@ Settings for classic indent-styles: K&R BSD=C++ GNU PBP PerlStyle=Whitesmith | |||
| 1825 | 1852 | ||
| 1826 | CPerl knows several indentation styles, and may bulk set the | 1853 | CPerl knows several indentation styles, and may bulk set the |
| 1827 | corresponding variables. Use \\[cperl-set-style] to do this or | 1854 | corresponding variables. Use \\[cperl-set-style] to do this or |
| 1828 | set the `cperl-file-style' user option. Use | 1855 | set the variable `cperl-file-style' user option. Use |
| 1829 | \\[cperl-set-style-back] to restore the memorized preexisting | 1856 | \\[cperl-set-style-back] to restore the memorized preexisting |
| 1830 | values \(both available from menu). See examples in | 1857 | values \(both available from menu). See examples in |
| 1831 | `cperl-style-examples'. | 1858 | `cperl-style-examples'. |
| @@ -1972,12 +1999,16 @@ or as help on variables `cperl-tips', `cperl-problems', | |||
| 1972 | (derived-mode-add-parents 'cperl-mode '(perl-mode))) | 1999 | (derived-mode-add-parents 'cperl-mode '(perl-mode))) |
| 1973 | 2000 | ||
| 1974 | (defun cperl--set-file-style () | 2001 | (defun cperl--set-file-style () |
| 2002 | "Set the file style according to the variable `cperl-file-style'. | ||
| 2003 | Do nothing if the variable is nil." | ||
| 1975 | (when cperl-file-style | 2004 | (when cperl-file-style |
| 1976 | (cperl-file-style cperl-file-style))) | 2005 | (cperl-file-style cperl-file-style))) |
| 1977 | 2006 | ||
| 1978 | 2007 | ||
| 1979 | ;; Fix for perldb - make default reasonable | 2008 | ;; Fix for perldb - make default reasonable |
| 1980 | (defun cperl-db () | 2009 | (defun cperl-db () |
| 2010 | "Obsolete workaround for an outdated issue with `perldb'." | ||
| 2011 | (declare (obsolete 'perldb "31.1")) | ||
| 1981 | (interactive) | 2012 | (interactive) |
| 1982 | (require 'gud) | 2013 | (require 'gud) |
| 1983 | ;; FIXME: Use `read-string' or `read-shell-command'? | 2014 | ;; FIXME: Use `read-string' or `read-shell-command'? |
| @@ -1990,7 +2021,7 @@ or as help on variables `cperl-tips', `cperl-problems', | |||
| 1990 | '(gud-perldb-history . 1)))) | 2021 | '(gud-perldb-history . 1)))) |
| 1991 | 2022 | ||
| 1992 | (defun cperl-msb-fix () | 2023 | (defun cperl-msb-fix () |
| 1993 | ;; Adds perl files to msb menu, supposes that msb is already loaded | 2024 | "Add perl files to msb menu, supposes that msb is already loaded." |
| 1994 | (setq cperl-msb-fixed t) | 2025 | (setq cperl-msb-fixed t) |
| 1995 | (let* ((l (length msb-menu-cond)) | 2026 | (let* ((l (length msb-menu-cond)) |
| 1996 | (last (nth (1- l) msb-menu-cond)) | 2027 | (last (nth (1- l) msb-menu-cond)) |
| @@ -2016,7 +2047,8 @@ or as help on variables `cperl-tips', `cperl-problems', | |||
| 2016 | (defvar cperl-st-ket '(5 . ?\<)) | 2047 | (defvar cperl-st-ket '(5 . ?\<)) |
| 2017 | 2048 | ||
| 2018 | 2049 | ||
| 2019 | (defun cperl-comment-indent () ; called at point at supposed comment | 2050 | (defun cperl-comment-indent () |
| 2051 | "Called at point at supposed comment." | ||
| 2020 | (let ((p (point)) (c (current-column)) was phony) | 2052 | (let ((p (point)) (c (current-column)) was phony) |
| 2021 | (if (and (not cperl-indent-comment-at-column-0) | 2053 | (if (and (not cperl-indent-comment-at-column-0) |
| 2022 | (looking-at "^#")) | 2054 | (looking-at "^#")) |
| @@ -2058,15 +2090,15 @@ or as help on variables `cperl-tips', `cperl-problems', | |||
| 2058 | (forward-char (length comment-start)))))) | 2090 | (forward-char (length comment-start)))))) |
| 2059 | 2091 | ||
| 2060 | (defun cperl-comment-region (b e arg) | 2092 | (defun cperl-comment-region (b e arg) |
| 2061 | "Comment or uncomment each line in the region in CPerl mode. | 2093 | "Comment or uncomment each line in the region between B and E. |
| 2062 | See `comment-region'." | 2094 | ARG is passed to `comment-region', which see." |
| 2063 | (interactive "r\np") | 2095 | (interactive "r\np") |
| 2064 | (let ((comment-start "#")) | 2096 | (let ((comment-start "#")) |
| 2065 | (comment-region b e arg))) | 2097 | (comment-region b e arg))) |
| 2066 | 2098 | ||
| 2067 | (defun cperl-uncomment-region (b e arg) | 2099 | (defun cperl-uncomment-region (b e arg) |
| 2068 | "Uncomment or comment each line in the region in CPerl mode. | 2100 | "Uncomment or comment each line in the region between B and E. |
| 2069 | See `comment-region'." | 2101 | ARG is passed to `comment-region', which see." |
| 2070 | (interactive "r\np") | 2102 | (interactive "r\np") |
| 2071 | (let ((comment-start "#")) | 2103 | (let ((comment-start "#")) |
| 2072 | (comment-region b e (- arg)))) | 2104 | (comment-region b e (- arg)))) |
| @@ -2074,7 +2106,7 @@ See `comment-region'." | |||
| 2074 | (defvar cperl-brace-recursing nil) | 2106 | (defvar cperl-brace-recursing nil) |
| 2075 | 2107 | ||
| 2076 | (defun cperl-electric-brace (arg &optional only-before) | 2108 | (defun cperl-electric-brace (arg &optional only-before) |
| 2077 | "Insert character and correct line's indentation. | 2109 | "Insert character ARG and correct line's indentation. |
| 2078 | If ONLY-BEFORE and `cperl-auto-newline', will insert newline before the | 2110 | If ONLY-BEFORE and `cperl-auto-newline', will insert newline before the |
| 2079 | place (even in empty line), but not after. If after \")\" and the inserted | 2111 | place (even in empty line), but not after. If after \")\" and the inserted |
| 2080 | char is \"{\", insert extra newline before only if | 2112 | char is \"{\", insert extra newline before only if |
| @@ -2148,7 +2180,8 @@ char is \"{\", insert extra newline before only if | |||
| 2148 | (self-insert-command (prefix-numeric-value arg))))))) | 2180 | (self-insert-command (prefix-numeric-value arg))))))) |
| 2149 | 2181 | ||
| 2150 | (defun cperl-electric-lbrace (arg &optional end) | 2182 | (defun cperl-electric-lbrace (arg &optional end) |
| 2151 | "Insert character, correct line's indentation, correct quoting by space." | 2183 | "Insert character ARG, correct line's indentation, correct quoting by space. |
| 2184 | Do not look beyond END." | ||
| 2152 | (interactive "P") | 2185 | (interactive "P") |
| 2153 | (let ((cperl-brace-recursing t) | 2186 | (let ((cperl-brace-recursing t) |
| 2154 | (cperl-auto-newline cperl-auto-newline) | 2187 | (cperl-auto-newline cperl-auto-newline) |
| @@ -2188,7 +2221,8 @@ char is \"{\", insert extra newline before only if | |||
| 2188 | 2221 | ||
| 2189 | (defun cperl-electric-paren (arg) | 2222 | (defun cperl-electric-paren (arg) |
| 2190 | "Insert an opening parenthesis or a matching pair of parentheses. | 2223 | "Insert an opening parenthesis or a matching pair of parentheses. |
| 2191 | See `cperl-electric-parens'." | 2224 | See `cperl-electric-parens'. |
| 2225 | Argument ARG is the opening parenthesis." | ||
| 2192 | (interactive "P") | 2226 | (interactive "P") |
| 2193 | (let ((other-end (if (and cperl-electric-parens-mark | 2227 | (let ((other-end (if (and cperl-electric-parens-mark |
| 2194 | (region-active-p) | 2228 | (region-active-p) |
| @@ -2223,7 +2257,8 @@ See `cperl-electric-parens'." | |||
| 2223 | (defun cperl-electric-rparen (arg) | 2257 | (defun cperl-electric-rparen (arg) |
| 2224 | "Insert a matching pair of parentheses if marking is active. | 2258 | "Insert a matching pair of parentheses if marking is active. |
| 2225 | If not, or if we are not at the end of marking range, would self-insert. | 2259 | If not, or if we are not at the end of marking range, would self-insert. |
| 2226 | Affected by `cperl-electric-parens'." | 2260 | Affected by `cperl-electric-parens'. |
| 2261 | Argument ARG is the closing parenthesis." | ||
| 2227 | (interactive "P") | 2262 | (interactive "P") |
| 2228 | (let ((other-end (if (and cperl-electric-parens-mark | 2263 | (let ((other-end (if (and cperl-electric-parens-mark |
| 2229 | (cperl-val 'cperl-electric-parens) | 2264 | (cperl-val 'cperl-electric-parens) |
| @@ -2324,7 +2359,8 @@ to nil." | |||
| 2324 | (message "Precede char by C-q to avoid expansion")))))) | 2359 | (message "Precede char by C-q to avoid expansion")))))) |
| 2325 | 2360 | ||
| 2326 | (defun cperl-ensure-newlines (n &optional pos) | 2361 | (defun cperl-ensure-newlines (n &optional pos) |
| 2327 | "Make sure there are N newlines after the point." | 2362 | "Make sure there are N newlines after the point. |
| 2363 | Go to POS which defaults to the current point after processing." | ||
| 2328 | (or pos (setq pos (point))) | 2364 | (or pos (setq pos (point))) |
| 2329 | (if (looking-at "\n") | 2365 | (if (looking-at "\n") |
| 2330 | (forward-char 1) | 2366 | (forward-char 1) |
| @@ -2538,7 +2574,8 @@ If in POD, insert appropriate lines." | |||
| 2538 | (newline-and-indent)))))) | 2574 | (newline-and-indent)))))) |
| 2539 | 2575 | ||
| 2540 | (defun cperl-electric-semi (arg) | 2576 | (defun cperl-electric-semi (arg) |
| 2541 | "Insert character and correct line's indentation." | 2577 | "Insert character and correct line's indentation. |
| 2578 | ARG is the character to insert." | ||
| 2542 | (interactive "P") | 2579 | (interactive "P") |
| 2543 | (if cperl-auto-newline | 2580 | (if cperl-auto-newline |
| 2544 | (cperl-electric-terminator arg) | 2581 | (cperl-electric-terminator arg) |
| @@ -2547,7 +2584,8 @@ If in POD, insert appropriate lines." | |||
| 2547 | (cperl-indent-line)))) | 2584 | (cperl-indent-line)))) |
| 2548 | 2585 | ||
| 2549 | (defun cperl-electric-terminator (arg) | 2586 | (defun cperl-electric-terminator (arg) |
| 2550 | "Insert character and correct line's indentation." | 2587 | "Insert character and correct line's indentation. |
| 2588 | ARG is the character to insert." | ||
| 2551 | (interactive "P") | 2589 | (interactive "P") |
| 2552 | (let ((end (point)) | 2590 | (let ((end (point)) |
| 2553 | (auto (and cperl-auto-newline | 2591 | (auto (and cperl-auto-newline |
| @@ -2598,7 +2636,8 @@ If in POD, insert appropriate lines." | |||
| 2598 | 2636 | ||
| 2599 | (defun cperl-electric-backspace (arg) | 2637 | (defun cperl-electric-backspace (arg) |
| 2600 | "Backspace, or remove whitespace around the point inserted by an electric key. | 2638 | "Backspace, or remove whitespace around the point inserted by an electric key. |
| 2601 | Will untabify if `cperl-electric-backspace-untabify' is non-nil." | 2639 | Will untabify if `cperl-electric-backspace-untabify' is non-nil. |
| 2640 | ARG is the key which caused the action." | ||
| 2602 | (interactive "p") | 2641 | (interactive "p") |
| 2603 | (if (and cperl-auto-newline | 2642 | (if (and cperl-auto-newline |
| 2604 | (memq last-command '(cperl-electric-semi | 2643 | (memq last-command '(cperl-electric-semi |
| @@ -2629,6 +2668,7 @@ Will untabify if `cperl-electric-backspace-untabify' is non-nil." | |||
| 2629 | (put 'cperl-electric-backspace 'delete-selection 'supersede) | 2668 | (put 'cperl-electric-backspace 'delete-selection 'supersede) |
| 2630 | 2669 | ||
| 2631 | (defun cperl-inside-parens-p () | 2670 | (defun cperl-inside-parens-p () |
| 2671 | "Obsolete function, unused." | ||
| 2632 | (declare (obsolete nil "28.1")) ; not used | 2672 | (declare (obsolete nil "28.1")) ; not used |
| 2633 | (condition-case () | 2673 | (condition-case () |
| 2634 | (save-excursion | 2674 | (save-excursion |
| @@ -2648,7 +2688,8 @@ or in the line's indentation; otherwise insert a tab. | |||
| 2648 | A numeric argument, regardless of its value, | 2688 | A numeric argument, regardless of its value, |
| 2649 | means indent rigidly all the lines of the expression starting after point | 2689 | means indent rigidly all the lines of the expression starting after point |
| 2650 | so that this line becomes properly indented. | 2690 | so that this line becomes properly indented. |
| 2651 | The relative indentation among the lines of the expression are preserved." | 2691 | The relative indentation among the lines of the expression are preserved. |
| 2692 | If WHOLE-EXP is non-nil, indent the whole expression." | ||
| 2652 | (interactive "P") | 2693 | (interactive "P") |
| 2653 | (cperl-update-syntaxification (point)) | 2694 | (cperl-update-syntaxification (point)) |
| 2654 | (if whole-exp | 2695 | (if whole-exp |
| @@ -2676,7 +2717,8 @@ The relative indentation among the lines of the expression are preserved." | |||
| 2676 | 2717 | ||
| 2677 | (defun cperl-indent-line (&optional parse-data) | 2718 | (defun cperl-indent-line (&optional parse-data) |
| 2678 | "Indent current line as Perl code. | 2719 | "Indent current line as Perl code. |
| 2679 | Return the amount the indentation changed by." | 2720 | Return the amount the indentation changed by. |
| 2721 | PARSE-DATA is used to save status between calls in a loop." | ||
| 2680 | (let ((case-fold-search nil) | 2722 | (let ((case-fold-search nil) |
| 2681 | (pos (- (point-max) (point))) | 2723 | (pos (- (point-max) (point))) |
| 2682 | indent i shift-amt) | 2724 | indent i shift-amt) |
| @@ -2720,7 +2762,7 @@ Return the amount the indentation changed by." | |||
| 2720 | shift-amt)) | 2762 | shift-amt)) |
| 2721 | 2763 | ||
| 2722 | (defun cperl-after-label () | 2764 | (defun cperl-after-label () |
| 2723 | ;; Returns true if the point is after label. Does not do save-excursion. | 2765 | "Return non-nil if the point is after label. Does not do `save-excursion'." |
| 2724 | (and (eq (preceding-char) ?:) | 2766 | (and (eq (preceding-char) ?:) |
| 2725 | (memq (char-syntax (char-after (- (point) 2))) | 2767 | (memq (char-syntax (char-after (- (point) 2))) |
| 2726 | '(?w ?_)) | 2768 | '(?w ?_)) |
| @@ -2736,7 +2778,8 @@ PARSE-START if preset. | |||
| 2736 | STATE is what is returned by `parse-partial-sexp'. | 2778 | STATE is what is returned by `parse-partial-sexp'. |
| 2737 | DEPTH is true is we are immediately after end of block | 2779 | DEPTH is true is we are immediately after end of block |
| 2738 | which contains START. | 2780 | which contains START. |
| 2739 | PRESTART is the position basing on which START was found." | 2781 | PRESTART is the position basing on which START was found. |
| 2782 | START-STATE should be a good guess for the start of a function." | ||
| 2740 | (save-excursion | 2783 | (save-excursion |
| 2741 | (let ((start-point (point)) depth state start prestart) | 2784 | (let ((start-point (point)) depth state start prestart) |
| 2742 | (if (and parse-start | 2785 | (if (and parse-start |
| @@ -2766,7 +2809,7 @@ PRESTART is the position basing on which START was found." | |||
| 2766 | (defvar cperl-look-for-prop '((pod in-pod) (here-doc-delim here-doc-group))) | 2809 | (defvar cperl-look-for-prop '((pod in-pod) (here-doc-delim here-doc-group))) |
| 2767 | 2810 | ||
| 2768 | (defun cperl-beginning-of-property (p prop &optional lim) | 2811 | (defun cperl-beginning-of-property (p prop &optional lim) |
| 2769 | "Given that P has a property PROP, find where the property starts. | 2812 | "Given that P has a property PROP, find where the property start. |
| 2770 | Will not look before LIM." | 2813 | Will not look before LIM." |
| 2771 | ;; XXXX What to do at point-max??? | 2814 | ;; XXXX What to do at point-max??? |
| 2772 | (or (previous-single-property-change (cperl-1+ p) prop lim) | 2815 | (or (previous-single-property-change (cperl-1+ p) prop lim) |
| @@ -2782,7 +2825,7 @@ Will not look before LIM." | |||
| 2782 | ) | 2825 | ) |
| 2783 | 2826 | ||
| 2784 | (defun cperl-sniff-for-indent (&optional parse-data) ; was parse-start | 2827 | (defun cperl-sniff-for-indent (&optional parse-data) ; was parse-start |
| 2785 | ;; the sniffer logic to understand what the current line MEANS. | 2828 | "Find out what the current line means, based on the given PARSE-DATA." |
| 2786 | (cperl-update-syntaxification (point)) | 2829 | (cperl-update-syntaxification (point)) |
| 2787 | (let ((res (get-text-property (point) 'syntax-type))) | 2830 | (let ((res (get-text-property (point) 'syntax-type))) |
| 2788 | (save-excursion | 2831 | (save-excursion |
| @@ -3089,6 +3132,7 @@ The values mean: | |||
| 3089 | 3132 | ||
| 3090 | (defun cperl-calculate-indent (&optional parse-data) ; was parse-start | 3133 | (defun cperl-calculate-indent (&optional parse-data) ; was parse-start |
| 3091 | "Return appropriate indentation for current line as Perl code. | 3134 | "Return appropriate indentation for current line as Perl code. |
| 3135 | PARSE-DATA is the result of a previous call to speed up things. | ||
| 3092 | In usual case returns an integer: the column to indent to. | 3136 | In usual case returns an integer: the column to indent to. |
| 3093 | Returns nil if line starts inside a string, t if in a comment. | 3137 | Returns nil if line starts inside a string, t if in a comment. |
| 3094 | 3138 | ||
| @@ -3344,13 +3388,15 @@ Returns true if comment is found. In POD will not move the point." | |||
| 3344 | (nth 4 state)))) | 3388 | (nth 4 state)))) |
| 3345 | 3389 | ||
| 3346 | (defsubst cperl-modify-syntax-type (at how) | 3390 | (defsubst cperl-modify-syntax-type (at how) |
| 3391 | "Modify the syntax-table text properties at AT as given by HOW." | ||
| 3347 | (if (< at (point-max)) | 3392 | (if (< at (point-max)) |
| 3348 | (progn | 3393 | (progn |
| 3349 | (put-text-property at (1+ at) 'syntax-table how) | 3394 | (put-text-property at (1+ at) 'syntax-table how) |
| 3350 | (put-text-property at (1+ at) 'rear-nonsticky '(syntax-table))))) | 3395 | (put-text-property at (1+ at) 'rear-nonsticky '(syntax-table))))) |
| 3351 | 3396 | ||
| 3352 | (defun cperl-protect-defun-start (s e) | 3397 | (defun cperl-protect-defun-start (s e) |
| 3353 | ;; C code looks for "^\\s(" to skip comment backward in "hard" situations | 3398 | "Mark parentheses as punctuation between S and E. |
| 3399 | C code looks for \"^\\s(\" to skip comment backward in \"hard\" situations." | ||
| 3354 | (save-excursion | 3400 | (save-excursion |
| 3355 | (goto-char s) | 3401 | (goto-char s) |
| 3356 | (while (re-search-forward "^\\s(" e 'to-end) | 3402 | (while (re-search-forward "^\\s(" e 'to-end) |
| @@ -3688,7 +3734,8 @@ newer. To activate the extra delimiters, switch on the minor mode | |||
| 3688 | `cperl-extra-paired-delimiters-mode'. This is also available from the | 3734 | `cperl-extra-paired-delimiters-mode'. This is also available from the |
| 3689 | \"Perl\" menu in section \"Toggle...\". | 3735 | \"Perl\" menu in section \"Toggle...\". |
| 3690 | The character pairs available are: | 3736 | The character pairs available are: |
| 3691 | (), <>, [], {}, «», »«, ༺༻, ༼༽, ᚛᚜, \\=‘\\=’, \\=’\\=‘, \\=“\\=”, \\=”\\=“, \\=‵\\=′, \\=‶\\=″, \\=‷\\=‴, ‹›, ›‹, ⁅⁆, | 3737 | \(), <>, [], {}, «», »«, ༺༻, ༼༽, ᚛᚜, \\=‘\\=’, \\=’\\=‘, \\=“\\=”, \\=”\\=“, |
| 3738 | \\=‵\\=′, \\=‶\\=″, \\=‷\\=‴, ‹›, ›‹, ⁅⁆, | ||
| 3692 | ⁍⁌, ⁽⁾, ₍₎, →←, ↛↚, ↝↜, ↠↞, ↣↢, ↦↤, ↪↩, ↬↫, ↱↰, ↳↲, ⇀↼, ⇁↽, ⇉⇇, ⇏⇍, ⇒⇐, ⇛⇚, | 3739 | ⁍⁌, ⁽⁾, ₍₎, →←, ↛↚, ↝↜, ↠↞, ↣↢, ↦↤, ↪↩, ↬↫, ↱↰, ↳↲, ⇀↼, ⇁↽, ⇉⇇, ⇏⇍, ⇒⇐, ⇛⇚, |
| 3693 | ⇝⇜, ⇢⇠, ⇥⇤, ⇨⇦, ⇴⬰, ⇶⬱, ⇸⇷, ⇻⇺, ⇾⇽, ∈∋, ∉∌, ∊∍, ≤≥, ≦≧, ≨≩, ≪≫, ≮≯, ≰≱, ≲≳, | 3740 | ⇝⇜, ⇢⇠, ⇥⇤, ⇨⇦, ⇴⬰, ⇶⬱, ⇸⇷, ⇻⇺, ⇾⇽, ∈∋, ∉∌, ∊∍, ≤≥, ≦≧, ≨≩, ≪≫, ≮≯, ≰≱, ≲≳, |
| 3694 | ≴≵, ≺≻, ≼≽, ≾≿, ⊀⊁, ⊂⊃, ⊄⊅, ⊆⊇, ⊈⊉, ⊊⊋, ⊣⊢, ⊦⫞, ⊨⫤, ⊩⫣, ⊰⊱, ⋐⋑, ⋖⋗, ⋘⋙, ⋜⋝, | 3741 | ≴≵, ≺≻, ≼≽, ≾≿, ⊀⊁, ⊂⊃, ⊄⊅, ⊆⊇, ⊈⊉, ⊊⊋, ⊣⊢, ⊦⫞, ⊨⫤, ⊩⫣, ⊰⊱, ⋐⋑, ⋖⋗, ⋘⋙, ⋜⋝, |
| @@ -3832,7 +3879,8 @@ modify syntax-type text property if the situation is too hard." | |||
| 3832 | (defun cperl-forward-group-in-re (&optional st-l) | 3879 | (defun cperl-forward-group-in-re (&optional st-l) |
| 3833 | "Find the end of a group in a REx. | 3880 | "Find the end of a group in a REx. |
| 3834 | Return the error message (if any). Does not work if delimiter is `)'. | 3881 | Return the error message (if any). Does not work if delimiter is `)'. |
| 3835 | Works before syntax recognition is done." | 3882 | Works before syntax recognition is done. |
| 3883 | ST-L is a cached syntax table to use." | ||
| 3836 | ;; Works *before* syntax recognition is done | 3884 | ;; Works *before* syntax recognition is done |
| 3837 | (or st-l (setq st-l (list nil))) ; Avoid overwriting '() | 3885 | (or st-l (setq st-l (list nil))) ; Avoid overwriting '() |
| 3838 | (let (st result reset-st) | 3886 | (let (st result reset-st) |
| @@ -3856,7 +3904,14 @@ Works before syntax recognition is done." | |||
| 3856 | 3904 | ||
| 3857 | 3905 | ||
| 3858 | (defsubst cperl-postpone-fontification (b e type val &optional now) | 3906 | (defsubst cperl-postpone-fontification (b e type val &optional now) |
| 3859 | ;; Do after syntactic fontification? | 3907 | "Prepare text between B and E for postponed fontification. |
| 3908 | TYPE is now always the symbol `face', VAL is the value (the actual face) | ||
| 3909 | to be applied. This works by adding a text property `cperl-postpone' to | ||
| 3910 | the range, which later is evaluated in the function | ||
| 3911 | `cperl-fontify-update' which is inserted into the `font-lock-defaults'. | ||
| 3912 | If `cperl-syntaxify-by-font-lock' is nil (which is not recommended), | ||
| 3913 | then the text property TYPE is immediately set to VAL. | ||
| 3914 | NOW is no longer useful." | ||
| 3860 | (if cperl-syntaxify-by-font-lock | 3915 | (if cperl-syntaxify-by-font-lock |
| 3861 | (or now (put-text-property b e 'cperl-postpone (cons type val))) | 3916 | (or now (put-text-property b e 'cperl-postpone (cons type val))) |
| 3862 | (put-text-property b e type val))) | 3917 | (put-text-property b e type val))) |
| @@ -3954,7 +4009,11 @@ position of the end of the unsafe construct." | |||
| 3954 | 4009 | ||
| 3955 | (defun cperl-find-sub-attrs (&optional st-l _b-fname _e-fname pos) | 4010 | (defun cperl-find-sub-attrs (&optional st-l _b-fname _e-fname pos) |
| 3956 | "Syntactically mark (and fontify) attributes of a subroutine. | 4011 | "Syntactically mark (and fontify) attributes of a subroutine. |
| 3957 | Should be called with the point before leading colon of an attribute." | 4012 | Within attributes, parentheses and text between them have weird |
| 4013 | syntactical properties which are likely to mess up search-based | ||
| 4014 | fontification. Therefore they are fontified explicitly here. | ||
| 4015 | Should be called with the point before leading colon of | ||
| 4016 | an attribute. ST-L and POS are a cached from a previous call." | ||
| 3958 | ;; Works *before* syntax recognition is done | 4017 | ;; Works *before* syntax recognition is done |
| 3959 | (or st-l (setq st-l (list nil))) ; Avoid overwriting '() | 4018 | (or st-l (setq st-l (list nil))) ; Avoid overwriting '() |
| 3960 | (let (st p reset-st after-first (start (point)) start1 end1) | 4019 | (let (st p reset-st after-first (start (point)) start1 end1) |
| @@ -4033,6 +4092,9 @@ Should be called with the point before leading colon of an attribute." | |||
| 4033 | (set-syntax-table reset-st)))) | 4092 | (set-syntax-table reset-st)))) |
| 4034 | 4093 | ||
| 4035 | (defsubst cperl-look-at-leading-count (is-x-REx e) | 4094 | (defsubst cperl-look-at-leading-count (is-x-REx e) |
| 4095 | "Mark suspicious regexp content up to E. | ||
| 4096 | If IS-X-REX is non-nil, then process a regular expression which has an | ||
| 4097 | /x modifier." | ||
| 4036 | (if (and | 4098 | (if (and |
| 4037 | (< (point) e) | 4099 | (< (point) e) |
| 4038 | (re-search-forward (concat "\\=" (if is-x-REx "[ \t\n]*" "") "[{?+*]") | 4100 | (re-search-forward (concat "\\=" (if is-x-REx "[ \t\n]*" "") "[{?+*]") |
| @@ -4045,6 +4107,10 @@ Should be called with the point before leading colon of an attribute." | |||
| 4045 | ;; Do some smarter-highlighting | 4107 | ;; Do some smarter-highlighting |
| 4046 | ;; XXXX Currently ignores alphanum/dash delims, | 4108 | ;; XXXX Currently ignores alphanum/dash delims, |
| 4047 | (defsubst cperl-highlight-charclass (endbracket dashface bsface onec-space) | 4109 | (defsubst cperl-highlight-charclass (endbracket dashface bsface onec-space) |
| 4110 | "Process the special syntax of character classes for fontification. | ||
| 4111 | ENDBRACKET is the position of the closing bracket, DASHFACE, BSFACE and | ||
| 4112 | ONEC-SPACE are the faces to be applied to a range indicator, characters | ||
| 4113 | and character escapes, respectively." | ||
| 4048 | (let ((l '(1 5 7)) ll lle lll | 4114 | (let ((l '(1 5 7)) ll lle lll |
| 4049 | ;; 2 groups, the first takes the whole match (include \[trnfabe]) | 4115 | ;; 2 groups, the first takes the whole match (include \[trnfabe]) |
| 4050 | (singleChar (concat "\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." "\\|" "\\\\x" "\\([[:xdigit:]][[:xdigit:]]?\\|\\={[[:xdigit:]]+}\\)" "\\|" "\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)"))) | 4116 | (singleChar (concat "\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." "\\|" "\\\\x" "\\([[:xdigit:]][[:xdigit:]]?\\|\\={[[:xdigit:]]+}\\)" "\\|" "\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)"))) |
| @@ -5319,12 +5385,13 @@ recursive calls in starting lines of here-documents." | |||
| 5319 | (list (car err-l) overshoot))) | 5385 | (list (car err-l) overshoot))) |
| 5320 | 5386 | ||
| 5321 | (defun cperl-find-pods-heres-region (min max) | 5387 | (defun cperl-find-pods-heres-region (min max) |
| 5388 | "Call `cperl-find-pods-heres' in the region between MIN and MAX." | ||
| 5322 | (interactive "r") | 5389 | (interactive "r") |
| 5323 | (cperl-find-pods-heres min max)) | 5390 | (cperl-find-pods-heres min max)) |
| 5324 | 5391 | ||
| 5325 | (defun cperl-backward-to-noncomment (lim) | 5392 | (defun cperl-backward-to-noncomment (lim) |
| 5326 | ;; Stops at lim or after non-whitespace that is not in comment | 5393 | "Go backward. Stop at LIM or after non-whitespace not in a comment." |
| 5327 | ;; XXXX Wrongly understands end-of-multiline strings with # as comment | 5394 | ;;XXXX Wrongly understands end-of-multiline strings with # as comment" |
| 5328 | (let (stop p pr) | 5395 | (let (stop p pr) |
| 5329 | (while (and (not stop) (> (point) (or lim (point-min)))) | 5396 | (while (and (not stop) (> (point) (or lim (point-min)))) |
| 5330 | (skip-chars-backward " \t\n\f" lim) | 5397 | (skip-chars-backward " \t\n\f" lim) |
| @@ -5345,7 +5412,7 @@ recursive calls in starting lines of here-documents." | |||
| 5345 | 5412 | ||
| 5346 | ;; Used only in `cperl-sniff-for-indent'... | 5413 | ;; Used only in `cperl-sniff-for-indent'... |
| 5347 | (defun cperl-block-p () | 5414 | (defun cperl-block-p () |
| 5348 | "Point is before ?\\{. Return true if it starts a block." | 5415 | "Return non-nil if this is the start of a block. Point is before ?\\{." |
| 5349 | ;; No save-excursion! This is more a distinguisher of a block/hash ref... | 5416 | ;; No save-excursion! This is more a distinguisher of a block/hash ref... |
| 5350 | (cperl-backward-to-noncomment (point-min)) | 5417 | (cperl-backward-to-noncomment (point-min)) |
| 5351 | (or (memq (preceding-char) (append ";){}$@&%\C-@" nil)) ; Or label! \C-@ at bobp | 5418 | (or (memq (preceding-char) (append ";){}$@&%\C-@" nil)) ; Or label! \C-@ at bobp |
| @@ -5420,8 +5487,9 @@ statement would start; thus the block in ${func()} does not count." | |||
| 5420 | (defun cperl-after-expr-p (&optional lim chars test) | 5487 | (defun cperl-after-expr-p (&optional lim chars test) |
| 5421 | "Return non-nil if the position is good for start of expression. | 5488 | "Return non-nil if the position is good for start of expression. |
| 5422 | TEST is the expression to evaluate at the found position. If absent, | 5489 | TEST is the expression to evaluate at the found position. If absent, |
| 5423 | CHARS is a string that contains good characters to have before us (however, | 5490 | CHARS is a string that contains good characters to have before |
| 5424 | `}' is treated \"smartly\" if it is not in the list)." | 5491 | us (however, `}' is treated \"smartly\" if it is not in the list). LIM |
| 5492 | is the minimal position to use." | ||
| 5425 | (let ((lim (or lim (point-min))) | 5493 | (let ((lim (or lim (point-min))) |
| 5426 | stop p) | 5494 | stop p) |
| 5427 | (cperl-update-syntaxification (point)) | 5495 | (cperl-update-syntaxification (point)) |
| @@ -5469,6 +5537,7 @@ CHARS is a string that contains good characters to have before us (however, | |||
| 5469 | 'format))))))))) | 5537 | 'format))))))))) |
| 5470 | 5538 | ||
| 5471 | (defun cperl-backward-to-start-of-expr (&optional lim) | 5539 | (defun cperl-backward-to-start-of-expr (&optional lim) |
| 5540 | "Go backward to the start of the expression, but not before LIM." | ||
| 5472 | (condition-case nil | 5541 | (condition-case nil |
| 5473 | (progn | 5542 | (progn |
| 5474 | (while (and (or (not lim) | 5543 | (while (and (or (not lim) |
| @@ -5480,6 +5549,7 @@ CHARS is a string that contains good characters to have before us (however, | |||
| 5480 | (error nil))) | 5549 | (error nil))) |
| 5481 | 5550 | ||
| 5482 | (defun cperl-at-end-of-expr (&optional lim) | 5551 | (defun cperl-at-end-of-expr (&optional lim) |
| 5552 | "Find the end of the previous expression. Do not go back beyond LIM." | ||
| 5483 | ;; Since the SEXP approach below is very fragile, do some overengineering | 5553 | ;; Since the SEXP approach below is very fragile, do some overengineering |
| 5484 | (or (looking-at (concat cperl-maybe-white-and-comment-rex "[;}]")) | 5554 | (or (looking-at (concat cperl-maybe-white-and-comment-rex "[;}]")) |
| 5485 | (condition-case nil | 5555 | (condition-case nil |
| @@ -5498,6 +5568,7 @@ CHARS is a string that contains good characters to have before us (however, | |||
| 5498 | (error t)))) | 5568 | (error t)))) |
| 5499 | 5569 | ||
| 5500 | (defun cperl-forward-to-end-of-expr (&optional lim) | 5570 | (defun cperl-forward-to-end-of-expr (&optional lim) |
| 5571 | "Go forward to the end of the expression, but not beyond LIM." | ||
| 5501 | (condition-case nil | 5572 | (condition-case nil |
| 5502 | (progn | 5573 | (progn |
| 5503 | (while (and (< (point) (or lim (point-max))) | 5574 | (while (and (< (point) (or lim (point-max))) |
| @@ -5506,6 +5577,7 @@ CHARS is a string that contains good characters to have before us (however, | |||
| 5506 | (error nil))) | 5577 | (error nil))) |
| 5507 | 5578 | ||
| 5508 | (defun cperl-backward-to-start-of-continued-exp (lim) | 5579 | (defun cperl-backward-to-start-of-continued-exp (lim) |
| 5580 | "Go backward to the start of a continuation line, but not beyond LIM." | ||
| 5509 | (if (memq (preceding-char) (append ")]}\"'`" nil)) | 5581 | (if (memq (preceding-char) (append ")]}\"'`" nil)) |
| 5510 | (forward-sexp -1)) | 5582 | (forward-sexp -1)) |
| 5511 | (beginning-of-line) | 5583 | (beginning-of-line) |
| @@ -5514,7 +5586,8 @@ CHARS is a string that contains good characters to have before us (however, | |||
| 5514 | (skip-chars-forward " \t")) | 5586 | (skip-chars-forward " \t")) |
| 5515 | 5587 | ||
| 5516 | (defun cperl-after-block-and-statement-beg (lim) | 5588 | (defun cperl-after-block-and-statement-beg (lim) |
| 5517 | "Return non-nil if the preceding ?} ends the statement." | 5589 | "Return non-nil if the preceding ?} ends the statement. |
| 5590 | Do not look before LIM." | ||
| 5518 | ;; We assume that we are after ?\} | 5591 | ;; We assume that we are after ?\} |
| 5519 | (and | 5592 | (and |
| 5520 | (cperl-after-block-p lim) | 5593 | (cperl-after-block-p lim) |
| @@ -5600,7 +5673,8 @@ conditional/loop constructs." | |||
| 5600 | 5673 | ||
| 5601 | (defun cperl-fix-line-spacing (&optional end parse-data) | 5674 | (defun cperl-fix-line-spacing (&optional end parse-data) |
| 5602 | "Improve whitespace in a conditional/loop construct. | 5675 | "Improve whitespace in a conditional/loop construct. |
| 5603 | Returns some position at the last line." | 5676 | Returns some position at the last line. |
| 5677 | Process until END, use PARSE-DATA from a previous call." | ||
| 5604 | (interactive) | 5678 | (interactive) |
| 5605 | (or end | 5679 | (or end |
| 5606 | (setq end (point-max))) | 5680 | (setq end (point-max))) |
| @@ -5825,6 +5899,7 @@ Returns some position at the last line." | |||
| 5825 | (defvar cperl-update-start) ; Do not need to make them local | 5899 | (defvar cperl-update-start) ; Do not need to make them local |
| 5826 | (defvar cperl-update-end) | 5900 | (defvar cperl-update-end) |
| 5827 | (defun cperl-delay-update-hook (beg end _old-len) | 5901 | (defun cperl-delay-update-hook (beg end _old-len) |
| 5902 | "Process reformatting between BEG and END in `after-change-functions'." | ||
| 5828 | (setq cperl-update-start (min beg (or cperl-update-start (point-max)))) | 5903 | (setq cperl-update-start (min beg (or cperl-update-start (point-max)))) |
| 5829 | (setq cperl-update-end (max end (or cperl-update-end (point-min))))) | 5904 | (setq cperl-update-end (max end (or cperl-update-end (point-min))))) |
| 5830 | 5905 | ||
| @@ -5910,7 +5985,9 @@ conditional/loop constructs." | |||
| 5910 | "Like `fill-paragraph', but handle CPerl comments. | 5985 | "Like `fill-paragraph', but handle CPerl comments. |
| 5911 | If any of the current line is a comment, fill the comment or the | 5986 | If any of the current line is a comment, fill the comment or the |
| 5912 | block of it that point is in, preserving the comment's initial | 5987 | block of it that point is in, preserving the comment's initial |
| 5913 | indentation and initial hashes. Behaves usually outside of comment." | 5988 | indentation and initial hashes. Behaves usually outside of comment. |
| 5989 | JUSTIFY is passed to `fill-paragraph'. ITERATION is for internal | ||
| 5990 | use, it indicates a recursive call." | ||
| 5914 | ;; (interactive "P") ; Only works when called from fill-paragraph. -stef | 5991 | ;; (interactive "P") ; Only works when called from fill-paragraph. -stef |
| 5915 | (let (;; Non-nil if the current line contains a comment. | 5992 | (let (;; Non-nil if the current line contains a comment. |
| 5916 | has-comment | 5993 | has-comment |
| @@ -5997,7 +6074,7 @@ indentation and initial hashes. Behaves usually outside of comment." | |||
| 5997 | t) | 6074 | t) |
| 5998 | 6075 | ||
| 5999 | (defun cperl-do-auto-fill () | 6076 | (defun cperl-do-auto-fill () |
| 6000 | ;; Break out if the line is short enough | 6077 | "Break out if the line is short enough." |
| 6001 | (if (> (save-excursion | 6078 | (if (> (save-excursion |
| 6002 | (end-of-line) | 6079 | (end-of-line) |
| 6003 | (current-column)) | 6080 | (current-column)) |
| @@ -6167,6 +6244,8 @@ comment, or POD." | |||
| 6167 | 6244 | ||
| 6168 | ;; Suggested by Mark A. Hershberger | 6245 | ;; Suggested by Mark A. Hershberger |
| 6169 | (defun cperl-outline-level () | 6246 | (defun cperl-outline-level () |
| 6247 | "Guess the outline level. 0 for a package, 1 for a sub. | ||
| 6248 | In POD, returns the level of the current heading." | ||
| 6170 | (looking-at outline-regexp) | 6249 | (looking-at outline-regexp) |
| 6171 | (cond ((not (match-beginning 1)) 0) ; beginning-of-file | 6250 | (cond ((not (match-beginning 1)) 0) ; beginning-of-file |
| 6172 | ;; 2=package-group, 5=package-name 8=sub-name 16=head-level | 6251 | ;; 2=package-group, 5=package-name 8=sub-name 16=head-level |
| @@ -6201,19 +6280,22 @@ comment, or POD." | |||
| 6201 | "Additional expressions to highlight in Perl mode. Maximal set.") | 6280 | "Additional expressions to highlight in Perl mode. Maximal set.") |
| 6202 | 6281 | ||
| 6203 | (defun cperl-load-font-lock-keywords () | 6282 | (defun cperl-load-font-lock-keywords () |
| 6283 | "Initialize the default set of cperl faces." | ||
| 6204 | (or cperl-faces-init (cperl-init-faces)) | 6284 | (or cperl-faces-init (cperl-init-faces)) |
| 6205 | cperl-font-lock-keywords) | 6285 | cperl-font-lock-keywords) |
| 6206 | 6286 | ||
| 6207 | (defun cperl-load-font-lock-keywords-1 () | 6287 | (defun cperl-load-font-lock-keywords-1 () |
| 6288 | "Initialize the minimal set of cperl faces." | ||
| 6208 | (or cperl-faces-init (cperl-init-faces)) | 6289 | (or cperl-faces-init (cperl-init-faces)) |
| 6209 | cperl-font-lock-keywords-1) | 6290 | cperl-font-lock-keywords-1) |
| 6210 | 6291 | ||
| 6211 | (defun cperl-load-font-lock-keywords-2 () | 6292 | (defun cperl-load-font-lock-keywords-2 () |
| 6293 | "Initialize the maximal set of cperl faces." | ||
| 6212 | (or cperl-faces-init (cperl-init-faces)) | 6294 | (or cperl-faces-init (cperl-init-faces)) |
| 6213 | cperl-font-lock-keywords-2) | 6295 | cperl-font-lock-keywords-2) |
| 6214 | 6296 | ||
| 6215 | (defun cperl-font-lock-syntactic-face-function (state) | 6297 | (defun cperl-font-lock-syntactic-face-function (state) |
| 6216 | "Apply faces according to their syntax type. | 6298 | "Apply faces according to their syntax type, given as STATE. |
| 6217 | In CPerl mode, this is used for here-documents which have been | 6299 | In CPerl mode, this is used for here-documents which have been |
| 6218 | marked as c-style comments. For everything else, delegate to the | 6300 | marked as c-style comments. For everything else, delegate to the |
| 6219 | default function." | 6301 | default function." |
| @@ -6233,6 +6315,7 @@ builtin functions to be fontified like, well, builtin | |||
| 6233 | functions (which they are not). Inherits from `default'.") | 6315 | functions (which they are not). Inherits from `default'.") |
| 6234 | 6316 | ||
| 6235 | (defun cperl-init-faces () | 6317 | (defun cperl-init-faces () |
| 6318 | "Initialize the faces for CPerl mode." | ||
| 6236 | (condition-case errs | 6319 | (condition-case errs |
| 6237 | (progn | 6320 | (progn |
| 6238 | (let (t-font-lock-keywords t-font-lock-keywords-1) | 6321 | (let (t-font-lock-keywords t-font-lock-keywords-1) |
| @@ -6910,12 +6993,13 @@ else | |||
| 6910 | ) | 6993 | ) |
| 6911 | ("Current")) | 6994 | ("Current")) |
| 6912 | "List of variables to set to get a particular indentation style. | 6995 | "List of variables to set to get a particular indentation style. |
| 6913 | Should be used via `cperl-set-style', `cperl-file-style' or via Perl menu. | 6996 | Should be used via `cperl-set-style', command `cperl-file-style' or via |
| 6997 | Perl menu. | ||
| 6914 | 6998 | ||
| 6915 | See examples in `cperl-style-examples'.") | 6999 | See examples in `cperl-style-examples'.") |
| 6916 | 7000 | ||
| 6917 | (defun cperl-set-style (style) | 7001 | (defun cperl-set-style (style) |
| 6918 | "Set CPerl mode variables to use one of several different indentation styles. | 7002 | "Set CPerl indentation variables to STYLE, one of the predefined styles. |
| 6919 | This command sets the default values for the variables. It does | 7003 | This command sets the default values for the variables. It does |
| 6920 | not affect buffers visiting files where the style has been set as | 7004 | not affect buffers visiting files where the style has been set as |
| 6921 | a file or directory variable. To change the indentation style of | 7005 | a file or directory variable. To change the indentation style of |
| @@ -6971,9 +7055,9 @@ and \"Whitesmith\"." | |||
| 6971 | noerror)) | 7055 | noerror)) |
| 6972 | 7056 | ||
| 6973 | (defun cperl-info-buffer (type) | 7057 | (defun cperl-info-buffer (type) |
| 6974 | ;; Return buffer with documentation. Creates if missing. | 7058 | "Return buffer with documentation. Create if missing. |
| 6975 | ;; If TYPE, this vars buffer. | 7059 | If TYPE, this vars buffer. |
| 6976 | ;; Special care is taken to not stomp over an existing info buffer | 7060 | Special care is taken to not stomp over an existing info buffer" |
| 6977 | (let* ((bname (if type "*info-perl-var*" "*info-perl*")) | 7061 | (let* ((bname (if type "*info-perl-var*" "*info-perl*")) |
| 6978 | (info (get-buffer bname)) | 7062 | (info (get-buffer bname)) |
| 6979 | (oldbuf (get-buffer "*info*"))) | 7063 | (oldbuf (get-buffer "*info*"))) |
| @@ -7009,6 +7093,8 @@ and \"Whitesmith\"." | |||
| 7009 | 'find-tag-default)))))) | 7093 | 'find-tag-default)))))) |
| 7010 | 7094 | ||
| 7011 | (defun cperl-info-on-command (command) | 7095 | (defun cperl-info-on-command (command) |
| 7096 | "Show an info buffer for COMMAND. | ||
| 7097 | This is obsolete because Perl info pages are no longer distributed." | ||
| 7012 | (declare (obsolete cperl-perldoc "30.1")) | 7098 | (declare (obsolete cperl-perldoc "30.1")) |
| 7013 | (interactive | 7099 | (interactive |
| 7014 | (let* ((default (cperl-word-at-point)) | 7100 | (let* ((default (cperl-word-at-point)) |
| @@ -7080,11 +7166,15 @@ and \"Whitesmith\"." | |||
| 7080 | (select-window iniwin))) | 7166 | (select-window iniwin))) |
| 7081 | 7167 | ||
| 7082 | (defun cperl-info-on-current-command () | 7168 | (defun cperl-info-on-current-command () |
| 7169 | "Show an info buffer for the current command. | ||
| 7170 | This is obsolete because Perl info pages are no longer distributed." | ||
| 7083 | (declare (obsolete cperl-perldoc "30.1")) | 7171 | (declare (obsolete cperl-perldoc "30.1")) |
| 7084 | (interactive) | 7172 | (interactive) |
| 7085 | (cperl-perldoc (cperl-word-at-point))) | 7173 | (cperl-perldoc (cperl-word-at-point))) |
| 7086 | 7174 | ||
| 7087 | (defun cperl-imenu-info-imenu-search () | 7175 | (defun cperl-imenu-info-imenu-search () |
| 7176 | "Search a Perl info buffer. | ||
| 7177 | This is obsolete because Perl info pages are no longer distributed." | ||
| 7088 | (declare (obsolete nil "30.1")) | 7178 | (declare (obsolete nil "30.1")) |
| 7089 | (if (looking-at "^-X[ \t\n]") nil | 7179 | (if (looking-at "^-X[ \t\n]") nil |
| 7090 | (re-search-backward | 7180 | (re-search-backward |
| @@ -7092,6 +7182,8 @@ and \"Whitesmith\"." | |||
| 7092 | (forward-line 1))) | 7182 | (forward-line 1))) |
| 7093 | 7183 | ||
| 7094 | (defun cperl-imenu-info-imenu-name () | 7184 | (defun cperl-imenu-info-imenu-name () |
| 7185 | "Return the name of a Perl info buffer. | ||
| 7186 | This is obsolete because Perl info pages are no longer distributed." | ||
| 7095 | (declare (obsolete nil "30.1")) | 7187 | (declare (obsolete nil "30.1")) |
| 7096 | (buffer-substring | 7188 | (buffer-substring |
| 7097 | (match-beginning 1) (match-end 1))) | 7189 | (match-beginning 1) (match-end 1))) |
| @@ -7099,6 +7191,8 @@ and \"Whitesmith\"." | |||
| 7099 | (declare-function imenu-choose-buffer-index "imenu" (&optional prompt alist)) | 7191 | (declare-function imenu-choose-buffer-index "imenu" (&optional prompt alist)) |
| 7100 | 7192 | ||
| 7101 | (defun cperl-imenu-on-info () | 7193 | (defun cperl-imenu-on-info () |
| 7194 | "Create an imenu index for a Perl info page. | ||
| 7195 | This is obsolete because Perl info pages are no longer distributed." | ||
| 7102 | (declare (obsolete nil "30.1")) | 7196 | (declare (obsolete nil "30.1")) |
| 7103 | (interactive) | 7197 | (interactive) |
| 7104 | (message | 7198 | (message |
| @@ -7106,7 +7200,7 @@ and \"Whitesmith\"." | |||
| 7106 | "Consider installing the perl-doc package from GNU ELPA."))) | 7200 | "Consider installing the perl-doc package from GNU ELPA."))) |
| 7107 | 7201 | ||
| 7108 | (defun cperl-lineup (beg end &optional step minshift) | 7202 | (defun cperl-lineup (beg end &optional step minshift) |
| 7109 | "Lineup construction in a region. | 7203 | "Lineup construction in a region from BEG to END. |
| 7110 | Beginning of region should be at the start of a construction. | 7204 | Beginning of region should be at the start of a construction. |
| 7111 | All first occurrences of this construction in the lines that are | 7205 | All first occurrences of this construction in the lines that are |
| 7112 | partially contained in the region are lined up at the same column. | 7206 | partially contained in the region are lined up at the same column. |
| @@ -7164,7 +7258,8 @@ Will not move the position at the start to the left." | |||
| 7164 | (goto-char (match-beginning 0)))))))) ; No body | 7258 | (goto-char (match-beginning 0)))))))) ; No body |
| 7165 | 7259 | ||
| 7166 | (defun cperl-etags (&optional add all files) ;; NOT USED??? | 7260 | (defun cperl-etags (&optional add all files) ;; NOT USED??? |
| 7167 | "Run etags with appropriate options for Perl files. | 7261 | "Run etags with appropriate options for Perl FILES. |
| 7262 | Add to the current tags file if ADD is non-nil. | ||
| 7168 | If optional argument ALL is `recursive', will process Perl files | 7263 | If optional argument ALL is `recursive', will process Perl files |
| 7169 | in subdirectories too." | 7264 | in subdirectories too." |
| 7170 | ;; Apparently etags doesn't support UTF-8 encoded sources, and usage | 7265 | ;; Apparently etags doesn't support UTF-8 encoded sources, and usage |
| @@ -7252,8 +7347,9 @@ Delay of auto-help controlled by `cperl-lazy-help-time'." | |||
| 7252 | 7347 | ||
| 7253 | (defun cperl-toggle-set-debug-unwind (arg &optional backtrace) | 7348 | (defun cperl-toggle-set-debug-unwind (arg &optional backtrace) |
| 7254 | "Toggle (or, with numeric argument, set) debugging state of syntaxification. | 7349 | "Toggle (or, with numeric argument, set) debugging state of syntaxification. |
| 7255 | Nonpositive numeric argument disables debugging messages. The message | 7350 | Nonpositive numeric argument ARG disables debugging messages. The |
| 7256 | summarizes which regions it was decided to rescan for syntactic constructs. | 7351 | message summarizes which regions it was decided to rescan for syntactic |
| 7352 | constructs. BACKTRACE is added to ARG if provided. | ||
| 7257 | 7353 | ||
| 7258 | The message looks like this: | 7354 | The message looks like this: |
| 7259 | 7355 | ||
| @@ -7279,6 +7375,7 @@ by CPerl." | |||
| 7279 | (defvar cperl-tmp-buffer " *cperl-tmp*") | 7375 | (defvar cperl-tmp-buffer " *cperl-tmp*") |
| 7280 | 7376 | ||
| 7281 | (defun cperl-setup-tmp-buf () | 7377 | (defun cperl-setup-tmp-buf () |
| 7378 | "Prepare a temporary buffer for internal use during tags file creation." | ||
| 7282 | (set-buffer (get-buffer-create cperl-tmp-buffer)) | 7379 | (set-buffer (get-buffer-create cperl-tmp-buffer)) |
| 7283 | (set-syntax-table cperl-mode-syntax-table) | 7380 | (set-syntax-table cperl-mode-syntax-table) |
| 7284 | (buffer-disable-undo) | 7381 | (buffer-disable-undo) |
| @@ -7302,6 +7399,7 @@ Does not move point." | |||
| 7302 | beg)))) | 7399 | beg)))) |
| 7303 | 7400 | ||
| 7304 | (defun cperl-xsub-scan () | 7401 | (defun cperl-xsub-scan () |
| 7402 | "Scan for XS subroutines." | ||
| 7305 | (require 'imenu) | 7403 | (require 'imenu) |
| 7306 | (let ((index-alist '()) | 7404 | (let ((index-alist '()) |
| 7307 | index index1 name package prefix) | 7405 | index index1 name package prefix) |
| @@ -7346,6 +7444,8 @@ Does not move point." | |||
| 7346 | (defvar cperl-unreadable-ok nil) | 7444 | (defvar cperl-unreadable-ok nil) |
| 7347 | 7445 | ||
| 7348 | (defun cperl-find-tags (ifile xs topdir) | 7446 | (defun cperl-find-tags (ifile xs topdir) |
| 7447 | "Find tags in IFILE. Treat as an XS file if non-nil. | ||
| 7448 | Entries are made relative to TOPDIR." | ||
| 7349 | (let ((b (get-buffer cperl-tmp-buffer)) ind lst elt pos ret rel | 7449 | (let ((b (get-buffer cperl-tmp-buffer)) ind lst elt pos ret rel |
| 7350 | (cperl-pod-here-fontify nil) file) | 7450 | (cperl-pod-here-fontify nil) file) |
| 7351 | (save-excursion | 7451 | (save-excursion |
| @@ -7452,16 +7552,17 @@ is relocated, the file TAGS inside it breaks). Use as | |||
| 7452 | (defun cperl-add-tags-recurse () | 7552 | (defun cperl-add-tags-recurse () |
| 7453 | "Add to TAGS file data for Perl files in the current directory and kids. | 7553 | "Add to TAGS file data for Perl files in the current directory and kids. |
| 7454 | Use as | 7554 | Use as |
| 7455 | emacs -batch -q -no-site-file -l emacs/cperl-mode.el \\ | 7555 | Emacs -batch -q -no-site-file -l emacs/cperl-mode.el \\ |
| 7456 | -f cperl-add-tags-recurse" | 7556 | -f `cperl-add-tags-recurse'" |
| 7457 | (cperl-write-tags nil nil t t)) | 7557 | (cperl-write-tags nil nil t t)) |
| 7458 | 7558 | ||
| 7459 | (defvar cperl-tags-file-name "TAGS" | 7559 | (defvar cperl-tags-file-name "TAGS" |
| 7460 | "TAGS file name to use in `cperl-write-tags'.") | 7560 | "TAGS file name to use in `cperl-write-tags'.") |
| 7461 | 7561 | ||
| 7462 | (defun cperl-write-tags (&optional file erase recurse dir inbuffer noxs topdir) | 7562 | (defun cperl-write-tags (&optional file erase recurse dir inbuffer noxs topdir) |
| 7463 | ;; If INBUFFER, do not select buffer, and do not save | 7563 | "Write tags for FILE. If this is a directory, RECURSE if non-nil. |
| 7464 | ;; If ERASE is `ignore', do not erase, and do not try to delete old info. | 7564 | If ERASE is `ignore', do not erase, and do not try to delete old info. |
| 7565 | If INBUFFER, do not select buffer, and do not save." | ||
| 7465 | (require 'etags) | 7566 | (require 'etags) |
| 7466 | (if file nil | 7567 | (if file nil |
| 7467 | (setq file (if dir default-directory (buffer-file-name))) | 7568 | (setq file (if dir default-directory (buffer-file-name))) |
| @@ -7557,7 +7658,7 @@ Use as | |||
| 7557 | (declare-function etags-snarf-tag "etags" (&optional use-explicit)) | 7658 | (declare-function etags-snarf-tag "etags" (&optional use-explicit)) |
| 7558 | 7659 | ||
| 7559 | (defun cperl-tags-hier-fill () | 7660 | (defun cperl-tags-hier-fill () |
| 7560 | ;; Suppose we are in a tag table cooked by cperl. | 7661 | "Fill a tags hierarchy if in a tag table cooked by cperl." |
| 7561 | (goto-char 1) | 7662 | (goto-char 1) |
| 7562 | (let (pack name line ord cons1 file info fileind) | 7663 | (let (pack name line ord cons1 file info fileind) |
| 7563 | (while (re-search-forward cperl-tags-hier-regexp-list nil t) | 7664 | (while (re-search-forward cperl-tags-hier-regexp-list nil t) |
| @@ -7604,7 +7705,8 @@ Use as | |||
| 7604 | "Show hierarchical menu of classes and methods. | 7705 | "Show hierarchical menu of classes and methods. |
| 7605 | Finds info about classes by a scan of loaded TAGS files. | 7706 | Finds info about classes by a scan of loaded TAGS files. |
| 7606 | Supposes that the TAGS files contain fully qualified function names. | 7707 | Supposes that the TAGS files contain fully qualified function names. |
| 7607 | One may build such TAGS files from CPerl mode menu." | 7708 | One may build such TAGS files from CPerl mode menu. |
| 7709 | If UPDATE is non-nil, update the tags table." | ||
| 7608 | (interactive) | 7710 | (interactive) |
| 7609 | (require 'etags) | 7711 | (require 'etags) |
| 7610 | (require 'imenu) | 7712 | (require 'imenu) |
| @@ -7651,6 +7753,8 @@ One may build such TAGS files from CPerl mode menu." | |||
| 7651 | (if (eq update -999) (cperl-tags-hier-init t))) | 7753 | (if (eq update -999) (cperl-tags-hier-init t))) |
| 7652 | 7754 | ||
| 7653 | (defun cperl-tags-treeify (to level) | 7755 | (defun cperl-tags-treeify (to level) |
| 7756 | "Build a tree for the tags hierarchy into TO. | ||
| 7757 | LEVEL us the current level during the recursive calls." | ||
| 7654 | ;; cadr of `to' is read-write. On start it is a cons | 7758 | ;; cadr of `to' is read-write. On start it is a cons |
| 7655 | (let* ((regexp (concat "^\\(" (mapconcat | 7759 | (let* ((regexp (concat "^\\(" (mapconcat |
| 7656 | #'identity | 7760 | #'identity |
| @@ -7719,6 +7823,7 @@ One may build such TAGS files from CPerl mode menu." | |||
| 7719 | root-packages)))) | 7823 | root-packages)))) |
| 7720 | 7824 | ||
| 7721 | (defun cperl-list-fold (list name limit) | 7825 | (defun cperl-list-fold (list name limit) |
| 7826 | "Fold LIST with name NAME into sublists with LIMIT members or less." | ||
| 7722 | (let (list1 list2 elt1 (num 0)) | 7827 | (let (list1 list2 elt1 (num 0)) |
| 7723 | (if (<= (length list) limit) list | 7828 | (if (<= (length list) limit) list |
| 7724 | (setq list1 nil list2 nil) | 7829 | (setq list1 nil list2 nil) |
| @@ -7738,6 +7843,7 @@ One may build such TAGS files from CPerl mode menu." | |||
| 7738 | list1))))) | 7843 | list1))))) |
| 7739 | 7844 | ||
| 7740 | (defun cperl-menu-to-keymap (menu) | 7845 | (defun cperl-menu-to-keymap (menu) |
| 7846 | "Prepare MENU for display with `imenu'." | ||
| 7741 | (let (list) | 7847 | (let (list) |
| 7742 | (cons 'keymap | 7848 | (cons 'keymap |
| 7743 | (mapcar | 7849 | (mapcar |
| @@ -7787,7 +7893,8 @@ One may build such TAGS files from CPerl mode menu." | |||
| 7787 | ;;"[*/+-|&<.]+=" | 7893 | ;;"[*/+-|&<.]+=" |
| 7788 | ) | 7894 | ) |
| 7789 | "\\|") | 7895 | "\\|") |
| 7790 | "If matches at the start of match found by `my-bad-c-style-regexp', | 7896 | "Lisp Regular expression for things regularly occuring in a Perl regex. |
| 7897 | If matches at the start of match found by `my-bad-c-style-regexp', | ||
| 7791 | insertion of a whitespace will not help.") | 7898 | insertion of a whitespace will not help.") |
| 7792 | 7899 | ||
| 7793 | (defvar found-bad) | 7900 | (defvar found-bad) |
| @@ -7824,6 +7931,7 @@ Currently it is tuned to C and Perl syntax." | |||
| 7824 | (message "No appropriate place found")))) | 7931 | (message "No appropriate place found")))) |
| 7825 | 7932 | ||
| 7826 | (defun cperl-next-bad-style () | 7933 | (defun cperl-next-bad-style () |
| 7934 | "Proceed to the next occurrence of bad regexp style." | ||
| 7827 | (let (p (not-found t) found) | 7935 | (let (p (not-found t) found) |
| 7828 | (while (and not-found | 7936 | (while (and not-found |
| 7829 | (re-search-forward cperl-bad-style-regexp nil 'to-end)) | 7937 | (re-search-forward cperl-bad-style-regexp nil 'to-end)) |
| @@ -7874,6 +7982,7 @@ Currently it is tuned to C and Perl syntax." | |||
| 7874 | (defvar cperl-help-from-timer nil) | 7982 | (defvar cperl-help-from-timer nil) |
| 7875 | 7983 | ||
| 7876 | (defun cperl-word-at-point-hard () | 7984 | (defun cperl-word-at-point-hard () |
| 7985 | "Try hard to find a useful token for Perl at point." | ||
| 7877 | ;; Does not save-excursion | 7986 | ;; Does not save-excursion |
| 7878 | ;; Get to the something meaningful | 7987 | ;; Get to the something meaningful |
| 7879 | (or (eobp) (eolp) (forward-char 1)) | 7988 | (or (eobp) (eolp) (forward-char 1)) |
| @@ -7951,7 +8060,7 @@ than a line. Your contribution to update/shorten it is appreciated." | |||
| 7951 | "Where the documentation can be found.") | 8060 | "Where the documentation can be found.") |
| 7952 | 8061 | ||
| 7953 | (defun cperl-describe-perl-symbol (val) | 8062 | (defun cperl-describe-perl-symbol (val) |
| 7954 | "Display the documentation of symbol at point, a Perl operator." | 8063 | "Display the documentation of symbol VAL at point, a Perl operator." |
| 7955 | (let ((enable-recursive-minibuffers t) | 8064 | (let ((enable-recursive-minibuffers t) |
| 7956 | regexp) | 8065 | regexp) |
| 7957 | (cond | 8066 | (cond |
| @@ -7994,7 +8103,8 @@ than a line. Your contribution to update/shorten it is appreciated." | |||
| 7994 | 8103 | ||
| 7995 | (defvar cperl-short-docs 'please-ignore-this-line | 8104 | (defvar cperl-short-docs 'please-ignore-this-line |
| 7996 | ;; Perl4 version was written by Johan Vromans (jvromans@squirrel.nl) | 8105 | ;; Perl4 version was written by Johan Vromans (jvromans@squirrel.nl) |
| 7997 | "# based on \\='@(#)@ perl-descr.el 1.9 - describe-perl-symbol\\=' [Perl 5] | 8106 | "Short documentation of Perl functions and variables. |
| 8107 | # based on \\='@(#)@ perl-descr.el 1.9 - describe-perl-symbol\\=' [Perl 5] | ||
| 7998 | ... Range (list context); flip/flop [no flop when flip] (scalar context). | 8108 | ... Range (list context); flip/flop [no flop when flip] (scalar context). |
| 7999 | ! ... Logical negation. | 8109 | ! ... Logical negation. |
| 8000 | ... != ... Numeric inequality. | 8110 | ... != ... Numeric inequality. |
| @@ -8437,7 +8547,8 @@ while (EXPR) { ... } EXPR while EXPR | |||
| 8437 | =encoding encodingname Encoding of the document.") | 8547 | =encoding encodingname Encoding of the document.") |
| 8438 | 8548 | ||
| 8439 | (defun cperl-switch-to-doc-buffer (&optional interactive) | 8549 | (defun cperl-switch-to-doc-buffer (&optional interactive) |
| 8440 | "Go to the Perl documentation buffer and insert the documentation." | 8550 | "Go to the Perl documentation buffer and insert the documentation. |
| 8551 | If INTERACTIVE, open a new window for this buffer." | ||
| 8441 | (interactive "p") | 8552 | (interactive "p") |
| 8442 | (let ((buf (get-buffer-create cperl-doc-buffer))) | 8553 | (let ((buf (get-buffer-create cperl-doc-buffer))) |
| 8443 | (if interactive | 8554 | (if interactive |
| @@ -8450,11 +8561,12 @@ while (EXPR) { ... } EXPR while EXPR | |||
| 8450 | (setq buffer-read-only t))))) | 8561 | (setq buffer-read-only t))))) |
| 8451 | 8562 | ||
| 8452 | (defun cperl-beautify-regexp-piece (b e embed level) | 8563 | (defun cperl-beautify-regexp-piece (b e embed level) |
| 8564 | "Beautify part of a regexp from B to E. | ||
| 8565 | If EMBED is nil, process the whole regular expression. Recurse to depth | ||
| 8566 | LEVEL." | ||
| 8453 | ;; b is before the starting delimiter, e before the ending | 8567 | ;; b is before the starting delimiter, e before the ending |
| 8454 | ;; e should be a marker, may be changed, but remains "correct". | 8568 | ;; e should be a marker, may be changed, but remains "correct". |
| 8455 | ;; EMBED is nil if we process the whole REx. | ||
| 8456 | ;; The REx is guaranteed to have //x | 8569 | ;; The REx is guaranteed to have //x |
| 8457 | ;; LEVEL shows how many levels deep to go | ||
| 8458 | ;; position at enter and at leave is not defined | 8570 | ;; position at enter and at leave is not defined |
| 8459 | (let (s c tmp (m (make-marker)) (m1 (make-marker)) c1 spaces inline pos) | 8571 | (let (s c tmp (m (make-marker)) (m1 (make-marker)) c1 spaces inline pos) |
| 8460 | (if embed | 8572 | (if embed |
| @@ -8638,6 +8750,7 @@ while (EXPR) { ... } EXPR while EXPR | |||
| 8638 | (cperl-make-indent c))))) | 8750 | (cperl-make-indent c))))) |
| 8639 | 8751 | ||
| 8640 | (defun cperl-make-regexp-x () | 8752 | (defun cperl-make-regexp-x () |
| 8753 | "Ensure that a regular expression has a \"/x\" modifier." | ||
| 8641 | ;; Returns position of the start | 8754 | ;; Returns position of the start |
| 8642 | ;; XXX this is called too often! Need to cache the result! | 8755 | ;; XXX this is called too often! Need to cache the result! |
| 8643 | (save-excursion | 8756 | (save-excursion |
| @@ -8673,7 +8786,8 @@ while (EXPR) { ... } EXPR while EXPR | |||
| 8673 | b))) | 8786 | b))) |
| 8674 | 8787 | ||
| 8675 | (defun cperl-beautify-regexp (&optional deep) | 8788 | (defun cperl-beautify-regexp (&optional deep) |
| 8676 | "Do it. (Experimental, may change semantics, recheck the result.) | 8789 | "Beautify a regular expression to level DEEP. |
| 8790 | \(Experimental, may change semantics, recheck the result.) | ||
| 8677 | We suppose that the regexp is scanned already." | 8791 | We suppose that the regexp is scanned already." |
| 8678 | (interactive "P") | 8792 | (interactive "P") |
| 8679 | (setq deep (if deep (prefix-numeric-value deep) -1)) | 8793 | (setq deep (if deep (prefix-numeric-value deep) -1)) |
| @@ -8743,6 +8857,7 @@ We suppose that the regexp is scanned already." | |||
| 8743 | 8857 | ||
| 8744 | (defun cperl-beautify-level (&optional deep) | 8858 | (defun cperl-beautify-level (&optional deep) |
| 8745 | "Find an enclosing group in regexp and beautify it. | 8859 | "Find an enclosing group in regexp and beautify it. |
| 8860 | Recurse to DEEP levels. | ||
| 8746 | \(Experimental, may change semantics, recheck the result.) | 8861 | \(Experimental, may change semantics, recheck the result.) |
| 8747 | We suppose that the regexp is scanned already." | 8862 | We suppose that the regexp is scanned already." |
| 8748 | (interactive "P") | 8863 | (interactive "P") |
| @@ -9074,7 +9189,7 @@ If a region is highlighted, restricts to the region." | |||
| 9074 | (cperl-pod-spell t)) | 9189 | (cperl-pod-spell t)) |
| 9075 | 9190 | ||
| 9076 | (defun cperl-pod-spell (&optional do-heres) | 9191 | (defun cperl-pod-spell (&optional do-heres) |
| 9077 | "Spell-check POD documentation. | 9192 | "Spell-check POD documentation. Do here-docs if DO-HERES. |
| 9078 | If invoked with prefix argument, will do HERE-DOCs instead. | 9193 | If invoked with prefix argument, will do HERE-DOCs instead. |
| 9079 | If a region is highlighted, restricts to the region." | 9194 | If a region is highlighted, restricts to the region." |
| 9080 | (interactive "P") | 9195 | (interactive "P") |
| @@ -9097,9 +9212,9 @@ If a region is highlighted, restricts to the region." | |||
| 9097 | beg end)))) | 9212 | beg end)))) |
| 9098 | 9213 | ||
| 9099 | (defun cperl-map-pods-heres (func &optional prop s end) | 9214 | (defun cperl-map-pods-heres (func &optional prop s end) |
| 9100 | "Execute a function over regions of pods or here-documents. | 9215 | "Execute FUNC over regions of pods or here-documents. |
| 9101 | PROP is the text-property to search for; default to `in-pod'. Stop when | 9216 | Start at S. PROP is the text-property to search for; default to |
| 9102 | function returns nil." | 9217 | `in-pod'. Stop at END or when FUNC returns nil." |
| 9103 | (let (pos posend has-prop (cont t)) | 9218 | (let (pos posend has-prop (cont t)) |
| 9104 | (or prop (setq prop 'in-pod)) | 9219 | (or prop (setq prop 'in-pod)) |
| 9105 | (or s (setq s (point-min))) | 9220 | (or s (setq s (point-min))) |
| @@ -9116,9 +9231,9 @@ function returns nil." | |||
| 9116 | 9231 | ||
| 9117 | ;; Based on code by Masatake YAMATO: | 9232 | ;; Based on code by Masatake YAMATO: |
| 9118 | (defun cperl-get-here-doc-region (&optional pos pod) | 9233 | (defun cperl-get-here-doc-region (&optional pos pod) |
| 9119 | "Return HERE document region around the point. | 9234 | "Return HERE document region around POS. |
| 9120 | Return nil if the point is not in a HERE document region. If POD is non-nil, | 9235 | Return nil if the point is not in a HERE document region. If POD is |
| 9121 | will return a POD section if point is in a POD section." | 9236 | non-nil, will return a POD section if point is in a POD section." |
| 9122 | (or pos (setq pos (point))) | 9237 | (or pos (setq pos (point))) |
| 9123 | (cperl-update-syntaxification pos) | 9238 | (cperl-update-syntaxification pos) |
| 9124 | (if (or (eq 'here-doc (get-text-property pos 'syntax-type)) | 9239 | (if (or (eq 'here-doc (get-text-property pos 'syntax-type)) |
| @@ -9152,10 +9267,9 @@ POS defaults to the point." | |||
| 9152 | 9267 | ||
| 9153 | (defun cperl-facemenu-add-face-function (face _end) | 9268 | (defun cperl-facemenu-add-face-function (face _end) |
| 9154 | "A callback to process user-initiated font-change requests. | 9269 | "A callback to process user-initiated font-change requests. |
| 9155 | Translates `bold', `italic', and `bold-italic' requests to insertion of | 9270 | Translates FACE which is one of `bold', `italic', and `bold-italic' to |
| 9156 | corresponding POD directives, and `underline' to C<> POD directive. | 9271 | insertion of corresponding POD directives, and `underline' to C<> POD |
| 9157 | 9272 | directive." | |
| 9158 | Such requests are usually bound to M-o LETTER." | ||
| 9159 | (or (get-text-property (point) 'in-pod) | 9273 | (or (get-text-property (point) 'in-pod) |
| 9160 | (error "Faces can only be set within POD")) | 9274 | (error "Faces can only be set within POD")) |
| 9161 | (setq facemenu-end-add-face (if (eq face 'bold-italic) ">>" ">")) | 9275 | (setq facemenu-end-add-face (if (eq face 'bold-italic) ">>" ">")) |
| @@ -9253,9 +9367,11 @@ Delay of auto-help controlled by `cperl-lazy-help-time'." | |||
| 9253 | (setq cperl-lazy-installed nil)) | 9367 | (setq cperl-lazy-installed nil)) |
| 9254 | 9368 | ||
| 9255 | (defun cperl-lazy-hook () | 9369 | (defun cperl-lazy-hook () |
| 9370 | "Set display of cperl short-docs to be shown when idle." | ||
| 9256 | (setq cperl-help-shown nil)) | 9371 | (setq cperl-help-shown nil)) |
| 9257 | 9372 | ||
| 9258 | (defun cperl-get-help-defer () | 9373 | (defun cperl-get-help-defer () |
| 9374 | "Hook to display short-docs when idle." | ||
| 9259 | (if (not (memq major-mode '(perl-mode cperl-mode))) nil | 9375 | (if (not (memq major-mode '(perl-mode cperl-mode))) nil |
| 9260 | (let ((cperl-message-on-help-error nil) (cperl-help-from-timer t)) | 9376 | (let ((cperl-message-on-help-error nil) (cperl-help-from-timer t)) |
| 9261 | (cperl-get-help) | 9377 | (cperl-get-help) |
| @@ -9266,12 +9382,14 @@ Delay of auto-help controlled by `cperl-lazy-help-time'." | |||
| 9266 | ;;; Plug for wrong font-lock: | 9382 | ;;; Plug for wrong font-lock: |
| 9267 | 9383 | ||
| 9268 | (defun cperl-font-lock-unfontify-region-function (beg end) | 9384 | (defun cperl-font-lock-unfontify-region-function (beg end) |
| 9385 | "Remove fontification between BEG and END." | ||
| 9269 | (declare (obsolete nil "30.1")) | 9386 | (declare (obsolete nil "30.1")) |
| 9270 | (with-silent-modifications | 9387 | (with-silent-modifications |
| 9271 | (remove-text-properties beg end '(face nil)))) | 9388 | (remove-text-properties beg end '(face nil)))) |
| 9272 | 9389 | ||
| 9273 | (defun cperl-font-lock-fontify-region-function (beg end loudly) | 9390 | (defun cperl-font-lock-fontify-region-function (beg end loudly) |
| 9274 | "Extend the region to safe positions, then call the default function. | 9391 | "Extend the region to safe positions, then call the default function. |
| 9392 | Process from BEG to END. LOUDLY is passed to the default function. | ||
| 9275 | Newer `font-lock's can do it themselves. | 9393 | Newer `font-lock's can do it themselves. |
| 9276 | We unwind only as far as needed for fontification. Syntaxification may | 9394 | We unwind only as far as needed for fontification. Syntaxification may |
| 9277 | do extra unwind via `cperl-unwind-to-safe'." | 9395 | do extra unwind via `cperl-unwind-to-safe'." |
| @@ -9300,6 +9418,7 @@ do extra unwind via `cperl-unwind-to-safe'." | |||
| 9300 | (font-lock-default-fontify-region beg end loudly)) | 9418 | (font-lock-default-fontify-region beg end loudly)) |
| 9301 | 9419 | ||
| 9302 | (defun cperl-fontify-syntactically (end) | 9420 | (defun cperl-fontify-syntactically (end) |
| 9421 | "Find and apply text properties for \"hard\" syntax to END." | ||
| 9303 | ;; Some vars for debugging only | 9422 | ;; Some vars for debugging only |
| 9304 | ;; (message "Syntaxifying...") | 9423 | ;; (message "Syntaxifying...") |
| 9305 | (let ((dbg (point)) (iend end) (idone cperl-syntax-done-to) | 9424 | (let ((dbg (point)) (iend end) (idone cperl-syntax-done-to) |
| @@ -9329,6 +9448,8 @@ do extra unwind via `cperl-unwind-to-safe'." | |||
| 9329 | nil)) ; Do not iterate | 9448 | nil)) ; Do not iterate |
| 9330 | 9449 | ||
| 9331 | (defun cperl-fontify-update (end) | 9450 | (defun cperl-fontify-update (end) |
| 9451 | "Function to convert postponed fontification up to END to actual faces. | ||
| 9452 | This function is part of our `font-lock-defaults'." | ||
| 9332 | (let ((pos (point-min)) prop posend) | 9453 | (let ((pos (point-min)) prop posend) |
| 9333 | (setq end (point-max)) | 9454 | (setq end (point-max)) |
| 9334 | (while (< pos end) | 9455 | (while (< pos end) |
| @@ -9339,6 +9460,8 @@ do extra unwind via `cperl-unwind-to-safe'." | |||
| 9339 | nil) ; Do not iterate | 9460 | nil) ; Do not iterate |
| 9340 | 9461 | ||
| 9341 | (defun cperl-fontify-update-bad (end) | 9462 | (defun cperl-fontify-update-bad (end) |
| 9463 | "Process postponed fontification to end of buffer, ignoring END. | ||
| 9464 | This function is no longer needed." | ||
| 9342 | ;; Since fontification happens with different region than syntaxification, | 9465 | ;; Since fontification happens with different region than syntaxification, |
| 9343 | ;; do to the end of buffer, not to END | 9466 | ;; do to the end of buffer, not to END |
| 9344 | ;; likewise, start earlier if needed | 9467 | ;; likewise, start earlier if needed |
| @@ -9356,12 +9479,15 @@ do extra unwind via `cperl-unwind-to-safe'." | |||
| 9356 | 9479 | ||
| 9357 | ;; Called when any modification is made to buffer text. | 9480 | ;; Called when any modification is made to buffer text. |
| 9358 | (defun cperl-after-change-function (beg _end _old-len) | 9481 | (defun cperl-after-change-function (beg _end _old-len) |
| 9482 | "Process information provided as an `after-change-function'. | ||
| 9483 | Reset CPerl mode's syntax pointer to BEG." | ||
| 9359 | ;; We should have been informed about changes by `font-lock'. Since it | 9484 | ;; We should have been informed about changes by `font-lock'. Since it |
| 9360 | ;; does not inform as which calls are deferred, do it ourselves | 9485 | ;; does not inform as which calls are deferred, do it ourselves |
| 9361 | (if cperl-syntax-done-to | 9486 | (if cperl-syntax-done-to |
| 9362 | (setq cperl-syntax-done-to (min cperl-syntax-done-to beg)))) | 9487 | (setq cperl-syntax-done-to (min cperl-syntax-done-to beg)))) |
| 9363 | 9488 | ||
| 9364 | (defun cperl-update-syntaxification (to) | 9489 | (defun cperl-update-syntaxification (to) |
| 9490 | "Apply syntax table properties up to TO." | ||
| 9365 | (when cperl-use-syntax-table-text-property | 9491 | (when cperl-use-syntax-table-text-property |
| 9366 | (syntax-propertize to))) | 9492 | (syntax-propertize to))) |
| 9367 | 9493 | ||