From: Sebastian Tennant <sdt@sebyte.me>
To: help-gnu-emacs@gnu.org
Subject: Dired - highlight the name of the directory in directory headers
Date: Wed, 18 Nov 2020 16:56:24 +0000 [thread overview]
Message-ID: <87pn4apps7.fsf@sebyte.me> (raw)
Hello all,
I thought it would be easy to highlight the name of the directory in
directory headers in Dired buffers. For example:
/home/bob/Notes:
^^^^^
My first approach was to use font-lock-add-keywords:
(font-lock-add-keywords 'dired-mode '("\\([^/]+\\):\n" . (1 'bold)))
but try as I might I could not get this to work.
I then thought I would add a function to dired-mode-hook:
(defun highlight-directory-name-in-headers ()
(hi-lock-face-buffer "\\([^/]+\\):\n" 'bold 1))
(add-hook 'dired-mode-hook 'highlight-directory-name-in-headers t)
but that didn't work either.
In the end, I got the mode hook to 'work' by delaying the call to
hi-lock-face-buffer:
(defun highlight-directory-name-in-headers ()
(run-at-time
0.1 nil 'hi-lock-face-buffer "\\([^/]+\\):\n" 'bold 1))
but this is an ugly kludge if ever I saw one.
How should it be done?
sebyte
--
Dorothy Annan Trevor Tennant database - DATTdb
http://dattdb.info
next reply other threads:[~2020-11-18 16:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-18 16:56 Sebastian Tennant [this message]
2020-11-18 18:42 ` Dired - highlight the name of the directory in directory headers Michael Heerdegen
2020-11-18 23:08 ` Drew Adams
-- strict thread matches above, loose matches on Subject: below --
2020-11-18 17:45 Sebastian Tennant
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=87pn4apps7.fsf@sebyte.me \
--to=sdt@sebyte.me \
--cc=help-gnu-emacs@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.