[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wrapping code in a try/except
From: |
Andrea Crotti |
Subject: |
Re: Wrapping code in a try/except |
Date: |
Tue, 23 Nov 2010 15:32:46 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) |
Andrea Crotti <andrea.crotti.0@gmail.com> writes:
>
> puff that'a a lot of code ;)
> You would be right about yasnippet, if it wasn't that there are
> variables like
>
> yas/selected-text, and wrap-region.
> This for example works perfectly when I use the kill-ring.
> When I use the selected text it just doesn't indent after, maybe the
> hook is a bit buggy.
> I'll try to update and see if anything changes, but actually I would
> prefer it a lot...
>
> try {
> `(or yas/selected-text (car kill-ring))`
> } catch ${1:Exception} {
>
> }
I updated an tried again, actually the solution using
(defun my-whole-indent ()
(indent-region (point-min)(point-max)))
(add-hook 'yas/after-exit-snippet-hook 'my-whole-indent)
is almost perfect, the only problem is that for some reasons after
exiting the first snippet, EVERY key I press triggers the exit snippet,
so emacs keeps reindenting the buffer all the time.
It doesn't make much sense to me, I thought it was my configuration but
also with
Emacs -Q and only the minimal loaded it's the same...
Also using a timer of course can be fine, maybe even better
Re: Wrapping code in a try/except, Kevin Rodgers, 2010/11/04