From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#50689: 28.0.50; Wrong VC repo URL detection in bug-reference-mode Date: Mon, 20 Sep 2021 00:43:07 +0100 Message-ID: <877dfcb08k.fsf@tcd.ie> Reply-To: "Basil L. Contovounesios" Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7616"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Tassilo Horn To: 50689@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 20 01:44:22 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1mS6Tt-0001l9-Ua for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Sep 2021 01:44:22 +0200 Original-Received: from localhost ([::1]:41036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mS6Tr-0003N9-3p for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Sep 2021 19:44:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mS6Tb-0003N1-1F for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 19:44:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56976) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mS6Ta-0004SQ-PT; Sun, 19 Sep 2021 19:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mS6Ta-0005OP-H2; Sun, 19 Sep 2021 19:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: tsdh@gnu.org, bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Sep 2021 23:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50689 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Tassilo Horn Original-Received: via spool by submit@debbugs.gnu.org id=B.163209500020673 (code B ref -1); Sun, 19 Sep 2021 23:44:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Sep 2021 23:43:20 +0000 Original-Received: from localhost ([127.0.0.1]:40289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mS6Su-0005NK-9Y for submit@debbugs.gnu.org; Sun, 19 Sep 2021 19:43:20 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:44440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mS6Ss-0005NC-5n for submit@debbugs.gnu.org; Sun, 19 Sep 2021 19:43:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mS6Sr-0003MX-Rt for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 19:43:17 -0400 Original-Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:43873) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mS6Sn-0003w2-Ne for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 19:43:17 -0400 Original-Received: by mail-wm1-x331.google.com with SMTP id a194-20020a1c98cb000000b0030b41ac389fso6082466wme.2 for ; Sun, 19 Sep 2021 16:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:subject:date:message-id:user-agent:mime-version; bh=XrpFe6eRkItV+xZRSLe2vBefSb7qgq0sTQtXcD72764=; b=C4pY01P4x9N30VGUkbY2M93/etZjRAjBlKTVpg0JY9B5wt+OMBlEoRR4qWk3Suu0y4 1QD/0mx1pMJdXfoboflDx1xsrSYF3R9oJvvBhXkzHvDu/gsect7fgEQtIqRk3f5ZF5ma 4eWHWSF3NLlIWaZQGZ10Gr/CqTrNGkz7bePCeFcq1p9Z+VdIPRqhISnQMdT65D5+MdOf yBeCM2uKAbd/UhlSWxqBZEhBvW7Djgcr5LGBCVeQKtOIcQj8ZWXbNX0Om6q0W94nDjl1 ljkSjwbOGbJ7BONM+uURZeeYUZNd842SawN+jgIMHArezkxEt5iKiVDS3FAsDscL/+bx zJSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=XrpFe6eRkItV+xZRSLe2vBefSb7qgq0sTQtXcD72764=; b=IdWnmFdnXTyMW448YuLgqERHy3H99BLJqZLf1kWthlbWkxgdFsuBvcnuORIptU5grN pOf9Lgsz1rDUxr4Dju0RVllcypp1hu19irQSvanZ2b9kRQkrkE7+f3lKqgdTty0Ibg15 /DKuIf7pg/UybetfA2PG1wjVGmdN7NYgsZTsTKdGdfJKSmsHQz1uafRnad1e6EXmEgJt 0AWec2JNTqLtxYkEBv0IFEBGgI0XDlOcAp7gj7ZPSBwnsoSp6WxlkVcQbSrLRhMckO/Y +Kjj9JjXbIPK0I4Xz98lFA6DKgte3br2PqvO7VnieeTyyV8yIZMzQZ3S/B7Qlr6l9Bvr JC9g== X-Gm-Message-State: AOAM5325wqLx+wW1KXNqLXAVJT7a0i9edTRhReShJXOysUCG72K9tK3c qrMFGHqBCq7OOZHZkY1aGrRaL1GidNdYvw== X-Google-Smtp-Source: ABdhPJwhrCqkgSnztKBd2kTAk33ETnjfQCVLpdUZrudm5xX/oohkK2Kn4/voXDRWOMiTycUbD6ULiQ== X-Received: by 2002:a1c:a942:: with SMTP id s63mr26160194wme.45.1632094989964; Sun, 19 Sep 2021 16:43:09 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:d15:339e:aa10:60f1]) by smtp.gmail.com with ESMTPSA id u23sm16685280wmc.24.2021.09.19.16.43.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Sep 2021 16:43:08 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=contovob@tcd.ie; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:214800 Archived-At: --=-=-= Content-Type: text/plain Tags: patch In a clone of https://github.com/abo-abo/swiper.git, with the following remotes: $ git remote -v elpa savannah:/srv/git/emacs/elpa.git (fetch) elpa savannah:/srv/git/emacs/elpa.git (push) origin git@github.com:basil-conto/swiper.git (fetch) origin git@github.com:basil-conto/swiper.git (push) upstream git@github.com:abo-abo/swiper.git (fetch) upstream git@github.com:abo-abo/swiper.git (push) 0. emacs -Q ivy.el 1. M-: (vc-call-backend 'Git 'repository-url "upstream") RET This returns: "git@github.com:basil-conto/swiper.git" instead of: "git@github.com:abo-abo/swiper.git" Step 1 is effectively what bug-reference-try-setup-from-vc does, and I believe the incorrect result is due to vc-git-repository-url expecting a file name, not a Git remote name, as its first argument. How's the attached fix? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-VC-repo-URL-detection-in-bug-reference-mode.patch >From dd1be2b9c277a53078fb20242702ecf2599cbb7b Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sun, 19 Sep 2021 21:13:17 +0100 Subject: [PATCH 1/2] Fix VC repo URL detection in bug-reference-mode * lisp/progmodes/bug-reference.el (bug-reference-try-setup-from-vc): Pass file or directory name in question as the first argument to the backend's repository-url implementation. Use when-let and seq-some to flatten nested conditionals. --- lisp/progmodes/bug-reference.el | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index b646a47c85..fd014a38d9 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -376,24 +376,19 @@ bug-reference-try-setup-from-vc Test each configuration in `bug-reference-setup-from-vc-alist' and `bug-reference--setup-from-vc-alist' and apply it if applicable." - (let ((file-or-dir (or buffer-file-name - ;; Catches modes such as vc-dir and Magit. - default-directory))) - (when file-or-dir - (let* ((backend (vc-responsible-backend file-or-dir t)) - (url - (or (ignore-errors - (vc-call-backend backend 'repository-url "upstream")) - (ignore-errors - (vc-call-backend backend 'repository-url))))) - (when url - (catch 'found - (dolist (config (append - bug-reference-setup-from-vc-alist - (bug-reference--setup-from-vc-alist))) - (when (apply #'bug-reference-maybe-setup-from-vc - url config) - (throw 'found t))))))))) + (when-let ((file-or-dir (or buffer-file-name + ;; Catches modes such as vc-dir and Magit. + default-directory)) + (backend (vc-responsible-backend file-or-dir t)) + (url (seq-some (lambda (remote) + (ignore-errors + (vc-call-backend backend 'repository-url + file-or-dir remote))) + '("upstream" nil)))) + (seq-some (lambda (config) + (apply #'bug-reference-maybe-setup-from-vc url config)) + (append bug-reference-setup-from-vc-alist + (bug-reference--setup-from-vc-alist))))) (defvar bug-reference-setup-from-mail-alist `((,(regexp-opt '("emacs" "auctex" "gnus" "tramp" "orgmode") 'words) -- 2.33.0 --=-=-= Content-Type: text/plain Thanks, -- Basil In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) of 2021-09-20 built on tia Repository revision: 3c513435369826e44a53dcb12ecc14657e03c73d Repository branch: HEAD Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Debian GNU/Linux bookworm/sid Configured using: 'configure 'CC=ccache gcc' 'CFLAGS=-Og -ggdb' --config-cache --prefix=/home/blc/.local --enable-checking=structs --with-x-toolkit=lucid --with-file-notification=yes --with-x' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XAW3D XDBE XIM XPM LUCID ZLIB Important settings: value of $LANG: en_IE.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: ELisp/l Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (vc-git diff-mode easy-mmode vc-dispatcher help-mode pp shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map text-property-search time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 57729 7685) (symbols 48 7242 5) (strings 32 21156 1629) (string-bytes 1 675261) (vectors 16 14813) (vector-slots 8 196771 13743) (floats 8 31 55) (intervals 56 350 15) (buffers 992 12)) --=-=-=--