Commit 029cb4d5 authored by Stefan Monnier's avatar Stefan Monnier

(cperl-mode): Set major-mode to cperl-mode

so that C-h m shows the correct information.
Use make-local-variable rather than make-variable-buffer-local.
(cperl-info-buffer, cperl-setup-tmp-buf):
Use make-local-variable rather than make-variable-buffer-local.

Updated to author version 4.23.
(cperl-electric-pod): SYNOPSIS was misspelled.
(cperl-find-pods-heres): @if ? a : b was considered a REx.
(cperl-after-expr-p): Make true after __END__.
parent 101922c3
...@@ -189,7 +189,7 @@ for constructs with multiline if/unless/while/until/for/foreach condition." ...@@ -189,7 +189,7 @@ for constructs with multiline if/unless/while/until/for/foreach condition."
(defcustom cperl-lineup-step nil (defcustom cperl-lineup-step nil
"*`cperl-lineup' will always lineup at multiple of this number. "*`cperl-lineup' will always lineup at multiple of this number.
If `nil', the value of `cperl-indent-level' will be used." If nil, the value of `cperl-indent-level' will be used."
:type '(choice (const nil) integer) :type '(choice (const nil) integer)
:group 'cperl-indentation-details) :group 'cperl-indentation-details)
...@@ -248,13 +248,13 @@ regardless of where in the line point is when the TAB command is used." ...@@ -248,13 +248,13 @@ regardless of where in the line point is when the TAB command is used."
:group 'cperl-indentation-details) :group 'cperl-indentation-details)
(defcustom cperl-font-lock nil (defcustom cperl-font-lock nil
"*Non-nil (and non-null) means CPerl buffers will use font-lock-mode. "*Non-nil (and non-null) means CPerl buffers will use `font-lock-mode'.
Can be overwritten by `cperl-hairy' if nil." Can be overwritten by `cperl-hairy' if nil."
:type '(choice (const null) boolean) :type '(choice (const null) boolean)
:group 'cperl-affected-by-hairy) :group 'cperl-affected-by-hairy)
(defcustom cperl-electric-lbrace-space nil (defcustom cperl-electric-lbrace-space nil
"*Non-nil (and non-null) means { after $ in CPerl buffers should be preceded by ` '. "*Non-nil (and non-null) means { after $ should be preceded by ` '.
Can be overwritten by `cperl-hairy' if nil." Can be overwritten by `cperl-hairy' if nil."
:type '(choice (const null) boolean) :type '(choice (const null) boolean)
:group 'cperl-affected-by-hairy) :group 'cperl-affected-by-hairy)
...@@ -431,7 +431,7 @@ Older version of this page was called `perl5', newer `perl'." ...@@ -431,7 +431,7 @@ Older version of this page was called `perl5', newer `perl'."
(defcustom cperl-regexp-indent-step nil (defcustom cperl-regexp-indent-step nil
"*Indentation used when beautifying regexps. "*Indentation used when beautifying regexps.
If `nil', the value of `cperl-indent-level' will be used." If nil, the value of `cperl-indent-level' will be used."
:type '(choice integer (const nil)) :type '(choice integer (const nil))
:group 'cperl-indentation-details) :group 'cperl-indentation-details)
...@@ -600,7 +600,7 @@ from Perl menu). If many files are related, generate TAGS files from ...@@ -600,7 +600,7 @@ from Perl menu). If many files are related, generate TAGS files from
Tools/Tags submenu in Perl menu. Tools/Tags submenu in Perl menu.
If some class structure is too complicated, use Tools/Hierarchy-view If some class structure is too complicated, use Tools/Hierarchy-view
from Perl menu, or hierarchic view of imenu. The second one uses the from Perl menu, or hierarchic view of imenu. The second one uses the
current buffer only, the first one requires generation of TAGS from current buffer only, the first one requires generation of TAGS from
Perl/Tools/Tags menu beforehand. Perl/Tools/Tags menu beforehand.
...@@ -611,12 +611,12 @@ Switch auto-help on/off with Perl/Tools/Auto-help. ...@@ -611,12 +611,12 @@ Switch auto-help on/off with Perl/Tools/Auto-help.
Though with contemporary Emaxen CPerl mode should maintain the correct Though with contemporary Emaxen CPerl mode should maintain the correct
parsing of Perl even when editing, sometimes it may be lost. Fix this by parsing of Perl even when editing, sometimes it may be lost. Fix this by
M-x norm RET \\[normal-mode]
In cases of more severe confusion sometimes it is helpful to do In cases of more severe confusion sometimes it is helpful to do
M-x load-l RET cperl-mode RET \\[load-library] cperl-mode RET
M-x norm RET \\[normal-mode]
Before reporting (non-)problems look in the problem section of online Before reporting (non-)problems look in the problem section of online
micro-docs on what I know about CPerl problems.") micro-docs on what I know about CPerl problems.")
...@@ -719,7 +719,7 @@ Imenu in 19.31 is broken. Set `imenu-use-keymap-menu' to t, and remove ...@@ -719,7 +719,7 @@ Imenu in 19.31 is broken. Set `imenu-use-keymap-menu' to t, and remove
`imenu-add-to-menubar' in 20.2 is broken. `imenu-add-to-menubar' in 20.2 is broken.
A lot of things on XEmacs may be broken too, judging by bug reports I A lot of things on XEmacs may be broken too, judging by bug reports I
recieve. Note that some releases of XEmacs are better than the others receive. Note that some releases of XEmacs are better than the others
as far as bugs reports I see are concerned.") as far as bugs reports I see are concerned.")
(defvar cperl-praise 'please-ignore-this-line (defvar cperl-praise 'please-ignore-this-line
...@@ -800,6 +800,9 @@ the settings present before the switch. ...@@ -800,6 +800,9 @@ the settings present before the switch.
9) When doing indentation of control constructs, may correct 9) When doing indentation of control constructs, may correct
line-breaks/spacing between elements of the construct. line-breaks/spacing between elements of the construct.
10) Uses a linear-time algorith for indentation of regions (on Emaxen with
capable syntax engines).
") ")
(defvar cperl-speed 'please-ignore-this-line (defvar cperl-speed 'please-ignore-this-line
...@@ -898,7 +901,7 @@ the faces: please specify bold, italic, underline, shadow and box.) ...@@ -898,7 +901,7 @@ the faces: please specify bold, italic, underline, shadow and box.)
(defvar cperl-del-back-ch (defvar cperl-del-back-ch
(car (append (where-is-internal 'delete-backward-char) (car (append (where-is-internal 'delete-backward-char)
(where-is-internal 'backward-delete-char-untabify))) (where-is-internal 'backward-delete-char-untabify)))
"Character generated by key bound to delete-backward-char.") "Character generated by key bound to `delete-backward-char'.")
(and (vectorp cperl-del-back-ch) (= (length cperl-del-back-ch) 1) (and (vectorp cperl-del-back-ch) (= (length cperl-del-back-ch) 1)
(setq cperl-del-back-ch (aref cperl-del-back-ch 0))) (setq cperl-del-back-ch (aref cperl-del-back-ch 0)))
...@@ -1414,7 +1417,7 @@ or as help on variables `cperl-tips', `cperl-problems', ...@@ -1414,7 +1417,7 @@ or as help on variables `cperl-tips', `cperl-problems',
(cperl-define-key "\C-hf" 'cperl-info-on-current-command [(control h) f]) (cperl-define-key "\C-hf" 'cperl-info-on-current-command [(control h) f])
(cperl-define-key "\C-c\C-hf" 'cperl-info-on-command (cperl-define-key "\C-c\C-hf" 'cperl-info-on-command
[(control c) (control h) f]))) [(control c) (control h) f])))
(setq major-mode 'perl-mode) (setq major-mode 'cperl-mode)
(setq mode-name "CPerl") (setq mode-name "CPerl")
(if (not cperl-mode-abbrev-table) (if (not cperl-mode-abbrev-table)
(let ((prev-a-c abbrevs-changed)) (let ((prev-a-c abbrevs-changed))
...@@ -1489,22 +1492,22 @@ or as help on variables `cperl-tips', `cperl-problems', ...@@ -1489,22 +1492,22 @@ or as help on variables `cperl-tips', `cperl-problems',
(make-local-variable 'cperl-syntax-state) (make-local-variable 'cperl-syntax-state)
(if cperl-use-syntax-table-text-property (if cperl-use-syntax-table-text-property
(progn (progn
(make-variable-buffer-local 'parse-sexp-lookup-properties) (make-local-variable 'parse-sexp-lookup-properties)
;; Do not introduce variable if not needed, we check it! ;; Do not introduce variable if not needed, we check it!
(set 'parse-sexp-lookup-properties t) (set 'parse-sexp-lookup-properties t)
;; Fix broken font-lock: ;; Fix broken font-lock:
(or (boundp 'font-lock-unfontify-region-function) (or (boundp 'font-lock-unfontify-region-function)
(set 'font-lock-unfontify-region-function (set 'font-lock-unfontify-region-function
'font-lock-default-unfontify-region)) 'font-lock-default-unfontify-region))
(make-variable-buffer-local 'font-lock-unfontify-region-function) (make-local-variable 'font-lock-unfontify-region-function)
(set 'font-lock-unfontify-region-function (set 'font-lock-unfontify-region-function
'cperl-font-lock-unfontify-region-function) 'cperl-font-lock-unfontify-region-function)
(make-variable-buffer-local 'cperl-syntax-done-to) (make-local-variable 'cperl-syntax-done-to)
;; Another bug: unless font-lock-syntactic-keywords, font-lock ;; Another bug: unless font-lock-syntactic-keywords, font-lock
;; ignores syntax-table text-property. (t) is a hack ;; ignores syntax-table text-property. (t) is a hack
;; to make font-lock think that font-lock-syntactic-keywords ;; to make font-lock think that font-lock-syntactic-keywords
;; are defined ;; are defined
(make-variable-buffer-local 'font-lock-syntactic-keywords) (make-local-variable 'font-lock-syntactic-keywords)
(setq font-lock-syntactic-keywords (setq font-lock-syntactic-keywords
(if cperl-syntaxify-by-font-lock (if cperl-syntaxify-by-font-lock
'(t (cperl-fontify-syntaxically)) '(t (cperl-fontify-syntaxically))
...@@ -1942,7 +1945,7 @@ to nil." ...@@ -1942,7 +1945,7 @@ to nil."
(file-name-nondirectory (buffer-file-name))) (file-name-nondirectory (buffer-file-name)))
p (point)) p (point))
(insert " NAME\n\n" name (insert " NAME\n\n" name
" - \n\n=head1 SYNOPSYS\n\n\n\n" " - \n\n=head1 SYNOPSIS\n\n\n\n"
"=head1 DESCRIPTION") "=head1 DESCRIPTION")
(cperl-ensure-newlines 4) (cperl-ensure-newlines 4)
(goto-char p) (goto-char p)
...@@ -2818,7 +2821,7 @@ the current line is to be regarded as part of a block comment." ...@@ -2818,7 +2821,7 @@ the current line is to be regarded as part of a block comment."
(defun cperl-to-comment-or-eol () (defun cperl-to-comment-or-eol ()
"Goes to position before comment on the current line, or to end of line. "Go to position before comment on the current line, or to end of line.
Returns true if comment is found." Returns true if comment is found."
(let (state stop-in cpoint (lim (progn (end-of-line) (point)))) (let (state stop-in cpoint (lim (progn (end-of-line) (point))))
(beginning-of-line) (beginning-of-line)
...@@ -3390,8 +3393,11 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', ...@@ -3390,8 +3393,11 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
(if (eq (preceding-char) ?-) (if (eq (preceding-char) ?-)
;; -d ?foo? is a RE ;; -d ?foo? is a RE
(looking-at "[a-zA-Z]\\>") (looking-at "[a-zA-Z]\\>")
(looking-at (and
"\\(while\\|if\\|unless\\|until\\|and\\|or\\|not\\|xor\\|split\\|grep\\|map\\|print\\)\\>")))) (not (memq (preceding-char)
'(?$ ?@ ?& ?%)))
(looking-at
"\\(while\\|if\\|unless\\|until\\|and\\|or\\|not\\|xor\\|split\\|grep\\|map\\|print\\)\\>")))))
(and (eq (preceding-char) ?.) (and (eq (preceding-char) ?.)
(eq (char-after (- (point) 2)) ?.)) (eq (char-after (- (point) 2)) ?.))
(bobp)) (bobp))
...@@ -3630,7 +3636,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', ...@@ -3630,7 +3636,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
(error nil)))) (error nil))))
(defun cperl-after-expr-p (&optional lim chars test) (defun cperl-after-expr-p (&optional lim chars test)
"Returns true if the position is good for start of expression. "Return true if the position is good for start of expression.
TEST is the expression to evaluate at the found position. If absent, TEST is the expression to evaluate at the found position. If absent,
CHARS is a string that contains good characters to have before us (however, CHARS is a string that contains good characters to have before us (however,
`}' is treated \"smartly\" if it is not in the list)." `}' is treated \"smartly\" if it is not in the list)."
...@@ -3657,6 +3663,7 @@ CHARS is a string that contains good characters to have before us (however, ...@@ -3657,6 +3663,7 @@ CHARS is a string that contains good characters to have before us (however,
(setq stop t)))) (setq stop t))))
(or (bobp) ; ???? Needed (or (bobp) ; ???? Needed
(eq (point) lim) (eq (point) lim)
(looking-at "[ \t]*__\\(END\\|DATA\\)__") ; After this anything goes
(progn (progn
(if test (eval test) (if test (eval test)
(or (memq (preceding-char) (append (or chars "{;") nil)) (or (memq (preceding-char) (append (or chars "{;") nil))
...@@ -4981,7 +4988,7 @@ side-effect of memorizing only." ...@@ -4981,7 +4988,7 @@ side-effect of memorizing only."
(set-buffer "*info-perl-tmp*") (set-buffer "*info-perl-tmp*")
(rename-buffer "*info*") (rename-buffer "*info*")
(set-buffer bname))) (set-buffer bname)))
(make-variable-buffer-local 'window-min-height) (make-local-variable 'window-min-height)
(setq window-min-height 2) (setq window-min-height 2)
(current-buffer))))) (current-buffer)))))
...@@ -5000,7 +5007,7 @@ side-effect of memorizing only." ...@@ -5000,7 +5007,7 @@ side-effect of memorizing only."
'find-tag-default)))))) 'find-tag-default))))))
(defun cperl-info-on-command (command) (defun cperl-info-on-command (command)
"Shows documentation for Perl command in other window. "Show documentation for Perl command in other window.
If perl-info buffer is shown in some frame, uses this frame. If perl-info buffer is shown in some frame, uses this frame.
Customized by setting variables `cperl-shrink-wrap-info-frame', Customized by setting variables `cperl-shrink-wrap-info-frame',
`cperl-max-help-size'." `cperl-max-help-size'."
...@@ -5083,7 +5090,7 @@ Customized by setting variables `cperl-shrink-wrap-info-frame', ...@@ -5083,7 +5090,7 @@ Customized by setting variables `cperl-shrink-wrap-info-frame',
(select-window iniwin))) (select-window iniwin)))
(defun cperl-info-on-current-command () (defun cperl-info-on-current-command ()
"Shows documentation for Perl command at point in other window." "Show documentation for Perl command at point in other window."
(interactive) (interactive)
(cperl-info-on-command (cperl-word-at-point))) (cperl-info-on-command (cperl-word-at-point)))
...@@ -5133,7 +5140,7 @@ partially contained in the region are lined up at the same column. ...@@ -5133,7 +5140,7 @@ partially contained in the region are lined up at the same column.
MINSHIFT is the minimal amount of space to insert before the construction. MINSHIFT is the minimal amount of space to insert before the construction.
STEP is the tabwidth to position constructions. STEP is the tabwidth to position constructions.
If STEP is `nil', `cperl-lineup-step' will be used If STEP is nil, `cperl-lineup-step' will be used
\(or `cperl-indent-level', if `cperl-lineup-step' is `nil'). \(or `cperl-indent-level', if `cperl-lineup-step' is `nil').
Will not move the position at the start to the left." Will not move the position at the start to the left."
(interactive "r") (interactive "r")
...@@ -5273,7 +5280,7 @@ See `cperl-lazy-help-time' too." ...@@ -5273,7 +5280,7 @@ See `cperl-lazy-help-time' too."
(auto-fill-mode 0) (auto-fill-mode 0)
(if cperl-use-syntax-table-text-property-for-tags (if cperl-use-syntax-table-text-property-for-tags
(progn (progn
(make-variable-buffer-local 'parse-sexp-lookup-properties) (make-local-variable 'parse-sexp-lookup-properties)
;; Do not introduce variable if not needed, we check it! ;; Do not introduce variable if not needed, we check it!
(set 'parse-sexp-lookup-properties t)))) (set 'parse-sexp-lookup-properties t))))
...@@ -6919,7 +6926,7 @@ We suppose that the regexp is scanned already." ...@@ -6919,7 +6926,7 @@ We suppose that the regexp is scanned already."
(cperl-fontify-syntaxically to))))) (cperl-fontify-syntaxically to)))))
(defvar cperl-version (defvar cperl-version
(let ((v "Revision: 4.21")) (let ((v "Revision: 4.23"))
(string-match ":\\s *\\([0-9.]+\\)" v) (string-match ":\\s *\\([0-9.]+\\)" v)
(substring v (match-beginning 1) (match-end 1))) (substring v (match-beginning 1) (match-end 1)))
"Version of IZ-supported CPerl package this file is based on.") "Version of IZ-supported CPerl package this file is based on.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment