From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: RFC: Automatic setup for bug-reference-mode Date: Sun, 14 Jun 2020 14:56:56 +0200 Message-ID: <875zbt24br.fsf@gnu.org> References: <87r1uihtsu.fsf@gnu.org> <87blllx2t6.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="111780"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Stefan Monnier , emacs-devel@gnu.org To: "Basil L. Contovounesios" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 14 14:57:48 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkSCq-000SzP-Pj for ged-emacs-devel@m.gmane-mx.org; Sun, 14 Jun 2020 14:57:48 +0200 Original-Received: from localhost ([::1]:37370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkSCp-0004I9-Ql for ged-emacs-devel@m.gmane-mx.org; Sun, 14 Jun 2020 08:57:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkSC7-0003qg-Ob for emacs-devel@gnu.org; Sun, 14 Jun 2020 08:57:03 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44377) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkSC6-0005lm-6z; Sun, 14 Jun 2020 08:57:02 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:42621) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1jkSC5-0003f7-8e; Sun, 14 Jun 2020 08:57:01 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id C94BC27C0054; Sun, 14 Jun 2020 08:57:00 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 14 Jun 2020 08:57:00 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeiiedgiedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefvrghsshhi lhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqnecuggftrfgrthhtvghrnheple fhudeuvddvudetteegtdffheeuuddtjeethfejteegtefhffdtfffgudevkeffnecuffho mhgrihhnpehgnhhurdhorhhgnecukfhppeelfedrvdefiedrudefiedrfedunecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnhdomhgv shhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeehvdelke dqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: from thinkpad-t440p (p5dec881f.dip0.t-ipconnect.de [93.236.136.31]) by mail.messagingengine.com (Postfix) with ESMTPA id 688B83061856; Sun, 14 Jun 2020 08:56:58 -0400 (EDT) Mail-Followup-To: "Basil L. Contovounesios" , emacs-devel@gnu.org, Stefan Monnier In-Reply-To: <87blllx2t6.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sun, 14 Jun 2020 13:13:57 +0100") X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:252226 Archived-At: "Basil L. Contovounesios" writes: Hi Basil, I'll incorporate your suggestions later. >> + (url (pcase backend >> + ('Git (string-trim > > This needs (eval-when-compile (require 'subr-x)). Or simply remove the "p" from "pcase", I guess. >> + (shell-command-to-string >> + "git ls-remote --get-url")))))) > > Doesn't VC provide a robust way to get output from Git? vc-git--call maybe? >> + (cl-flet ((maybe-set (url-rx bug-rx bug-url-fmt) >> + (when (string-match url-rx url) >> + (setq bug-reference-bug-regexp bug-rx) >> + (setq bug-reference-url-format >> + (if (functionp bug-url-fmt) >> + (funcall bug-url-fmt) >> + bug-url-fmt))))) >> + (when (and url >> + ;; If there's a space in the url, it's propably an >> + ;; error message. >> + (not (string-match-p "[[:space:]]" url))) >> + (or >> + ;; GNU projects on savannah. FIXME: Only a fraction of >> + ;; them uses debbugs. >> + (maybe-set "git\\.\\(sv\\|savannah\\)\\.gnu\\.org:" > ^^^ > Nit: Can this be a shy group? Yes. Is is generally better to use shy groups if we aren't going to do anything with the groups anyway? >> ;;;###autoload >> -(defun vc-responsible-backend (file) >> +(defun vc-responsible-backend (file &optional no-error) >> "Return the name of a backend system that is responsible for FILE. >> >> If FILE is already registered, return the >> @@ -967,7 +967,10 @@ vc-responsible-backend >> >> Note that if FILE is a symbolic link, it will not be resolved -- >> the responsible backend system for the symbolic link itself will >> -be reported." >> +be reported. >> + >> +If NO-ERROR is nil, signal an error that no VC backend is >> +responsible for the given file." >> (or (and (not (file-directory-p file)) (vc-backend file)) >> (catch 'found >> ;; First try: find a responsible backend. If this is for registration, > > NO-ERROR seems to be a no-op in this patch. Indeed. Obviously it should have done what the docstring says. > Instead of changing the function's arglist, would it be any worse to > do the following? > > (ignore-errors (vc-responsible-backend ...)) IMHO, that it errors if no backend is found is the actual error but we cannot change that anymore. And to me "what backend would this file use" is a very common question. Even vc.el itself encodes that (dolist (backend vc-handled-backends) ...) form again in `vc-backend-for-registration' in order not to trigger the error semantics of `vc-responsible-backend'. But that's not important to me. I can also leave it as it is. Bye, Tassilo PS: I like your style of suggesting improvements using questions which all have a positive answer. Did you visit a lecture of Stefan? ;-)