3

I want to display the line contains matching bracket in the message/mini buffer at the bottom of emacs. I found some code on emacs Wiki, after put it in init file, emacs do show the maching line in the message buffer:

Matches    myfucntion...()

But then it disappears very quickly (<1s) and is replaced by the following message:

Error running timer "show-paren-function": (wrong-type-argument stringp t)

I was wondering what is the cause of this timer error and just want the matching line info to be always displayed as long as my cursor stays, it would be the best if it can also display the matching line number.

Below is the code I'm using from: emacswiki: How to show the matching paren when it is offscreen

    (defadvice show-paren-function
      (after show-matching-paren-offscreen activate)
      "If the matching paren is offscreen, show the matching line in the
        echo area. Has no effect if the character before point is not of
        the syntax class ')'."
      (interactive)
      (let* ((cb (char-before (point)))
             (matching-text (and cb
                                 (char-equal (char-syntax cb) ?\) )
                                 (blink-matching-open))))
        (when matching-text (message matching-text))))

More pages that I found that is relavent but not constructive:

Request: show-smartparens and offscreen delimiter

I tried mic-paren with emacs 25.1, but it has the same problem as the matching message also disappears very fast.

Update: Error message disappears after using:

    (defadvice show-paren-function
      (after show-matching-paren-offscreen activate)
      "If the matching paren is offscreen, show the matching line in the
        echo area. Has no effect if the character before point is not of
        the syntax class ')'."
      (interactive)
      (let* (
         (cb (char-before (point)))
             (matching-text (and cb
                                 (char-equal (char-syntax cb) ?\) )
                                 (blink-matching-open)
                )
         )
        )
      )
    
     )

1 Answer 1

1

A quick look at the code shows this:

blink-matching-open does not return a string - the return value is not the matching text. So message complains that its arg is not a string.

blink-matching-open itself calls message to show the matching text, so you should be able to just remove your (when matching-text...).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.