From 267935b9f1358c23c22d5d441ef1a7e0bfd195ba Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 11 Oct 1994 07:29:05 +0000 Subject: [PATCH] (blink-matching-open): Check there is a previous nonblank line before trying to display it. No need for backward-char before the skip-chars-backward. --- lisp/simple.el | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 9c729358fe1..8ca4eb99e91 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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) -- 2.39.5