aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Jörg2021-02-04 20:52:20 +0100
committerLars Ingebrigtsen2021-02-04 20:52:29 +0100
commita92167674f6f2bbe4e97c40b483995d08ab15b85 (patch)
tree3481191e9911335facf3095486d9d540cf44040e
parenta2d7f3f171386f39a55f73988f94b1f4c94d8a6b (diff)
downloademacs-a92167674f6f2bbe4e97c40b483995d08ab15b85.tar.gz
emacs-a92167674f6f2bbe4e97c40b483995d08ab15b85.zip
cperl-mode: eliminate dead code
* lisp/progmodes/cperl-mode.el (cperl-update-syntaxification): Eliminate check for `syntax-propertize-rules` (always true) and eliminate unused first parameter. (cperl-mode): Eliminate obsolete `font-lock-syntactic-keywords`, Eliminate check for `syntax-propertize-rules` (always true). (cperl-fontify-syntaxically): Eliminate call to no-longer-existing function `edebug-backtrace` (bug#46302).
-rw-r--r--lisp/progmodes/cperl-mode.el90
1 files changed, 29 insertions, 61 deletions
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index d401513646f..a70e8e36c0b 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -1157,25 +1157,25 @@ versions of Emacs."
1157 (get-text-property (point-min) 'in-pod) 1157 (get-text-property (point-min) 'in-pod)
1158 (< (progn 1158 (< (progn
1159 (and cperl-syntaxify-for-menu 1159 (and cperl-syntaxify-for-menu
1160 (cperl-update-syntaxification (point-max) (point-max))) 1160 (cperl-update-syntaxification (point-max)))
1161 (next-single-property-change (point-min) 'in-pod nil (point-max))) 1161 (next-single-property-change (point-min) 'in-pod nil (point-max)))
1162 (point-max)))] 1162 (point-max)))]
1163 ["Ispell HERE-DOCs" cperl-here-doc-spell 1163 ["Ispell HERE-DOCs" cperl-here-doc-spell
1164 (< (progn 1164 (< (progn
1165 (and cperl-syntaxify-for-menu 1165 (and cperl-syntaxify-for-menu
1166 (cperl-update-syntaxification (point-max) (point-max))) 1166 (cperl-update-syntaxification (point-max)))
1167 (next-single-property-change (point-min) 'here-doc-group nil (point-max))) 1167 (next-single-property-change (point-min) 'here-doc-group nil (point-max)))
1168 (point-max))] 1168 (point-max))]
1169 ["Narrow to this HERE-DOC" cperl-narrow-to-here-doc 1169 ["Narrow to this HERE-DOC" cperl-narrow-to-here-doc
1170 (eq 'here-doc (progn 1170 (eq 'here-doc (progn
1171 (and cperl-syntaxify-for-menu 1171 (and cperl-syntaxify-for-menu
1172 (cperl-update-syntaxification (point) (point))) 1172 (cperl-update-syntaxification (point)))
1173 (get-text-property (point) 'syntax-type)))] 1173 (get-text-property (point) 'syntax-type)))]
1174 ["Select this HERE-DOC or POD section" 1174 ["Select this HERE-DOC or POD section"
1175 cperl-select-this-pod-or-here-doc 1175 cperl-select-this-pod-or-here-doc
1176 (memq (progn 1176 (memq (progn
1177 (and cperl-syntaxify-for-menu 1177 (and cperl-syntaxify-for-menu
1178 (cperl-update-syntaxification (point) (point))) 1178 (cperl-update-syntaxification (point)))
1179 (get-text-property (point) 'syntax-type)) 1179 (get-text-property (point) 'syntax-type))
1180 '(here-doc pod))] 1180 '(here-doc pod))]
1181 "----" 1181 "----"
@@ -1659,36 +1659,18 @@ or as help on variables `cperl-tips', `cperl-problems',
1659 nil nil ((?_ . "w")))) 1659 nil nil ((?_ . "w"))))
1660 ;; Reset syntaxification cache. 1660 ;; Reset syntaxification cache.
1661 (setq-local cperl-syntax-state nil) 1661 (setq-local cperl-syntax-state nil)
1662 (if cperl-use-syntax-table-text-property 1662 (when cperl-use-syntax-table-text-property
1663 (if (eval-when-compile (fboundp 'syntax-propertize-rules)) 1663 ;; Reset syntaxification cache.
1664 (progn 1664 (setq-local cperl-syntax-done-to nil)
1665 ;; Reset syntaxification cache. 1665 (setq-local syntax-propertize-function
1666 (setq-local cperl-syntax-done-to nil) 1666 (lambda (start end)
1667 (setq-local syntax-propertize-function 1667 (goto-char start)
1668 (lambda (start end) 1668 ;; Even if cperl-fontify-syntaxically has already gone
1669 (goto-char start) 1669 ;; beyond `start', syntax-propertize has just removed
1670 ;; Even if cperl-fontify-syntaxically has already gone 1670 ;; syntax-table properties between start and end, so we have
1671 ;; beyond `start', syntax-propertize has just removed 1671 ;; to re-apply them.
1672 ;; syntax-table properties between start and end, so we have 1672 (setq cperl-syntax-done-to start)
1673 ;; to re-apply them. 1673 (cperl-fontify-syntaxically end))))
1674 (setq cperl-syntax-done-to start)
1675 (cperl-fontify-syntaxically end))))
1676 ;; Do not introduce variable if not needed, we check it!
1677 (setq-local parse-sexp-lookup-properties t)
1678 ;; Our: just a plug for wrong font-lock
1679 (setq-local font-lock-unfontify-region-function
1680 ;; not present with old Emacs
1681 #'cperl-font-lock-unfontify-region-function)
1682 ;; Reset syntaxification cache.
1683 (setq-local cperl-syntax-done-to nil)
1684 (setq-local font-lock-syntactic-keywords
1685 (if cperl-syntaxify-by-font-lock
1686 '((cperl-fontify-syntaxically))
1687 ;; unless font-lock-syntactic-keywords, font-lock (pre-22.1)
1688 ;; used to ignore syntax-table text-properties. (t) is a hack
1689 ;; to make font-lock think that font-lock-syntactic-keywords
1690 ;; are defined.
1691 '(t)))))
1692 (setq cperl-font-lock-multiline t) ; Not localized... 1674 (setq cperl-font-lock-multiline t) ; Not localized...
1693 (setq-local font-lock-multiline t) 1675 (setq-local font-lock-multiline t)
1694 (setq-local font-lock-fontify-region-function 1676 (setq-local font-lock-fontify-region-function
@@ -2405,7 +2387,7 @@ means indent rigidly all the lines of the expression starting after point
2405so that this line becomes properly indented. 2387so that this line becomes properly indented.
2406The relative indentation among the lines of the expression are preserved." 2388The relative indentation among the lines of the expression are preserved."
2407 (interactive "P") 2389 (interactive "P")
2408 (cperl-update-syntaxification (point) (point)) 2390 (cperl-update-syntaxification (point))
2409 (if whole-exp 2391 (if whole-exp
2410 ;; If arg, always indent this line as Perl 2392 ;; If arg, always indent this line as Perl
2411 ;; and shift remaining lines of expression the same amount. 2393 ;; and shift remaining lines of expression the same amount.
@@ -2533,7 +2515,7 @@ Will not look before LIM."
2533 2515
2534(defun cperl-sniff-for-indent (&optional parse-data) ; was parse-start 2516(defun cperl-sniff-for-indent (&optional parse-data) ; was parse-start
2535 ;; the sniffer logic to understand what the current line MEANS. 2517 ;; the sniffer logic to understand what the current line MEANS.
2536 (cperl-update-syntaxification (point) (point)) 2518 (cperl-update-syntaxification (point))
2537 (let ((res (get-text-property (point) 'syntax-type))) 2519 (let ((res (get-text-property (point) 'syntax-type)))
2538 (save-excursion 2520 (save-excursion
2539 (cond 2521 (cond
@@ -3025,7 +3007,7 @@ Returns true if comment is found. In POD will not move the point."
3025 ;; then looks for literal # or end-of-line. 3007 ;; then looks for literal # or end-of-line.
3026 (let (state stop-in cpoint (lim (point-at-eol)) pr e) 3008 (let (state stop-in cpoint (lim (point-at-eol)) pr e)
3027 (or cperl-font-locking 3009 (or cperl-font-locking
3028 (cperl-update-syntaxification lim lim)) 3010 (cperl-update-syntaxification lim))
3029 (beginning-of-line) 3011 (beginning-of-line)
3030 (if (setq pr (get-text-property (point) 'syntax-type)) 3012 (if (setq pr (get-text-property (point) 'syntax-type))
3031 (setq e (next-single-property-change (point) 'syntax-type nil (point-max)))) 3013 (setq e (next-single-property-change (point) 'syntax-type nil (point-max))))
@@ -4640,7 +4622,7 @@ CHARS is a string that contains good characters to have before us (however,
4640`}' is treated \"smartly\" if it is not in the list)." 4622`}' is treated \"smartly\" if it is not in the list)."
4641 (let ((lim (or lim (point-min))) 4623 (let ((lim (or lim (point-min)))
4642 stop p) 4624 stop p)
4643 (cperl-update-syntaxification (point) (point)) 4625 (cperl-update-syntaxification (point))
4644 (save-excursion 4626 (save-excursion
4645 (while (and (not stop) (> (point) lim)) 4627 (while (and (not stop) (> (point) lim))
4646 (skip-chars-backward " \t\n\f" lim) 4628 (skip-chars-backward " \t\n\f" lim)
@@ -5027,7 +5009,7 @@ inclusive.
5027If `cperl-indent-region-fix-constructs', will improve spacing on 5009If `cperl-indent-region-fix-constructs', will improve spacing on
5028conditional/loop constructs." 5010conditional/loop constructs."
5029 (interactive "r") 5011 (interactive "r")
5030 (cperl-update-syntaxification end end) 5012 (cperl-update-syntaxification end)
5031 (save-excursion 5013 (save-excursion
5032 (let (cperl-update-start cperl-update-end (h-a-c after-change-functions)) 5014 (let (cperl-update-start cperl-update-end (h-a-c after-change-functions))
5033 (let ((indent-info (list nil nil nil) ; Cannot use '(), since will modify 5015 (let ((indent-info (list nil nil nil) ; Cannot use '(), since will modify
@@ -5233,7 +5215,7 @@ indentation and initial hashes. Behaves usually outside of comment."
5233 packages ends-ranges p marker is-proto 5215 packages ends-ranges p marker is-proto
5234 is-pack index index1 name (end-range 0) package) 5216 is-pack index index1 name (end-range 0) package)
5235 (goto-char (point-min)) 5217 (goto-char (point-min))
5236 (cperl-update-syntaxification (point-max) (point-max)) 5218 (cperl-update-syntaxification (point-max))
5237 ;; Search for the function 5219 ;; Search for the function
5238 (progn ;;save-match-data 5220 (progn ;;save-match-data
5239 (while (re-search-forward 5221 (while (re-search-forward
@@ -8209,7 +8191,7 @@ function returns nil."
8209 (or prop (setq prop 'in-pod)) 8191 (or prop (setq prop 'in-pod))
8210 (or s (setq s (point-min))) 8192 (or s (setq s (point-min)))
8211 (or end (setq end (point-max))) 8193 (or end (setq end (point-max)))
8212 (cperl-update-syntaxification end end) 8194 (cperl-update-syntaxification end)
8213 (save-excursion 8195 (save-excursion
8214 (goto-char (setq pos s)) 8196 (goto-char (setq pos s))
8215 (while (and cont (< pos end)) 8197 (while (and cont (< pos end))
@@ -8225,7 +8207,7 @@ function returns nil."
8225Return nil if the point is not in a HERE document region. If POD is non-nil, 8207Return nil if the point is not in a HERE document region. If POD is non-nil,
8226will return a POD section if point is in a POD section." 8208will return a POD section if point is in a POD section."
8227 (or pos (setq pos (point))) 8209 (or pos (setq pos (point)))
8228 (cperl-update-syntaxification pos pos) 8210 (cperl-update-syntaxification pos)
8229 (if (or (eq 'here-doc (get-text-property pos 'syntax-type)) 8211 (if (or (eq 'here-doc (get-text-property pos 'syntax-type))
8230 (and pod 8212 (and pod
8231 (eq 'pod (get-text-property pos 'syntax-type)))) 8213 (eq 'pod (get-text-property pos 'syntax-type))))
@@ -8295,7 +8277,7 @@ start with default arguments, then refine the slowdown regions."
8295 (forward-line step) 8277 (forward-line step)
8296 (setq l (+ l step)) 8278 (setq l (+ l step))
8297 (setq c (1+ c)) 8279 (setq c (1+ c))
8298 (cperl-update-syntaxification (point) (point)) 8280 (cperl-update-syntaxification (point))
8299 (setq delta (- (- tt (setq tt (funcall timems)))) tot (+ tot delta)) 8281 (setq delta (- (- tt (setq tt (funcall timems)))) tot (+ tot delta))
8300 (message "to %s:%6s,%7s" l delta tot)) 8282 (message "to %s:%6s,%7s" l delta tot))
8301 tot)) 8283 tot))
@@ -8405,19 +8387,12 @@ do extra unwind via `cperl-unwind-to-safe'."
8405 (setq end (point))) 8387 (setq end (point)))
8406 (font-lock-default-fontify-region beg end loudly)) 8388 (font-lock-default-fontify-region beg end loudly))
8407 8389
8408(defvar cperl-d-l nil)
8409(defvar edebug-backtrace-buffer) ;FIXME: Why?
8410(defun cperl-fontify-syntaxically (end) 8390(defun cperl-fontify-syntaxically (end)
8411 ;; Some vars for debugging only 8391 ;; Some vars for debugging only
8412 ;; (message "Syntaxifying...") 8392 ;; (message "Syntaxifying...")
8413 (let ((dbg (point)) (iend end) (idone cperl-syntax-done-to) 8393 (let ((dbg (point)) (iend end) (idone cperl-syntax-done-to)
8414 (istate (car cperl-syntax-state)) 8394 (istate (car cperl-syntax-state))
8415 start from-start edebug-backtrace-buffer) 8395 start from-start)
8416 (if (eq cperl-syntaxify-by-font-lock 'backtrace)
8417 (progn
8418 (require 'edebug)
8419 (let ((f 'edebug-backtrace))
8420 (funcall f)))) ; Avoid compile-time warning
8421 (or cperl-syntax-done-to 8396 (or cperl-syntax-done-to
8422 (setq cperl-syntax-done-to (point-min) 8397 (setq cperl-syntax-done-to (point-min)
8423 from-start t)) 8398 from-start t))
@@ -8473,16 +8448,9 @@ do extra unwind via `cperl-unwind-to-safe'."
8473 (if cperl-syntax-done-to 8448 (if cperl-syntax-done-to
8474 (setq cperl-syntax-done-to (min cperl-syntax-done-to beg)))) 8449 (setq cperl-syntax-done-to (min cperl-syntax-done-to beg))))
8475 8450
8476(defun cperl-update-syntaxification (from to) 8451(defun cperl-update-syntaxification (to)
8477 (cond 8452 (when cperl-use-syntax-table-text-property
8478 ((not cperl-use-syntax-table-text-property) nil) 8453 (syntax-propertize to)))
8479 ((fboundp 'syntax-propertize) (syntax-propertize to))
8480 ((and cperl-syntaxify-by-font-lock
8481 (or (null cperl-syntax-done-to)
8482 (< cperl-syntax-done-to to)))
8483 (save-excursion
8484 (goto-char from)
8485 (cperl-fontify-syntaxically to)))))
8486 8454
8487(defvar cperl-version 8455(defvar cperl-version
8488 (let ((v "Revision: 6.2")) 8456 (let ((v "Revision: 6.2"))