Mercurial > hg > xemacs-beta
comparison lisp/modes/cperl-mode.el @ 110:fe104dbd9147 r20-1b7
Import from CVS: tag r20-1b7
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:19:45 +0200 |
parents | 360340f9fd5f |
children | 6608ceec7cf8 |
comparison
equal
deleted
inserted
replaced
109:e183fc049578 | 110:fe104dbd9147 |
---|---|
30 | 30 |
31 | 31 |
32 ;;; Corrections made by Ilya Zakharevich ilya@math.mps.ohio-state.edu | 32 ;;; Corrections made by Ilya Zakharevich ilya@math.mps.ohio-state.edu |
33 ;;; XEmacs changes by Peter Arius arius@informatik.uni-erlangen.de | 33 ;;; XEmacs changes by Peter Arius arius@informatik.uni-erlangen.de |
34 | 34 |
35 ;; $Id: cperl-mode.el,v 1.3 1997/03/08 23:26:24 steve Exp $ | 35 ;; $Id: cperl-mode.el,v 1.4 1997/03/16 03:05:17 steve Exp $ |
36 | 36 |
37 ;;; To use this mode put the following into your .emacs file: | 37 ;;; To use this mode put the following into your .emacs file: |
38 | 38 |
39 ;; (autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t) | 39 ;; (autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t) |
40 | 40 |
43 | 43 |
44 ;; (setq cperl-hairy t) | 44 ;; (setq cperl-hairy t) |
45 | 45 |
46 ;;; in your .emacs file. (Emacs rulers do not consider it politically | 46 ;;; in your .emacs file. (Emacs rulers do not consider it politically |
47 ;;; correct to make whistles enabled by default.) | 47 ;;; correct to make whistles enabled by default.) |
48 | |
49 ;;; DO NOT FORGET to read micro-docs. (available from `Perl' menu). <<<<<< | |
50 ;;; or as help on variables `cperl-tips', `cperl-problems', <<<<<< | |
51 ;;; `cperl-non-problems'. <<<<<< | |
48 | 52 |
49 ;;; Additional useful commands to put into your .emacs file: | 53 ;;; Additional useful commands to put into your .emacs file: |
50 | 54 |
51 ;; (setq auto-mode-alist | 55 ;; (setq auto-mode-alist |
52 ;; (append '(("\\.[pP][Llm]$" . perl-mode)) auto-mode-alist )) | 56 ;; (append '(("\\.[pP][Llm]$" . perl-mode)) auto-mode-alist )) |
325 ;;; comments and docstrings corrected, XEmacs support cleaned up. | 329 ;;; comments and docstrings corrected, XEmacs support cleaned up. |
326 ;;; The closing parenths would enclose the region into matching | 330 ;;; The closing parenths would enclose the region into matching |
327 ;;; parens under the same conditions as the opening ones. | 331 ;;; parens under the same conditions as the opening ones. |
328 ;;; Minor updates to `cperl-short-docs'. | 332 ;;; Minor updates to `cperl-short-docs'. |
329 ;;; Will not consider <<= as start of here-doc. | 333 ;;; Will not consider <<= as start of here-doc. |
334 | |
335 ;;;; After 1.29 | |
336 ;;; Added an extra advice to look into Micro-docs. ;-). | |
337 ;;; Enclosing of region when you press a closing parenth is regulated by | |
338 ;;; `cperl-electric-parens-string'. | |
339 ;;; Minor updates to `cperl-short-docs'. | |
340 ;;; `initialize-new-tags-table' called only if present (Does this help | |
341 ;;; with generation of tags under XEmacs?). | |
342 ;;; When creating/updating tag files, new info is written at the old place, | |
343 ;;; or at the end (is this a wanted behaviour? I need this in perl build directory). | |
344 | |
345 ;;;; After 1.30 | |
346 ;;; All the keywords from keywords.pl included (maybe with dummy explanation). | |
347 ;;; No auto-help inside strings, comment, here-docs, formats, and pods. | |
348 ;;; Shrinkwrapping of info, regulated by `cperl-max-help-size'. | |
349 ;;; Info on variables as well. | |
350 ;;; Recognision of HERE-DOCS improved yet more. | |
351 ;;; Autonewline works on `}' without warnings. | |
352 ;;; Autohelp works again on $_[0]. | |
353 | |
354 ;;;; After 1.31 | |
355 ;;; perl-descr.el found its author - hi, Johan! | |
330 | 356 |
331 (defvar cperl-extra-newline-before-brace nil | 357 (defvar cperl-extra-newline-before-brace nil |
332 "*Non-nil means that if, elsif, while, until, else, for, foreach | 358 "*Non-nil means that if, elsif, while, until, else, for, foreach |
333 and do constructs look like: | 359 and do constructs look like: |
334 | 360 |
383 (defvar cperl-font-lock nil | 409 (defvar cperl-font-lock nil |
384 "*Non-nil (and non-null) means CPerl buffers will use font-lock-mode. | 410 "*Non-nil (and non-null) means CPerl buffers will use font-lock-mode. |
385 Can be overwritten by `cperl-hairy' if nil.") | 411 Can be overwritten by `cperl-hairy' if nil.") |
386 | 412 |
387 (defvar cperl-electric-lbrace-space nil | 413 (defvar cperl-electric-lbrace-space nil |
388 "*Non-nil (and non-null) means { after $ in CPerl buffers should be preceded by ` '. | 414 "*Non-nil (and non-null) means { after $ in CPerl buffers should be preceeded by ` '. |
389 Can be overwritten by `cperl-hairy' if nil.") | 415 Can be overwritten by `cperl-hairy' if nil.") |
390 | 416 |
391 (defvar cperl-electric-parens-string "({[<" | 417 (defvar cperl-electric-parens-string "({[]})<" |
392 "*String of parentheses that should be electric in CPerl.") | 418 "*String of parentheses that should be electric in CPerl.") |
393 | 419 |
394 (defvar cperl-electric-parens nil | 420 (defvar cperl-electric-parens nil |
395 "*Non-nil (and non-null) means parentheses should be electric in CPerl. | 421 "*Non-nil (and non-null) means parentheses should be electric in CPerl. |
396 Can be overwritten by `cperl-hairy' if nil.") | 422 Can be overwritten by `cperl-hairy' if nil.") |
453 | 479 |
454 (defvar cperl-imenu-addback nil | 480 (defvar cperl-imenu-addback nil |
455 "*Not-nil means add backreferences to generated `imenu's. | 481 "*Not-nil means add backreferences to generated `imenu's. |
456 May require patched `imenu' and `imenu-go'.") | 482 May require patched `imenu' and `imenu-go'.") |
457 | 483 |
484 (defvar cperl-max-help-size 66 | |
485 "*Non-nil means shrink-wrapping of info-buffer allowed up to these percents.") | |
486 | |
487 (defvar cperl-shrink-wrap-info-frame t | |
488 "*Non-nil means shrink-wrapping of info-buffer-frame allowed.") | |
489 | |
458 (defvar cperl-info-page "perl" | 490 (defvar cperl-info-page "perl" |
459 "Name of the info page containing perl docs. | 491 "Name of the info page containing perl docs. |
460 Older version of this page was called `perl5', newer `perl'.") | 492 Older version of this page was called `perl5', newer `perl'.") |
461 | 493 |
462 | 494 |
545 *cannot* match parentheses in Perl 100% correctly. So | 577 *cannot* match parentheses in Perl 100% correctly. So |
546 1 if s#//#/#; | 578 1 if s#//#/#; |
547 will not break indentation, but | 579 will not break indentation, but |
548 1 if ( s#//#/# ); | 580 1 if ( s#//#/# ); |
549 will. | 581 will. |
582 | |
583 By similar reasons | |
584 s\"abc\"def\"; | |
585 will confuse CPerl a lot. | |
550 | 586 |
551 If you still get wrong indentation in situation that you think the | 587 If you still get wrong indentation in situation that you think the |
552 code should be able to parse, try: | 588 code should be able to parse, try: |
553 | 589 |
554 a) Check what Emacs thinks about balance of your parentheses. | 590 a) Check what Emacs thinks about balance of your parentheses. |
1192 (skip-chars-backward " \t") | 1228 (skip-chars-backward " \t") |
1193 (eq (preceding-char) ?\)))) | 1229 (eq (preceding-char) ?\)))) |
1194 (if cperl-auto-newline | 1230 (if cperl-auto-newline |
1195 (progn (cperl-indent-line) (newline) t) nil))) | 1231 (progn (cperl-indent-line) (newline) t) nil))) |
1196 (progn | 1232 (progn |
1197 (if cperl-auto-newline | |
1198 (setq insertpos (point))) | |
1199 (insert last-command-char) | 1233 (insert last-command-char) |
1200 (cperl-indent-line) | 1234 (cperl-indent-line) |
1235 (if cperl-auto-newline | |
1236 (setq insertpos (1- (point)))) | |
1201 (if (and cperl-auto-newline (null only-before)) | 1237 (if (and cperl-auto-newline (null only-before)) |
1202 (progn | 1238 (progn |
1203 (newline) | 1239 (newline) |
1204 (cperl-indent-line))) | 1240 (cperl-indent-line))) |
1205 (save-excursion | 1241 (save-excursion |
1280 "Insert a matching pair of parentheses if marking is active. | 1316 "Insert a matching pair of parentheses if marking is active. |
1281 If not, or if we are not at the end of marking range, would self-insert." | 1317 If not, or if we are not at the end of marking range, would self-insert." |
1282 (interactive "P") | 1318 (interactive "P") |
1283 (let ((beg (save-excursion (beginning-of-line) (point))) | 1319 (let ((beg (save-excursion (beginning-of-line) (point))) |
1284 (other-end (if (and cperl-electric-parens-mark | 1320 (other-end (if (and cperl-electric-parens-mark |
1321 (cperl-val 'cperl-electric-parens) | |
1322 (memq last-command-char | |
1323 (append cperl-electric-parens-string nil)) | |
1285 (cperl-mark-active) | 1324 (cperl-mark-active) |
1286 (< (mark) (point))) | 1325 (< (mark) (point))) |
1287 (mark) | 1326 (mark) |
1288 nil)) | 1327 nil)) |
1289 p) | 1328 p) |
2135 (search | 2174 (search |
2136 (concat | 2175 (concat |
2137 "\\(\\`\n?\\|\n\n\\)=" | 2176 "\\(\\`\n?\\|\n\n\\)=" |
2138 "\\|" | 2177 "\\|" |
2139 ;; One extra () before this: | 2178 ;; One extra () before this: |
2140 "<<\\(\\([\"'`]\\)\\([^\"'`\n]*\\)\\3\\|\\(\\([a-zA-Z_][a-zA-Z_0-9]*\\)?\\)[^=]\\)" ; [^=] to avoid <<=. | 2179 "<<" |
2180 "\\(" | |
2181 ;; First variant "BLAH" or just ``. | |
2182 "\\([\"'`]\\)" | |
2183 "\\([^\"'`\n]*\\)" | |
2184 "\\3" | |
2185 "\\|" | |
2186 ;; Second variant: Identifier or empty | |
2187 "\\(\\([a-zA-Z_][a-zA-Z_0-9]*\\)?\\)" | |
2188 ;; Check that we do not have <<= or << 30 or << $blah. | |
2189 "\\([^= \t$@%&]\\|[ \t]+[^ \t\n0-9$@%&]\\)" | |
2190 "\\)" | |
2141 "\\|" | 2191 "\\|" |
2142 ;; 1+5 extra () before this: | 2192 ;; 1+6 extra () before this: |
2143 "^[ \t]*format[ \t]*\\([a-zA-Z0-9_]+\\)?[ \t]*=[ \t]*$"))) | 2193 "^[ \t]*format[ \t]*\\([a-zA-Z0-9_]+\\)?[ \t]*=[ \t]*$"))) |
2144 (unwind-protect | 2194 (unwind-protect |
2145 (progn | 2195 (progn |
2146 (save-excursion | 2196 (save-excursion |
2147 (message "Scanning for pods, formats and here-docs...") | 2197 (message "Scanning for pods, formats and here-docs...") |
2157 (cond | 2207 (cond |
2158 ((match-beginning 1) ; POD section | 2208 ((match-beginning 1) ; POD section |
2159 ;; "\\(\\`\n?\\|\n\n\\)=" | 2209 ;; "\\(\\`\n?\\|\n\n\\)=" |
2160 (if (looking-at "\n*cut\\>") | 2210 (if (looking-at "\n*cut\\>") |
2161 (progn | 2211 (progn |
2162 (message "=cut is not preceded by a pod section") | 2212 (message "=cut is not preceeded by a pod section") |
2163 (setq err (point))) | 2213 (setq err (point))) |
2164 (beginning-of-line) | 2214 (beginning-of-line) |
2165 | 2215 |
2166 (setq b (point) bb b) | 2216 (setq b (point) bb b) |
2167 (or (re-search-forward "\n\n=cut\\>" max 'toend) | 2217 (or (re-search-forward "\n\n=cut\\>" max 'toend) |
2238 'syntax-type 'here-doc) | 2288 'syntax-type 'here-doc) |
2239 (cperl-put-do-not-fontify b (match-beginning 0))) | 2289 (cperl-put-do-not-fontify b (match-beginning 0))) |
2240 (t (message "End of here-document `%s' not found." tag))))) | 2290 (t (message "End of here-document `%s' not found." tag))))) |
2241 ;; format | 2291 ;; format |
2242 (t | 2292 (t |
2243 ;; 1+5=6 extra () before this: | 2293 ;; 1+6=7 extra () before this: |
2244 ;; "^[ \t]*format[ \t]*\\([a-zA-Z0-9_]+\\)?[ \t]*=[ \t]*$"))) | 2294 ;; "^[ \t]*format[ \t]*\\([a-zA-Z0-9_]+\\)?[ \t]*=[ \t]*$"))) |
2245 (setq b (point) | 2295 (setq b (point) |
2246 name (if (match-beginning 7) ; 6 + 1 | 2296 name (if (match-beginning 8) ; 7 + 1 |
2247 (buffer-substring (match-beginning 7) ; 6 + 1 | 2297 (buffer-substring (match-beginning 8) ; 7 + 1 |
2248 (match-end 7)) ; 6 + 1 | 2298 (match-end 8)) ; 7 + 1 |
2249 "")) | 2299 "")) |
2250 (setq argument nil) | 2300 (setq argument nil) |
2251 (if cperl-pod-here-fontify | 2301 (if cperl-pod-here-fontify |
2252 (while (and (eq (forward-line) 0) | 2302 (while (and (eq (forward-line) 0) |
2253 (not (looking-at "^[.;]$"))) | 2303 (not (looking-at "^[.;]$"))) |
2288 ;;; (t (message "End of format `%s' not found." name))) | 2338 ;;; (t (message "End of format `%s' not found." name))) |
2289 ))) | 2339 ))) |
2290 ;;; (while (re-search-forward "\\(\\`\n?\\|\n\n\\)=" max t) | 2340 ;;; (while (re-search-forward "\\(\\`\n?\\|\n\n\\)=" max t) |
2291 ;;; (if (looking-at "\n*cut\\>") | 2341 ;;; (if (looking-at "\n*cut\\>") |
2292 ;;; (progn | 2342 ;;; (progn |
2293 ;;; (message "=cut is not preceded by a pod section") | 2343 ;;; (message "=cut is not preceeded by a pod section") |
2294 ;;; (setq err (point))) | 2344 ;;; (setq err (point))) |
2295 ;;; (beginning-of-line) | 2345 ;;; (beginning-of-line) |
2296 | 2346 |
2297 ;;; (setq b (point) bb b) | 2347 ;;; (setq b (point) bb b) |
2298 ;;; (or (re-search-forward "\n\n=cut\\>" max 'toend) | 2348 ;;; (or (re-search-forward "\n\n=cut\\>" max 'toend) |
3293 (interactive) | 3343 (interactive) |
3294 (require 'mode-compile) | 3344 (require 'mode-compile) |
3295 (let ((perl-dbg-flags "-wc")) | 3345 (let ((perl-dbg-flags "-wc")) |
3296 (mode-compile))) | 3346 (mode-compile))) |
3297 | 3347 |
3298 (defun cperl-info-buffer () | 3348 (defun cperl-info-buffer (type) |
3299 ;; Returns buffer with documentation. Creates if missing | 3349 ;; Returns buffer with documentation. Creates if missing. |
3300 (let ((info (get-buffer "*info-perl*"))) | 3350 ;; If TYPE, this vars buffer. |
3351 ;; Special care is taken to not stomp over an existing info buffer | |
3352 (let* ((bname (if type "*info-perl-var*" "*info-perl*")) | |
3353 (info (get-buffer bname)) | |
3354 (oldbuf (get-buffer "*info*"))) | |
3301 (if info info | 3355 (if info info |
3302 (save-window-excursion | 3356 (save-window-excursion |
3303 ;; Get Info running | 3357 ;; Get Info running |
3304 (require 'info) | 3358 (require 'info) |
3359 (cond (oldbuf | |
3360 (set-buffer oldbuf) | |
3361 (rename-buffer "*info-perl-tmp*"))) | |
3305 (save-window-excursion | 3362 (save-window-excursion |
3306 (info)) | 3363 (info)) |
3307 (Info-find-node cperl-info-page "perlfunc") | 3364 (Info-find-node cperl-info-page (if type "perlvar" "perlfunc")) |
3308 (set-buffer "*info*") | 3365 (set-buffer "*info*") |
3309 (rename-buffer "*info-perl*") | 3366 (rename-buffer bname) |
3367 (cond (oldbuf | |
3368 (set-buffer "*info-perl-tmp*") | |
3369 (rename-buffer "*info*") | |
3370 (set-buffer bname))) | |
3371 (make-variable-buffer-local 'window-min-height) | |
3372 (setq window-min-height 2) | |
3310 (current-buffer))))) | 3373 (current-buffer))))) |
3311 | 3374 |
3312 (defun cperl-word-at-point (&optional p) | 3375 (defun cperl-word-at-point (&optional p) |
3313 ;; Returns the word at point or at P. | 3376 ;; Returns the word at point or at P. |
3314 (save-excursion | 3377 (save-excursion |
3315 (if p (goto-char p)) | 3378 (if p (goto-char p)) |
3316 (require 'etags) | 3379 (or (cperl-word-at-point-hard) |
3317 (funcall (or (and (boundp 'find-tag-default-function) | 3380 (progn |
3318 find-tag-default-function) | 3381 (require 'etags) |
3319 (get major-mode 'find-tag-default-function) | 3382 (funcall (or (and (boundp 'find-tag-default-function) |
3320 ;; XEmacs 19.12 has `find-tag-default-hook'; it is | 3383 find-tag-default-function) |
3321 ;; automatically used within `find-tag-default': | 3384 (get major-mode 'find-tag-default-function) |
3322 'find-tag-default)))) | 3385 ;; XEmacs 19.12 has `find-tag-default-hook'; it is |
3386 ;; automatically used within `find-tag-default': | |
3387 'find-tag-default)))))) | |
3323 | 3388 |
3324 (defun cperl-info-on-command (command) | 3389 (defun cperl-info-on-command (command) |
3325 "Shows documentation for Perl command in other window." | 3390 "Shows documentation for Perl command in other window. |
3391 If perl-info buffer is shown in some frame, uses this frame. | |
3392 Customized by setting variables `cperl-shrink-wrap-info-frame', | |
3393 `cperl-max-help-size'." | |
3326 (interactive | 3394 (interactive |
3327 (let* ((default (cperl-word-at-point)) | 3395 (let* ((default (cperl-word-at-point)) |
3328 (read (read-string | 3396 (read (read-string |
3329 (format "Find doc for Perl function (default %s): " | 3397 (format "Find doc for Perl function (default %s): " |
3330 default)))) | 3398 default)))) |
3332 default | 3400 default |
3333 read)))) | 3401 read)))) |
3334 | 3402 |
3335 (let ((buffer (current-buffer)) | 3403 (let ((buffer (current-buffer)) |
3336 (cmd-desc (concat "^" (regexp-quote command) "[^a-zA-Z_0-9]")) ; "tr///" | 3404 (cmd-desc (concat "^" (regexp-quote command) "[^a-zA-Z_0-9]")) ; "tr///" |
3337 pos) | 3405 pos isvar height iniheight frheight buf win fr1 fr2 iniwin not-loner |
3406 max-height char-height buf-list) | |
3338 (if (string-match "^-[a-zA-Z]$" command) | 3407 (if (string-match "^-[a-zA-Z]$" command) |
3339 (setq cmd-desc "^-X[ \t\n]")) | 3408 (setq cmd-desc "^-X[ \t\n]")) |
3340 (set-buffer (cperl-info-buffer)) | 3409 (setq isvar (string-match "^[$@%]" command) |
3410 buf (cperl-info-buffer isvar) | |
3411 iniwin (selected-window) | |
3412 fr1 (window-frame iniwin)) | |
3413 (set-buffer buf) | |
3341 (beginning-of-buffer) | 3414 (beginning-of-buffer) |
3342 (re-search-forward "^-X[ \t\n]") | 3415 (or isvar |
3343 (forward-line -1) | 3416 (progn (re-search-forward "^-X[ \t\n]") |
3417 (forward-line -1))) | |
3344 (if (re-search-forward cmd-desc nil t) | 3418 (if (re-search-forward cmd-desc nil t) |
3345 (progn | 3419 (progn |
3346 (setq pos (progn (beginning-of-line) | 3420 ;; Go back to beginning of the group (ex, for qq) |
3347 (point))) | 3421 (if (re-search-backward "^[ \t\n\f]") |
3348 (pop-to-buffer (cperl-info-buffer)) | 3422 (forward-line 1)) |
3423 (beginning-of-line) | |
3424 ;; Get some of | |
3425 (setq pos (point) | |
3426 buf-list (list buf "*info-perl-var*" "*info-perl*")) | |
3427 (while (and (not win) buf-list) | |
3428 (setq win (get-buffer-window (car buf-list) t)) | |
3429 (setq buf-list (cdr buf-list))) | |
3430 (or (not win) | |
3431 (eq (window-buffer win) buf) | |
3432 (set-window-buffer win buf)) | |
3433 (and win (setq fr2 (window-frame win))) | |
3434 (if (or (not fr2) (eq fr1 fr2)) | |
3435 (pop-to-buffer buf) | |
3436 (special-display-popup-frame buf) ; Make it visible | |
3437 (select-window win)) | |
3438 (goto-char pos) ; Needed (?!). | |
3439 ;; Resize | |
3440 (setq iniheight (window-height) | |
3441 frheight (frame-height) | |
3442 not-loner (< iniheight (1- frheight))) ; Are not alone | |
3443 (cond ((if not-loner cperl-max-help-size | |
3444 cperl-shrink-wrap-info-frame) | |
3445 (setq height | |
3446 (+ 2 | |
3447 (count-lines | |
3448 pos | |
3449 (save-excursion | |
3450 (if (re-search-forward | |
3451 "^[ \t][^\n]*\n+\\([^ \t\n\f]\\|\\'\\)" nil t) | |
3452 (match-beginning 0) (point-max))))) | |
3453 max-height | |
3454 (if not-loner | |
3455 (/ (* (- frheight 3) cperl-max-help-size) 100) | |
3456 (setq char-height (frame-char-height)) | |
3457 ;; Non-functioning under OS/2: | |
3458 (if (eq char-height 1) (setq char-height 18)) | |
3459 ;; Title, menubar, + 2 for slack | |
3460 (- (/ (x-display-pixel-height) char-height) 4) | |
3461 )) | |
3462 (if (> height max-height) (setq height max-height)) | |
3463 ;;(message "was %s doing %s" iniheight height) | |
3464 (if not-loner | |
3465 (enlarge-window (- height iniheight)) | |
3466 (set-frame-height (window-frame win) (1+ height))))) | |
3349 (set-window-start (selected-window) pos)) | 3467 (set-window-start (selected-window) pos)) |
3350 (message "No entry for %s found." command)) | 3468 (message "No entry for %s found." command)) |
3351 (pop-to-buffer buffer))) | 3469 ;;(pop-to-buffer buffer) |
3470 (select-window iniwin))) | |
3352 | 3471 |
3353 (defun cperl-info-on-current-command () | 3472 (defun cperl-info-on-current-command () |
3354 "Shows documentation for Perl command at point in other window." | 3473 "Shows documentation for Perl command at point in other window." |
3355 (interactive) | 3474 (interactive) |
3356 (cperl-info-on-command (cperl-word-at-point))) | 3475 (cperl-info-on-command (cperl-word-at-point))) |
3371 imenu-create-index-function | 3490 imenu-create-index-function |
3372 imenu-prev-index-position-function | 3491 imenu-prev-index-position-function |
3373 imenu-extract-index-name-function | 3492 imenu-extract-index-name-function |
3374 (index-item (save-restriction | 3493 (index-item (save-restriction |
3375 (save-window-excursion | 3494 (save-window-excursion |
3376 (set-buffer (cperl-info-buffer)) | 3495 (set-buffer (cperl-info-buffer nil)) |
3377 (setq imenu-create-index-function | 3496 (setq imenu-create-index-function |
3378 'imenu-default-create-index-function | 3497 'imenu-default-create-index-function |
3379 imenu-prev-index-position-function | 3498 imenu-prev-index-position-function |
3380 'cperl-imenu-info-imenu-search | 3499 'cperl-imenu-info-imenu-search |
3381 imenu-extract-index-name-function | 3500 imenu-extract-index-name-function |
3658 (t (cperl-write-tags file erase recurse t t))))) | 3777 (t (cperl-write-tags file erase recurse t t))))) |
3659 files)) | 3778 files)) |
3660 ) | 3779 ) |
3661 (t | 3780 (t |
3662 (setq xs (string-match "\\.xs$" file)) | 3781 (setq xs (string-match "\\.xs$" file)) |
3663 (cond ((eq erase 'ignore) nil) | 3782 (cond ((eq erase 'ignore) (goto-char (point-max))) |
3664 (erase (erase-buffer)) | 3783 (erase (erase-buffer)) |
3665 (t | 3784 (t |
3666 (goto-char 1) | 3785 (goto-char 1) |
3667 (if (search-forward (concat "\f\n" file ",") nil t) | 3786 (if (search-forward (concat "\f\n" file ",") nil t) |
3668 (progn | 3787 (progn |
3669 (search-backward "\f\n") | 3788 (search-backward "\f\n") |
3670 (delete-region (point) | 3789 (delete-region (point) |
3671 (progn | 3790 (progn |
3672 (forward-char 1) | 3791 (forward-char 1) |
3673 (search-forward "\f\n" nil 'toend) | 3792 (search-forward "\f\n" nil 'toend) |
3674 (point))) | 3793 (point)))) |
3675 (goto-char 1))))) | 3794 (goto-char (point-max))))) |
3676 (insert (cperl-find-tags file xs)))) | 3795 (insert (cperl-find-tags file xs)))) |
3677 (if inbuffer nil ; Delegate to the caller | 3796 (if inbuffer nil ; Delegate to the caller |
3678 (save-buffer 0) ; No backup | 3797 (save-buffer 0) ; No backup |
3679 (initialize-new-tags-table))))) | 3798 (if (fboundp 'initialize-new-tags-table) ; Do we need something special in XEmacs? |
3799 (initialize-new-tags-table)))))) | |
3680 | 3800 |
3681 (defvar cperl-tags-hier-regexp-list | 3801 (defvar cperl-tags-hier-regexp-list |
3682 "^\\(\\(package\\)\\>\\|sub\\>[^\n]+::\\|[a-zA-Z_][a-zA-Z_0-9:]*(\C-?[^\n]+::\\|[ \t]*BOOT:\C-?[^\n]+::\\)") | 3802 "^\\(\\(package\\)\\>\\|sub\\>[^\n]+::\\|[a-zA-Z_][a-zA-Z_0-9:]*(\C-?[^\n]+::\\|[ \t]*BOOT:\C-?[^\n]+::\\)") |
3683 | 3803 |
3684 (defvar cperl-hierarchy '(() ()) | 3804 (defvar cperl-hierarchy '(() ()) |
3969 ;;; Getting help | 4089 ;;; Getting help |
3970 (defvar cperl-have-help-regexp | 4090 (defvar cperl-have-help-regexp |
3971 ;;(concat "\\(" | 4091 ;;(concat "\\(" |
3972 (mapconcat | 4092 (mapconcat |
3973 'identity | 4093 'identity |
3974 '("[$@%*&][0-9a-zA-Z_:]+" ; Usual variable | 4094 '("[$@%*&][0-9a-zA-Z_:]+\\([ \t]*[[{]\\)?" ; Usual variable |
3975 "[$@]\\^[a-zA-Z]" ; Special variable | 4095 "[$@]\\^[a-zA-Z]" ; Special variable |
3976 "[$@][^ \n\t]" ; Special variable | 4096 "[$@][^ \n\t]" ; Special variable |
3977 "-[a-zA-Z]" ; File test | 4097 "-[a-zA-Z]" ; File test |
3978 "\\\\[a-zA-Z0]" ; Special chars | 4098 "\\\\[a-zA-Z0]" ; Special chars |
4099 "^=[a-z][a-zA-Z0-9_]*" ; Pod sections | |
3979 "[-!&*+,-./<=>?\\\\^|~]+" ; Operator | 4100 "[-!&*+,-./<=>?\\\\^|~]+" ; Operator |
3980 "[a-zA-Z_0-9:]+" ; symbol or number | 4101 "[a-zA-Z_0-9:]+" ; symbol or number |
3981 "x=" | 4102 "x=" |
3982 "#!" | 4103 "#!" |
3983 ) | 4104 ) |
3987 ;;"\\)" | 4108 ;;"\\)" |
3988 ;;) | 4109 ;;) |
3989 "Matches places in the buffer we can find help for.") | 4110 "Matches places in the buffer we can find help for.") |
3990 | 4111 |
3991 (defvar cperl-message-on-help-error t) | 4112 (defvar cperl-message-on-help-error t) |
4113 (defvar cperl-help-from-timer nil) | |
4114 | |
4115 (defun cperl-word-at-point-hard () | |
4116 ;; Does not save-excursion | |
4117 ;; Get to the something meaningful | |
4118 (or (eobp) (eolp) (forward-char 1)) | |
4119 (re-search-backward "[-a-zA-Z0-9_:!&*+,-./<=>?\\\\^|~$%@]" | |
4120 (save-excursion (beginning-of-line) (point)) | |
4121 'to-beg) | |
4122 ;; (cond | |
4123 ;; ((or (eobp) (looking-at "[][ \t\n{}();,]")) ; Not at a symbol | |
4124 ;; (skip-chars-backward " \n\t\r({[]});,") | |
4125 ;; (or (bobp) (backward-char 1)))) | |
4126 ;; Try to backtrace | |
4127 (cond | |
4128 ((looking-at "[a-zA-Z0-9_:]") ; symbol | |
4129 (skip-chars-backward "[a-zA-Z0-9_:]") | |
4130 (cond | |
4131 ((and (eq (preceding-char) ?^) ; $^I | |
4132 (eq (char-after (- (point) 2)) ?\$)) | |
4133 (forward-char -2)) | |
4134 ((memq (preceding-char) (append "*$@%&\\" nil)) ; *glob | |
4135 (forward-char -1)) | |
4136 ((and (eq (preceding-char) ?\=) | |
4137 (eq (current-column) 1)) | |
4138 (forward-char -1))) ; =head1 | |
4139 (if (and (eq (preceding-char) ?\<) | |
4140 (looking-at "\\$?[a-zA-Z0-9_:]+>")) ; <FH> | |
4141 (forward-char -1))) | |
4142 ((and (looking-at "=") (eq (preceding-char) ?x)) ; x= | |
4143 (forward-char -1)) | |
4144 ((and (looking-at "\\^") (eq (preceding-char) ?\$)) ; $^I | |
4145 (forward-char -1)) | |
4146 ((looking-at "[-!&*+,-./<=>?\\\\^|~]") | |
4147 (skip-chars-backward "[-!&*+,-./<=>?\\\\^|~]") | |
4148 (cond | |
4149 ((and (eq (preceding-char) ?\$) | |
4150 (not (eq (char-after (- (point) 2)) ?\$))) ; $- | |
4151 (forward-char -1)) | |
4152 ((and (eq (following-char) ?\>) | |
4153 (string-match "[a-zA-Z0-9_]" (char-to-string (preceding-char))) | |
4154 (save-excursion | |
4155 (forward-sexp -1) | |
4156 (and (eq (preceding-char) ?\<) | |
4157 (looking-at "\\$?[a-zA-Z0-9_:]+>")))) ; <FH> | |
4158 (search-backward "<")))) | |
4159 ((and (eq (following-char) ?\$) | |
4160 (eq (preceding-char) ?\<) | |
4161 (looking-at "\\$?[a-zA-Z0-9_:]+>")) ; <$fh> | |
4162 (forward-char -1))) | |
4163 (if (looking-at cperl-have-help-regexp) | |
4164 (buffer-substring (match-beginning 0) (match-end 0)))) | |
3992 | 4165 |
3993 (defun cperl-get-help () | 4166 (defun cperl-get-help () |
3994 "Get one-line docs on the symbol at the point. | 4167 "Get one-line docs on the symbol at the point. |
3995 The data for these docs is a little bit obsolete and may be in fact longer | 4168 The data for these docs is a little bit obsolete and may be in fact longer |
3996 than a line. Your contribution to update/shorten it is appreciated." | 4169 than a line. Your contribution to update/shorten it is appreciated." |
3997 (interactive) | 4170 (interactive) |
3998 (save-excursion | 4171 (save-excursion |
3999 ;; Get to the something meaningful | 4172 (let ((word (cperl-word-at-point-hard))) |
4000 (or (eobp) (eolp) (forward-char 1)) | 4173 (if word |
4001 (re-search-backward "[-a-zA-Z0-9_:!&*+,-./<=>?\\\\^|~$%@]" | 4174 (if (and cperl-help-from-timer ; Bail out if not in mainland |
4002 (save-excursion (beginning-of-line) (point)) | 4175 (not (string-match "^#!\\|\\\\\\|^=" word)) ; Show help even in comments/strings. |
4003 'to-beg) | 4176 (or (memq (get-text-property (point) 'face) |
4004 ;; (cond | 4177 '(font-lock-comment-face font-lock-string-face)) |
4005 ;; ((or (eobp) (looking-at "[][ \t\n{}();,]")) ; Not at a symbol | 4178 (memq (get-text-property (point) 'syntax-type) |
4006 ;; (skip-chars-backward " \n\t\r({[]});,") | 4179 '(pod here-doc format)))) |
4007 ;; (or (bobp) (backward-char 1)))) | 4180 nil |
4008 ;; Try to backtrace | 4181 (cperl-describe-perl-symbol word)) |
4009 (cond | 4182 (if cperl-message-on-help-error |
4010 ((looking-at "[a-zA-Z0-9_:]") ; symbol | 4183 (message "Nothing found for %s..." |
4011 (skip-chars-backward "[a-zA-Z0-9_:]") | 4184 (buffer-substring (point) (+ 5 (point))))))))) |
4012 (cond | |
4013 ((and (eq (preceding-char) ?^) ; $^I | |
4014 (eq (char-after (- (point) 2)) ?\$)) | |
4015 (forward-char -2)) | |
4016 ((memq (preceding-char) (append "*$@%&\\" nil)) ; *glob | |
4017 (forward-char -1))) | |
4018 (if (and (eq (preceding-char) ?\<) | |
4019 (looking-at "\\$?[a-zA-Z0-9_:]+>")) ; <FH> | |
4020 (forward-char -1))) | |
4021 ((and (looking-at "=") (eq (preceding-char) ?x)) ; x= | |
4022 (forward-char -1)) | |
4023 ((and (looking-at "\\^") (eq (preceding-char) ?\$)) ; $^I | |
4024 (forward-char -1)) | |
4025 ((looking-at "[-!&*+,-./<=>?\\\\^|~]") | |
4026 (skip-chars-backward "[-!&*+,-./<=>?\\\\^|~]") | |
4027 (cond | |
4028 ((and (eq (preceding-char) ?\$) | |
4029 (not (eq (char-after (- (point) 2)) ?\$))) ; $- | |
4030 (forward-char -1)) | |
4031 ((and (eq (following-char) ?\>) | |
4032 (string-match "[a-zA-Z0-9_]" (char-to-string (preceding-char))) | |
4033 (save-excursion | |
4034 (forward-sexp -1) | |
4035 (and (eq (preceding-char) ?\<) | |
4036 (looking-at "\\$?[a-zA-Z0-9_:]+>")))) ; <FH> | |
4037 (search-backward "<")))) | |
4038 ((and (eq (following-char) ?\$) | |
4039 (eq (preceding-char) ?\<) | |
4040 (looking-at "\\$?[a-zA-Z0-9_:]+>")) ; <$fh> | |
4041 (forward-char -1))) | |
4042 ;;(or (eobp) (forward-char 1)) | |
4043 (if (looking-at cperl-have-help-regexp) | |
4044 (cperl-describe-perl-symbol | |
4045 (buffer-substring (match-beginning 0) (match-end 0))) | |
4046 (if cperl-message-on-help-error | |
4047 (message "Nothing found for %s..." | |
4048 (buffer-substring (point) (+ 5 (point)))))))) | |
4049 | 4185 |
4050 ;;; Stolen from perl-descr.el by Johan Vromans: | 4186 ;;; Stolen from perl-descr.el by Johan Vromans: |
4051 | 4187 |
4052 (defvar cperl-doc-buffer " *perl-doc*" | 4188 (defvar cperl-doc-buffer " *perl-doc*" |
4053 "Where the documentation can be found.") | 4189 "Where the documentation can be found.") |
4054 | 4190 |
4055 (defun cperl-describe-perl-symbol (val) | 4191 (defun cperl-describe-perl-symbol (val) |
4056 "Display the documentation of symbol at point, a Perl operator." | 4192 "Display the documentation of symbol at point, a Perl operator." |
4057 ;; We suppose that the current position is at the start of the symbol | 4193 (let ((enable-recursive-minibuffers t) |
4058 ;; when we convert $_[5] to @_ | |
4059 (let (;;(fn (perl-symbol-at-point)) | |
4060 (enable-recursive-minibuffers t) | |
4061 ;;val | |
4062 args-file regexp) | 4194 args-file regexp) |
4063 ;; (interactive | |
4064 ;; (let ((fn (perl-symbol-at-point)) | |
4065 ;; (enable-recursive-minibuffers t) | |
4066 ;; val args-file regexp) | |
4067 ;; (setq val (read-from-minibuffer | |
4068 ;; (if fn | |
4069 ;; (format "Symbol (default %s): " fn) | |
4070 ;; "Symbol: "))) | |
4071 ;; (if (string= val "") | |
4072 ;; (setq val fn)) | |
4073 (cond | 4195 (cond |
4074 ((string-match "^[&*][a-zA-Z_]" val) | 4196 ((string-match "^[&*][a-zA-Z_]" val) |
4075 (setq val (concat (substring val 0 1) "NAME"))) | 4197 (setq val (concat (substring val 0 1) "NAME"))) |
4076 ((looking-at "[$@][a-zA-Z_:0-9]+\\([[{]\\)") | 4198 ((string-match "^[$@]\\([a-zA-Z_:0-9]+\\)[ \t]*\\[" val) |
4077 (if (= ?\[ (char-after (match-beginning 1))) | 4199 (setq val (concat "@" (substring val 1 (match-end 1))))) |
4078 (setq val (concat "@" (substring val 1))) | 4200 ((string-match "^[$@]\\([a-zA-Z_:0-9]+\\)[ \t]*{" val) |
4079 (setq val (concat "%" (substring val 1))))) | 4201 (setq val (concat "%" (substring val 1 (match-end 1))))) |
4080 ((and (string= val "x") (looking-at "x=")) | 4202 ((and (string= val "x") (string-match "^x=" val)) |
4081 (setq val "x=")) | 4203 (setq val "x=")) |
4082 ((string-match "^\\$[\C-a-\C-z]" val) | 4204 ((string-match "^\\$[\C-a-\C-z]" val) |
4083 (setq val (concat "$^" (char-to-string (+ ?A -1 (aref val 1)))))) | 4205 (setq val (concat "$^" (char-to-string (+ ?A -1 (aref val 1)))))) |
4084 ((and (string= "<" val) (looking-at "<\\$?[a-zA-Z0-9_:]+>")) | 4206 ((string-match "^CORE::" val) |
4207 (setq val "CORE::")) | |
4208 ((string-match "^SUPER::" val) | |
4209 (setq val "SUPER::")) | |
4210 ((and (string= "<" val) (string-match "^<\\$?[a-zA-Z0-9_:]+>" val)) | |
4085 (setq val "<NAME>"))) | 4211 (setq val "<NAME>"))) |
4086 ;;; (if (string-match "^[&*][a-zA-Z_]" val) | 4212 (setq regexp (concat "^" |
4087 ;;; (setq val (concat (substring val 0 1) "NAME")) | 4213 "\\([^a-zA-Z0-9_:]+[ \t]+\\)?" |
4088 ;;; (if (looking-at "[$@][a-zA-Z_:0-9]+\\([[{]\\)") | |
4089 ;;; (if (= ?\[ (char-after (match-beginning 1))) | |
4090 ;;; (setq val (concat "@" (substring val 1))) | |
4091 ;;; (setq val (concat "%" (substring val 1)))) | |
4092 ;;; (if (and (string= val "x") (looking-at "x=")) | |
4093 ;;; (setq val "x=") | |
4094 ;;; (if (looking-at "[$@][a-zA-Z_:0-9]") | |
4095 ;;; )))) | |
4096 (setq regexp (concat "^" "\\([^a-zA-Z0-9_:]+[ \t]\\)?" | |
4097 (regexp-quote val) | 4214 (regexp-quote val) |
4098 "\\([ \t([/]\\|$\\)")) | 4215 "\\([ \t([/]\\|$\\)")) |
4099 | 4216 |
4100 ;; get the buffer with the documentation text | 4217 ;; get the buffer with the documentation text |
4101 (cperl-switch-to-doc-buffer) | 4218 (cperl-switch-to-doc-buffer) |
4112 (message "%s" (buffer-substring lnstart (point))))) | 4229 (message "%s" (buffer-substring lnstart (point))))) |
4113 (if cperl-message-on-help-error | 4230 (if cperl-message-on-help-error |
4114 (message "No definition for %s" val))))))) | 4231 (message "No definition for %s" val))))))) |
4115 | 4232 |
4116 (defvar cperl-short-docs "Ignore my value" | 4233 (defvar cperl-short-docs "Ignore my value" |
4234 ;; Perl4 version was written by Johan Vromans (jvromans@squirrel.nl) | |
4117 "# based on '@(#)@ perl-descr.el 1.9 - describe-perl-symbol' [Perl 5] | 4235 "# based on '@(#)@ perl-descr.el 1.9 - describe-perl-symbol' [Perl 5] |
4118 ! Logical negation. | 4236 ! ... Logical negation. |
4119 != Numeric inequality. | 4237 ... != ... Numeric inequality. |
4120 !~ Search pattern, substitution, or translation (negated). | 4238 ... !~ ... Search pattern, substitution, or translation (negated). |
4121 $! In numeric context: errno. In a string context: error string. | 4239 $! In numeric context: errno. In a string context: error string. |
4122 $\" The separator which joins elements of arrays interpolated in strings. | 4240 $\" The separator which joins elements of arrays interpolated in strings. |
4123 $# The output format for printed numbers. Initial value is %.20g. | 4241 $# The output format for printed numbers. Initial value is %.20g. |
4124 $$ The process number of the perl running this script. Altered (in the child process) by fork(). | 4242 $$ Process number of this script. Changes in the fork()ed child process. |
4125 $% The current page number of the currently selected output channel. | 4243 $% The current page number of the currently selected output channel. |
4126 | 4244 |
4127 The following variables are always local to the current block: | 4245 The following variables are always local to the current block: |
4128 | 4246 |
4129 $1 Match of the 1st set of parentheses in the last match (auto-local). | 4247 $1 Match of the 1st set of parentheses in the last match (auto-local). |
4145 $+ The last bracket matched by the last search pattern. | 4263 $+ The last bracket matched by the last search pattern. |
4146 $, The output field separator for the print operator. | 4264 $, The output field separator for the print operator. |
4147 $- The number of lines left on the page. | 4265 $- The number of lines left on the page. |
4148 $. The current input line number of the last filehandle that was read. | 4266 $. The current input line number of the last filehandle that was read. |
4149 $/ The input record separator, newline by default. | 4267 $/ The input record separator, newline by default. |
4150 $0 The name of the file containing the perl script being executed. May be set | 4268 $0 Name of the file containing the perl script being executed. May be set. |
4151 $: The set of characters after which a string may be broken to fill continuation fields (starting with ^) in a format. | 4269 $: String may be broken after these characters to fill ^-lines in a format. |
4152 $; The subscript separator for multi-dimensional array emulation. Default is \"\\034\". | 4270 $; Subscript separator for multi-dim array emulation. Default \"\\034\". |
4153 $< The real uid of this process. | 4271 $< The real uid of this process. |
4154 $= The page length of the current output channel. Default is 60 lines. | 4272 $= The page length of the current output channel. Default is 60 lines. |
4155 $> The effective uid of this process. | 4273 $> The effective uid of this process. |
4156 $? The status returned by the last ``, pipe close or `system'. | 4274 $? The status returned by the last ``, pipe close or `system'. |
4157 $@ The perl error message from the last eval or do @var{EXPR} command. | 4275 $@ The perl error message from the last eval or do @var{EXPR} command. |
4171 $^P Internal debugging flag. | 4289 $^P Internal debugging flag. |
4172 $^T The time the script was started. Used by -A/-M/-C file tests. | 4290 $^T The time the script was started. Used by -A/-M/-C file tests. |
4173 $^W True if warnings are requested (perl -w flag). | 4291 $^W True if warnings are requested (perl -w flag). |
4174 $^X The name under which perl was invoked (argv[0] in C-speech). | 4292 $^X The name under which perl was invoked (argv[0] in C-speech). |
4175 $_ The default input and pattern-searching space. | 4293 $_ The default input and pattern-searching space. |
4176 $| Flag for auto-flush after write/print on the currently selected output channel. Default is 0. | 4294 $| Auto-flush after write/print on the current output channel? Default 0. |
4177 $~ The name of the current report format. | 4295 $~ The name of the current report format. |
4178 % Modulo division. | 4296 ... % ... Modulo division. |
4179 %= Modulo division assignment. | 4297 ... %= ... Modulo division assignment. |
4180 %ENV Contains the current environment. | 4298 %ENV Contains the current environment. |
4181 %INC List of files that have been require-d or do-ne. | 4299 %INC List of files that have been require-d or do-ne. |
4182 %SIG Used to set signal handlers for various signals. | 4300 %SIG Used to set signal handlers for various signals. |
4183 & Bitwise and. | 4301 ... & ... Bitwise and. |
4184 && Logical and. | 4302 ... && ... Logical and. |
4185 &&= Logical and assignment. | 4303 ... &&= ... Logical and assignment. |
4186 &= Bitwise and assignment. | 4304 ... &= ... Bitwise and assignment. |
4187 * Multiplication. | 4305 ... * ... Multiplication. |
4188 ** Exponentiation. | 4306 ... ** ... Exponentiation. |
4189 *NAME Refers to all objects represented by NAME. *NAM1 = *NAM2 makes NAM1 a reference to NAM2. | 4307 *NAME Glob: all objects refered by NAME. *NAM1 = *NAM2 aliases NAM1 to NAM2. |
4190 &NAME(arg0, ...) Subroutine call. Arguments go to @_. | 4308 &NAME(arg0, ...) Subroutine call. Arguments go to @_. |
4191 + Addition. | 4309 ... + ... Addition. +EXPR Makes EXPR into scalar context. |
4192 ++ Auto-increment (magical on strings). | 4310 ++ Auto-increment (magical on strings). ++EXPR EXPR++ |
4193 += Addition assignment. | 4311 ... += ... Addition assignment. |
4194 , Comma operator. | 4312 , Comma operator. |
4195 - Subtraction. | 4313 ... - ... Subtraction. |
4196 -- Auto-decrement. | 4314 -- Auto-decrement (NOT magical on strings). --EXPR EXPR-- |
4197 -= Subtraction assignment. | 4315 ... -= ... Subtraction assignment. |
4198 -A Access time in days since script started. | 4316 -A Access time in days since script started. |
4199 -B File is a non-text (binary) file. | 4317 -B File is a non-text (binary) file. |
4200 -C Inode change time in days since script started. | 4318 -C Inode change time in days since script started. |
4201 -M Age in days since script started. | 4319 -M Age in days since script started. |
4202 -O File is owned by real uid. | 4320 -O File is owned by real uid. |
4223 -x File is executable by effective uid. | 4341 -x File is executable by effective uid. |
4224 -z File has zero size. | 4342 -z File has zero size. |
4225 . Concatenate strings. | 4343 . Concatenate strings. |
4226 .. Alternation, also range operator. | 4344 .. Alternation, also range operator. |
4227 .= Concatenate assignment strings | 4345 .= Concatenate assignment strings |
4228 / Division. /PATTERN/ioxsmg Pattern match | 4346 ... / ... Division. /PATTERN/ioxsmg Pattern match |
4229 /= Division assignment. | 4347 ... /= ... Division assignment. |
4230 /PATTERN/ioxsmg Pattern match. | 4348 /PATTERN/ioxsmg Pattern match. |
4231 < Numeric less than. <pattern> Glob. See <NAME>, <> as well. | 4349 ... < ... Numeric less than. <pattern> Glob. See <NAME>, <> as well. |
4232 <NAME> Reads line from filehandle NAME. NAME must be bareword/dollar-bareword. | 4350 <NAME> Reads line from filehandle NAME. NAME must be bareword/dollar-bareword. |
4233 <pattern> Glob. (Unless pattern is bareword/dollar-bareword - see <NAME>) | 4351 <pattern> Glob. (Unless pattern is bareword/dollar-bareword - see <NAME>) |
4234 <> Reads line from union of files in @ARGV (= command line) and STDIN. | 4352 <> Reads line from union of files in @ARGV (= command line) and STDIN. |
4235 << Bitwise shift left. << start of HERE-DOCUMENT. | 4353 ... << ... Bitwise shift left. << start of HERE-DOCUMENT. |
4236 <= Numeric less than or equal to. | 4354 ... <= ... Numeric less than or equal to. |
4237 <=> Numeric compare. | 4355 ... <=> ... Numeric compare. |
4238 = Assignment. | 4356 ... = ... Assignment. |
4239 == Numeric equality. | 4357 ... == ... Numeric equality. |
4240 =~ Search pattern, substitution, or translation | 4358 ... =~ ... Search pattern, substitution, or translation |
4241 > Numeric greater than. | 4359 ... > ... Numeric greater than. |
4242 >= Numeric greater than or equal to. | 4360 ... >= ... Numeric greater than or equal to. |
4243 >> Bitwise shift right. | 4361 ... >> ... Bitwise shift right. |
4244 >>= Bitwise shift right assignment. | 4362 ... >>= ... Bitwise shift right assignment. |
4245 ? : Alternation (if-then-else) operator. ?PAT? Backwards pattern match. | 4363 ... ? ... : ... Condition=if-then-else operator. ?PAT? One-time pattern match. |
4246 ?PATTERN? Backwards pattern match. | 4364 ?PATTERN? One-time pattern match. |
4247 @ARGV Command line arguments (not including the command name - see $0). | 4365 @ARGV Command line arguments (not including the command name - see $0). |
4248 @INC List of places to look for perl scripts during do/include/use. | 4366 @INC List of places to look for perl scripts during do/include/use. |
4249 @_ Parameter array for subroutines. Also used by split unless in array context. | 4367 @_ Parameter array for subroutines. Also used by split unless in array context. |
4250 \\ Creates a reference to whatever follows, like \$var. | 4368 \\ Creates a reference to whatever follows, like \$var. |
4251 \\0 Octal char, e.g. \\033. | 4369 \\0 Octal char, e.g. \\033. |
4252 \\E Case modification terminator. See \\Q, \\L, and \\U. | 4370 \\E Case modification terminator. See \\Q, \\L, and \\U. |
4253 \\L Lowercase until \\E . | 4371 \\L Lowercase until \\E . See also \l, lc. |
4254 \\U Upcase until \\E . | 4372 \\U Upcase until \\E . See also \u, uc. |
4255 \\Q Quote metacharacters until \\E . | 4373 \\Q Quote metacharacters until \\E . See also quotemeta. |
4256 \\a Alarm character (octal 007). | 4374 \\a Alarm character (octal 007). |
4257 \\b Backspace character (octal 010). | 4375 \\b Backspace character (octal 010). |
4258 \\c Control character, e.g. \\c[ . | 4376 \\c Control character, e.g. \\c[ . |
4259 \\e Escape character (octal 033). | 4377 \\e Escape character (octal 033). |
4260 \\f Formfeed character (octal 014). | 4378 \\f Formfeed character (octal 014). |
4261 \\l Lowercase of next character. See also \\L and \\u, | 4379 \\l Lowercase the next character. See also \\L and \\u, lcfirst, |
4262 \\n Newline character (octal 012). | 4380 \\n Newline character (octal 012). |
4263 \\r Return character (octal 015). | 4381 \\r Return character (octal 015). |
4264 \\t Tab character (octal 011). | 4382 \\t Tab character (octal 011). |
4265 \\u Upcase of next character. See also \\U and \\l, | 4383 \\u Upcase the next character. See also \\U and \\l, ucfirst, |
4266 \\x Hex character, e.g. \\x1b. | 4384 \\x Hex character, e.g. \\x1b. |
4267 ^ Bitwise exclusive or. | 4385 ^ ... Bitwise exclusive or. |
4268 __END__ End of program source. | 4386 __END__ Ends program source. |
4269 __DATA__ End of program source. | 4387 __DATA__ Ends program source. |
4270 __FILE__ Current (source) filename. | 4388 __FILE__ Current (source) filename. |
4271 __LINE__ Current line in current source. | 4389 __LINE__ Current line in current source. |
4272 ARGV Default multi-file input filehandle. <ARGV> is a synonym for <>. | 4390 ARGV Default multi-file input filehandle. <ARGV> is a synonym for <>. |
4273 ARGVOUT Output filehandle with -i flag. | 4391 ARGVOUT Output filehandle with -i flag. |
4274 BEGIN { block } Immediately executed (during compilation) piece of code. | 4392 BEGIN { ... } Immediately executed (during compilation) piece of code. |
4275 END { block } Pseudo-subroutine executed after the script finishes. | 4393 END { ... } Pseudo-subroutine executed after the script finishes. |
4276 DATA Input filehandle for what follows after __END__ or __DATA__. | 4394 DATA Input filehandle for what follows after __END__ or __DATA__. |
4277 accept(NEWSOCKET,GENERICSOCKET) | 4395 accept(NEWSOCKET,GENERICSOCKET) |
4278 alarm(SECONDS) | 4396 alarm(SECONDS) |
4279 atan2(X,Y) | 4397 atan2(X,Y) |
4280 bind(SOCKET,NAME) | 4398 bind(SOCKET,NAME) |
4285 chop[(LIST|VAR)] | 4403 chop[(LIST|VAR)] |
4286 chown(LIST) | 4404 chown(LIST) |
4287 chroot(FILENAME) | 4405 chroot(FILENAME) |
4288 close(FILEHANDLE) | 4406 close(FILEHANDLE) |
4289 closedir(DIRHANDLE) | 4407 closedir(DIRHANDLE) |
4290 cmp String compare. | 4408 ... cmp ... String compare. |
4291 connect(SOCKET,NAME) | 4409 connect(SOCKET,NAME) |
4292 continue of { block } continue { block }. Is executed after `next' or at end. | 4410 continue of { block } continue { block }. Is executed after `next' or at end. |
4293 cos(EXPR) | 4411 cos(EXPR) |
4294 crypt(PLAINTEXT,SALT) | 4412 crypt(PLAINTEXT,SALT) |
4295 dbmclose(ASSOC_ARRAY) | 4413 dbmclose(%HASH) |
4296 dbmopen(ASSOC,DBNAME,MODE) | 4414 dbmopen(%HASH,DBNAME,MODE) |
4297 defined(EXPR) | 4415 defined(EXPR) |
4298 delete($ASSOC{KEY}) | 4416 delete($HASH{KEY}) |
4299 die(LIST) | 4417 die(LIST) |
4300 do { ... }|SUBR while|until EXPR executes at least once | 4418 do { ... }|SUBR while|until EXPR executes at least once |
4301 do(EXPR|SUBR([LIST])) | 4419 do(EXPR|SUBR([LIST])) |
4302 dump LABEL | 4420 dump LABEL |
4303 each(ASSOC_ARRAY) | 4421 each(%HASH) |
4304 endgrent | 4422 endgrent |
4305 endhostent | 4423 endhostent |
4306 endnetent | 4424 endnetent |
4307 endprotoent | 4425 endprotoent |
4308 endpwent | 4426 endpwent |
4309 endservent | 4427 endservent |
4310 eof[([FILEHANDLE])] | 4428 eof[([FILEHANDLE])] |
4311 eq String equality. | 4429 ... eq ... String equality. |
4312 eval(EXPR) or eval { BLOCK } | 4430 eval(EXPR) or eval { BLOCK } |
4313 exec(LIST) | 4431 exec(LIST) |
4314 exit(EXPR) | 4432 exit(EXPR) |
4315 exp(EXPR) | 4433 exp(EXPR) |
4316 fcntl(FILEHANDLE,FUNCTION,SCALAR) | 4434 fcntl(FILEHANDLE,FUNCTION,SCALAR) |
4317 fileno(FILEHANDLE) | 4435 fileno(FILEHANDLE) |
4318 flock(FILEHANDLE,OPERATION) | 4436 flock(FILEHANDLE,OPERATION) |
4319 for (EXPR;EXPR;EXPR) { ... } | 4437 for (EXPR;EXPR;EXPR) { ... } |
4320 foreach [VAR] (@ARRAY) { ... } | 4438 foreach [VAR] (@ARRAY) { ... } |
4321 fork | 4439 fork |
4322 ge String greater than or equal. | 4440 ... ge ... String greater than or equal. |
4323 getc[(FILEHANDLE)] | 4441 getc[(FILEHANDLE)] |
4324 getgrent | 4442 getgrent |
4325 getgrgid(GID) | 4443 getgrgid(GID) |
4326 getgrnam(NAME) | 4444 getgrnam(NAME) |
4327 gethostbyaddr(ADDR,ADDRTYPE) | 4445 gethostbyaddr(ADDR,ADDRTYPE) |
4347 getsockname(SOCKET) | 4465 getsockname(SOCKET) |
4348 getsockopt(SOCKET,LEVEL,OPTNAME) | 4466 getsockopt(SOCKET,LEVEL,OPTNAME) |
4349 gmtime(EXPR) | 4467 gmtime(EXPR) |
4350 goto LABEL | 4468 goto LABEL |
4351 grep(EXPR,LIST) | 4469 grep(EXPR,LIST) |
4352 gt String greater than. | 4470 ... gt ... String greater than. |
4353 hex(EXPR) | 4471 hex(EXPR) |
4354 if (EXPR) { ... } [ elsif (EXPR) { ... } ... ] [ else { ... } ] or EXPR if EXPR | 4472 if (EXPR) { ... } [ elsif (EXPR) { ... } ... ] [ else { ... } ] or EXPR if EXPR |
4355 index(STR,SUBSTR[,OFFSET]) | 4473 index(STR,SUBSTR[,OFFSET]) |
4356 int(EXPR) | 4474 int(EXPR) |
4357 ioctl(FILEHANDLE,FUNCTION,SCALAR) | 4475 ioctl(FILEHANDLE,FUNCTION,SCALAR) |
4358 join(EXPR,LIST) | 4476 join(EXPR,LIST) |
4359 keys(ASSOC_ARRAY) | 4477 keys(%HASH) |
4360 kill(LIST) | 4478 kill(LIST) |
4361 last [LABEL] | 4479 last [LABEL] |
4362 le String less than or equal. | 4480 ... le ... String less than or equal. |
4363 length(EXPR) | 4481 length(EXPR) |
4364 link(OLDFILE,NEWFILE) | 4482 link(OLDFILE,NEWFILE) |
4365 listen(SOCKET,QUEUESIZE) | 4483 listen(SOCKET,QUEUESIZE) |
4366 local(LIST) | 4484 local(LIST) |
4367 localtime(EXPR) | 4485 localtime(EXPR) |
4368 log(EXPR) | 4486 log(EXPR) |
4369 lstat(EXPR|FILEHANDLE|VAR) | 4487 lstat(EXPR|FILEHANDLE|VAR) |
4370 lt String less than. | 4488 ... lt ... String less than. |
4371 m/PATTERN/iogsmx | 4489 m/PATTERN/iogsmx |
4372 mkdir(FILENAME,MODE) | 4490 mkdir(FILENAME,MODE) |
4373 msgctl(ID,CMD,ARG) | 4491 msgctl(ID,CMD,ARG) |
4374 msgget(KEY,FLAGS) | 4492 msgget(KEY,FLAGS) |
4375 msgrcv(ID,VAR,SIZE,TYPE.FLAGS) | 4493 msgrcv(ID,VAR,SIZE,TYPE.FLAGS) |
4376 msgsnd(ID,MSG,FLAGS) | 4494 msgsnd(ID,MSG,FLAGS) |
4377 my VAR or my (VAR1,...) Introduces a lexical variable ($VAR, @ARR, or %HASH). | 4495 my VAR or my (VAR1,...) Introduces a lexical variable ($VAR, @ARR, or %HASH). |
4378 ne String inequality. | 4496 ... ne ... String inequality. |
4379 next [LABEL] | 4497 next [LABEL] |
4380 oct(EXPR) | 4498 oct(EXPR) |
4381 open(FILEHANDLE[,EXPR]) | 4499 open(FILEHANDLE[,EXPR]) |
4382 opendir(DIRHANDLE,EXPR) | 4500 opendir(DIRHANDLE,EXPR) |
4383 ord(EXPR) | 4501 ord(EXPR) |
4384 pack(TEMPLATE,LIST) | 4502 pack(TEMPLATE,LIST) |
4385 package Introduces package context. | 4503 package NAME Introduces package context. |
4386 pipe(READHANDLE,WRITEHANDLE) | 4504 pipe(READHANDLE,WRITEHANDLE) |
4387 pop(ARRAY) | 4505 pop(ARRAY) |
4388 print [FILEHANDLE] [(LIST)] | 4506 print [FILEHANDLE] [(LIST)] |
4389 printf [FILEHANDLE] (FORMAT,LIST) | 4507 printf [FILEHANDLE] (FORMAT,LIST) |
4390 push(ARRAY,LIST) | 4508 push(ARRAY,LIST) |
4439 sprintf(FORMAT,LIST) | 4557 sprintf(FORMAT,LIST) |
4440 sqrt(EXPR) | 4558 sqrt(EXPR) |
4441 srand(EXPR) | 4559 srand(EXPR) |
4442 stat(EXPR|FILEHANDLE|VAR) | 4560 stat(EXPR|FILEHANDLE|VAR) |
4443 study[(SCALAR)] | 4561 study[(SCALAR)] |
4444 sub [NAME [(format)]] { BODY } or sub [NAME [(format)]]; | 4562 sub [NAME [(format)]] { BODY } sub NAME [(format)]; sub [(format)] {...} |
4445 substr(EXPR,OFFSET[,LEN]) | 4563 substr(EXPR,OFFSET[,LEN]) |
4446 symlink(OLDFILE,NEWFILE) | 4564 symlink(OLDFILE,NEWFILE) |
4447 syscall(LIST) | 4565 syscall(LIST) |
4448 sysread(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) | 4566 sysread(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) |
4449 system(LIST) | 4567 system(LIST) |
4458 undef[(EXPR)] | 4576 undef[(EXPR)] |
4459 unless (EXPR) { ... } [ else { ... } ] or EXPR unless EXPR | 4577 unless (EXPR) { ... } [ else { ... } ] or EXPR unless EXPR |
4460 unlink(LIST) | 4578 unlink(LIST) |
4461 unpack(TEMPLATE,EXPR) | 4579 unpack(TEMPLATE,EXPR) |
4462 unshift(ARRAY,LIST) | 4580 unshift(ARRAY,LIST) |
4463 until (EXPR) { ... } or EXPR until EXPR | 4581 until (EXPR) { ... } EXPR until EXPR |
4464 utime(LIST) | 4582 utime(LIST) |
4465 values(ASSOC_ARRAY) | 4583 values(%HASH) |
4466 vec(EXPR,OFFSET,BITS) | 4584 vec(EXPR,OFFSET,BITS) |
4467 wait | 4585 wait |
4468 waitpid(PID,FLAGS) | 4586 waitpid(PID,FLAGS) |
4469 wantarray | 4587 wantarray |
4470 warn(LIST) | 4588 warn(LIST) |
4471 while (EXPR) { ... } or EXPR while EXPR | 4589 while (EXPR) { ... } EXPR while EXPR |
4472 write[(EXPR|FILEHANDLE)] | 4590 write[(EXPR|FILEHANDLE)] |
4473 x Repeat string or array. | 4591 ... x ... Repeat string or array. |
4474 x= Repetition assignment. | 4592 x= ... Repetition assignment. |
4475 y/SEARCHLIST/REPLACEMENTLIST/ | 4593 y/SEARCHLIST/REPLACEMENTLIST/ |
4476 | Bitwise or. | 4594 ... | ... Bitwise or. |
4477 || Logical or. | 4595 ... || ... Logical or. |
4478 ~ Unary bitwise complement. | 4596 ~ ... Unary bitwise complement. |
4479 #! OS interpreter indicator. If contains `perl', used for options, and -x. | 4597 #! OS interpreter indicator. If contains `perl', used for options, and -x. |
4598 AUTOLOAD {...} Shorthand for `sub AUTOLOAD {...}'. | |
4599 CORE:: Prefix to access builtin function if imported sub obscures it. | |
4600 SUPER:: Prefix to lookup for a method in @ISA classes. | |
4601 DESTROY Shorthand for `sub DESTROY {...}'. | |
4602 ... EQ ... Obsolete synonym of `eq'. | |
4603 ... GE ... Obsolete synonym of `ge'. | |
4604 ... GT ... Obsolete synonym of `gt'. | |
4605 ... LE ... Obsolete synonym of `le'. | |
4606 ... LT ... Obsolete synonym of `lt'. | |
4607 ... NE ... Obsolete synonym of `ne'. | |
4608 abs [ EXPR ] absolute value | |
4609 ... and ... Low-precedence synonym for &&. | |
4610 bless REFERENCE [, PACKAGE] Makes reference into an object of a package. | |
4611 chomp Docs missing | |
4612 chr Docs missing | |
4613 else Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}. | |
4614 elsif Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}. | |
4615 exists $HASH{KEY} True if the key exists. | |
4616 format Docs missing | |
4617 formline Docs missing | |
4618 glob EXPR Synonym of <EXPR>. | |
4619 lc [ EXPR ] Returns lowercased EXPR. | |
4620 lcfirst [ EXPR ] Returns EXPR with lower-cased first letter. | |
4621 map Docs missing | |
4622 no PACKAGE [SYMBOL1, ...] Partial reverse for `use'. Runs `unimport' method. | |
4623 ... not ... Low-precedence synonym for ! - negation. | |
4624 ... or ... Low-precedence synonym for ||. | |
4625 pos STRING Set/Get end-position of the last match over this string, see \\G. | |
4626 quotemeta [ EXPR ] Quote metacharacters. | |
4627 qw Docs missing | |
4628 readline FH Synonym of <FH>. | |
4629 readpipe CMD Synonym of `CMD`. | |
4630 ref [ EXPR ] Type of EXPR when dereferenced. | |
4631 sysopen Docs missing | |
4632 tie Docs missing | |
4633 tied Docs missing | |
4634 uc [ EXPR ] Returns upcased EXPR. | |
4635 ucfirst [ EXPR ] Returns EXPR with upcased first letter. | |
4636 untie Docs missing | |
4637 use PACKAGE [SYMBOL1, ...] Compile-time `require' with consequent `import'. | |
4638 ... xor ... Low-precedence synonym for exclusive or. | |
4639 prototype \&SUB Returns prototype of the function given a reference. | |
4640 =head1 Top-level heading. | |
4641 =head2 Second-level heading. | |
4642 =head3 Third-level heading (is there such?). | |
4643 =over [ NUMBER ] Start list. | |
4644 =item [ TITLE ] Start new item in the list. | |
4645 =back End list. | |
4646 =cut Switch from POD to Perl. | |
4647 =pod Switch from Perl to POD. | |
4480 ") | 4648 ") |
4481 | 4649 |
4482 (defun cperl-switch-to-doc-buffer () | 4650 (defun cperl-switch-to-doc-buffer () |
4483 "Go to the perl documentation buffer and insert the documentation." | 4651 "Go to the perl documentation buffer and insert the documentation." |
4484 (interactive) | 4652 (interactive) |
4520 (defun cperl-lazy-hook () | 4688 (defun cperl-lazy-hook () |
4521 (setq cperl-help-shown nil)) | 4689 (setq cperl-help-shown nil)) |
4522 | 4690 |
4523 (defun cperl-get-help-defer () | 4691 (defun cperl-get-help-defer () |
4524 (if (not (eq major-mode 'perl-mode)) nil | 4692 (if (not (eq major-mode 'perl-mode)) nil |
4525 (let ((cperl-message-on-help-error nil)) | 4693 (let ((cperl-message-on-help-error nil) (cperl-help-from-timer t)) |
4526 (cperl-get-help) | 4694 (cperl-get-help) |
4527 (setq cperl-help-shown t)))) | 4695 (setq cperl-help-shown t)))) |
4528 (cperl-lazy-install))) | 4696 (cperl-lazy-install))) |
4529 | |
4530 (provide 'cperl-mode) | |
4531 | |
4532 ;;; cperl-mode.el ends here |