From: James Thomas <jimjoe@gmx.net>
To: Christopher Howard <christopher@librehacker.com>
Cc: Help Gnu Emacs Mailing List <help-gnu-emacs@gnu.org>
Subject: Re: file metadata
Date: Wed, 16 Oct 2024 04:18:15 +0530 [thread overview]
Message-ID: <864j5d6l00.fsf@gmx.net> (raw)
In-Reply-To: <86a5f6babl.fsf@gmx.net> (James Thomas's message of "Tue, 15 Oct 2024 03:45:26 +0530")
James Thomas wrote:
> Christopher Howard wrote:
>
>> Hi, I have a bunch of files in various project that have
>> non-descriptive names, but I don't want to change the file names, nor
>> the file contents. It would be nice if there was some way I could
>> display my own description of the file next to the the file listing,
>> say in dired. Do we have any kind of extension, ideally with dired
>> integration, that provides some of kind of file metadata system, or
>> interacts with a third party metadata system?
>
> I had a system where I used:
>
> (let ((backup-directory-alist '(("." . "~/denote"))))
> (make-backup-file-name-1 (expand-file-name
> (file-name-with-extension filename "org"))))
>
> ...to automatically check for a corresponding denote file with metadata.
Wth, I decided to write it again. Sharing if useful for Denote users:
--8<---------------cut here---------------start------------->8---
;; Metadata for files
(defun denote-metadata (file)
(interactive
(list (read-file-name "Metadata for file: ")))
(find-file
(let* ((backup-directory-alist `(("." . ,(denote-directory))))
(name (make-backup-file-name-1
(expand-file-name file))))
(expand-file-name
(concat
(denote-get-identifier) "--"
(file-name-nondirectory name) ".org")
(file-name-directory name))))))
(defun my/dired-mark-files-with-metadata nil
(interactive)
(save-excursion
(let* ((backup-directory-alist '(("." . "/")))
(d (file-relative-name
(make-backup-file-name-1
(expand-file-name default-directory))
"/"))
temp
(hits 0))
(mapcar
(lambda (f)
(goto-char (point-min))
(when
(search-forward-regexp
(format
"\\s %s[*@]?$"
(file-name-sans-extension
(string-remove-prefix
d
(string-trim-left
f (concat denote-id-regexp "--")))))
nil t)
(setq hits (1+ hits))
(dired-mark 1)))
(directory-files
(denote-directory) nil
(concat "\\`" denote-id-regexp "--" d)))
(message "%d files with metadata marked" hits))))
--8<---------------cut here---------------end--------------->8---
--
next prev parent reply other threads:[~2024-10-15 22:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 22:22 file metadata Christopher Howard
2024-10-12 0:58 ` [External] : " Drew Adams
2024-10-12 7:16 ` Dan Hitt
2024-10-14 14:47 ` Christopher Howard
2024-10-13 22:54 ` Jean Louis
2024-10-14 22:15 ` James Thomas
2024-10-15 22:48 ` James Thomas [this message]
2024-10-15 23:32 ` James Thomas
2024-10-15 23:36 ` James Thomas
[not found] <mailman.80.1728955562.19238.help-gnu-emacs@gnu.org>
2024-10-15 11:16 ` gfp
2024-10-15 20:20 ` Jean Louis
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=864j5d6l00.fsf@gmx.net \
--to=jimjoe@gmx.net \
--cc=christopher@librehacker.com \
--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.
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).