diff options
| author | Juanma Barranquero | 2011-04-22 20:44:26 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2011-04-22 20:44:26 +0200 |
| commit | e02f48d76bfd57f014ffbe3ba56b62f2d5ccc794 (patch) | |
| tree | d27a2d9fd6838d6e619c824deb12a568ceac54f6 /lisp/progmodes/delphi.el | |
| parent | 7ede3b6577ae99a3e7ac45baa7cace439bf5070c (diff) | |
| download | emacs-e02f48d76bfd57f014ffbe3ba56b62f2d5ccc794.tar.gz emacs-e02f48d76bfd57f014ffbe3ba56b62f2d5ccc794.zip | |
lisp/progmodes/*.el: Lexical-binding cleanup.
Diffstat (limited to 'lisp/progmodes/delphi.el')
| -rw-r--r-- | lisp/progmodes/delphi.el | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/lisp/progmodes/delphi.el b/lisp/progmodes/delphi.el index 0f823c806e0..c809079381f 100644 --- a/lisp/progmodes/delphi.el +++ b/lisp/progmodes/delphi.el | |||
| @@ -328,7 +328,7 @@ routine.") | |||
| 328 | (after-change-functions nil) | 328 | (after-change-functions nil) |
| 329 | (modified (buffer-modified-p))) | 329 | (modified (buffer-modified-p))) |
| 330 | ;; Disable any queries about editing obsolete files. | 330 | ;; Disable any queries about editing obsolete files. |
| 331 | (fset 'ask-user-about-supersession-threat (lambda (fn))) | 331 | (fset 'ask-user-about-supersession-threat (lambda (_fn))) |
| 332 | (unwind-protect | 332 | (unwind-protect |
| 333 | (progn ,@forms) | 333 | (progn ,@forms) |
| 334 | (set-buffer-modified-p modified) | 334 | (set-buffer-modified-p modified) |
| @@ -444,6 +444,12 @@ routine.") | |||
| 444 | (goto-char curr-point) | 444 | (goto-char curr-point) |
| 445 | next)) | 445 | next)) |
| 446 | 446 | ||
| 447 | (defvar delphi-ignore-changes t | ||
| 448 | "Internal flag to control if the Delphi mode responds to buffer changes. | ||
| 449 | Defaults to t in case the `delphi-after-change' function is called on a | ||
| 450 | non-Delphi buffer. Set to nil in a Delphi buffer. To override, just do: | ||
| 451 | (let ((delphi-ignore-changes t)) ...)") | ||
| 452 | |||
| 447 | (defun delphi-set-text-properties (from to properties) | 453 | (defun delphi-set-text-properties (from to properties) |
| 448 | ;; Like `set-text-properties', except we do not consider this to be a buffer | 454 | ;; Like `set-text-properties', except we do not consider this to be a buffer |
| 449 | ;; modification. | 455 | ;; modification. |
| @@ -590,7 +596,6 @@ routine.") | |||
| 590 | ;; character set. | 596 | ;; character set. |
| 591 | (let ((currp (point)) | 597 | (let ((currp (point)) |
| 592 | (end nil) | 598 | (end nil) |
| 593 | (start nil) | ||
| 594 | (token nil)) | 599 | (token nil)) |
| 595 | (goto-char p) | 600 | (goto-char p) |
| 596 | (when (> (skip-chars-forward charset) 0) | 601 | (when (> (skip-chars-forward charset) 0) |
| @@ -720,13 +725,7 @@ routine.") | |||
| 720 | (delphi-step-progress p "Fontifying" delphi-fontifying-progress-step)) | 725 | (delphi-step-progress p "Fontifying" delphi-fontifying-progress-step)) |
| 721 | (delphi-progress-done))))) | 726 | (delphi-progress-done))))) |
| 722 | 727 | ||
| 723 | (defvar delphi-ignore-changes t | 728 | (defun delphi-after-change (change-start change-end _old-length) |
| 724 | "Internal flag to control if the Delphi mode responds to buffer changes. | ||
| 725 | Defaults to t in case the `delphi-after-change' function is called on a | ||
| 726 | non-Delphi buffer. Set to nil in a Delphi buffer. To override, just do: | ||
| 727 | (let ((delphi-ignore-changes t)) ...)") | ||
| 728 | |||
| 729 | (defun delphi-after-change (change-start change-end old-length) | ||
| 730 | ;; Called when the buffer has changed. Reparses the changed region. | 729 | ;; Called when the buffer has changed. Reparses the changed region. |
| 731 | (unless delphi-ignore-changes | 730 | (unless delphi-ignore-changes |
| 732 | (let ((delphi-ignore-changes t)) ; Prevent recursive calls. | 731 | (let ((delphi-ignore-changes t)) ; Prevent recursive calls. |
| @@ -922,8 +921,7 @@ non-Delphi buffer. Set to nil in a Delphi buffer. To override, just do: | |||
| 922 | ;; Returns the token of the if or case statement. | 921 | ;; Returns the token of the if or case statement. |
| 923 | (let ((token (delphi-previous-token from-else)) | 922 | (let ((token (delphi-previous-token from-else)) |
| 924 | (token-kind nil) | 923 | (token-kind nil) |
| 925 | (semicolon-count 0) | 924 | (semicolon-count 0)) |
| 926 | (if-count 0)) | ||
| 927 | (catch 'done | 925 | (catch 'done |
| 928 | (while token | 926 | (while token |
| 929 | (setq token-kind (delphi-token-kind token)) | 927 | (setq token-kind (delphi-token-kind token)) |
| @@ -971,8 +969,7 @@ non-Delphi buffer. Set to nil in a Delphi buffer. To override, just do: | |||
| 971 | comment | 969 | comment |
| 972 | ;; Scan until we run out of // comments. | 970 | ;; Scan until we run out of // comments. |
| 973 | (let ((prev-comment comment) | 971 | (let ((prev-comment comment) |
| 974 | (start-comment comment) | 972 | (start-comment comment)) |
| 975 | (kind nil)) | ||
| 976 | (while (let ((kind (delphi-token-kind prev-comment))) | 973 | (while (let ((kind (delphi-token-kind prev-comment))) |
| 977 | (cond ((eq kind 'space)) | 974 | (cond ((eq kind 'space)) |
| 978 | ((eq kind 'comment-single-line) | 975 | ((eq kind 'comment-single-line) |
| @@ -989,8 +986,7 @@ non-Delphi buffer. Set to nil in a Delphi buffer. To override, just do: | |||
| 989 | comment | 986 | comment |
| 990 | ;; Scan until we run out of // comments. | 987 | ;; Scan until we run out of // comments. |
| 991 | (let ((next-comment comment) | 988 | (let ((next-comment comment) |
| 992 | (end-comment comment) | 989 | (end-comment comment)) |
| 993 | (kind nil)) | ||
| 994 | (while (let ((kind (delphi-token-kind next-comment))) | 990 | (while (let ((kind (delphi-token-kind next-comment))) |
| 995 | (cond ((eq kind 'space)) | 991 | (cond ((eq kind 'space)) |
| 996 | ((eq kind 'comment-single-line) | 992 | ((eq kind 'comment-single-line) |
| @@ -1527,7 +1523,6 @@ If before the indent, the point is moved to the indent." | |||
| 1527 | (interactive) | 1523 | (interactive) |
| 1528 | (delphi-save-match-data | 1524 | (delphi-save-match-data |
| 1529 | (let ((marked-point (point-marker)) ; Maintain our position reliably. | 1525 | (let ((marked-point (point-marker)) ; Maintain our position reliably. |
| 1530 | (new-point nil) | ||
| 1531 | (line-start nil) | 1526 | (line-start nil) |
| 1532 | (old-indent 0) | 1527 | (old-indent 0) |
| 1533 | (new-indent 0)) | 1528 | (new-indent 0)) |