diff options
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/image-dired.el | 23 |
2 files changed, 32 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 36bfbcafa89..2b3c70b7ed1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2007-07-21 Thien-Thi Nguyen <ttn@gnuvola.org> | ||
| 2 | |||
| 3 | * image-dired.el (image-dired-sane-db-file): New func. | ||
| 4 | (image-dired-write-tags, image-dired-remove-tag) | ||
| 5 | (image-dired-list-tags, image-dired-write-comments) | ||
| 6 | (image-dired-get-comment, image-dired-mark-tagged-files) | ||
| 7 | (image-dired-create-gallery-lists): Call new func. | ||
| 8 | Reported by Dieter Wilhelm <dieter@duenenhof-wilhelm.de>. | ||
| 9 | |||
| 1 | 2007-07-21 Dan Nicolaescu <dann@ics.uci.edu> | 10 | 2007-07-21 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 11 | ||
| 3 | * vc-hg.el (vc-hg-diff): Use vc-hg-command. | 12 | * vc-hg.el (vc-hg-diff): Use vc-hg-command. |
diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 867c50df013..db6415977b4 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el | |||
| @@ -866,11 +866,28 @@ displayed." | |||
| 866 | ;;;###autoload | 866 | ;;;###autoload |
| 867 | (defalias 'tumme 'image-dired-show-all-from-dir) | 867 | (defalias 'tumme 'image-dired-show-all-from-dir) |
| 868 | 868 | ||
| 869 | (defun image-dired-sane-db-file () | ||
| 870 | "Check if `image-dired-db-file' exists. | ||
| 871 | If not, try to create it (including any parent directories). | ||
| 872 | Signal error if there are problems creating it." | ||
| 873 | (or (file-exists-p image-dired-db-file) | ||
| 874 | (let (dir buf) | ||
| 875 | (unless (file-directory-p (setq dir (file-name-directory | ||
| 876 | image-dired-db-file))) | ||
| 877 | (make-directory dir t)) | ||
| 878 | (with-current-buffer (setq buf (create-file-buffer | ||
| 879 | image-dired-db-file)) | ||
| 880 | (write-file image-dired-db-file)) | ||
| 881 | (kill-buffer buf) | ||
| 882 | (file-exists-p image-dired-db-file)) | ||
| 883 | (error "Could not create %s" image-dired-db-file))) | ||
| 884 | |||
| 869 | (defun image-dired-write-tags (file-tags) | 885 | (defun image-dired-write-tags (file-tags) |
| 870 | "Write file tags to database. | 886 | "Write file tags to database. |
| 871 | Write each file and tag in FILE-TAGS to the database. FILE-TAGS | 887 | Write each file and tag in FILE-TAGS to the database. FILE-TAGS |
| 872 | is an alist in the following form: | 888 | is an alist in the following form: |
| 873 | ((FILE . TAG) ... )" | 889 | ((FILE . TAG) ... )" |
| 890 | (image-dired-sane-db-file) | ||
| 874 | (let (end file tag) | 891 | (let (end file tag) |
| 875 | (with-temp-file image-dired-db-file | 892 | (with-temp-file image-dired-db-file |
| 876 | (insert-file-contents image-dired-db-file) | 893 | (insert-file-contents image-dired-db-file) |
| @@ -890,6 +907,7 @@ is an alist in the following form: | |||
| 890 | 907 | ||
| 891 | (defun image-dired-remove-tag (files tag) | 908 | (defun image-dired-remove-tag (files tag) |
| 892 | "For all FILES, remove TAG from the image database." | 909 | "For all FILES, remove TAG from the image database." |
| 910 | (image-dired-sane-db-file) | ||
| 893 | (save-excursion | 911 | (save-excursion |
| 894 | (let (end buf start) | 912 | (let (end buf start) |
| 895 | (setq buf (find-file image-dired-db-file)) | 913 | (setq buf (find-file image-dired-db-file)) |
| @@ -924,6 +942,7 @@ is an alist in the following form: | |||
| 924 | 942 | ||
| 925 | (defun image-dired-list-tags (file) | 943 | (defun image-dired-list-tags (file) |
| 926 | "Read all tags for image FILE from the image database." | 944 | "Read all tags for image FILE from the image database." |
| 945 | (image-dired-sane-db-file) | ||
| 927 | (save-excursion | 946 | (save-excursion |
| 928 | (let (end buf (tags "")) | 947 | (let (end buf (tags "")) |
| 929 | (setq buf (find-file image-dired-db-file)) | 948 | (setq buf (find-file image-dired-db-file)) |
| @@ -2035,6 +2054,7 @@ function. The result is a couple of new files in | |||
| 2035 | Write file comments to one or more files. FILE-COMMENTS is an alist on | 2054 | Write file comments to one or more files. FILE-COMMENTS is an alist on |
| 2036 | the following form: | 2055 | the following form: |
| 2037 | ((FILE . COMMENT) ... )" | 2056 | ((FILE . COMMENT) ... )" |
| 2057 | (image-dired-sane-db-file) | ||
| 2038 | (let (end comment-beg-pos comment-end-pos file comment) | 2058 | (let (end comment-beg-pos comment-end-pos file comment) |
| 2039 | (with-temp-file image-dired-db-file | 2059 | (with-temp-file image-dired-db-file |
| 2040 | (insert-file-contents image-dired-db-file) | 2060 | (insert-file-contents image-dired-db-file) |
| @@ -2105,6 +2125,7 @@ as initial value." | |||
| 2105 | 2125 | ||
| 2106 | (defun image-dired-get-comment (file) | 2126 | (defun image-dired-get-comment (file) |
| 2107 | "Get comment for file FILE." | 2127 | "Get comment for file FILE." |
| 2128 | (image-dired-sane-db-file) | ||
| 2108 | (save-excursion | 2129 | (save-excursion |
| 2109 | (let (end buf comment-beg-pos comment-end-pos comment) | 2130 | (let (end buf comment-beg-pos comment-end-pos comment) |
| 2110 | (setq buf (find-file image-dired-db-file)) | 2131 | (setq buf (find-file image-dired-db-file)) |
| @@ -2133,6 +2154,7 @@ lets you input a regexp and this will be matched against all tags | |||
| 2133 | on all image files in the database file. The files that have a | 2154 | on all image files in the database file. The files that have a |
| 2134 | matching tags will be marked in the dired buffer." | 2155 | matching tags will be marked in the dired buffer." |
| 2135 | (interactive) | 2156 | (interactive) |
| 2157 | (image-dired-sane-db-file) | ||
| 2136 | (let ((tag (read-string "Mark tagged files (regexp): ")) | 2158 | (let ((tag (read-string "Mark tagged files (regexp): ")) |
| 2137 | (hits 0) | 2159 | (hits 0) |
| 2138 | files buf) | 2160 | files buf) |
| @@ -2297,6 +2319,7 @@ image-dired-file-comment-list: | |||
| 2297 | 2319 | ||
| 2298 | (defun image-dired-create-gallery-lists () | 2320 | (defun image-dired-create-gallery-lists () |
| 2299 | "Create temporary lists used by `image-dired-gallery-generate'." | 2321 | "Create temporary lists used by `image-dired-gallery-generate'." |
| 2322 | (image-dired-sane-db-file) | ||
| 2300 | (let ((buf (find-file image-dired-db-file)) | 2323 | (let ((buf (find-file image-dired-db-file)) |
| 2301 | end beg file row-tags) | 2324 | end beg file row-tags) |
| 2302 | (setq image-dired-tag-file-list nil) | 2325 | (setq image-dired-tag-file-list nil) |