emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should we move 20.x related stuff out of NEWS ?


From: Juri Linkov
Subject: Re: Should we move 20.x related stuff out of NEWS ?
Date: Sat, 17 Apr 2004 17:09:59 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

>>> Well, customize-variable could also record the two last Emacs minor
>>> and major Emacs versions valid on each change, and then the NEWS file
>>> gets narrowed accordingly by C-h n.

I really wouldn't want to make a mountain out of a molehill,
but I think an idea to automatically narrow O?NEWS.([1-9])?
to the selected release is very good for Emacs users.

I propose to replace the function `view-emacs-news' (whose
current numeric argument has no sense) by the following function.
It allows the user to select a release number, finds it among
different news files, and narrows the buffer to the selected
release.

(defun view-emacs-news (&optional release map)
  "Display info on recent changes to Emacs."
  (interactive
   (let* ((map (sort
                (delete-dups
                 (mapcan
                  (lambda (file)
                    (with-temp-buffer
                      (insert-file-contents
                       (expand-file-name file data-directory))
                      (let (res)
                        (while (re-search-forward
                                "Changes in \\(?:Emacs\\|version\\)?[ 
\t]*\\([0-9]+\\(?:\.[0-9]+\\)?\\)"
                                nil t)
                          (setq res (cons (list (match-string-no-properties 1) 
file) res)))
                        res)))
                  (append '("NEWS" "ONEWS")
                          (directory-files data-directory nil
                                           "^ONEWS\\.[0-9]+$" nil))))
                (lambda (a b)
                  (string< (car b) (car a)))))
          (release (caar map)))
     (list (completing-read
            (format "Read NEWS for the release (default %s): " release)
            (mapcar 'car map) nil nil nil nil release)
           map)))
  (let* ((file (cadr (assoc release map))))
    (if (not file)
        (error "No news is good news")
      (view-file (expand-file-name file data-directory))
      (widen)
      (goto-char (point-min))
      (when (re-search-forward
             (concat "Changes in \\(?:Emacs\\|version\\)?[ \t]*" release)
             nil t)
        (beginning-of-line)
        (narrow-to-region
         (point)
         (save-excursion
           (while (or (and (or
                            (re-search-forward
                             "Changes in \\(?:Emacs\\|version\\)?[ 
\t]*\\([0-9]+\\(?:\.[0-9]+\\)?\\)"
                             nil t)
                            (re-search-forward
                             "For older news, see the file ONEWS"
                             nil t))
                           (equal (match-string-no-properties 1) release))))
           (beginning-of-line)
           (point)))))))

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]