From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61639: 30.0.50; [PATCH] Do not error out on non image file in image-dired Date: Tue, 21 Feb 2023 15:23:01 +0100 Message-ID: <87mt57kshm.fsf@ledu-giraud.fr> References: <87sff1quwk.fsf@ledu-giraud.fr> <83sff0v6wz.fsf@gnu.org> <87ttzgtq6p.fsf@ledu-giraud.fr> <83edqkv48n.fsf@gnu.org> <87k00ctofi.fsf@ledu-giraud.fr> <83a618v1jj.fsf@gnu.org> <87bklothkw.fsf@ledu-giraud.fr> <83ttzfteg1.fsf@gnu.org> <87y1orrz7f.fsf@ledu-giraud.fr> <83cz63tbkf.fsf@gnu.org> Reply-To: Manuel Giraud 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="8526"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61639@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 21 15:25:32 2023 Return-path: Envelope-to: geb-bug-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 1pUTaG-00013k-9l for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Feb 2023 15:25:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUTYq-0002by-Sg; Tue, 21 Feb 2023 09:24:04 -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 1pUTYo-0002bi-Tt for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 09:24:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUTYo-000171-LH for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 09:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pUTYo-0000xK-1m for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 09:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Feb 2023 14:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61639 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 61639-submit@debbugs.gnu.org id=B61639.16769893903607 (code B ref 61639); Tue, 21 Feb 2023 14:24:02 +0000 Original-Received: (at 61639) by debbugs.gnu.org; 21 Feb 2023 14:23:10 +0000 Original-Received: from localhost ([127.0.0.1]:55106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUTXx-0000w7-U7 for submit@debbugs.gnu.org; Tue, 21 Feb 2023 09:23:10 -0500 Original-Received: from ledu-giraud.fr ([51.159.28.247]:48940) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUTXw-0000vt-2C for 61639@debbugs.gnu.org; Tue, 21 Feb 2023 09:23:09 -0500 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=ZJf5efg+ KC2EL6PPVywd8kxmAqtXX0M8BNyKsEccKVo=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=l6Y4k+GPHFSLHnQ9SpVVSN+Ebpq5hs 7Ijc/Cjy97PvjHp8/pmFZv7Vl4FbY6O6Z9E1YNMnXLhSzuyz0qB2gyDQ== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=ZJf5efg+KC2EL6PP Vywd8kxmAqtXX0M8BNyKsEccKVo=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=RND2chX2+kPa0AmBpkoOTPXt6RrZiE9nuG5HmS oVSieNYpniZKcjNmRm7OLYI05qNunYrwPc9Aaq7DyqfgDvbkPiV6c8Jspypu/xAK2535sv 9s8NxK30GnP8OItqKHyo8uC3WHHC6rzEQxOUkue5ekjmlPv+C909ruHrZ43Z1I5SkPjYU7 nyvZ/GEHd0lyHs9FbZUGFzENKpK3zO8oqWy5q//GceuX7mPVEDtU4jW/3n09/inXmbHVMU ljexXukERir6q5G8Klx6IfOkvtV/XI9DBsGVy6DopN1Nk4H03bEnRucXkHilADOE8v/QuQ eHU8duL0S6c9Ux6lYKQVHnGQ== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 8cce2996 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 21 Feb 2023 15:23:05 +0100 (CET) In-Reply-To: <83cz63tbkf.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 21 Feb 2023 15:03:44 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256273 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: [...] >> 'plusp' is a classic Common Lisp predicate (that also seems to be >> defined in Emacs). It is equivalent to (> x 0)=E2=80=A6 maybe you prefe= r that. >> Should I fix my patch? > > Where is it defined? It isn't defined in "emacs -Q", and not after > loading image-dired. (Tested in Emacs 29.) C-h f gives me this: --8<---------------cut here---------------start------------->8--- plusp is an alias for =E2=80=98cl-plusp=E2=80=99 in =E2=80=98cl.el=E2=80=99. This function is obsolete since 27.1; use =E2=80=98cl-plusp=E2=80=99 instea= d. --8<---------------cut here---------------end--------------->8--- =E2=80=A6 anyway here is an updated version of the patch to avoid this. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Do-not-error-out-on-non-image-file-bug-61639.patch >From e9b6f649a97800fcc045b52a63556d25ca4b472c Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Sun, 19 Feb 2023 21:03:57 +0100 Subject: [PATCH] Do not error out on non image file (bug#61639) * lisp/image/image-dired.el (image-dired-display-thumbs): Do not insert non image file and do not display image-dired buffer if it is empty. --- lisp/image/image-dired.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index cfcd1851188..20697b3c9e0 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -586,13 +586,15 @@ image-dired-display-thumbs (erase-buffer)) (goto-char (point-max))) (dolist (file files) - (let ((thumb (image-dired--get-create-thumbnail-file file))) + (when (string-match-p (image-dired--file-name-regexp) file) (image-dired-insert-thumbnail - thumb file dired-buf + (image-dired--get-create-thumbnail-file file) file dired-buf (cl-incf image-dired--number-of-thumbnails))))) - (if do-not-pop - (display-buffer buf) - (pop-to-buffer buf)) + (if (> image-dired--number-of-thumbnails 0) + (if do-not-pop + (display-buffer buf) + (pop-to-buffer buf)) + (message "No images selected")) (image-dired--line-up-with-method) (image-dired--update-header-line)))) -- 2.39.1 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=--