unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ramesh Nedunchezian <rameshnedunchezian@outlook.com>
To: Dmitry Gutov <dgutov@yandex.ru>, 61449@debbugs.gnu.org
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	[thread overview]
Message-ID: <TY2PR0101MB36938782BE73ADD6422B250CDADD9@TY2PR0101MB3693.apcprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <8e8703e8-b41b-3fb1-edf1-8764fe725488@yandex.ru>

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


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.

[-- Attachment #2: Type: text/html, Size: 3247 bytes --]

  reply	other threads:[~2023-02-13 11:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-12  5:32 bug#61449: 30.0.50; diff-hl-dired: Consider adding a cookie to diff-hl-dired overlay Ramesh Nedunchezian
     [not found] ` <handler.61449.B.167618026110384.ack@debbugs.gnu.org>
2023-02-12  5:41   ` bug#61449: Acknowledgement (30.0.50; diff-hl-dired: Consider adding a cookie to diff-hl-dired overlay) Ramesh Nedunchezian
2023-02-12  6:34 ` bug#61449: 30.0.50; diff-hl-dired: Consider adding a cookie to diff-hl-dired overlay Ramesh Nedunchezian
2023-02-12 13:12 ` Dmitry Gutov
2023-02-13 11:32   ` Ramesh Nedunchezian
2023-02-12 13:12 ` Dmitry Gutov
2023-02-13 11:19   ` Ramesh Nedunchezian [this message]
2023-02-18 23:25     ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=TY2PR0101MB36938782BE73ADD6422B250CDADD9@TY2PR0101MB3693.apcprd01.prod.exchangelabs.com \
    --to=rameshnedunchezian@outlook.com \
    --cc=61449@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).