From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.devel Subject: Re: master ca47390: image-dired: Report when a necessary executable is not found Date: Mon, 5 Sep 2016 14:30:21 +0900 (JST) Message-ID: References: <20160904134431.30494.94659@vcs.savannah.gnu.org> <20160904134431.7513F220140@vcs.savannah.gnu.org> <9ba96760-15da-e7f5-a4e5-4a93ecd49f7a@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-218649739-1473053423=:32022" X-Trace: blaine.gmane.org 1473053448 14005 195.159.176.226 (5 Sep 2016 05:30:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 5 Sep 2016 05:30:48 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: Emacs developers To: =?ISO-8859-15?Q?Cl=E9ment_Pit--Claudel?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 05 07:30:44 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgmUR-0002Vd-Fm for ged-emacs-devel@m.gmane.org; Mon, 05 Sep 2016 07:30:39 +0200 Original-Received: from localhost ([::1]:52327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgmUP-000795-2y for ged-emacs-devel@m.gmane.org; Mon, 05 Sep 2016 01:30:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgmUH-00078o-Rp for emacs-devel@gnu.org; Mon, 05 Sep 2016 01:30:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgmUD-0005zn-Jv for emacs-devel@gnu.org; Mon, 05 Sep 2016 01:30:28 -0400 Original-Received: from mail-pf0-x231.google.com ([2607:f8b0:400e:c00::231]:34738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgmUD-0005zj-9I for emacs-devel@gnu.org; Mon, 05 Sep 2016 01:30:25 -0400 Original-Received: by mail-pf0-x231.google.com with SMTP id p64so61502921pfb.1 for ; Sun, 04 Sep 2016 22:30:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=ZHuTUU3UjbgnBxA9g/5HSURRFmtEsCEiT1a3gc1hlrA=; b=evejsJk6RjQrGZTJiaF7cpR4mlfXA+G9aHkxKGbelD5lhieirWvv6XA7GCCCJBWTRo CViwNb+xxULjRwvU3JgbDFa8SZjV5RsC5WvEDoyUr255GvEgBrHil0BgWNlFF6eMn3J/ gCchCppdjZarpmOi7QoS5QJKkASWALlM99SLzqg6MDixWO5E7ArXo4P5XjELzM+1CoIN 8odOp5mF/ri2Rok4nXHJZUbrXDc3ohGZDf/EqRc36Y5yumWeGWRGXqfDLJVMW7fcH+ha PiLWm9UaZ0BDG3JAXksTDKk1Yfv+SFQUP9o7xhd3d61NY88mcx7imluaJfybf8p25+cR ZNdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=ZHuTUU3UjbgnBxA9g/5HSURRFmtEsCEiT1a3gc1hlrA=; b=IpJ3+RjhZswhc5nAfBavllRjluftCb8YhfYL/+wqAhb3KPKjPclMJKMgYEc+aDqtrG +lgMz5BSc1hahFFwk0GZzHmgVMxIx3+XIRHQkcKtYUMAj3edq5SZ3aoL51oZDUMiBbdM nm2EJTr/orjr8bwRsFNurFtH0jwphxZi2WoU8DgBweaKQXpA8UGiie/mN2Ke9JzFgqQo KHTZ73Yn0q1Z7goPBPuMnPiYfOQlfNLstdPluxOzchRE2EXei4nP9ROfPxTLu5k7A1pl s43922Tf4AOgNZ2l380uDm05irYVxaYR+cHkYoGmVBf81v3G1TBCct5OIwmo3pbc6sNf jI5w== X-Gm-Message-State: AE9vXwMfva7VOq8/jYXlIIMCm/XY094DYrAiAMmSkYks7zRhuIewcXeztYOp/gfV3gtkNw== X-Received: by 10.98.202.66 with SMTP id n63mr35894767pfg.10.1473053424556; Sun, 04 Sep 2016 22:30:24 -0700 (PDT) Original-Received: from calancha-pc (69.191.218.133.dy.bbexcite.jp. [133.218.191.69]) by smtp.gmail.com with ESMTPSA id i8sm6822479paw.25.2016.09.04.22.30.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 22:30:23 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <9ba96760-15da-e7f5-a4e5-4a93ecd49f7a@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207188 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-218649739-1473053423=:32022 Content-Type: text/plain; format=flowed; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Mon, 5 Sep 2016, Clément Pit--Claudel wrote: > On 2016-09-04 23:42, Tino Calancha wrote: >> Please let me know if the following patch is OK: >> … > >> (defcustom image-dired-cmd-create-thumbnail-program >> - "convert" >> + (executable-find "convert") > >> … > >> (defcustom image-dired-cmd-create-thumbnail-program >> - (executable-find "convert") >> + (when (executable-find "convert") "convert") > > I don't understand how these two consecutive patches works. My motivation is to report more clearly when a necessary executable is missing. If i don't have installed "jpegtran" (image-dired-cmd-rotate-original-program) and i call image-dired-rotate-original i get the message: "Could not rotate image" >Assume I don't have "convert". Before the patches Emacs would complain, >and installing ImageMagick would fix the complaint. >After, Emacs will complain about not finding "convert", but after I >install ImageMagick Emacs will keep complaining, because the defcustom >will still be nil. Is this intended? Or am I misunderstanding something? Good point. I agree is a nuisance having to set those values after installing the executable. How about following more simple patch?: It just check for the required executable at the top of each function using it; it signals an error if the executable is not found: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From cefb3ca722ade34f81f54b0f1a09b8ba759b1f69 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Mon, 5 Sep 2016 14:23:15 +0900 Subject: [PATCH] image-dired: Signal an error before calling a missing executable lisp/image-dired.el (image-dired-display-image) (image-dired-rotate-thumbnail) (image-dired-rotate-original) (image-dired-set-exif-data) (image-dired-get-exif-data): Throw and error when the executable used in the function is missing. (image-dired-next-line, image-dired-previous-line): Use 'forward-line'. --- lisp/image-dired.el | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 34e4eae..617914a 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -615,6 +615,8 @@ image-dired-thumb-name (defun image-dired-create-thumb (original-file thumbnail-file) "For ORIGINAL-FILE, create thumbnail image named THUMBNAIL-FILE." + (unless (executable-find image-dired-cmd-create-thumbnail-program) + (error "Executable image-dired-cmd-create-thumbnail-program is not found")) (let* ((width (int-to-string image-dired-thumb-width)) (height (int-to-string image-dired-thumb-height)) (modif-time (format "%.0f" (float-time (nth 5 (file-attributes @@ -1144,7 +1146,8 @@ image-dired-next-line "Move to next line and display properties." (interactive) (let ((goal-column (current-column))) - (next-line)) + (forward-line 1) + (move-to-column goal-column)) ;; If we end up in an empty spot, back up to the next thumbnail. (if (not (image-dired-image-at-point-p)) (image-dired-backward-image)) @@ -1157,7 +1160,8 @@ image-dired-previous-line "Move to previous line and display properties." (interactive) (let ((goal-column (current-column))) - (previous-line)) + (forward-line -1) + (move-to-column goal-column)) ;; If we end up in an empty spot, back up to the next ;; thumbnail. This should only happen if the user deleted a ;; thumbnail and did not refresh, so it is not very common. But we @@ -1802,6 +1806,8 @@ image-dired-display-image If optional argument ORIGINAL-SIZE is non-nil, display image in its original size." + (unless (executable-find image-dired-cmd-create-temp-image-program) + (error "image-dired-cmd-create-temp-image-program is not found")) (let ((new-file (expand-file-name image-dired-temp-image-file)) width height command ret (image-type 'jpeg)) @@ -1866,6 +1872,8 @@ image-dired-image-at-point-p (defun image-dired-rotate-thumbnail (degrees) "Rotate thumbnail DEGREES degrees." + (unless (executable-find image-dired-cmd-rotate-thumbnail-program) + (error "image-dired-cmd-rotate-thumbnail-program is not found")) (if (not (image-dired-image-at-point-p)) (message "No thumbnail at point") (let ((file (image-dired-thumb-name (image-dired-original-file-name))) @@ -1908,6 +1916,8 @@ image-dired-refresh-thumb (defun image-dired-rotate-original (degrees) "Rotate original image DEGREES degrees." + (unless (executable-find image-dired-cmd-rotate-original-program) + (error "image-dired-cmd-rotate-original-program is not found")) (if (not (image-dired-image-at-point-p)) (message "No image at point") (let ((file (image-dired-original-file-name)) @@ -1986,6 +1996,8 @@ image-dired-thumbnail-set-image-description (defun image-dired-set-exif-data (file tag-name tag-value) "In FILE, set EXIF tag TAG-NAME to value TAG-VALUE." + (unless (executable-findimage-dired-cmd-write-exif-data-program) + (error "image-dired-cmd-write-exif-data-program is not found")) (let (command) (setq command (format-spec image-dired-cmd-write-exif-data-options @@ -1998,6 +2010,8 @@ image-dired-set-exif-data (defun image-dired-get-exif-data (file tag-name) "From FILE, return EXIF tag TAG-NAME." + (unless (executable-find image-dired-cmd-read-exif-data-program) + (error "image-dired-cmd-read-exif-data-program is not found")) (let ((buf (get-buffer-create "*image-dired-get-exif-data*")) command tag-value) (setq command (format-spec -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Repository revision: 2db3307e8a966a8f652a210d8f8eb83daddd7d9f --8323329-218649739-1473053423=:32022--