From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sacha Chua Newsgroups: gmane.emacs.devel Subject: [PATCH] image-dired-show-all-from-dir: reuse dired's default directory Date: Thu, 02 Jan 2025 15:00:29 -0500 Message-ID: <87cyh5ugte.fsf@sachachua.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16579"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 02 21:01:32 2025 Return-path: Envelope-to: ged-emacs-devel@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 1tTRNs-00048Z-LN for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Jan 2025 21:01:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTRN9-0007qg-PQ; Thu, 02 Jan 2025 15:00:47 -0500 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 1tTRN7-0007pM-QJ for emacs-devel@gnu.org; Thu, 02 Jan 2025 15:00:45 -0500 Original-Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTRN5-0006Mb-Rb for emacs-devel@gnu.org; Thu, 02 Jan 2025 15:00:45 -0500 Original-Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-6dd5c544813so70282006d6.1 for ; Thu, 02 Jan 2025 12:00:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sachachua-com.20230601.gappssmtp.com; s=20230601; t=1735848042; x=1736452842; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=bguBV+OttzXqDeRTpreXwz7e45/HGwPZqRWyE0hNkvQ=; b=QNfSk2Ax6xPARGq78QwpkiKkzM/SVXYdIqiLECvSH3K8DOXqMmhTC4/mrT67Hk7kWm NdBEtV8D/gAy0AKhajJpjCe/cbaY5NjVvpACpQ2tTP+lszoOE1f30IW0Dmi3OxBS79GX O1VEF2kTkyozgqu64FWrRfyGtuJDom4Bp+HAIS25QBAGcVzP0UwQGCycI5UA2P6fkMjP 1xMlvUUIDX/luxkb4o8KM++velaOOI3R3Tcgj3towYnhPd82sfAisDXR9DxyksiHyMj7 ByRmWJl3bFYsyuyXqVMvxL8Qc/n5qTrzGKJYuGYpyf65zd8XiT/HH87tJ+YjyI10l7T+ rmrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735848042; x=1736452842; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=bguBV+OttzXqDeRTpreXwz7e45/HGwPZqRWyE0hNkvQ=; b=wM7ruuF0KzsO++rzIm3Fd+8XHvkngYTFjV4aUrB2EWwyxbnd7YUs/9gUzfqJTVhlVE LMJIF5zm9q4RRgbIAzQTLgFzIgzT/AvFw8FgbRHrOYD9VVfisAOMe/iDJnQoafWu4PMN xlm837vvDHexFawgochvIGhUsbGKCi50XckuO04WfcqS20PomrRw8mtmdWVWOaOVlu9Y TkjKrGcwyptXP7Y3zprFXxHtdmJGLSIAomJLUFYyjYXCBffFqbacC1AbYPxr/Yk37jmH IToES6e192UCjqYCfgxsjsXYTG1hVrw+/gv9IDXBRRlpakG8ORf+g5xo1CTQG8DF0bxO U0+A== X-Gm-Message-State: AOJu0Ywcfoa/vYOHbIHjVy5Iq5389ml1m94Be747t+ZL4xQ3c3GsdHY2 LwLtUBE4A93oGzww4FJvl+IeF8x4PkmTDiOc5BlNtmsW4PH+i3Yxju/IXLxS8jB1Ko5gB57R2rS oWJw= X-Gm-Gg: ASbGncuQesaJ9SShAKJPKnWqyYKYt5DeyDxyqo/SLqpnTHHoeg5QIGchAe1/PCmxpdW PpBAce0sc6Cw8vt38J+76V3/XyPKqFPVPLSyUo8YeL83EbxuvDmsosNPtIFKwb9jaVdv5py6ZlR JXo9fRLEsNPMFrQZxYZfoJDnffosx9WNYUwz2GA/rWu+ey3iTcLixkzENmdt6fmGqGDexxB4R7z TicArG6FT8grDVgS5gHMAuVazkawbT8JF8QIZ87bW4QMFYE0ss= X-Google-Smtp-Source: AGHT+IFkBkAZXza/iU7tS1Bm9kAhss9oq7iZMjP6TvLwI0V4PsmWxLcGqI7emzJuZ9UacpSIpesESg== X-Received: by 2002:a05:6214:3a8c:b0:6d3:65ad:5cf9 with SMTP id 6a1803df08f44-6dd233329e0mr780938466d6.15.1735848041644; Thu, 02 Jan 2025 12:00:41 -0800 (PST) Original-Received: from sacha-p52 ([76.71.82.209]) by smtp.googlemail.com with ESMTPSA id 6a1803df08f44-6dd35b0c471sm110722406d6.29.2025.01.02.12.00.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2025 12:00:40 -0800 (PST) Received-SPF: none client-ip=2607:f8b0:4864:20::f2a; envelope-from=sacha@sachachua.com; helo=mail-qv1-xf2a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:327588 Archived-At: --=-=-= Content-Type: text/plain Hello, everyone! With a tiny tweak, image-dired-show-all-from-dir can handle a bunch of things that dired can handle already (view arbitrary list of files, handle wildcards). This is how I've been using it to quickly look at the most recent screenshots in a couple of directories: https://sachachua.com/blog/2025/01/using-image-dired-to-browse-the-latest-screenshots-from-multiple-directories/ What do you think? I believe I have copyright assignment papers on file, although this is a tiny change. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-image-dired-show-all-from-dir-Reuse-dired-s-default-.patch >From afc2b649cd2b26765f4a7fd4c6f3eac51c4018f5 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Thu, 2 Jan 2025 14:52:28 -0500 Subject: [PATCH] image-dired-show-all-from-dir: Reuse dired's default-directory * lisp/image/image-dired.el (image-dired-show-all-from-dir): Delegate figuring out default-directory to dired. This handles the case where image-dired is called with a cons cell that has a directory in the car and a list of files in the cdr, which dired can handle, and therefore allows image-dired-show-all-from-dir to show an arbitrary list of images. It also means that image-dired-show-all-from-dir can handle wildcards. --- lisp/image/image-dired.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 83745e88f09..06fbca6a3f7 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -630,7 +630,8 @@ image-dired-show-all-from-dir (interactive "DShow thumbnails for directory: ") (dired dir) (dired-mark-files-regexp (image-dired--file-name-regexp)) - (let ((files (dired-get-marked-files nil nil nil t))) + (let ((files (dired-get-marked-files nil nil nil t)) + (dired-default-directory default-directory)) (cond ((and (null (cdr files))) (message "No image files in directory")) ((or (not image-dired-show-all-from-dir-max-files) @@ -644,7 +645,7 @@ image-dired-show-all-from-dir (let ((inhibit-message t)) (dired-unmark-all-marks)) (pop-to-buffer image-dired-thumbnail-buffer) - (setq default-directory dir) + (setq default-directory dired-default-directory) (image-dired--update-header-line)) (t (message "Image-Dired canceled"))))) -- 2.43.0 --=-=-= Content-Type: text/plain Sacha --=-=-=--