[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mon, 15 Jul 2019 15:36:03 +0200
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
Stefan Monnier <address@hidden> writes:
>> It seems like people like writing `ignore-errors' a lot more than
>> `condition-case', and I think `ignore-errors' is the wrong thing to say
>> 90% of the time.
> I agree, but I think in 99% of those cases, the author has no idea which
> error might need to be caught.
That's true. If only Emacs Lisp had... checked exceptions. *runs
But it sure would be nice if we had some way of telling at least some of
the errors that a function can raise...
>> So would it be a good idea to add a new convenience macro `ignore-error'
>> to entice people to not use `ignore-errors' so much? It would take an
>> error condition as its parameter, so:
>> (ignore-error 'file-error
>> (directory-files dir))
> [ I think the argument shouldn't be quoted. ]
> More importantly, if you want me to use this, you'll have to improve
> elisp-mode's completion so it DTRT for the error symbol, like it does in
Let's see... It this stuff?
((and (or 'condition-case 'condition-case-unless-debug)
(< (point) beg)))))
(list t obarray
:predicate (lambda (sym) (get sym
Sure, that should be simple enough to cargo cult for the new macro, I
The parameter should perhaps also be allowed to be a list of symbols:
(ignore-error (file-error some-other-error)
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no