From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: James Thomas Newsgroups: gmane.emacs.help Subject: Re: file metadata Date: Wed, 16 Oct 2024 04:18:15 +0530 Message-ID: <864j5d6l00.fsf@gmx.net> References: <87bjzqp9dv.fsf@librehacker.com> <86a5f6babl.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11204"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Help Gnu Emacs Mailing List To: Christopher Howard Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 16 00:49:14 2024 Return-path: Envelope-to: geh-help-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 1t0qLq-0002lo-2y for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Oct 2024 00:49:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0qLG-00054q-Sn; Tue, 15 Oct 2024 18:48:38 -0400 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 1t0qLE-00054Z-UP for help-gnu-emacs@gnu.org; Tue, 15 Oct 2024 18:48:37 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0qLD-0001iq-1Z for help-gnu-emacs@gnu.org; Tue, 15 Oct 2024 18:48:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1729032503; x=1729637303; i=jimjoe@gmx.net; bh=9GvdlUQmB7i10GjgKKrno3yGrslxE6MhMqjJ9N/T5hg=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=WZWEC0CgvwOs728nuwyRgzjwIy+FmjIgUGdzmIAstjbfCVhASln8A+vBY0gANn8v Kc0CzL8C3qW4oqs218k7UpuBCSEoJbqJlIJ1E3UOCEH4QyZ0cf3ZIerzkBKlY3H20 j6O40SNj8QKM45dKH2gTr9a+CkkcLSMKDnmxvY45aa7Ewkjd5cnTsFAPk3K1Jcjfk c30P6SnwmYdjGm+tMybDvFsMH6uE+BpzCCCi8zWQUm2IRHj58bqnNCBugQWD1xM5v +z33x16XHi/BhTSXOypOZhV+t0d4B8UrIsowqlT4aTNrfRcBzpvkJybnN8ZnDBQ+V mezcPeSz3UhauKnBZA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from user-Inspiron-3493 ([42.108.27.75]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MlNtF-1tfejA3e0b-00llhf; Wed, 16 Oct 2024 00:48:23 +0200 In-Reply-To: <86a5f6babl.fsf@gmx.net> (James Thomas's message of "Tue, 15 Oct 2024 03:45:26 +0530") X-Provags-ID: V03:K1:ahR9HFV4Q4kAzX/5il+mp4Zj6/HuQBEWdN1tNoqVyElc6n22wbw XnBlrqqrBtR2urHtt2dQzQmOhXSweddw/1Oh8YS+quQjuF7nWEA2bD7Gv6slye/2lXcK6pa ZwrM5Y5aTDADzcNUwZ8/ncLgQNzyBSS6yZdI5pCsLDY4UVdID6sJvkjzPnkGaYCD4R1VncZ tZA9t1mJAGGXh1zZsiSiQ== UI-OutboundReport: notjunk:1;M01:P0:WJB/0KOzTX8=;KEEfJyG69jAv1XiOzYYE+Mc1c/0 V/W89SLm+hBBQLJ7tTEE/6Mz62cZxkW5ZC9gQLXlLd7FCf0BAp2xqcHBlZRnKzsuKgpI4Cvb0 rVH7HnQRaFtI1RR8KKY1CvkTIQb4OJfwC94SUbpKotQn02KVSErmcur6kaGPggys9V9VNKN4A gELGJ2LtpO4DFzUQ5Aae5F+cwNbP4nyuQpb/L6pb892QkbUl6eAt9ldN77DJl9J+1vaO8IL4m dhkAYWB89b7FBtxVwj6vnUZWBABU4t3lSjAoynVjlSib1o+wUV9l5G3RcKJWKJF3b7AFnydDt Vkmcn4Mfq4R7rgMtIhtZ2JJq5PxZBtmMMjuOvyuJunCpN2HJvFPUY2uJ/bt3yJelpL26KPHVQ rK1m64sebCKRNGwCXNTuhLWh//Ah66sXubpGzv5jT3dGlJFtqOxDKBGdrpNT9pCiRrDBT2GrC QDC4ThfzWMfmfBUmWL/oM1swi/G/rp8SaaoD1OhcDBhiqnc7RBfoBaCKjRDPTLO/WA9IJ9iiQ WTsz1SrWSv4JXihSChkj/L18Ie/fH7D/fhZ5MFbsnwDD6oJIY880nTIajz9kwvByIZyBcqGVs yC6rSltosTf5jTM8rBlFz/5pA81LR3m5bMH4ly72On5r4g2a6FRK2bHcasWlzcZY8iKGn5oTR DeyHNUDsQaT7diE/DBrgYCfiyeMppdBFJfhVe87WfT9D5Hav/MKqgHdS/LbbhyVMQa7kLKE6a cyCRs+u7J9iSgh0FtPf6JisX1GJ6ESagKgFllnEpGGmq3xwpuMHvmoJRGoRLcgzkoPAPdy9Q Received-SPF: pass client-ip=212.227.17.22; envelope-from=jimjoe@gmx.net; helo=mout.gmx.net X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1.249, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148164 Archived-At: 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--- --