]> git.eshelyaron.com Git - emacs.git/commitdiff
(blink-matching-open): Now three strategies for choosing
authorRichard M. Stallman <rms@gnu.org>
Sat, 26 Mar 1994 05:53:18 +0000 (05:53 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 26 Mar 1994 05:53:18 +0000 (05:53 +0000)
the text to display when the matching open is off screen.

lisp/simple.el

index cc2e4c6d801ba50df38b02bd05d70b7929444bf5..05e011395f22f4601f8ddd9a57b26727629aefd5 100644 (file)
@@ -2277,17 +2277,32 @@ in the mode line."
                  (goto-char blinkpos)
                  (message
                   "Matches %s"
+                  ;; Show what precedes the open in its line, if anything.
                   (if (save-excursion
                         (skip-chars-backward " \t")
                         (not (bolp)))
                       (buffer-substring (progn (beginning-of-line) (point))
                                         (1+ blinkpos))
-                    (buffer-substring blinkpos
-                                      (progn
-                                       (forward-char 1)
-                                       (skip-chars-forward "\n \t")
-                                       (end-of-line)
-                                       (point)))))))
+                    ;; Show what follows the open in its line, if anything.
+                    (if (save-excursion
+                          (forward-char 1)
+                          (skip-chars-forward " \t")
+                          (not (eolp)))
+                        (buffer-substring blinkpos
+                                          (progn (end-of-line) (point)))
+                      ;; Otherwise show the previous nonblank line.
+                      (concat
+                       (buffer-substring (progn
+                                          (backward-char 1)
+                                          (skip-chars-backward "\n \t")
+                                          (beginning-of-line)
+                                          (point))
+                                         (progn (end-of-line)
+                                                (skip-chars-backward " \t")
+                                                (point)))
+                       ;; Replace the newline and other whitespace with `...'.
+                       "..."
+                       (buffer-substring blinkpos (1+ blinkpos))))))))
             (cond (mismatch
                    (message "Mismatched parentheses"))
                   ((not blink-matching-paren-distance)