help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Automatically checking parentheses before a global save not working.


From: Andreas Politz
Subject: Re: Automatically checking parentheses before a global save not working.
Date: Wed, 08 Dec 2010 15:17:03 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Elena <egarrulo@gmail.com> writes:

> On 1 Lug, 19:16, Andreas Politz <poli...@fh-trier.de> wrote:
>> (condition-case nil
>>     (check-parens)
>>   (error
>>    (when (yes-or-no-p (format "Fix parens in buffer %s ?" (buffer-name)))
>>      (switch-to-buffer (current-buffer))
>>      (recursive-edit) ;;Edit and press C-M-c
>>      (check-parens))))
>
> Thanks Andreas. This works even better than what I was trying to
> achieve (I would have just aborted saving before leaving the user into
> the offending buffer).

The last sentence is somewhat surprising.  You can use a timer to
circumvent the `save-current-buffer'.

(defun check-paren-hook ()
  (condition-case err
      (check-parens)
    (error
     (run-with-idle-timer 0 nil 'switch-to-buffer (current-buffer))
     (signal (car err) (cdr err)))))

-ap


reply via email to

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