From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#67062: 30.0.50; [PATCH] Abbreviate the revision in 'vc-annotate' (for Git) Date: Thu, 14 Dec 2023 11:42:45 -0800 Message-ID: <10fbafbc-fad9-6738-1146-c37c61e7b1e3@gmail.com> References: <66fc4912-6aa5-79da-bd6f-52f068cf1a77@gmail.com> <83y1f4wxby.fsf@gnu.org> <2eb31324-ae24-db4b-4f62-a0140bfb9f81@gutov.dev> <83sf5bv77j.fsf@gnu.org> <83bkbzusri.fsf@gnu.org> <86msvi95aw.fsf@mail.linkov.net> <8742d731-62ba-0808-bdc6-cbad1cf98116@gutov.dev> <2f7c9164-4a64-91c6-245e-61208de8560c@gmail.com> <868r72895g.fsf@mail.linkov.net> <83o7fxu458.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------daqOM9ixvrEW5W2sXlQ5E58J" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8026"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry@gutov.dev, 67062@debbugs.gnu.org To: Eli Zaretskii , Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 14 20:43:16 2023 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 1rDrc3-0001tL-If for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Dec 2023 20:43:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDrbt-0002Gs-NJ; Thu, 14 Dec 2023 14:43:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rDrbq-0002Gd-Sw for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 14:43:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rDrbq-00023E-9B for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 14:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rDrbp-0003pf-L5 for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 14:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Dec 2023 19:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67062 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67062-submit@debbugs.gnu.org id=B67062.170258297614716 (code B ref 67062); Thu, 14 Dec 2023 19:43:01 +0000 Original-Received: (at 67062) by debbugs.gnu.org; 14 Dec 2023 19:42:56 +0000 Original-Received: from localhost ([127.0.0.1]:50960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDrbj-0003pH-Ns for submit@debbugs.gnu.org; Thu, 14 Dec 2023 14:42:56 -0500 Original-Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:44487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDrbh-0003oy-Cj for 67062@debbugs.gnu.org; Thu, 14 Dec 2023 14:42:53 -0500 Original-Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1d367494c96so5551535ad.1 for <67062@debbugs.gnu.org>; Thu, 14 Dec 2023 11:42:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702582968; x=1703187768; darn=debbugs.gnu.org; h=in-reply-to:from:content-language:references:cc:to:subject :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=h4wKje7QH17jfHJMG9JKMZH0MRd/LyVKqxhc9cG+X9Y=; b=hLM6VSMYVsalzgtaScLZmgJ6kRCmnQTQrayZdBS4v7cGD0Qyb2mmVZhCKpttxep2zX qb4gjxYEXFSt4u8LRZ1X1oSxGVGEFjpNMGWcCnYZd/jKW1nxFAH+OnNavkJLQ9dO/WWs ZP5IFGY/dbM0kaUi2Z/Jq089W7vNLxRqfkVNu7OjLAaPuyNTTKW49//w32vzWrgHKYnQ qmxNMgGtrQyya3khfhJczGHEUx5vDt1el+lEx4EF7qbUe9/g7TKdzvZ+lk6ppNH5cY0n CAgraRcUXx2NFYiJl+ma6qOQ0LeLBSwgqzY2J4vpkD+22tXVB3IzH+KGbb2LlzZ8rSh2 E7fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702582968; x=1703187768; h=in-reply-to:from:content-language:references:cc:to:subject :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=h4wKje7QH17jfHJMG9JKMZH0MRd/LyVKqxhc9cG+X9Y=; b=okk1DjgYC+F+l7NdFd48quQLgf5d0mJH/ysPVf49oB91KyhP4TOqCOFw7tSNS3axM8 Oc+lJTs6O0g+i56ezHLAwFrrhdIYzl5IeCMhnK7SWF87gCz4PLkxjYv5T2TmzhOv9SaI ZZBIDa7/6Omw+uGkJMZjk1obtPYRCiDYo1ByZOb4A9J5FB/4V3jGQgeJ6qIkEraaygDj SX78EKm4gw+isDdBzhfSx4Qoh8XifIQSRreYw0I1jEptjN39wiUqrpOOAUGjhhA0Ni3r qvkc9rVYqxQL/rhsu+rCKk0lfVfd2dg4bRXiiUdAA+0oagY1n1RyiDU14XL2GDmFBdtq FPiA== X-Gm-Message-State: AOJu0Yx8FZYdQkiyyzrMV5rH2jCCGYYNTO98t4Xk7ryXKH3C8Uwo1G0i QPg4IsweNaqXL7jyQBweMM4= X-Google-Smtp-Source: AGHT+IEoGSKfssfa7Cfjjn7DPD/NQBFkQvs10etVfkidsntP4KsUYqdZhbcn464CdKW8J2YWskJnfw== X-Received: by 2002:a17:903:482:b0:1d3:4e1c:aecb with SMTP id jj2-20020a170903048200b001d34e1caecbmr1623814plb.49.1702582967809; Thu, 14 Dec 2023 11:42:47 -0800 (PST) Original-Received: from [192.168.1.2] (076-168-148-233.res.spectrum.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id u5-20020a170902b28500b001cfcf0fcc56sm2458059plr.84.2023.12.14.11.42.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Dec 2023 11:42:47 -0800 (PST) Content-Language: en-US In-Reply-To: <83o7fxu458.fsf@gnu.org> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276214 Archived-At: This is a multi-part message in MIME format. --------------daqOM9ixvrEW5W2sXlQ5E58J Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/13/2023 6:19 AM, Eli Zaretskii wrote: > This solution is also fine by me. > > Thanks. Ok, having tried out a few different implementation options, how about something like this? This adds a new function, 'vc-short-revision', that calls 'vc-working-revision' for most backends, but first checks if 'vc-BACKEND-short-revision' exists; if so, it calls that instead. Then the Git backend defines this function to do the necessary legwork. Hopefully this strikes the right balance between not requiring any extra code for other backends (including the default "backend"), while also not hardcoding "(if (eq backend 'Git)" in a generic function. In practice, this should work, though I should mention one caveat: when you pass a particular REV to 'vc-annotate', it will use that REV as-is in the buffer name. In my other patches, 'vc-annotate' would normalize the REV (so, for example, you could pass in the full 40-character Git SHA to 'vc-annotate' and the buffer name would only show the shortened form). I'm not sure this is a big deal though, since the Git revisions that you see on each line for 'vc-annotate' are the short revs by default; that means that when you call 'vc-annotate-revision-previous-to-line', it'll pass the *short* rev at that line to 'vc-annotate'. --------------daqOM9ixvrEW5W2sXlQ5E58J Content-Type: text/plain; charset=UTF-8; name="0001-Abbreviate-the-VC-revision-in-vc-annotate-s-buffer-n.patch" Content-Disposition: attachment; filename*0="0001-Abbreviate-the-VC-revision-in-vc-annotate-s-buffer-n.pa"; filename*1="tch" Content-Transfer-Encoding: base64 RnJvbSA2NzA4NGQyMjkyZDkzZjU4MjM3MDUwM2RmNzRjNjhjMGU5NWJkMjA5IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IFRodSwgMTQgRGVjIDIwMjMgMTE6MzE6MjcgLTA4MDAKU3ViamVjdDogW1BB VENIXSBBYmJyZXZpYXRlIHRoZSBWQyByZXZpc2lvbiBpbiB2Yy1hbm5vdGF0ZSdzIGJ1ZmZl ciBuYW1lCgoqIGxpc3AvdmMvdmMtaG9va3MuZWwgKHZjLXNob3J0LXJldmlzaW9uKTogTmV3 IGZ1bmN0aW9uLi4uCgoqIGxpc3AvdmMvdmMtYW5ub3RhdGUuZWwgKHZjLWFubm90YXRlKTog Li4uIGNhbGwgaXQuCgoqIGxpc3AvdmMvdmMtZ2l0LmVsICh2Yy1naXQtdXNlLXNob3J0LXJl dmlzaW9ucyk6IE5ldyBvcHRpb24uCih2Yy1naXQtc2hvcnQtcmV2aXNpb24pOi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