all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] trunk r116999: Provide function for asking vc about project root
       [not found] <E1Wc15p-0001h2-Rk@vcs.savannah.gnu.org>
@ 2014-04-21 14:43 ` Stefan Monnier
  2014-04-21 17:26   ` Daniel Colascione
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2014-04-21 14:43 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: emacs-devel

> +        (condition-case err
> +            (vc-call-backend backend 'root default-directory)
> +          (vc-not-supported
> +           (unless (eq (cadr err) 'root)
> +             (signal (car err) (cdr err)))
> +           nil)))))

Why do we need this gymnastics?


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] trunk r116999: Provide function for asking vc about project root
  2014-04-21 14:43 ` [Emacs-diffs] trunk r116999: Provide function for asking vc about project root Stefan Monnier
@ 2014-04-21 17:26   ` Daniel Colascione
  2014-04-21 21:51     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Colascione @ 2014-04-21 17:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

On 04/21/2014 07:43 AM, Stefan Monnier wrote:
>> +        (condition-case err
>> +            (vc-call-backend backend 'root default-directory)
>> +          (vc-not-supported
>> +           (unless (eq (cadr err) 'root)
>> +             (signal (car err) (cdr err)))
>> +           nil)))))
> 
> Why do we need this gymnastics?

So that we don't accidentally suppress errors we *don't* expect to get.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] trunk r116999: Provide function for asking vc about project root
  2014-04-21 17:26   ` Daniel Colascione
@ 2014-04-21 21:51     ` Stefan Monnier
  2014-04-21 21:55       ` Daniel Colascione
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2014-04-21 21:51 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: emacs-devel

>>> +        (condition-case err
>>> +            (vc-call-backend backend 'root default-directory)
>>> +          (vc-not-supported
>>> +           (unless (eq (cadr err) 'root)
>>> +             (signal (car err) (cdr err)))
>>> +           nil)))))
>> Why do we need this gymnastics?
> So that we don't accidentally suppress errors we *don't* expect to get.

No: I see the hypothetical reason, but I was wondering about
a practical reason.  IOW, I think this is overkill.  Note that the cost
is not only in code complexity but catching&re-raising signals also
defeats the backtraces in debug-on-error, which can be a pain.

I even wonder if we should allow `root' to fail.  E.g. RCS/CVS could
just walk up the directories until there's no RCS/CVS subdir.


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] trunk r116999: Provide function for asking vc about project root
  2014-04-21 21:51     ` Stefan Monnier
@ 2014-04-21 21:55       ` Daniel Colascione
  2014-04-22  1:44         ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Colascione @ 2014-04-21 21:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

On 04/21/2014 02:51 PM, Stefan Monnier wrote:
>>>> +        (condition-case err
>>>> +            (vc-call-backend backend 'root default-directory)
>>>> +          (vc-not-supported
>>>> +           (unless (eq (cadr err) 'root)
>>>> +             (signal (car err) (cdr err)))
>>>> +           nil)))))
>>> Why do we need this gymnastics?
>> So that we don't accidentally suppress errors we *don't* expect to get.
> 
> No: I see the hypothetical reason, but I was wondering about
> a practical reason.  IOW, I think this is overkill.  Note that the cost
> is not only in code complexity but catching&re-raising signals also
> defeats the backtraces in debug-on-error, which can be a pain.

We're not catching all errors --- just vc-not-supported --- and it
amounts to an assertion that nothing else went horribly wrong, because
we re-raise only in cases where we'd otherwise swallow the error, and an
error with a truncated stack is at least better than nothing at all.

> I even wonder if we should allow `root' to fail.  E.g. RCS/CVS could
> just walk up the directories until there's no RCS/CVS subdir.

Works for me. Backends could also just have their root functions
explicitly return nil if they can't figure it out.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] trunk r116999: Provide function for asking vc about project root
  2014-04-21 21:55       ` Daniel Colascione
@ 2014-04-22  1:44         ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2014-04-22  1:44 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: emacs-devel

>> I even wonder if we should allow `root' to fail.  E.g. RCS/CVS could
>> just walk up the directories until there's no RCS/CVS subdir.
> Works for me. Backends could also just have their root functions
> explicitly return nil if they can't figure it out.

Exactly.  So we shouldn't catch errors at all in vc-root-dir.


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-22  1:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1Wc15p-0001h2-Rk@vcs.savannah.gnu.org>
2014-04-21 14:43 ` [Emacs-diffs] trunk r116999: Provide function for asking vc about project root Stefan Monnier
2014-04-21 17:26   ` Daniel Colascione
2014-04-21 21:51     ` Stefan Monnier
2014-04-21 21:55       ` Daniel Colascione
2014-04-22  1:44         ` Stefan Monnier

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.