emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Annoying paren match messages in minibuffer


From: Geoff Gole
Subject: Re: Annoying paren match messages in minibuffer
Date: Tue, 13 Jan 2009 22:58:54 +0900

> For those, you'd need to set the variable buffer-locally rather than
> let-bind it.

I found getting this right a touch tricky due to the possibility of
recursive minibuffers. But here we go:

(defun locally-suppress-paren-matching ()
  (make-local-variable 'blink-matching-paren)
  (setq blink-matching-paren nil)
  (make-local-variable 'show-paren-mode)
  (setq show-paren-mode nil)
  ;; remove suppression so recursive minibuffers can retain matching
  (remove-hook 'minibuffer-setup-hook 'locally-suppress-paren-matching))

;; This can be used to suppress spurious paren matching complaints for
;; minibuffer input that might be sensible without being balanced.
(defmacro with-minibuffer-suppressed-paren-matching (&rest body)
  "Suppresses paren highlighting for minibuffer invocations in
BODY.  On entry to the minibuffer the suppression is removed,
allowing paren highlighting to work for recursive minibuffers."
  `(let ((minibuffer-setup-hook
          ;; On entry, kill paren matching and remove self from
          ;; minibuffer-setup-hook (fix for recursive minibuffers).
          (cons 'locally-suppress-paren-matching minibuffer-setup-hook))
         (minibuffer-exit-hook
          ;; On exit, add back the removed hook.
          (cons (lambda ()
                  (add-hook 'minibuffer-setup-hook
                            'locally-suppress-paren-matching))
                minibuffer-exit-hook)))
     ,@body))

I don't really like this solution. It appears to work, but requires
patching in a whole bunch of places. And check out the "nifty" self
removing hook!

> Maybe the problem can be fixed by changing the way the message is
> displayed.  E.g. it could be displayed as " [unmatched paren]" at the
> end of the minibuffer input, as is done for minibuffer
> completion messages.

I initially thought this might be a bad idea as it would require
special casing paren matching in the minibuffer. The idea is growing
on me, though.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]