From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: Re: [dieter@duenenhof-wilhelm.de: image-dired (tumme) database file not existing] Date: Thu, 19 Jul 2007 16:10:02 +0200 Message-ID: <87y7hcxz5x.fsf@ambire.localdomain> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1184854244 2158 80.91.229.12 (19 Jul 2007 14:10:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 19 Jul 2007 14:10:44 +0000 (UTC) Cc: dieter@duenenhof-wilhelm.de, emacs-devel@gnu.org To: Mathias Dahl Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 19 16:10:42 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IBWiG-0002Wv-Sz for ged-emacs-devel@m.gmane.org; Thu, 19 Jul 2007 16:10:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IBWiG-0004Q7-AX for ged-emacs-devel@m.gmane.org; Thu, 19 Jul 2007 10:10:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IBWi2-00049P-2Z for emacs-devel@gnu.org; Thu, 19 Jul 2007 10:10:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IBWi1-00047v-3U for emacs-devel@gnu.org; Thu, 19 Jul 2007 10:10:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IBWi0-00047V-SA for emacs-devel@gnu.org; Thu, 19 Jul 2007 10:10:24 -0400 Original-Received: from smtp-out1.libero.it ([212.52.84.41]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IBWi0-0000ad-6j for emacs-devel@gnu.org; Thu, 19 Jul 2007 10:10:24 -0400 Original-Received: from localhost (172.31.0.48) by smtp-out1.libero.it (7.3.120) id 4688F31701AC3A38 for emacs-devel@gnu.org; Thu, 19 Jul 2007 16:10:23 +0200 X-Scanned: with antispam and antivirus automated system at libero.it Original-Received: from smtp-out2.libero.it ([172.31.0.38]) by localhost (asav-out7.libero.it [192.168.32.35]) (amavisd-new, port 10024) with ESMTP id du-OaPhlbP7u for ; Thu, 19 Jul 2007 16:10:22 +0200 (CEST) Original-Received: from outrelay08.libero.it (192.168.32.103) by smtp-out2.libero.it (7.3.120) id 4611FD38080098C6 for emacs-devel@gnu.org; Thu, 19 Jul 2007 16:10:22 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CACgNn0aXFSCK/2dsb2JhbAA Original-Received: from ppp-138-32.21-151.libero.it (HELO ambire.localdomain) ([151.21.32.138]) by OutRelay-b08.libero.it with ESMTP; 19 Jul 2007 16:10:22 +0200 Original-Received: from ttn by ambire.localdomain with local (Exim 4.63) (envelope-from ) id 1IBWhe-0005Tn-TK; Thu, 19 Jul 2007 16:10:02 +0200 In-Reply-To: (Richard Stallman's message of "Thu\, 19 Jul 2007 08\:23\:51 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:75122 Archived-At: --=-=-= () Dieter Wilhelm () Wed, 18 Jul 2007 17:39:34 +0200 image-dired-write-comments: Opening input file: no such file or directory, /home/dieter/.emacs.d/image-dired/.image-dired_db below is a quick patch (against the trunk). here is a ChangeLog entry: * image-dired.el (image-dired-sane-db-file): New func. (image-dired-write-tags, image-dired-remove-tag) (image-dired-list-tags, image-dired-write-comments) (image-dired-get-comment, image-dired-mark-tagged-files) (image-dired-create-gallery-lists): Call new func. does this give good results? thi ___________________________________________________ --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=.ttn.image-dired.diff Index: image-dired.el =================================================================== RCS file: /sources/emacs/emacs/lisp/image-dired.el,v retrieving revision 1.4 diff -c -r1.4 image-dired.el *** image-dired.el 13 Jun 2007 00:05:24 -0000 1.4 --- image-dired.el 19 Jul 2007 14:00:33 -0000 *************** *** 869,879 **** --- 869,896 ---- ;;;###autoload (defalias 'tumme 'image-dired-show-all-from-dir) + (defun image-dired-sane-db-file () + "Check if `image-dired-db-file' exists. + If not, try to create it (including any parent directories). + Signal error if there are problems creating it." + (or (file-exists-p image-dired-db-file) + (let (dir buf) + (unless (file-directory-p (setq dir (file-name-directory + image-dired-db-file))) + (make-directory dir t)) + (with-current-buffer (setq buf (create-file-buffer + image-dired-db-file)) + (write-file image-dired-db-file)) + (kill-buffer buf) + (file-exists-p image-dired-db-file)) + (error "Could not create %s" image-dired-db-file))) + (defun image-dired-write-tags (file-tags) "Write file tags to database. Write each file and tag in FILE-TAGS to the database. FILE-TAGS is an alist in the following form: ((FILE . TAG) ... )" + (image-dired-sane-db-file) (let (end file tag) (with-temp-file image-dired-db-file (insert-file-contents image-dired-db-file) *************** *** 893,898 **** --- 910,916 ---- (defun image-dired-remove-tag (files tag) "For all FILES, remove TAG from the image database." + (image-dired-sane-db-file) (save-excursion (let (end buf start) (setq buf (find-file image-dired-db-file)) *************** *** 927,932 **** --- 945,951 ---- (defun image-dired-list-tags (file) "Read all tags for image FILE from the image database." + (image-dired-sane-db-file) (save-excursion (let (end buf (tags "")) (setq buf (find-file image-dired-db-file)) *************** *** 2038,2043 **** --- 2057,2063 ---- Write file comments to one or more files. FILE-COMMENTS is an alist on the following form: ((FILE . COMMENT) ... )" + (image-dired-sane-db-file) (let (end comment-beg-pos comment-end-pos file comment) (with-temp-file image-dired-db-file (insert-file-contents image-dired-db-file) *************** *** 2108,2113 **** --- 2128,2134 ---- (defun image-dired-get-comment (file) "Get comment for file FILE." + (image-dired-sane-db-file) (save-excursion (let (end buf comment-beg-pos comment-end-pos comment) (setq buf (find-file image-dired-db-file)) *************** *** 2136,2141 **** --- 2157,2163 ---- on all image files in the database file. The files that have a matching tags will be marked in the dired buffer." (interactive) + (image-dired-sane-db-file) (let ((tag (read-string "Mark tagged files (regexp): ")) (hits 0) files buf) *************** *** 2300,2305 **** --- 2322,2328 ---- (defun image-dired-create-gallery-lists () "Create temporary lists used by `image-dired-gallery-generate'." + (image-dired-sane-db-file) (let ((buf (find-file image-dired-db-file)) end beg file row-tags) (setq image-dired-tag-file-list nil) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--