I'm replacing a buggy code that was suppose to show a matching brace in the minibuffer in case it was off-screen with the following:

(paren-activate) ;; activates mic-paren
(setq paren-match-face 'highlight)
(setq paren-sexp-mode t)
(setq paren-highlight-offscreen t)

This works almost perfectly. The only problem, it highlights the matching braces also in the minibuffer when ido shows its thing.

How can I disable mic-paren in the minibuffer?

For reference, here is the old code snippet:

(show-paren-mode t)
(setq show-paren-style 'expression)
;; Show in the mini-buffer the matching brace in case it is off screen.
(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 ')'."
  (if (not (minibuffer-prompt))
      (let ((matching-text nil))
        ;; Only call `blink-matching-open' if the character before point
        ;; is a close parentheses type character. Otherwise, there's not
        ;; really any point, and `blink-matching-open' would just echo
        ;; "Mismatched parentheses", which gets really annoying.
        (if (char-equal (char-syntax (char-before (point))) ?\))
            (setq matching-text (blink-matching-open)))
        (if (not (null matching-text))
            (message matching-text)))))

You can use the following to code to disable mic-paren in minibuffer whenever ido is used (using ido-minibuffer-setup-hook). Technically this does not disable mic-paren but sets its face to nil so that its highlighting does not have any effect

(defun my-remove-mic-paren-face-in-minibuffer ()
  (set (make-variable-buffer-local 'paren-match-face) nil))

(add-hook 'ido-minibuffer-setup-hook #'my-remove-mic-paren-face-in-minibuffer)

Also emacs already has a mode for highlighting matching parens show-paren, which is pretty sophisticated, you might want to try it out

  • I had issues enabling showing the match in the minibuffer using show-paren. That's why I decided to switch to mic-paren. – Dror Atariah Dec 20 '14 at 19:51
  • This works almost fine. If I hit ~/, to jump to my home, then the bad facing re-appear in the minibuffer. Any solution? – Dror Atariah Dec 21 '14 at 20:42
  • I have edited the answer now it should work even when you enter ~/ – Iqbal Ansari Dec 22 '14 at 2:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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