Function: erc-news

erc-news is an interactive and byte-compiled function defined in erc.el.gz.

Signature

(erc-news ARG)

Documentation

Show ERC news in a manner similar to view-emacs-news.

With ARG, download and display the latest revision, which may contain more up-to-date information, even for older versions.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-news (arg)
  "Show ERC news in a manner similar to `view-emacs-news'.
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 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)
              (goto-char (point-min))
              (search-forward "200 OK" (pos-eol))
              (search-forward "\n\n")
              (delete-region (point-min) (point))
              ;; 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
                           (cons (time-add (current-time) (* 60 60 12))
                                 tempfile))))))
       (and-let* ((file (or (eval-when-compile (macroexp-file-name))
                            (locate-library "erc")))
                  (dir (file-name-directory file))
                  (adjacent (expand-file-name "ERC-NEWS" dir))
                  ((file-exists-p adjacent)))
         adjacent)
       (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 (not (search-forward (concat "\014\n* Changes in ERC "
                                               (string-join v "."))
                                       nil t)))
      (setq v (butlast v))))
  (beginning-of-line))