From: Uday S Reddy <uDOTsDOTreddy@cs.bham.ac.uk>
To: help-gnu-emacs@gnu.org
Subject: Re: Automatically checking parentheses before a global save not working.
Date: Thu, 01 Jul 2010 20:11:09 +0100 [thread overview]
Message-ID: <i0ip8d$n0c$1@north.jnrs.ja.net> (raw)
In-Reply-To: <e4d6ef68-2e04-44d8-9765-eda0bb8c338d@c10g2000yqi.googlegroups.com>
Elena wrote:
> On 1 Lug, 18:16, Andreas Politz <poli...@fh-trier.de> wrote:
>>> (switch-to-buffer (buffer-name))
>> There is no user interaction at this point.
>
> What do you mean, please? Can't I call `switch-to-buffer' there?
> However, `yes-or-no-p' (which interacts with the user) works, and the
> buffer to fix is being correctly identified by name.
All that is fine. But you can't expect to be able to edit the buffer in the
midst of a save-buffer action. The best thing to would be to signal an error
again, so that the save-buffer is aborted.
>
> If I can't switch buffer right away, maybe an alternative and safe
> approach would be to set a delayed switch, which would run after
> termination of `condition-case'.
>
>> Also, I suppose running the hook is wrapped in some
>> current-buffer-saving-macro.
Andreas is wondering if save-buffer calls the before-save-hook inside a
save-current-buffer macro, so that save-buffer finishes in the same buffer it
started. If so, running switch-to-buffer in the middle of the hook will have
no effect.
You might try printing an error message, e.g.,
(error "Unbalanced parentheses in %s" (current-buffer))
Cheers,
Uday
next prev parent reply other threads:[~2010-07-01 19:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-01 13:49 Automatically checking parentheses before a global save not working Elena
[not found] ` <87k4pffa8w.fsf@fh-trier.de>
[not found] ` <e4d6ef68-2e04-44d8-9765-eda0bb8c338d@c10g2000yqi.googlegroups.com>
2010-07-01 19:11 ` Uday S Reddy [this message]
2010-08-04 15:37 ` Johan Bockgård
[not found] ` <87eifndnck.fsf@fh-trier.de>
2010-07-02 8:54 ` Elena
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='i0ip8d$n0c$1@north.jnrs.ja.net' \
--to=udotsdotreddy@cs.bham.ac.uk \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.