From: Ramesh Nedunchezian <rameshnedunchezian@outlook.com>
To: 61449@debbugs.gnu.org, ", dgutov"@yandex.ru
Subject: bug#61449: 30.0.50; diff-hl-dired: Consider adding a cookie to diff-hl-dired overlay
Date: Sun, 12 Feb 2023 11:02:16 +0530 [thread overview]
Message-ID: <TY2PR0101MB3693A169203A1DD38A8F4C6CDADC9@TY2PR0101MB3693.apcprd01.prod.exchangelabs.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 4226 bytes --]
Would you mind adding a cookie to the overlay in
`diff-hl-dired-highlight-items`.
(overlay-put o 'diff-hl-dired-cookie type)
If this cookie is available, I can use it in the following ways.
1. Mark the files based on vc state. See command
`diff-hl-dired-mark-vc-states` and the associated screenshot `M-x
diff-hl-dired-mark-vc-states.png`.
2. Fontify the file names based on vc state. See command
`diff-hl-dired-fontify` and the associated screenshot `M-x
diff-hl-dired-fontify.png`.
In a sense, (1) is a GOOD---this is subjective, ofcourse---one other
way of fontifying a dired lines on vc state.
- diff-hl-dired-mode :: Put the vc state in indicator in fringe
- diff-hl-margin-mode :: Put the vc state in margin
- diff-hl-inline-mode(?) :: Put the vc state right on the file name or
the dired line.
I only need the cookie, and NOT the commands that I have attached.
Bonus points if you introduce some variation of my custom command in
the library.
----------------
Backstory: Yesterday, I was cleaning up a repo which I had been
working on-and-off for the last few years. Even though it was version
controlled, there were lots of artifacts which were never checked in.
I was apprehensive that could be some interesting titbits in the
"unknown" file. And there were quite a good number of "unknown" files
.... and I found `M-x vc-dired` too wordy, and distracting.
----------------
Remarks, and possible areas of improvement:
1. `diff-hl-dired-mode` kicks of an async process, and I wanted some
visual indication that the async process has finished, and I am
seeing ALL OF the unknown files. I would have appreciated an echo
area message, or a mode line indicator that the process has
finished.
2. `C-x v d` recursively lists all "unregistered" files, but
`diff-hl-dired-mode` lists only the entries in current directory.
I would have appreciated an option to do a recursive listing of
files ....
----------------
(require 'dash)
(require 'diff-hl-dired)
(add-hook 'dired-mode-hook
'diff-hl-dired-mode)
(add-hook 'dired-mode-hook
'dired-hide-details-mode)
(custom-set-faces
'(diff-hl-dired-change ((t (:foreground "orange"))))
'(diff-hl-dired-delete ((t (:foreground "red"))))
'(diff-hl-dired-ignored ((t (:inherit dired-ignored :foreground "grey50"))))
'(diff-hl-dired-insert ((t (:foreground "green"))))
'(diff-hl-dired-unknown ((t (:inherit dired-ignored :foreground "grey75")))))
(defvar diff-hl-dired-types
(->> (my-get-faces-matching-regexp "^diff-hl-dired-")
(--map (->> it
symbol-name
(replace-regexp-in-string "^diff-hl-dired-" "")
intern))
(cons nil)))
(defun diff-hl-dired-mark-vc-states (types)
(interactive
(->> (completing-read-multiple "VC State: "
diff-hl-dired-types
nil t)
(-map #'intern)
list))
(when types
(dired-mark-if
(memq
(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))
types)
(format "files in vc-states `%s'"
(string-join (mapcar #'symbol-name types) ",")))))
(defun dired-walk (f)
(let ((beg (point-min))
(end (point-max)))
(save-excursion
(goto-char beg)
(while (< (point) end)
(funcall f)
(forward-line 1)))))
(defun diff-hl-dired-fontify ()
(interactive)
(dired-walk
(lambda ()
(when-let* ((diff-hl-overlay
(->> (overlays-in
(line-beginning-position)
(line-end-position))
(--filter (overlay-get it 'diff-hl))
car))
(cookie (overlay-get diff-hl-overlay 'diff-hl-dired-cookie)))
(overlay-put (make-overlay (line-beginning-position) (line-end-position))
'face (diff-hl-dired-face-from-type cookie 'ignored))))))
[-- Attachment #1.2: Type: text/html, Size: 4534 bytes --]
[-- Attachment #2: M-x diff-hl-dired-mark-vc-states.png --]
[-- Type: image/png, Size: 31783 bytes --]
[-- Attachment #3: M-x diff-hl-dired-fontify.png --]
[-- Type: image/png, Size: 31076 bytes --]
next reply other threads:[~2023-02-12 5:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-12 5:32 Ramesh Nedunchezian [this message]
[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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=TY2PR0101MB3693A169203A1DD38A8F4C6CDADC9@TY2PR0101MB3693.apcprd01.prod.exchangelabs.com \
--to=rameshnedunchezian@outlook.com \
--cc=", dgutov"@yandex.ru \
--cc=61449@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.