diff options
| author | Juri Linkov | 2004-04-27 06:35:25 +0000 |
|---|---|---|
| committer | Juri Linkov | 2004-04-27 06:35:25 +0000 |
| commit | 598ea453d3c5921698353e0cdee47121cf1e6f0e (patch) | |
| tree | 434ee550986f218226f12c2cb6c0060466091947 | |
| parent | 1d359d88af21fb2316be2901752f0368cb9897b2 (diff) | |
| download | emacs-598ea453d3c5921698353e0cdee47121cf1e6f0e.tar.gz emacs-598ea453d3c5921698353e0cdee47121cf1e6f0e.zip | |
(view-emacs-news): With argument, display info for the
selected version by finding it among different NEWS files, and
narrowing the buffer to the selected version.
| -rw-r--r-- | lisp/help.el | 68 |
1 files changed, 55 insertions, 13 deletions
diff --git a/lisp/help.el b/lisp/help.el index b589de94474..fc43d8db03d 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; help.el --- help commands for Emacs | 1 | ;;; help.el --- help commands for Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002 | 3 | ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2004 |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Maintainer: FSF | 6 | ;; Maintainer: FSF |
| @@ -313,19 +313,61 @@ of the key sequence that ran this command." | |||
| 313 | 313 | ||
| 314 | (defun view-emacs-news (&optional arg) | 314 | (defun view-emacs-news (&optional arg) |
| 315 | "Display info on recent changes to Emacs. | 315 | "Display info on recent changes to Emacs. |
| 316 | With numeric argument, display information on correspondingly older changes." | 316 | With argument, display info only for the selected version." |
| 317 | (interactive "P") | 317 | (interactive "P") |
| 318 | (let* ((arg (if arg (prefix-numeric-value arg) 0)) | 318 | (if (not arg) |
| 319 | (file (cond ((eq arg 0) "NEWS") | 319 | (view-file (expand-file-name "NEWS" data-directory)) |
| 320 | ((eq arg 1) "ONEWS") | 320 | (let* ((map (sort |
| 321 | (t | 321 | (delete-dups |
| 322 | (nth (- arg 2) | 322 | (apply |
| 323 | (nreverse (directory-files data-directory | 323 | 'nconc |
| 324 | nil "^ONEWS\\.[0-9]+$" | 324 | (mapcar |
| 325 | nil))))))) | 325 | (lambda (file) |
| 326 | (if file | 326 | (with-temp-buffer |
| 327 | (view-file (expand-file-name file data-directory)) | 327 | (insert-file-contents |
| 328 | (error "No such old news")))) | 328 | (expand-file-name file data-directory)) |
| 329 | (let (res) | ||
| 330 | (while (re-search-forward | ||
| 331 | (if (string-match "^ONEWS\\.[0-9]+$" file) | ||
| 332 | "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)" | ||
| 333 | "^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t) | ||
| 334 | (setq res (cons (list (match-string-no-properties 1) | ||
| 335 | file) res))) | ||
| 336 | res))) | ||
| 337 | (append '("NEWS" "ONEWS") | ||
| 338 | (directory-files data-directory nil | ||
| 339 | "^ONEWS\\.[0-9]+$" nil))))) | ||
| 340 | (lambda (a b) | ||
| 341 | (string< (car b) (car a))))) | ||
| 342 | (current (caar map)) | ||
| 343 | (version (completing-read | ||
| 344 | (format "Read NEWS for the version (default %s): " current) | ||
| 345 | (mapcar 'car map) nil nil nil nil current)) | ||
| 346 | (file (cadr (assoc version map))) | ||
| 347 | res) | ||
| 348 | (if (not file) | ||
| 349 | (error "No news is good news") | ||
| 350 | (view-file (expand-file-name file data-directory)) | ||
| 351 | (widen) | ||
| 352 | (goto-char (point-min)) | ||
| 353 | (when (re-search-forward | ||
| 354 | (concat (if (string-match "^ONEWS\\.[0-9]+$" file) | ||
| 355 | "Changes in \\(?:Emacs\\|version\\)?[ \t]*" | ||
| 356 | "^\* [^0-9\n]*") version) | ||
| 357 | nil t) | ||
| 358 | (beginning-of-line) | ||
| 359 | (narrow-to-region | ||
| 360 | (point) | ||
| 361 | (save-excursion | ||
| 362 | (while (and (setq res | ||
| 363 | (re-search-forward | ||
| 364 | (if (string-match "^ONEWS\\.[0-9]+$" file) | ||
| 365 | "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)" | ||
| 366 | "^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t)) | ||
| 367 | (equal (match-string-no-properties 1) version))) | ||
| 368 | (or res (goto-char (point-max))) | ||
| 369 | (beginning-of-line) | ||
| 370 | (point)))))))) | ||
| 329 | 371 | ||
| 330 | (defun view-todo (&optional arg) | 372 | (defun view-todo (&optional arg) |
| 331 | "Display the Emacs TODO list." | 373 | "Display the Emacs TODO list." |