From: F. Jason Park Date: Fri, 2 Jun 2023 06:18:56 +0000 (-0700) Subject: Prefer emacs-news-mode in etc/ERC-NEWS X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a4df74832959f2f11d4dd52a39781ccc8d86550d;p=emacs.git Prefer emacs-news-mode in etc/ERC-NEWS * etc/ERC-NEWS: Remove `outline' from prop line and prefer `emacs-news-mode' in local variables list. * lisp/erc/erc.el (erc-news): Overwrite cached file and ask before re-fetching. --- diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS index e9ec9e2caab..5753120107a 100644 --- a/etc/ERC-NEWS +++ b/etc/ERC-NEWS @@ -1,4 +1,4 @@ -ERC NEWS -*- outline -*- +ERC NEWS Copyright (C) 2006-2023 Free Software Foundation, Inc. See the end of the file for license conditions. @@ -1926,5 +1926,6 @@ along with GNU Emacs. If not, see . Local variables: coding: utf-8 mode: outline +mode: emacs-news paragraph-separate: "[ ]*$" end: diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 2c2df81fa6d..99505a2355f 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -7458,8 +7458,9 @@ With ARG, download and display the latest revision, which may contain more up-to-date information, even for older versions." (interactive "P") (find-file - (or (and arg erc--news-temp-file + (or (and erc--news-temp-file (time-less-p (current-time) (car erc--news-temp-file)) + (not (and arg (y-or-n-p (format "Re-fetch? ")))) (cdr erc--news-temp-file)) (and arg (with-current-buffer (url-retrieve-synchronously erc--news-url) @@ -7467,7 +7468,10 @@ contain more up-to-date information, even for older versions." (search-forward "200 OK" (pos-eol)) (search-forward "\n\n") (delete-region (point-min) (point)) - (let ((tempfile (make-temp-file "erc-news."))) + ;; May warn about file having changed on disk (unless + ;; `query-about-changed-file' is nil on 28+). + (let ((tempfile (or (cdr erc--news-temp-file) + (make-temp-file "erc-news.")))) (write-region (point-min) (point-max) tempfile) (kill-buffer) (cdr (setq erc--news-temp-file @@ -7482,13 +7486,12 @@ contain more up-to-date information, even for older versions." (expand-file-name "ERC-NEWS" data-directory))) (when (fboundp 'emacs-news-view-mode) (emacs-news-view-mode)) + (goto-char (point-min)) (let ((v (mapcar #'number-to-string (seq-take-while #'natnump (version-to-list erc-version))))) - (while (and v - (goto-char (point-min)) - (not (search-forward (concat "\014\n* Changes in ERC " - (string-join v ".")) - nil t))) + (while (and v (not (search-forward (concat "\014\n* Changes in ERC " + (string-join v ".")) + nil t))) (setq v (butlast v)))) (beginning-of-line))