diff options
| author | Jim Blandy | 1993-06-29 18:21:12 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-06-29 18:21:12 +0000 |
| commit | d1475aa1baeb4fe2d93a9198d405e653d49e0bf0 (patch) | |
| tree | e9f925e06fab04d4ef85afbbc0d60f2d5e6e2211 | |
| parent | a12ff9f32b8901c02a7e12ed094bd72a1e2ec39c (diff) | |
| download | emacs-d1475aa1baeb4fe2d93a9198d405e653d49e0bf0.tar.gz emacs-d1475aa1baeb4fe2d93a9198d405e653d49e0bf0.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/paren.el | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lisp/paren.el b/lisp/paren.el index 0c180c160f6..efe56646a57 100644 --- a/lisp/paren.el +++ b/lisp/paren.el | |||
| @@ -24,11 +24,11 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Code: | 25 | ;;; Code: |
| 26 | 26 | ||
| 27 | (defvar blink-paren-overlay nil) | 27 | (defvar show-paren-overlay nil) |
| 28 | 28 | ||
| 29 | ;; Find the place to blink, if there is one, | 29 | ;; Find the place to show, if there is one, |
| 30 | ;; and blink it until input arrives. | 30 | ;; and show it until input arrives. |
| 31 | (defun blink-paren-command-hook () | 31 | (defun show-paren-command-hook () |
| 32 | (let (pos dir mismatch (oldpos (point)) | 32 | (let (pos dir mismatch (oldpos (point)) |
| 33 | (face (if (face-equal 'highlight 'region) | 33 | (face (if (face-equal 'highlight 'region) |
| 34 | 'underline 'highlight))) | 34 | 'underline 'highlight))) |
| @@ -59,27 +59,28 @@ | |||
| 59 | (char-after beg)) | 59 | (char-after beg)) |
| 60 | -8) | 60 | -8) |
| 61 | 255)))))) | 61 | 255)))))) |
| 62 | ;; If they don't properly match, don't blink. | 62 | ;; If they don't properly match, don't show. |
| 63 | (if mismatch | 63 | (if mismatch |
| 64 | (setq pos nil)))) | 64 | (setq pos nil)))) |
| 65 | (cond (pos | 65 | (cond (pos |
| 66 | (if blink-paren-overlay | 66 | (if show-paren-overlay |
| 67 | (move-overlay blink-paren-overlay (- pos dir) pos) | 67 | (move-overlay show-paren-overlay (- pos dir) pos) |
| 68 | (setq blink-paren-overlay | 68 | (setq show-paren-overlay |
| 69 | (make-overlay (- pos dir) pos))) | 69 | (make-overlay (- pos dir) pos))) |
| 70 | (overlay-put blink-paren-overlay 'face face) | 70 | (overlay-put show-paren-overlay 'face face) |
| 71 | ;;; This is code to blink the highlighting. | 71 | ;;; This is code to blink the highlighting. |
| 72 | ;;; It is desirable to avoid this because | 72 | ;;; It is desirable to avoid this because |
| 73 | ;;; it would interfere with auto-save and gc when idle. | 73 | ;;; it would interfere with auto-save and gc when idle. |
| 74 | ;;; (while (sit-for 1) | 74 | ;;; (while (sit-for 1) |
| 75 | ;;; (overlay-put blink-paren-overlay | 75 | ;;; (overlay-put show-paren-overlay |
| 76 | ;;; 'face | 76 | ;;; 'face |
| 77 | ;;; (if (overlay-get blink-paren-overlay | 77 | ;;; (if (overlay-get show-paren-overlay |
| 78 | ;;; 'face) | 78 | ;;; 'face) |
| 79 | ;;; nil face))) | 79 | ;;; nil face))) |
| 80 | ) | 80 | ) |
| 81 | (t | 81 | (t |
| 82 | (delete-overlay blink-paren-overlay))))) | 82 | (and show-paren-overlay (overlay-buffer show-paren-overlay) |
| 83 | (delete-overlay show-paren-overlay)))))) | ||
| 83 | 84 | ||
| 84 | (add-hook 'post-command-hook 'blink-paren-command-hook) | 85 | (add-hook 'post-command-hook 'show-paren-command-hook) |
| 85 | 86 | ||