aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Zlatanov2015-02-05 11:51:07 +0000
committerKatsumi Yamaoka2015-02-05 11:51:07 +0000
commitff7072d5314768e31a4f15ad1ce0039405ddb535 (patch)
treed5e4fd2285a2e2ce30629169b488a998dc3a9413
parentca25231a264d0c8dead443ab75c2edb02161cff9 (diff)
downloademacs-ff7072d5314768e31a4f15ad1ce0039405ddb535.tar.gz
emacs-ff7072d5314768e31a4f15ad1ce0039405ddb535.zip
lisp/gnus/gnus-start.el: always check newsrc timestamp when saving it
-rw-r--r--lisp/gnus/ChangeLog6
-rw-r--r--lisp/gnus/gnus-start.el34
2 files changed, 18 insertions, 22 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 19bf562cc23..32d3f08f586 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,9 @@
12015-02-05 Teodor Zlatanov <tzz@lifelogs.com>
2
3 * gnus-start.el (gnus-save-newsrc-file-check-timestamp): Remove
4 variable; always check the newrc timestamp.
5 (gnus-save-newsrc-file): Always check timestamp.
6
12015-02-05 Timo Lilja <timo.lilja@iki.fi> (tiny change) 72015-02-05 Timo Lilja <timo.lilja@iki.fi> (tiny change)
2 8
3 * mail-source.el (mail-source-call-script): If scripts exit with an 9 * mail-source.el (mail-source-call-script): If scripts exit with an
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index aa2568d5559..0c0246a4e14 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -442,15 +442,6 @@ See also `gnus-before-startup-hook'."
442 :group 'gnus-newsrc 442 :group 'gnus-newsrc
443 :type 'hook) 443 :type 'hook)
444 444
445(defcustom gnus-save-newsrc-file-check-timestamp nil
446 "Check the modification time of the newsrc.eld file before saving it.
447When the newsrc.eld file is updated by multiple machines,
448checking the file's modification time is a good way to avoid
449overwriting updated data."
450 :version "25.1"
451 :group 'gnus-newsrc
452 :type 'boolean)
453
454(defcustom gnus-save-newsrc-hook nil 445(defcustom gnus-save-newsrc-hook nil
455 "A hook called before saving any of the newsrc files." 446 "A hook called before saving any of the newsrc files."
456 :group 'gnus-newsrc 447 :group 'gnus-newsrc
@@ -2833,19 +2824,18 @@ If FORCE is non-nil, the .newsrc file is read."
2833 2824
2834 ;; check timestamp of `gnus-current-startup-file'.eld against 2825 ;; check timestamp of `gnus-current-startup-file'.eld against
2835 ;; `gnus-save-newsrc-file-last-timestamp' 2826 ;; `gnus-save-newsrc-file-last-timestamp'
2836 (when gnus-save-newsrc-file-check-timestamp 2827 (let* ((checkfile (concat gnus-current-startup-file ".eld"))
2837 (let* ((checkfile (concat gnus-current-startup-file ".eld")) 2828 (mtime (nth 5 (file-attributes checkfile))))
2838 (mtime (nth 5 (file-attributes checkfile)))) 2829 (when (and gnus-save-newsrc-file-last-timestamp
2839 (when (and gnus-save-newsrc-file-last-timestamp 2830 (time-less-p gnus-save-newsrc-file-last-timestamp
2840 (time-less-p gnus-save-newsrc-file-last-timestamp 2831 mtime))
2841 mtime)) 2832 (unless (y-or-n-p
2842 (unless (y-or-n-p 2833 (format "%s was updated externally after %s, save?"
2843 (format "%s was updated externally after %s, save?" 2834 checkfile
2844 checkfile 2835 (format-time-string
2845 (format-time-string 2836 "%c"
2846 "%c" 2837 gnus-save-newsrc-file-last-timestamp)))
2847 gnus-save-newsrc-file-last-timestamp))) 2838 (error "Couldn't save %s: updated externally" checkfile))))
2848 (error "Couldn't save %s: updated externally" checkfile)))))
2849 2839
2850 (if gnus-save-startup-file-via-temp-buffer 2840 (if gnus-save-startup-file-via-temp-buffer
2851 (let ((coding-system-for-write gnus-ding-file-coding-system) 2841 (let ((coding-system-for-write gnus-ding-file-coding-system)