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 05:02:07 +0530 Message-ID: <86zfn554eg.fsf@gmx.net> References: <87bjzqp9dv.fsf@librehacker.com> <86a5f6babl.fsf@gmx.net> <864j5d6l00.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="26453"; 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 01:33:19 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 1t0r2V-0006jM-0S for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Oct 2024 01:33:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0r1j-0001tQ-K7; Tue, 15 Oct 2024 19:32:31 -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 1t0r1i-0001tD-9z for help-gnu-emacs@gnu.org; Tue, 15 Oct 2024 19:32:30 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0r1g-00067W-En for help-gnu-emacs@gnu.org; Tue, 15 Oct 2024 19:32:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1729035132; x=1729639932; i=jimjoe@gmx.net; bh=RklSpZPclVZt1MzV6cLGCSxLfgG9GXAAxcrNAqbAsGc=; 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=Et4imSYrBp93hjWb0j1htFzUMz/BzLP9dAEi2uxCpZLgX5+mX+Y0iy8VpS9L1ZxI RfMHC4S3oPe9m6pjj5HwAKhgLpDJC4QUzu0Npbzzxd0ye1HC7Pyi8Ujlj8Os2Se7a jUQq2Llv2/8BwlS65x09mk7Mf9Io5R/810mQQax+w57ZasWxf+EycSBe/5oGDnKQ8 JofnDEthTsR0b0RpwB4/1AjKj4BE67sGUJ0C1+IzW8O+e5IZdanfKJ3gjft+QkyGR MOt5T+3oB23ya8yByIIew18K1xFzhJa29hIVWd9xihXuHYTuGsu2kUU16XJiW+YyK 9wc5U9mmcoG61HG6kg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from user-Inspiron-3493 ([42.108.27.120]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MFsUp-1tAQ3Y2cFL-00HMMm; Wed, 16 Oct 2024 01:32:12 +0200 In-Reply-To: <864j5d6l00.fsf@gmx.net> (James Thomas's message of "Wed, 16 Oct 2024 04:18:15 +0530") X-Provags-ID: V03:K1:xSKTQW2m6/IDUD+I4SWvRAdqwy6pOItfm1g8/yD0Y5geQak/RFg VstQjbXNqfZSeMsu0QAtaZTqJX2Tw2TXu5/vfTnrkY/8ay4FC+MKg08K5TymcFWQiGdvcze bOSJvsWH6liamEcDyKW2zGopsy0GTbevwfEFL0PVfRAA/wlK2UHtCqLzxE8R4Lvqr4i6hCs M6k38pr/x0hqjuHLCyPuw== UI-OutboundReport: notjunk:1;M01:P0:21oU0EXwj+4=;HmxeRLfDChPDHpK5AlLfbf3WEe/ NGgQQXen9MIePSZVvsmWEnQGora5lvSSLyowxrDkdmIoCIXYvFgr5ee6c8j1hL7zKhFhgZMXM EW+O/KZwOKT/c7nzTgD5OwZVJMIqLq3m5HyLS0JGOg9xCkhtHreJ60Z5pqXUavHYlF3gu+6Q5 RIlSfkb3Ue1ROpoenRHAarmcAy662jQrT703tFEM0c7RYn6QDwZveJsWgeyCf8UpizxbWCh7f bL+ttrznrsOOGTweUHybHfJ1ZIgIyCWOckbCakxxtW3afOt1A5MEIr87PG85JIoxo5iLu4V9q WghslVLSKNNxz9lTZBFsz/v2mRAUlg5ScEtJItV1qiu9Wohj9RwO7OAPlK862HetO7ercZLcP VsHMt4IbISYj7K8fV0XZKIGoTQh3uUHx6cn8YSLuYHTvcJBCi+ZKmKdoLG5AcsTJnSdN9uGZd CyEn8rY0uQk69E8T36g0Kax4/ieOTLBgHf9yCt2naDdyebMGRoyRShtmHS3QxEG1HVtAReJh5 rzG65PQg9TuBU+jkDETESvI3sCBjXU6xOXHLleFKTJBB8LeM3vlCHKxbvzrl1jVRKYigrsFEt UPI9yLrdaIaQn/z4tqbvJ1FZlFW4HZ/HeHWi9RInSRBmVEPUfdS7C+9awD+Tm1troK4/Hf28r DhjlBjQ5jy1RAElaVpXvFOHuT0Xc7VgyvCSUcG7iTW0sdb9imRKl7ObFjGtsHZHGjMnW+UPBZ RNL39JDjM7e6k6o6O6PxHLpNbo/94JSlbic11tATZ8vhahKSxtZEd+iR2HVg9YoGvTWGr/7/ Received-SPF: pass client-ip=212.227.17.21; envelope-from=jimjoe@gmx.net; helo=mout.gmx.net X-Spam_score_int: 20 X-Spam_score: 2.0 X-Spam_bar: ++ X-Spam_report: (2.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_PSBL=2.7, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:148165 Archived-At: James Thomas wrote: > 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: Updated version that accounts for 'keywords' (_after_ the original file extension): --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[*@]?$" (string-remove-suffix (if (setq temp (denote-retrieve-filename-keywords f)) (concat "__" temp) "") (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--- --