From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] image-dired-show-all-from-dir: reuse dired's default directory Date: Thu, 2 Jan 2025 14:22:09 -0600 Message-ID: References: <87cyh5ugte.fsf@sachachua.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17996"; mail-complaints-to="usenet@ciao.gmane.io" To: Sacha Chua , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 02 21:23:03 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 1tTRih-0004W3-F0 for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Jan 2025 21:23:03 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTRi0-0001jb-Na; Thu, 02 Jan 2025 15:22:20 -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 1tTRhy-0001jG-JB for emacs-devel@gnu.org; Thu, 02 Jan 2025 15:22:18 -0500 Original-Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTRhs-0002gO-BR for emacs-devel@gnu.org; Thu, 02 Jan 2025 15:22:18 -0500 Original-Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5d3f57582a2so22261228a12.1 for ; Thu, 02 Jan 2025 12:22:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735849330; x=1736454130; darn=gnu.org; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :from:to:cc:subject:date:message-id:reply-to; bh=0mrQEAMWSNs5fqnFLWwzhRAzo2jflx1ErbiMtJnNbh0=; b=iZwRr6pz1FL5sCk4VAYy8TKNuYNmPgBdand1pFKQEy+HKi2pyb5uzalc1KBV69K7+d JmEeSo5XvukXdzcOMkrpX4zT5JvRafqSGcEhCwyK7pvWx499FBET91/+r88bJsZQu92X ga9/3x43wP4F+APHXs0jBYDmcb0o2uReiXLrKeEiTww+1PB78DrZLAmnABcpnThaKUkj SwsmYMZtmPnpu9ZY/FeuSngEwfGMNSypiQXaPXn16PGjvabMln2WK62mLD9tHq1CU7hn 93AKip2rz5TFM+V3JAN/kxflcbsid5+u0d2OPxEMrA9xk7+boEO0D8CgzJkpt8yhmKm/ w08w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735849330; x=1736454130; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0mrQEAMWSNs5fqnFLWwzhRAzo2jflx1ErbiMtJnNbh0=; b=wumEZRtIyiq6Vt2sf3a2fOoKzq95OgFZesxujFT6xWmXjyu05QDWIEsk+K9CwaF4+Z s6bpQdUj4RmQum0Qm3aOiZw0X5j5/BdN5isfpiBKzKR0eaY1q4ER0bfGxmJ0z7SdZnZh AaESxojIXxI6sUwUrB/bSpf167+1ZdC/oPkomEmsVbIpxG1Q3L6KOjkvXobJ+hUwQxkd 25yjR00p7gwCUklsRnSAdqZMhibu9EhVEj79JfTMhwckcrFRqr1iEBRxC2YytLVF6DLW UvsbbFrJC4n12r3S5C2DLZ+k2JbwvR4u0JOXjNeVG4iSRq1eoBehhhWcFuwdT/R7M3UT cwSQ== X-Forwarded-Encrypted: i=1; AJvYcCV80wyxJxLGEfONFC6L2Esb/i64fhO1Fx5L46NkEGV59l8bqJenVnluxpkkqdmYcu6Gz7evMw4x3QlX6Q==@gnu.org X-Gm-Message-State: AOJu0YwHKKzmDWG+WCG8yAm49bhRnSEmKR5lEL4H/FKYvTNRzAMKghIa mlI/61ylUdO84SmvVhXc/ktJYp4HXpvWZDAUBAbH6I8/7A/9VyLrv6AcjoV/o9gSPtkntzzLsEA OMniJNnU04Xjn8P5X4pIZ6sqKPDw= X-Gm-Gg: ASbGnctY3oPjycDZmaO+qNflBrwBQpDVY15MSW+3J91Kd1V8ooicTdEkhWGa7U+1hyl vkqdg5kAeXfk9nF65/gYNDuenA4LEiDG8EAa/Yoc= X-Google-Smtp-Source: AGHT+IGOAvk471wYqWmhiEd1rYNBji6uY9DlFVRtoQUFT00CmzFOihkybK5ojHSQR5zFicV7TuK27SNxIv4nFGxhFZg= X-Received: by 2002:a05:6402:2346:b0:5d8:17da:dcf0 with SMTP id 4fb4d7f45d1cf-5d81e523027mr34412185a12.4.1735849330276; Thu, 02 Jan 2025 12:22:10 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 2 Jan 2025 14:22:09 -0600 In-Reply-To: <87cyh5ugte.fsf@sachachua.com> Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=stefankangas@gmail.com; helo=mail-ed1-x533.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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:327594 Archived-At: Sacha Chua writes: > 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. Thanks for the patch, and interesting use case. I can't find the variable `dired-default-directory`, but I do see that a function of that name was removed in Emacs 27. Where did you find that variable, and which version of Emacs are you running? Could it be that this variable is from a third-party package? > 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 > > > Sacha