From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ramesh Nedunchezian Newsgroups: gmane.emacs.bugs Subject: bug#61449: 30.0.50; diff-hl-dired: Consider adding a cookie to diff-hl-dired overlay Date: Mon, 13 Feb 2023 16:49:35 +0530 Message-ID: References: <8e8703e8-b41b-3fb1-edf1-8764fe725488@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------20i7DwrOkGBOs5Oso7E38Qe0" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11694"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 To: Dmitry Gutov , 61449@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 13 12:20:52 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 1pRWt8-0002te-V7 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 13 Feb 2023 12:20:51 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRWsd-0004P6-FQ; Mon, 13 Feb 2023 06:20:20 -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 1pRWsM-0004OJ-57 for bug-gnu-emacs@gnu.org; Mon, 13 Feb 2023 06:20:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRWsL-0007Nh-S2 for bug-gnu-emacs@gnu.org; Mon, 13 Feb 2023 06:20:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pRWsL-0003qO-LX for bug-gnu-emacs@gnu.org; Mon, 13 Feb 2023 06:20:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ramesh Nedunchezian Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Feb 2023 11:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61449 X-GNU-PR-Package: emacs Original-Received: via spool by 61449-submit@debbugs.gnu.org id=B61449.167628719314752 (code B ref 61449); Mon, 13 Feb 2023 11:20:01 +0000 Original-Received: (at 61449) by debbugs.gnu.org; 13 Feb 2023 11:19:53 +0000 Original-Received: from localhost ([127.0.0.1]:47806 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRWsC-0003ps-Dg for submit@debbugs.gnu.org; Mon, 13 Feb 2023 06:19:52 -0500 Original-Received: from mail-psaapc01olkn2103.outbound.protection.outlook.com ([40.92.52.103]:39072 helo=APC01-PSA-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRWsA-0003pd-4g for 61449@debbugs.gnu.org; Mon, 13 Feb 2023 06:19:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EUcGHtCGf3iKvoPZyji4myiS3NTksKuQIvOwaKhDy+8olIy2y5dDuFZ0L+QL5onJ5dxKByyVeDBMLbvvUF4k0Kd/jZzG2QQVwM9Fg+j7YRDCg0K9mhEfkv9iQO7h9syYduhCzzd9/zbkSL74JmmUe/9ZQP/QbAlmyPPSMf94h6k3kxNd5blCW8lzSVU0QMP4nzNdCJEgJGMLPRAoOYiHKiwzsMsUp8/MMhFZckU+bpMI/p77VuWYWIvD+km163MOcIWmFvJCuWqYAqPWSVLpKKF+wn/chXXICp97HABgR4blK/W8f4tqpSGOZVKTTg5Bev53uJW6rkkf3UQwXSeKaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wQ62omkireqqoxqa8nOsO51gLw7PHIl5sTx+NwrneYQ=; b=Ys2+4tESMfcf038VlIIaRIkZdojQT+BTVRtVIJakbHwMfjd4pUxTy+3dlpl4XgdZEwrf37TQsVDPjhnHWEQktynrxaDgOslr0GDf241+xZoZ3PNxkBS5974M4ljfdY4I5tmRxuZcLOFY8zHzDSm6WkA7b7p1wwdrVKbYP54bOG9SwWci7xvaIu1vlI2NBZ8d3kdUbTRqmLMt2UlPSZok2CO+1gfCb72+NqqQ1113MhJV4Vp0vyKJXOcxb2Xae3xtojzpsvT4EHCwSjb+JIq3UCeF6CzBDvubq6LXvbRDzm26gJTh6VzAX6RxmVkN9d+sCkM1tqcHPyVZ2PZOZ7wYfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wQ62omkireqqoxqa8nOsO51gLw7PHIl5sTx+NwrneYQ=; b=B/Fhu+Q88ubpR4UCuZJcB6KKWSXElJpFsyUfX3bw9Ostzev7RzZtFZzK3wqyMLcRbbz9ClgohavqOwJHRWmF7BeUqPPUUtfhT/27pxpYylC7pXwH2OVV8oNf3EOwjdJqHmWQJJ9YA19CBeVQ2dBllMTJbUEuty0Rvz3EnUkCEBz4tnLmP9l4GPjUA7JNJheek5V8EHLUldRsFI4hW0MQdvd8Nbl0QS/UEaw7MN34OpslSSG8491wCoTXOt0pERedR6I72fzyY60OxFU7VGRGa4qTNWPitUIYe8tnnwmOyvVyX7sFyPPL/2XB3zWhSaF2KxurCWxXYgXSB+h4ytth8A== Original-Received: from TY2PR0101MB3693.apcprd01.prod.exchangelabs.com (2603:1096:404:800f::16) by SG2PR01MB4100.apcprd01.prod.exchangelabs.com (2603:1096:4:1c3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.22; Mon, 13 Feb 2023 11:19:40 +0000 Original-Received: from TY2PR0101MB3693.apcprd01.prod.exchangelabs.com ([fe80::7d05:20af:9fed:2935]) by TY2PR0101MB3693.apcprd01.prod.exchangelabs.com ([fe80::7d05:20af:9fed:2935%5]) with mapi id 15.20.6086.023; Mon, 13 Feb 2023 11:19:40 +0000 Content-Language: en-US In-Reply-To: <8e8703e8-b41b-3fb1-edf1-8764fe725488@yandex.ru> X-TMN: [Nwgj3j097uz0cRnksZxqsVjqXDXKJ3Tct4+4z7QMA2zLrd8cGCzZfbDYkCq9v98SNF+YCbL2WS8=] X-ClientProxiedBy: MA0PR01CA0067.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:ad::13) To TY2PR0101MB3693.apcprd01.prod.exchangelabs.com (2603:1096:404:800f::16) X-Microsoft-Original-Message-ID: <4651d35a-89ac-cdf5-91b6-6d8d9dee6ca4@outlook.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY2PR0101MB3693:EE_|SG2PR01MB4100:EE_ X-MS-Office365-Filtering-Correlation-Id: ee6cbe06-1161-459b-fede-08db0db432cf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Yg5VAeIowWuAgz9b/gNizp0DG4VT2o1QfJ62H+fllxZeNCmrf1kMUr18Vldt+ZZJOuu1j7cAX0A/eh5+CLc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38DIANwkBBuXngKmMyWCuE/BTe9Gz8rD3SeSOtBugFXqTzff/AEyv8OC/Uyd9EAh6U+v9AV40TNzH49QgALHO5YfqzodUrGwQkaYhWVrurWnJ/77Klg6cE3SAzbPqRK7KzXuXaGga+XwiSM0fbeiCHFI+wMMgy3+y3v4HILYcK+f9b7YJGVXL3LUkTmnWXNFYbo4Uod6RD/KE/+NzKRPTxxT8/WHUmi+EkAhzgUTyHIXAP0m8tA6x9q8laz1jGMMWOgzNKfDfmFdKqlbXS0tCgRmUbFBJBXSlX5Vg8/iFbKgBihqQigdMPKK2DiLeXCRkXCbzVwftb31E88CHPTMo7UPKvc iByfUC7OliXoGOxoI9ie/5TprJCjqTedkfkmis8szEEmuVcXOhdXbfB5z7DtFEJUGzM1atIh9v2qivMw66jvYRHn8PafN5GgKH X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee6cbe06-1161-459b-fede-08db0db432cf X-MS-Exchange-CrossTenant-AuthSource: TY2PR0101MB3693.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2023 11:19:40.5368 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR01MB4100 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:255481 Archived-At: --------------20i7DwrOkGBOs5Oso7E38Qe0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 12/02/23 18:42, Dmitry Gutov wrote: > Hi! > > On 12/02/2023 07:32, Ramesh Nedunchezian wrote: >>        (when-let* ((diff-hl-overlay >>                     (->> (overlays-in >>                           (line-beginning-position) >>                           (line-end-position)) >>                          (--filter (overlay-get it 'diff-hl)) >>                          car))) >>          (overlay-get diff-hl-overlay 'diff-hl-dired-cookie)) > > Why do you need a cookie here? > > IIUC all such overlays (with 'diff-hl' property) inside Dired buffers are relevant. I have attached screenshots on what I could achieve with the cookie. I have also provided recipes for how the cookie could be used. ---------------- The information I am looking for is vc state, and it is buried too deep inside. Let me elaborate ... if I eval the form you have quoted above, I would get (setq x '(modification-hooks (diff-hl-overlay-modified) diff-hl-dired-cookie change before-string #(" " 0 1 (display ((left-fringe exclamation-mark diff-hl-dired-change)))) diff-hl t)) Note that the `diff-hl-dired-cookie` is added by me, and `diff-hl-dired` adds the follwing properties - `diff-hl-dired-cookie` :: This is added by me, and contains the vc state. - `diff-hl` :: This is added by `diff-hl-dired`, and `t` isn't much useful for the task I have hand. - `before-string` :: This is added by `diff-hl-dired`, and the vc state is avaiable as a face property. If I have to get to that property, this is the kind of manoeuvre I need to do (->> x (memq 'before-string) cadr (get-text-property 0 'display) car (-filter 'facep) car) If you add a cookie, I can do whatever with it. Mind you ... I am not saying the relevant information is /not/ there; I am only saying that it is buried too deep, and not readily accessible. --------------20i7DwrOkGBOs5Oso7E38Qe0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 12/02/23 18:42, Dmitry Gutov wrote:
Hi!

On 12/02/2023 07:32, Ramesh Nedunchezian wrote:
       (when-let* ((diff-hl-overlay
                    (->> (overlays-in
                          (line-beginning-position)
                          (line-end-position))
                         (--filter (overlay-get it 'diff-hl))
                         car)))
         (overlay-get diff-hl-overlay 'diff-hl-dired-cookie))

Why do you need a cookie here?

IIUC all such overlays (with 'diff-hl' property) inside Dired buffers are relevant.


I have attached screenshots on what I could achieve with the cookie.
I have also provided recipes for how the cookie could be used.

----------------

The information I am looking for is vc state, and it is buried too
deep inside.

Let me elaborate ... if I eval the form you have quoted above, I would
get

    (setq x '(modification-hooks
              (diff-hl-overlay-modified)
              diff-hl-dired-cookie change before-string
              #(" " 0 1
                (display
                 ((left-fringe exclamation-mark diff-hl-dired-change))))
              diff-hl t))


Note that the `diff-hl-dired-cookie` is added by me, and
`diff-hl-dired` adds the follwing properties
          

- `diff-hl-dired-cookie` :: This is added by me, and contains the vc
  state.
- `diff-hl` :: This is added by `diff-hl-dired`, and `t` isn't much
  useful for the task I have hand.
- `before-string` :: This is added by `diff-hl-dired`, and the vc
  state is avaiable as a face property.

  If I have to get to that property, this is the kind of manoeuvre I
  need to do

    (->> x
         (memq 'before-string)
         cadr
         (get-text-property 0 'display)
         car
         (-filter 'facep)
         car)

If you add a cookie, I can do whatever with it. 

Mind you ... I am not saying the relevant information is /not/ there; 
I am only saying that it is buried too deep, and not readily accessible.
--------------20i7DwrOkGBOs5Oso7E38Qe0--