]> git.eshelyaron.com Git - emacs.git/commitdiff
(blink-matching-open): Check there is a previous
authorRichard M. Stallman <rms@gnu.org>
Tue, 11 Oct 1994 07:29:05 +0000 (07:29 +0000)
committerRichard M. Stallman <rms@gnu.org>
Tue, 11 Oct 1994 07:29:05 +0000 (07:29 +0000)
nonblank line before trying to display it.
No need for backward-char before the skip-chars-backward.

lisp/simple.el

index 9c729358fe10930c9f5d91287955b8b420ccd963..8ca4eb99e91ed2cd14ad810bf5335670cfde6b1f 100644 (file)
@@ -2412,19 +2412,24 @@ in the mode line."
                           (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))))))))
+                      ;; Otherwise show the previous nonblank line,
+                      ;; if there is one.
+                      (if (save-excursion
+                            (skip-chars-backward "\n \t")
+                            (not (bobp)))
+                          (concat
+                           (buffer-substring (progn
+                                              (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)))
+                        ;; There is nothing to show except the char itself.
+                        (buffer-substring blinkpos (1+ blinkpos))))))))
             (cond (mismatch
                    (message "Mismatched parentheses"))
                   ((not blink-matching-paren-distance)