aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/os.texi36
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lisp/image-dired.el454
-rw-r--r--lisp/time-stamp.el4
-rw-r--r--lisp/time.el61
-rw-r--r--lisp/vc/add-log.el4
-rw-r--r--src/ChangeLog10
-rw-r--r--src/editfns.c7
-rw-r--r--src/xdisp.c49
10 files changed, 342 insertions, 303 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index f08ee3a227c..bf170100922 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12011-08-08 Chong Yidong <cyd@stupidchicken.com>
2
3 * os.texi (Time of Day): Remove set-time-zone-rule, and recommend
4 using setenv instead.
5
12011-07-28 Eli Zaretskii <eliz@gnu.org> 62011-07-28 Eli Zaretskii <eliz@gnu.org>
2 7
3 * display.texi (Bidirectional Display): Document the fact that 8 * display.texi (Bidirectional Display): Document the fact that
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 5f422065c5b..8533b77b219 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1143,6 +1143,18 @@ get with the function @code{file-attributes}.
1143@xref{Definition of file-attributes}. 1143@xref{Definition of file-attributes}.
1144@end defun 1144@end defun
1145 1145
1146@defun float-time &optional time-value
1147This function returns the current time as a floating-point number of
1148seconds since the epoch. The argument @var{time-value}, if given,
1149specifies a time to convert instead of the current time. The argument
1150should have the same form as for @code{current-time-string} (see
1151above). Thus, it accepts the output of @code{current-time} and
1152@code{file-attributes} (@pxref{Definition of file-attributes}).
1153
1154@emph{Warning}: Since the result is floating point, it may not be
1155exact. Do not use this function if precise time stamps are required.
1156@end defun
1157
1146@defun current-time-zone &optional time-value 1158@defun current-time-zone &optional time-value
1147This function returns a list describing the time zone that the user is 1159This function returns a list describing the time zone that the user is
1148in. 1160in.
@@ -1165,25 +1177,11 @@ times obtained from @code{current-time} (see above) and from
1165@code{file-attributes}. @xref{Definition of file-attributes}. 1177@code{file-attributes}. @xref{Definition of file-attributes}.
1166@end defun 1178@end defun
1167 1179
1168@defun set-time-zone-rule tz 1180The current time zone is determined by the @samp{TZ} environment
1169This function specifies the local time zone according to @var{tz}. If 1181variable. @xref{System Environment}. For example, you can tell Emacs
1170@var{tz} is @code{nil}, that means to use an implementation-defined 1182to use universal time with @code{(setenv "TZ" "UTC0")}. If @samp{TZ}
1171default time zone. If @var{tz} is @code{t}, that means to use 1183is not in the environment, Emacs uses a platform-dependent default
1172Universal Time. Otherwise, @var{tz} should be a string specifying a 1184time zone.
1173time zone rule.
1174@end defun
1175
1176@defun float-time &optional time-value
1177This function returns the current time as a floating-point number of
1178seconds since the epoch. The argument @var{time-value}, if given,
1179specifies a time to convert instead of the current time. The argument
1180should have the same form as for @code{current-time-string} (see
1181above). Thus, it accepts the output of @code{current-time} and
1182@code{file-attributes} (@pxref{Definition of file-attributes}).
1183
1184@emph{Warning}: Since the result is floating point, it may not be
1185exact. Do not use this function if precise time stamps are required.
1186@end defun
1187 1185
1188@node Time Conversion 1186@node Time Conversion
1189@section Time Conversion 1187@section Time Conversion
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d2ea294d2d0..d81f39aa64c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,18 @@
12011-08-08 Chong Yidong <cyd@stupidchicken.com>
2
3 * image-dired.el: Don't use find-file for temporary work (Bug#7895).
4 (image-dired--with-db-file): New macro.
5 (image-dired-write-tags, image-dired-remove-tag)
6 (image-dired-create-gallery-lists, image-dired-write-comments)
7 (image-dired-get-comment, image-dired-mark-tagged-files)
8 (image-dired-list-tags, image-dired-gallery-generate): Use it.
9 (image-dired-gallery-generate): Use insert-file-contents.
10
11 * time.el (display-time-world-list, display-time-world-display):
12 * time-stamp.el (time-stamp-string):
13 * vc/add-log.el (add-change-log-entry): Use setenv instead of
14 set-time-zone-rule (Bug#7337).
15
12011-08-08 Daiki Ueno <ueno@unixuser.org> 162011-08-08 Daiki Ueno <ueno@unixuser.org>
2 17
3 * epg.el (epg--status-KEYEXPIRED, epg--status-KEYREVOKED): Fix typo. 18 * epg.el (epg--status-KEYEXPIRED, epg--status-KEYREVOKED): Fix typo.
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index ce351f13a19..5477d01379d 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -516,6 +516,14 @@ before warning the user."
516 :type 'integer 516 :type 'integer
517 :group 'image-dired) 517 :group 'image-dired)
518 518
519(defmacro image-dired--with-db-file (&rest body)
520 "Run BODY in a temp buffer containing `image-dired-db-file'.
521Return the last form in BODY."
522 `(with-temp-buffer
523 (if (file-exists-p image-dired-db-file)
524 (insert-file-contents image-dired-db-file))
525 ,@body))
526
519(defun image-dired-dir () 527(defun image-dired-dir ()
520 "Return the current thumbnails directory (from variable `image-dired-dir'). 528 "Return the current thumbnails directory (from variable `image-dired-dir').
521Create the thumbnails directory if it does not exist." 529Create the thumbnails directory if it does not exist."
@@ -898,76 +906,69 @@ FILE-TAGS is an alist in the following form:
898 ((FILE . TAG) ... )" 906 ((FILE . TAG) ... )"
899 (image-dired-sane-db-file) 907 (image-dired-sane-db-file)
900 (let (end file tag) 908 (let (end file tag)
901 (with-temp-file image-dired-db-file 909 (image-dired--with-db-file
902 (insert-file-contents image-dired-db-file) 910 (setq buffer-file-name image-dired-db-file)
903 (dolist (elt file-tags) 911 (dolist (elt file-tags)
904 (setq file (car elt) 912 (setq file (car elt)
905 tag (cdr elt)) 913 tag (cdr elt))
906 (goto-char (point-min)) 914 (goto-char (point-min))
907 (if (search-forward-regexp (format "^%s.*$" file) nil t) 915 (if (search-forward-regexp (format "^%s.*$" file) nil t)
908 (progn 916 (progn
909 (setq end (point)) 917 (setq end (point))
910 (beginning-of-line) 918 (beginning-of-line)
911 (when (not (search-forward (format ";%s" tag) end t)) 919 (when (not (search-forward (format ";%s" tag) end t))
912 (end-of-line) 920 (end-of-line)
913 (insert (format ";%s" tag)))) 921 (insert (format ";%s" tag))))
914 (goto-char (point-max)) 922 (goto-char (point-max))
915 (insert (format "\n%s;%s" file tag))))))) 923 (insert (format "\n%s;%s" file tag))))
924 (save-buffer))))
916 925
917(defun image-dired-remove-tag (files tag) 926(defun image-dired-remove-tag (files tag)
918 "For all FILES, remove TAG from the image database." 927 "For all FILES, remove TAG from the image database."
919 (image-dired-sane-db-file) 928 (image-dired-sane-db-file)
920 (save-excursion 929 (image-dired--with-db-file
921 (let (end buf) 930 (setq buffer-file-name image-dired-db-file)
922 (setq buf (find-file image-dired-db-file)) 931 (let (end)
923 (if (not (listp files)) 932 (unless (listp files)
924 (if (stringp files) 933 (if (stringp files)
925 (setq files (list files)) 934 (setq files (list files))
926 (error "Files must be a string or a list of strings!"))) 935 (error "Files must be a string or a list of strings!")))
927 (mapc 936 (dolist (file files)
928 (lambda (file) 937 (goto-char (point-min))
929 (goto-char (point-min)) 938 (when (search-forward-regexp (format "^%s" file) nil t)
930 (when (search-forward-regexp 939 (end-of-line)
931 (format "^%s" file) nil t) 940 (setq end (point))
932 (end-of-line) 941 (beginning-of-line)
933 (setq end (point)) 942 (when (search-forward-regexp (format "\\(;%s\\)" tag) end t)
934 (beginning-of-line) 943 (delete-region (match-beginning 1) (match-end 1))
935 (when (search-forward-regexp (format "\\(;%s\\)" tag) end t) 944 ;; Check if file should still be in the database. If
936 (delete-region (match-beginning 1) (match-end 1)) 945 ;; it has no tags or comments, it will be removed.
937 ;; Check if file should still be in the database. If 946 (end-of-line)
938 ;; it has no tags or comments, it will be removed. 947 (setq end (point))
939 (end-of-line) 948 (beginning-of-line)
940 (setq end (point)) 949 (when (not (search-forward ";" end t))
941 (beginning-of-line) 950 (kill-line 1)
942 (when (not (search-forward ";" end t)) 951 ;; If on empty line at end of buffer
943 (kill-line 1) 952 (and (eobp)
944 ;; If on empty line at end of buffer 953 (looking-at "^$")
945 (when (and (eobp) 954 (delete-char -1)))))))
946 (looking-at "^$")) 955 (save-buffer)))
947 (delete-char -1))))))
948 files)
949 (save-buffer)
950 (kill-buffer buf))))
951 956
952(defun image-dired-list-tags (file) 957(defun image-dired-list-tags (file)
953 "Read all tags for image FILE from the image database." 958 "Read all tags for image FILE from the image database."
954 (image-dired-sane-db-file) 959 (image-dired-sane-db-file)
955 (save-excursion 960 (image-dired--with-db-file
956 (let (end buf (tags "")) 961 (let (end (tags ""))
957 (setq buf (find-file image-dired-db-file)) 962 (when (search-forward-regexp (format "^%s" file) nil t)
958 (goto-char (point-min)) 963 (end-of-line)
959 (when (search-forward-regexp 964 (setq end (point))
960 (format "^%s" file) nil t) 965 (beginning-of-line)
961 (end-of-line) 966 (if (search-forward ";" end t)
962 (setq end (point)) 967 (if (search-forward "comment:" end t)
963 (beginning-of-line) 968 (if (search-forward ";" end t)
964 (if (search-forward ";" end t) 969 (setq tags (buffer-substring (point) end)))
965 (if (search-forward "comment:" end t) 970 (setq tags (buffer-substring (point) end)))))
966 (if (search-forward ";" end t) 971 (split-string tags ";"))))
967 (setq tags (buffer-substring (point) end)))
968 (setq tags (buffer-substring (point) end)))))
969 (kill-buffer buf)
970 (split-string tags ";"))))
971 972
972;;;###autoload 973;;;###autoload
973(defun image-dired-tag-files (arg) 974(defun image-dired-tag-files (arg)
@@ -2061,34 +2062,35 @@ FILE-COMMENTS is an alist on the following form:
2061 ((FILE . COMMENT) ... )" 2062 ((FILE . COMMENT) ... )"
2062 (image-dired-sane-db-file) 2063 (image-dired-sane-db-file)
2063 (let (end comment-beg-pos comment-end-pos file comment) 2064 (let (end comment-beg-pos comment-end-pos file comment)
2064 (with-temp-file image-dired-db-file 2065 (image-dired--with-db-file
2065 (insert-file-contents image-dired-db-file) 2066 (setq buffer-file-name image-dired-db-file)
2066 (dolist (elt file-comments) 2067 (dolist (elt file-comments)
2067 (setq file (car elt) 2068 (setq file (car elt)
2068 comment (cdr elt)) 2069 comment (cdr elt))
2069 (goto-char (point-min)) 2070 (goto-char (point-min))
2070 (if (search-forward-regexp (format "^%s.*$" file) nil t) 2071 (if (search-forward-regexp (format "^%s.*$" file) nil t)
2071 (progn 2072 (progn
2072 (setq end (point)) 2073 (setq end (point))
2073 (beginning-of-line) 2074 (beginning-of-line)
2074 ;; Delete old comment, if any 2075 ;; Delete old comment, if any
2075 (when (search-forward ";comment:" end t) 2076 (when (search-forward ";comment:" end t)
2076 (setq comment-beg-pos (match-beginning 0)) 2077 (setq comment-beg-pos (match-beginning 0))
2077 ;; Any tags after the comment? 2078 ;; Any tags after the comment?
2078 (if (search-forward ";" end t) 2079 (if (search-forward ";" end t)
2079 (setq comment-end-pos (- (point) 1)) 2080 (setq comment-end-pos (- (point) 1))
2080 (setq comment-end-pos end)) 2081 (setq comment-end-pos end))
2081 ;; Delete comment tag and comment 2082 ;; Delete comment tag and comment
2082 (delete-region comment-beg-pos comment-end-pos)) 2083 (delete-region comment-beg-pos comment-end-pos))
2083 ;; Insert new comment 2084 ;; Insert new comment
2084 (beginning-of-line) 2085 (beginning-of-line)
2085 (unless (search-forward ";" end t) 2086 (unless (search-forward ";" end t)
2086 (end-of-line) 2087 (end-of-line)
2087 (insert ";")) 2088 (insert ";"))
2088 (insert (format "comment:%s;" comment))) 2089 (insert (format "comment:%s;" comment)))
2089 ;; File does not exist in database - add it. 2090 ;; File does not exist in database - add it.
2090 (goto-char (point-max)) 2091 (goto-char (point-max))
2091 (insert (format "\n%s;comment:%s" file comment))))))) 2092 (insert (format "\n%s;comment:%s" file comment))))
2093 (save-buffer))))
2092 2094
2093(defun image-dired-update-property (prop value) 2095(defun image-dired-update-property (prop value)
2094 "Update text property PROP with value VALUE at point." 2096 "Update text property PROP with value VALUE at point."
@@ -2130,24 +2132,20 @@ Optionally use old comment from FILE as initial value."
2130(defun image-dired-get-comment (file) 2132(defun image-dired-get-comment (file)
2131 "Get comment for file FILE." 2133 "Get comment for file FILE."
2132 (image-dired-sane-db-file) 2134 (image-dired-sane-db-file)
2133 (save-excursion 2135 (image-dired--with-db-file
2134 (let (end buf comment-beg-pos comment-end-pos comment) 2136 (let (end comment-beg-pos comment-end-pos comment)
2135 (setq buf (find-file image-dired-db-file)) 2137 (when (search-forward-regexp (format "^%s" file) nil t)
2136 (goto-char (point-min)) 2138 (end-of-line)
2137 (when (search-forward-regexp 2139 (setq end (point))
2138 (format "^%s" file) nil t) 2140 (beginning-of-line)
2139 (end-of-line) 2141 (when (search-forward ";comment:" end t)
2140 (setq end (point)) 2142 (setq comment-beg-pos (point))
2141 (beginning-of-line) 2143 (if (search-forward ";" end t)
2142 (cond ((search-forward ";comment:" end t) 2144 (setq comment-end-pos (- (point) 1))
2143 (setq comment-beg-pos (point)) 2145 (setq comment-end-pos end))
2144 (if (search-forward ";" end t) 2146 (setq comment (buffer-substring
2145 (setq comment-end-pos (- (point) 1)) 2147 comment-beg-pos comment-end-pos))))
2146 (setq comment-end-pos end)) 2148 comment)))
2147 (setq comment (buffer-substring
2148 comment-beg-pos comment-end-pos)))))
2149 (kill-buffer buf)
2150 comment)))
2151 2149
2152;;;###autoload 2150;;;###autoload
2153(defun image-dired-mark-tagged-files () 2151(defun image-dired-mark-tagged-files ()
@@ -2161,32 +2159,26 @@ matching tag will be marked in the dired buffer."
2161 (image-dired-sane-db-file) 2159 (image-dired-sane-db-file)
2162 (let ((tag (read-string "Mark tagged files (regexp): ")) 2160 (let ((tag (read-string "Mark tagged files (regexp): "))
2163 (hits 0) 2161 (hits 0)
2164 files buf) 2162 files)
2165 (save-excursion 2163 (image-dired--with-db-file
2166 (setq buf (find-file image-dired-db-file)) 2164 ;; Collect matches
2167 (goto-char (point-min)) 2165 (while (search-forward-regexp
2168 ;; Collect matches 2166 (concat "\\(^[^;\n]+\\);.*" tag ".*$") nil t)
2169 (while (search-forward-regexp 2167 (push (match-string 1) files)))
2170 (concat "\\(^[^;\n]+\\);.*" tag ".*$") nil t) 2168 ;; Mark files
2171 (setq files (append (list (match-string 1)) files))) 2169 (dolist (curr-file files)
2172 (kill-buffer buf) 2170 ;; I tried using `dired-mark-files-regexp' but it was waaaay to
2173 ;; Mark files 2171 ;; slow. Don't bother about hits found in other directories
2174 (mapc 2172 ;; than the current one.
2175 ;; I tried using `dired-mark-files-regexp' but it was 2173 (when (string= (file-name-as-directory
2176 ;; waaaay to slow. 2174 (expand-file-name default-directory))
2177 (lambda (curr-file) 2175 (file-name-as-directory
2178 ;; Don't bother about hits found in other directories than 2176 (file-name-directory curr-file)))
2179 ;; the current one. 2177 (setq curr-file (file-name-nondirectory curr-file))
2180 (when (string= (file-name-as-directory 2178 (goto-char (point-min))
2181 (expand-file-name default-directory)) 2179 (when (search-forward-regexp (format "\\s %s$" curr-file) nil t)
2182 (file-name-as-directory 2180 (setq hits (+ hits 1))
2183 (file-name-directory curr-file))) 2181 (dired-mark 1))))
2184 (setq curr-file (file-name-nondirectory curr-file))
2185 (goto-char (point-min))
2186 (when (search-forward-regexp (format "\\s %s$" curr-file) nil t)
2187 (setq hits (+ hits 1))
2188 (dired-mark 1))))
2189 files))
2190 (message "%d files with matching tag marked." hits))) 2182 (message "%d files with matching tag marked." hits)))
2191 2183
2192(defun image-dired-mouse-display-image (event) 2184(defun image-dired-mouse-display-image (event)
@@ -2322,29 +2314,26 @@ image-dired-file-comment-list:
2322(defun image-dired-create-gallery-lists () 2314(defun image-dired-create-gallery-lists ()
2323 "Create temporary lists used by `image-dired-gallery-generate'." 2315 "Create temporary lists used by `image-dired-gallery-generate'."
2324 (image-dired-sane-db-file) 2316 (image-dired-sane-db-file)
2325 (let ((buf (find-file image-dired-db-file)) 2317 (image-dired--with-db-file
2326 end beg file row-tags) 2318 (let (end beg file row-tags)
2327 (setq image-dired-tag-file-list nil) 2319 (setq image-dired-tag-file-list nil)
2328 (setq image-dired-file-tag-list nil) 2320 (setq image-dired-file-tag-list nil)
2329 (setq image-dired-file-comment-list nil) 2321 (setq image-dired-file-comment-list nil)
2330 (goto-char (point-min)) 2322 (goto-char (point-min))
2331 (while (search-forward-regexp "^." nil t) 2323 (while (search-forward-regexp "^." nil t)
2332 (end-of-line) 2324 (end-of-line)
2333 (setq end (point)) 2325 (setq end (point))
2334 (beginning-of-line) 2326 (beginning-of-line)
2335 (setq beg (point)) 2327 (setq beg (point))
2336 (if (not (search-forward ";" end nil)) 2328 (unless (search-forward ";" end nil)
2337 (error "Something is really wrong, check format of database")) 2329 (error "Something is really wrong, check format of database"))
2338 (setq row-tags (split-string 2330 (setq row-tags (split-string
2339 (buffer-substring beg end) ";")) 2331 (buffer-substring beg end) ";"))
2340 (setq file (car row-tags)) 2332 (setq file (car row-tags))
2341 (mapc 2333 (dolist (x (cdr row-tags))
2342 (lambda (x) 2334 (if (not (string-match "^comment:\\(.*\\)" x))
2343 (if (not (string-match "^comment:\\(.*\\)" x)) 2335 (image-dired-add-to-tag-file-lists x file)
2344 (image-dired-add-to-tag-file-lists x file) 2336 (image-dired-add-to-file-comment-list file (match-string 1 x)))))))
2345 (image-dired-add-to-file-comment-list file (match-string 1 x))))
2346 (cdr row-tags)))
2347 (kill-buffer buf))
2348 ;; Sort tag-file list 2337 ;; Sort tag-file list
2349 (setq image-dired-tag-file-list 2338 (setq image-dired-tag-file-list
2350 (sort image-dired-tag-file-list 2339 (sort image-dired-tag-file-list
@@ -2372,7 +2361,8 @@ it easier to generate, then HTML-files are created in
2372when using per-directory thumbnail file storage")) 2361when using per-directory thumbnail file storage"))
2373 (image-dired-create-gallery-lists) 2362 (image-dired-create-gallery-lists)
2374 (let ((tags image-dired-tag-file-list) 2363 (let ((tags image-dired-tag-file-list)
2375 count tag index-buf tag-buf 2364 (index-file (format "%s/index.html" image-dired-gallery-dir))
2365 count tag tag-file
2376 comment file-tags tag-link tag-link-list) 2366 comment file-tags tag-link tag-link-list)
2377 ;; Make sure gallery root exist 2367 ;; Make sure gallery root exist
2378 (if (file-exists-p image-dired-gallery-dir) 2368 (if (file-exists-p image-dired-gallery-dir)
@@ -2380,85 +2370,75 @@ when using per-directory thumbnail file storage"))
2380 (error "Variable image-dired-gallery-dir is not a directory")) 2370 (error "Variable image-dired-gallery-dir is not a directory"))
2381 (make-directory image-dired-gallery-dir)) 2371 (make-directory image-dired-gallery-dir))
2382 ;; Open index file 2372 ;; Open index file
2383 (setq index-buf (find-file 2373 (with-temp-file index-file
2384 (format "%s/index.html" image-dired-gallery-dir))) 2374 (if (file-exists-p index-file)
2385 (erase-buffer) 2375 (insert-file-contents index-file))
2386 (insert "<html>\n") 2376 (insert "<html>\n")
2387 (insert " <body>\n") 2377 (insert " <body>\n")
2388 (insert " <h2>Image-Dired Gallery</h2>\n") 2378 (insert " <h2>Image-Dired Gallery</h2>\n")
2389 (insert (format "<p>\n Gallery generated %s\n <p>\n" 2379 (insert (format "<p>\n Gallery generated %s\n <p>\n"
2390 (current-time-string))) 2380 (current-time-string)))
2391 (insert " <h3>Tag index</h3>\n") 2381 (insert " <h3>Tag index</h3>\n")
2392 (setq count 1) 2382 (setq count 1)
2393 ;; Pre-generate list of all tag links 2383 ;; Pre-generate list of all tag links
2394 (mapc 2384 (dolist (curr tags)
2395 (lambda (curr) 2385 (setq tag (car curr))
2396 (setq tag (car curr)) 2386 (when (not (member tag image-dired-gallery-hidden-tags))
2397 (when (not (member tag image-dired-gallery-hidden-tags)) 2387 (setq tag-link (format "<a href=\"%d.html\">%s</a>" count tag))
2398 (setq tag-link (format "<a href=\"%d.html\">%s</a>" count tag)) 2388 (if tag-link-list
2399 (if tag-link-list 2389 (setq tag-link-list
2400 (setq tag-link-list 2390 (append tag-link-list (list (cons tag tag-link))))
2401 (append tag-link-list (list (cons tag tag-link)))) 2391 (setq tag-link-list (list (cons tag tag-link))))
2402 (setq tag-link-list (list (cons tag tag-link)))) 2392 (setq count (1+ count))))
2403 (setq count (1+ count)))) 2393 (setq count 1)
2404 tags) 2394 ;; Main loop where we generated thumbnail pages per tag
2405 (setq count 1) 2395 (dolist (curr tags)
2406 ;; Main loop where we generated thumbnail pages per tag 2396 (setq tag (car curr))
2407 (mapc 2397 ;; Don't display hidden tags
2408 (lambda (curr) 2398 (when (not (member tag image-dired-gallery-hidden-tags))
2409 (setq tag (car curr)) 2399 ;; Insert link to tag page in index
2410 ;; Don't display hidden tags 2400 (insert (format " %s<br>\n" (cdr (assoc tag tag-link-list))))
2411 (when (not (member tag image-dired-gallery-hidden-tags)) 2401 ;; Open per-tag file
2412 ;; Insert link to tag page in index 2402 (setq tag-file (format "%s/%s.html" image-dired-gallery-dir count))
2413 (insert (format " %s<br>\n" (cdr (assoc tag tag-link-list)))) 2403 (with-temp-file tag-file
2414 ;; Open per-tag file 2404 (if (file-exists-p tag-file)
2415 (setq tag-buf (find-file 2405 (insert-file-contents tag-file))
2416 (format "%s/%s.html" image-dired-gallery-dir count))) 2406 (erase-buffer)
2417 (erase-buffer) 2407 (insert "<html>\n")
2418 (insert "<html>\n") 2408 (insert " <body>\n")
2419 (insert " <body>\n") 2409 (insert " <p><a href=\"index.html\">Index</a></p>\n")
2420 (insert " <p><a href=\"index.html\">Index</a></p>\n") 2410 (insert (format " <h2>Images with tag &quot;%s&quot;</h2>" tag))
2421 (insert (format " <h2>Images with tag &quot;%s&quot;</h2>" tag)) 2411 ;; Main loop for files per tag page
2422 ;; Main loop for files per tag page 2412 (dolist (file (cdr curr))
2423 (mapc 2413 (unless (image-dired-hidden-p file)
2424 (lambda (file) 2414 ;; Insert thumbnail with link to full image
2425 (when (not (image-dired-hidden-p file)) 2415 (insert
2426 ;; Insert thumbnail with link to full image 2416 (format "<a href=\"%s/%s\"><img src=\"%s/%s\"%s></a>\n"
2427 (insert 2417 image-dired-gallery-image-root-url
2428 (format "<a href=\"%s/%s\"><img src=\"%s/%s\"%s></a>\n" 2418 (file-name-nondirectory file)
2429 image-dired-gallery-image-root-url 2419 image-dired-gallery-thumb-image-root-url
2430 (file-name-nondirectory file) 2420 (file-name-nondirectory (image-dired-thumb-name file)) file))
2431 image-dired-gallery-thumb-image-root-url 2421 ;; Insert comment, if any
2432 (file-name-nondirectory (image-dired-thumb-name file)) file)) 2422 (if (setq comment (cdr (assoc file image-dired-file-comment-list)))
2433 ;; Insert comment, if any 2423 (insert (format "<br>\n%s<br>\n" comment))
2434 (if (setq comment (cdr (assoc file image-dired-file-comment-list))) 2424 (insert "<br>\n"))
2435 (insert (format "<br>\n%s<br>\n" comment)) 2425 ;; Insert links to other tags, if any
2436 (insert "<br>\n")) 2426 (when (> (length
2437 ;; Insert links to other tags, if any 2427 (setq file-tags (assoc file image-dired-file-tag-list))) 2)
2438 (when (> (length 2428 (insert "[ ")
2439 (setq file-tags (assoc file image-dired-file-tag-list))) 2) 2429 (dolist (extra-tag file-tags)
2440 (insert "[ ") 2430 ;; Only insert if not file name or the main tag
2441 (mapc 2431 (if (and (not (equal extra-tag tag))
2442 (lambda (extra-tag) 2432 (not (equal extra-tag file)))
2443 ;; Only insert if not file name or the main tag 2433 (insert
2444 (if (and (not (equal extra-tag tag)) 2434 (format "%s " (cdr (assoc extra-tag tag-link-list))))))
2445 (not (equal extra-tag file))) 2435 (insert "]<br>\n"))))
2446 (insert 2436 (insert " <p><a href=\"index.html\">Index</a></p>\n")
2447 (format "%s " (cdr (assoc extra-tag tag-link-list)))))) 2437 (insert " </body>\n")
2448 file-tags) 2438 (insert "</html>\n"))
2449 (insert "]<br>\n")))) 2439 (setq count (1+ count))))
2450 (cdr curr)) 2440 (insert " </body>\n")
2451 (insert " <p><a href=\"index.html\">Index</a></p>\n") 2441 (insert "</html>"))))
2452 (insert " </body>\n")
2453 (insert "</html>\n")
2454 (save-buffer)
2455 (kill-buffer tag-buf)
2456 (setq count (1+ count))))
2457 tags)
2458 (insert " </body>\n")
2459 (insert "</html>")
2460 (save-buffer)
2461 (kill-buffer index-buf)))
2462 2442
2463(defun image-dired-kill-buffer-and-window () 2443(defun image-dired-kill-buffer-and-window ()
2464 "Kill the current buffer and, if possible, also the window." 2444 "Kill the current buffer and, if possible, also the window."
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el
index 59340583997..fda8cd1438d 100644
--- a/lisp/time-stamp.el
+++ b/lisp/time-stamp.el
@@ -424,10 +424,10 @@ format the string."
424 (let ((ts-real-time-zone (getenv "TZ"))) 424 (let ((ts-real-time-zone (getenv "TZ")))
425 (unwind-protect 425 (unwind-protect
426 (progn 426 (progn
427 (set-time-zone-rule time-stamp-time-zone) 427 (setenv "TZ" time-stamp-time-zone)
428 (format-time-string 428 (format-time-string
429 (time-stamp-string-preprocess ts-format))) 429 (time-stamp-string-preprocess ts-format)))
430 (set-time-zone-rule ts-real-time-zone))) 430 (setenv "TZ" ts-real-time-zone)))
431 (format-time-string 431 (format-time-string
432 (time-stamp-string-preprocess ts-format))) 432 (time-stamp-string-preprocess ts-format)))
433 ;; handle version 1 compatibility 433 ;; handle version 1 compatibility
diff --git a/lisp/time.el b/lisp/time.el
index b158ef64691..f8fea0c64a2 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -156,21 +156,24 @@ LABEL is a string to display as the label of that TIMEZONE's time."
156(defcustom display-time-world-list 156(defcustom display-time-world-list
157 ;; Determine if zoneinfo style timezones are supported by testing that 157 ;; Determine if zoneinfo style timezones are supported by testing that
158 ;; America/New York and Europe/London return different timezones. 158 ;; America/New York and Europe/London return different timezones.
159 (let (gmt nyt) 159 (let ((old-tz (getenv "TZ"))
160 (set-time-zone-rule "America/New_York") 160 gmt nyt)
161 (setq nyt (format-time-string "%z")) 161 (unwind-protect
162 (set-time-zone-rule "Europe/London") 162 (progn
163 (setq gmt (format-time-string "%z")) 163 (setenv "TZ" "America/New_York")
164 (set-time-zone-rule nil) 164 (setq nyt (format-time-string "%z"))
165 (setenv "TZ" "Europe/London")
166 (setq gmt (format-time-string "%z")))
167 (setenv "TZ" old-tz))
165 (if (string-equal nyt gmt) 168 (if (string-equal nyt gmt)
166 legacy-style-world-list 169 legacy-style-world-list
167 zoneinfo-style-world-list)) 170 zoneinfo-style-world-list))
168 "Alist of time zones and places for `display-time-world' to display. 171 "Alist of time zones and places for `display-time-world' to display.
169Each element has the form (TIMEZONE LABEL). 172Each element has the form (TIMEZONE LABEL).
170TIMEZONE should be in the format supported by `set-time-zone-rule' on 173TIMEZONE should be in a format supported by your system. See the
171your system. See the documentation of `zoneinfo-style-world-list' and 174documentation of `zoneinfo-style-world-list' and
172\`legacy-style-world-list' for two widely used formats. 175\`legacy-style-world-list' for two widely used formats. LABEL is
173LABEL is a string to display as the label of that TIMEZONE's time." 176a string to display as the label of that TIMEZONE's time."
174 :group 'display-time 177 :group 'display-time
175 :type '(repeat (list string string)) 178 :type '(repeat (list string string))
176 :version "23.1") 179 :version "23.1")
@@ -521,26 +524,26 @@ See `display-time-world'."
521(defun display-time-world-display (alist) 524(defun display-time-world-display (alist)
522 "Replace current buffer text with times in various zones, based on ALIST." 525 "Replace current buffer text with times in various zones, based on ALIST."
523 (let ((inhibit-read-only t) 526 (let ((inhibit-read-only t)
524 (buffer-undo-list t)) 527 (buffer-undo-list t)
528 (old-tz (getenv "TZ"))
529 (max-width 0)
530 result fmt)
525 (erase-buffer) 531 (erase-buffer)
526 (let ((max-width 0) 532 (unwind-protect
527 (result ()) 533 (dolist (zone alist)
528 fmt) 534 (let* ((label (cadr zone))
529 (unwind-protect 535 (width (string-width label)))
530 (dolist (zone alist) 536 (setenv "TZ" (car zone))
531 (let* ((label (cadr zone)) 537 (push (cons label
532 (width (string-width label))) 538 (format-time-string display-time-world-time-format))
533 (set-time-zone-rule (car zone)) 539 result)
534 (push (cons label 540 (when (> width max-width)
535 (format-time-string display-time-world-time-format)) 541 (setq max-width width))))
536 result) 542 (setenv "TZ" old-tz))
537 (when (> width max-width) 543 (setq fmt (concat "%-" (int-to-string max-width) "s %s\n"))
538 (setq max-width width)))) 544 (dolist (timedata (nreverse result))
539 (set-time-zone-rule nil)) 545 (insert (format fmt (car timedata) (cdr timedata)))))
540 (setq fmt (concat "%-" (int-to-string max-width) "s %s\n")) 546 (delete-char -1))
541 (dolist (timedata (nreverse result))
542 (insert (format fmt (car timedata) (cdr timedata)))))
543 (delete-char -1)))
544 547
545;;;###autoload 548;;;###autoload
546(defun display-time-world () 549(defun display-time-world ()
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index e5aead2309f..9170d7b9424 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -853,9 +853,9 @@ non-nil, otherwise in local time."
853 (let ((tz (getenv "TZ"))) 853 (let ((tz (getenv "TZ")))
854 (unwind-protect 854 (unwind-protect
855 (progn 855 (progn
856 (set-time-zone-rule add-log-time-zone-rule) 856 (setenv "TZ" add-log-time-zone-rule)
857 (funcall add-log-time-format)) 857 (funcall add-log-time-format))
858 (set-time-zone-rule tz))) 858 (setenv "TZ" tz)))
859 (funcall add-log-time-format)) 859 (funcall add-log-time-format))
860 " " full-name 860 " " full-name
861 " <" addr ">")) 861 " <" addr ">"))
diff --git a/src/ChangeLog b/src/ChangeLog
index 4df4455e862..4d493eab7b1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,15 @@
12011-08-08 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (forward_to_next_line_start): Allow to use the
4 no-display-properties-and-no-overlays under bidi display. Set
5 disp_pos in the bidi iterator to avoid searches for display
6 properties and overlays.
7
12011-08-08 Chong Yidong <cyd@stupidchicken.com> 82011-08-08 Chong Yidong <cyd@stupidchicken.com>
2 9
10 * editfns.c (Fset_time_zone_rule): Document relationship with the
11 setenv function.
12
3 * ftfont.c (ftfont_pattern_entity): Copy the extras argument to 13 * ftfont.c (ftfont_pattern_entity): Copy the extras argument to
4 the font entity extracted from the cache (Bug#8109). 14 the font entity extracted from the cache (Bug#8109).
5 15
diff --git a/src/editfns.c b/src/editfns.c
index 5eed386afb7..297f7b6d7e4 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2053,7 +2053,12 @@ static char *initial_tz;
2053DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0, 2053DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0,
2054 doc: /* Set the local time zone using TZ, a string specifying a time zone rule. 2054 doc: /* Set the local time zone using TZ, a string specifying a time zone rule.
2055If TZ is nil, use implementation-defined default time zone information. 2055If TZ is nil, use implementation-defined default time zone information.
2056If TZ is t, use Universal Time. */) 2056If TZ is t, use Universal Time.
2057
2058Instead of calling this function, you typically want (setenv "TZ" TZ).
2059That changes both the environment of the Emacs process and the
2060variable `process-environment', whereas `set-time-zone-rule' affects
2061only the former. */)
2057 (Lisp_Object tz) 2062 (Lisp_Object tz)
2058{ 2063{
2059 const char *tzstring; 2064 const char *tzstring;
diff --git a/src/xdisp.c b/src/xdisp.c
index d4f53012763..b09a1547a57 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5567,19 +5567,42 @@ forward_to_next_line_start (struct it *it, int *skipped_p,
5567 5567
5568 xassert (!STRINGP (it->string)); 5568 xassert (!STRINGP (it->string));
5569 5569
5570 /* If we are not bidi-reordering, and there isn't any `display' 5570 /* If there isn't any `display' property in sight, and no
5571 property in sight, and no overlays, we can just use the 5571 overlays, we can just use the position of the newline in
5572 position of the newline in buffer text. */ 5572 buffer text. */
5573 if (!it->bidi_p 5573 if (it->stop_charpos >= limit
5574 && (it->stop_charpos >= limit 5574 || ((pos = Fnext_single_property_change (make_number (start),
5575 || ((pos = Fnext_single_property_change (make_number (start), 5575 Qdisplay, Qnil,
5576 Qdisplay, Qnil, 5576 make_number (limit)),
5577 make_number (limit)), 5577 NILP (pos))
5578 NILP (pos)) 5578 && next_overlay_change (start) == ZV))
5579 && next_overlay_change (start) == ZV))) 5579 {
5580 { 5580 if (!it->bidi_p)
5581 IT_CHARPOS (*it) = limit; 5581 {
5582 IT_BYTEPOS (*it) = CHAR_TO_BYTE (limit); 5582 IT_CHARPOS (*it) = limit;
5583 IT_BYTEPOS (*it) = CHAR_TO_BYTE (limit);
5584 }
5585 else
5586 {
5587 struct bidi_it bprev;
5588
5589 /* Help bidi.c avoid expensive searches for display
5590 properties and overlays, by telling it that there are
5591 none up to `limit'. */
5592 if (it->bidi_it.disp_pos < limit)
5593 {
5594 it->bidi_it.disp_pos = limit;
5595 it->bidi_it.disp_prop_p = 0;
5596 }
5597 do {
5598 bprev = it->bidi_it;
5599 bidi_move_to_visually_next (&it->bidi_it);
5600 } while (it->bidi_it.charpos != limit);
5601 IT_CHARPOS (*it) = limit;
5602 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
5603 if (bidi_it_prev)
5604 *bidi_it_prev = bprev;
5605 }
5583 *skipped_p = newline_found_p = 1; 5606 *skipped_p = newline_found_p = 1;
5584 } 5607 }
5585 else 5608 else