diff options
| author | Sam Steingold | 2000-08-16 14:33:21 +0000 |
|---|---|---|
| committer | Sam Steingold | 2000-08-16 14:33:21 +0000 |
| commit | 10e1dad96138dda35864ccb2885bb1c1fb33f8ba (patch) | |
| tree | 68b6ec2e61dfeda332bd124b405fd886ecf8ae21 | |
| parent | 6bb6cda236f7c682907eddac367786d97f12e522 (diff) | |
| download | emacs-10e1dad96138dda35864ccb2885bb1c1fb33f8ba.tar.gz emacs-10e1dad96138dda35864ccb2885bb1c1fb33f8ba.zip | |
* buff-menu.el (list-buffers-noselect): Use `dolist' instead of
`while'; use `with-current-buffer' instead of `save-excursion'.
Removed unnecessary kludges now that "*Buffer List*" is excluded.
| -rw-r--r-- | lisp/ChangeLog | 16 | ||||
| -rw-r--r-- | lisp/buff-menu.el | 154 |
2 files changed, 82 insertions, 88 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e6c2423b900..f7a25e44de3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2000-08-16 Sam Steingold <sds@gnu.org> | ||
| 2 | |||
| 3 | * buff-menu.el (list-buffers-noselect): Use `dolist' instead of | ||
| 4 | `while'; use `with-current-buffer' instead of `save-excursion'. | ||
| 5 | Removed unnecessary kludges now that "*Buffer List*" is excluded. | ||
| 6 | |||
| 1 | 2000-08-16 Kenichi Handa <handa@etl.go.jp> | 7 | 2000-08-16 Kenichi Handa <handa@etl.go.jp> |
| 2 | 8 | ||
| 3 | * international/ccl.el (declare-ccl-program): Docstring modified. | 9 | * international/ccl.el (declare-ccl-program): Docstring modified. |
| @@ -17,7 +23,7 @@ | |||
| 17 | (Buffer-menu-execute): When deleting, test `(and buf (buffer-name | 23 | (Buffer-menu-execute): When deleting, test `(and buf (buffer-name |
| 18 | buf))', instead of `(Buffer-menu-buffer nil)', to see if buffer | 24 | buf))', instead of `(Buffer-menu-buffer nil)', to see if buffer |
| 19 | wasn't killed. | 25 | wasn't killed. |
| 20 | 26 | ||
| 21 | * buff-menu.el (list-buffers-noselect): Don't display the | 27 | * buff-menu.el (list-buffers-noselect): Don't display the |
| 22 | *Buffer List* buffer. | 28 | *Buffer List* buffer. |
| 23 | 29 | ||
| @@ -25,7 +31,7 @@ | |||
| 25 | `Loading jit-lock' message. | 31 | `Loading jit-lock' message. |
| 26 | 32 | ||
| 27 | * emacs-lisp/cust-print.el, emacs-lisp/cl-specs.el | 33 | * emacs-lisp/cust-print.el, emacs-lisp/cl-specs.el |
| 28 | * emacs-lisp/edebug.el, progmodes/hideif.el: Change authors' | 34 | * emacs-lisp/edebug.el, progmodes/hideif.el: Change authors' |
| 29 | mail address. | 35 | mail address. |
| 30 | 36 | ||
| 31 | 2000-08-15 Miles Bader <miles@gnu.org> | 37 | 2000-08-15 Miles Bader <miles@gnu.org> |
| @@ -104,7 +110,7 @@ | |||
| 104 | * paren.el (show-paren-priority): New user option. | 110 | * paren.el (show-paren-priority): New user option. |
| 105 | (show-paren-function): Set overlay priorities to | 111 | (show-paren-function): Set overlay priorities to |
| 106 | show-paren-priority. | 112 | show-paren-priority. |
| 107 | 113 | ||
| 108 | 2000-08-14 Miles Bader <miles@gnu.org> | 114 | 2000-08-14 Miles Bader <miles@gnu.org> |
| 109 | 115 | ||
| 110 | * comint.el (comint-bol): Use `forward-line 0' instead of calling | 116 | * comint.el (comint-bol): Use `forward-line 0' instead of calling |
| @@ -124,9 +130,9 @@ | |||
| 124 | 130 | ||
| 125 | * xml.el (xml-parse-tag, xml-parse-attlist): Do not downcase | 131 | * xml.el (xml-parse-tag, xml-parse-attlist): Do not downcase |
| 126 | identifiers, since XML is case sensitive | 132 | identifiers, since XML is case sensitive |
| 127 | 133 | ||
| 128 | 2000-08-12 Miles Bader <miles@gnu.org> | 134 | 2000-08-12 Miles Bader <miles@gnu.org> |
| 129 | 135 | ||
| 130 | * comint.el (comint-output-filter): Don't bother frobbing | 136 | * comint.el (comint-output-filter): Don't bother frobbing |
| 131 | window-start, it doesn't seem to be necessary. | 137 | window-start, it doesn't seem to be necessary. |
| 132 | 138 | ||
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index c84ed105d9b..02036891cda 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el | |||
| @@ -44,7 +44,7 @@ | |||
| 44 | ;; Based on FSF code dating back to 1985. | 44 | ;; Based on FSF code dating back to 1985. |
| 45 | 45 | ||
| 46 | ;;; Code: | 46 | ;;; Code: |
| 47 | 47 | ||
| 48 | ;;;Trying to preserve the old window configuration works well in | 48 | ;;;Trying to preserve the old window configuration works well in |
| 49 | ;;;simple scenarios, when you enter the buffer menu, use it, and exit it. | 49 | ;;;simple scenarios, when you enter the buffer menu, use it, and exit it. |
| 50 | ;;;But it does strange things when you switch back to the buffer list buffer | 50 | ;;;But it does strange things when you switch back to the buffer list buffer |
| @@ -322,7 +322,7 @@ This command deletes and replaces all the previously existing windows | |||
| 322 | in the selected frame." | 322 | in the selected frame." |
| 323 | (interactive) | 323 | (interactive) |
| 324 | (let ((buff (Buffer-menu-buffer t)) | 324 | (let ((buff (Buffer-menu-buffer t)) |
| 325 | (menu (current-buffer)) | 325 | (menu (current-buffer)) |
| 326 | (others ()) | 326 | (others ()) |
| 327 | tem) | 327 | tem) |
| 328 | (goto-char (point-min)) | 328 | (goto-char (point-min)) |
| @@ -494,87 +494,75 @@ The R column contains a % for buffers that are read-only." | |||
| 494 | ") | 494 | ") |
| 495 | ;; Record the column where buffer names start. | 495 | ;; Record the column where buffer names start. |
| 496 | (setq Buffer-menu-buffer-column 4) | 496 | (setq Buffer-menu-buffer-column 4) |
| 497 | (let ((bl (buffer-list))) | 497 | (dolist (buffer (buffer-list)) |
| 498 | (while bl | 498 | (let ((name (buffer-name buffer)) |
| 499 | (let* ((buffer (car bl)) | 499 | (file (buffer-file-name buffer)) |
| 500 | (name (buffer-name buffer)) | 500 | this-buffer-line-start |
| 501 | (file (buffer-file-name buffer)) | 501 | this-buffer-read-only |
| 502 | this-buffer-line-start | 502 | (this-buffer-size (buffer-size buffer)) |
| 503 | this-buffer-read-only | 503 | this-buffer-mode-name |
| 504 | this-buffer-size | 504 | this-buffer-directory) |
| 505 | this-buffer-mode-name | 505 | (with-current-buffer buffer |
| 506 | this-buffer-directory) | 506 | (setq this-buffer-read-only buffer-read-only |
| 507 | (save-excursion | 507 | this-buffer-mode-name mode-name) |
| 508 | (set-buffer buffer) | 508 | (unless file |
| 509 | (setq this-buffer-read-only buffer-read-only) | 509 | ;; No visited file. Check local value of |
| 510 | (setq this-buffer-size (buffer-size)) | 510 | ;; list-buffers-directory. |
| 511 | (setq this-buffer-mode-name | 511 | (when (and (boundp 'list-buffers-directory) |
| 512 | (if (eq buffer standard-output) | 512 | list-buffers-directory) |
| 513 | "Buffer Menu" mode-name)) | 513 | (setq this-buffer-directory list-buffers-directory)))) |
| 514 | (or file | 514 | (cond |
| 515 | ;; No visited file. Check local value of | 515 | ;; Don't mention internal buffers. |
| 516 | ;; list-buffers-directory. | 516 | ((string= (substring name 0 1) " ")) |
| 517 | (if (and (boundp 'list-buffers-directory) | 517 | ;; Maybe don't mention buffers without files. |
| 518 | list-buffers-directory) | 518 | ((and files-only (not file))) |
| 519 | (setq this-buffer-directory list-buffers-directory)))) | 519 | ((string= name "*Buffer List*")) |
| 520 | (cond | 520 | ;; Otherwise output info. |
| 521 | ;; Don't mention internal buffers. | 521 | (t |
| 522 | ((string= (substring name 0 1) " ")) | 522 | (setq this-buffer-line-start (point)) |
| 523 | ;; Maybe don't mention buffers without files. | 523 | ;; Identify current buffer. |
| 524 | ((and files-only (not file))) | 524 | (if (eq buffer old-buffer) |
| 525 | ((string= name "*Buffer List*")) | 525 | (progn |
| 526 | ;; Otherwise output info. | 526 | (setq desired-point (point)) |
| 527 | (t | 527 | (princ ".")) |
| 528 | (setq this-buffer-line-start (point)) | 528 | (princ " ")) |
| 529 | ;; Identify current buffer. | 529 | ;; Identify modified buffers. |
| 530 | (if (eq buffer old-buffer) | 530 | (princ (if (buffer-modified-p buffer) "*" " ")) |
| 531 | (progn | 531 | ;; Handle readonly status. The output buffer is special |
| 532 | (setq desired-point (point)) | 532 | ;; cased to appear readonly; it is actually made so at a |
| 533 | (princ ".")) | 533 | ;; later date. |
| 534 | (princ " ")) | 534 | (princ (if (or (eq buffer standard-output) |
| 535 | ;; Identify modified buffers. | 535 | this-buffer-read-only) |
| 536 | (princ (if (buffer-modified-p buffer) "*" " ")) | 536 | "% " |
| 537 | ;; Handle readonly status. The output buffer is special | 537 | " ")) |
| 538 | ;; cased to appear readonly; it is actually made so at a later | 538 | (princ name) |
| 539 | ;; date. | 539 | ;; Put the buffer name into a text property |
| 540 | (princ (if (or (eq buffer standard-output) | 540 | ;; so we don't have to extract it from the text. |
| 541 | this-buffer-read-only) | 541 | ;; This way we avoid problems with unusual buffer names. |
| 542 | "% " | 542 | (setq this-buffer-line-start |
| 543 | " ")) | 543 | (+ this-buffer-line-start Buffer-menu-buffer-column)) |
| 544 | (princ name) | 544 | (let ((name-end (point))) |
| 545 | ;; Put the buffer name into a text property | 545 | (indent-to 17 2) |
| 546 | ;; so we don't have to extract it from the text. | 546 | (put-text-property this-buffer-line-start name-end |
| 547 | ;; This way we avoid problems with unusual buffer names. | 547 | 'buffer-name name) |
| 548 | (setq this-buffer-line-start | 548 | (put-text-property this-buffer-line-start (point) |
| 549 | (+ this-buffer-line-start Buffer-menu-buffer-column)) | 549 | 'buffer buffer) |
| 550 | (let ((name-end (point))) | 550 | (put-text-property this-buffer-line-start name-end |
| 551 | (indent-to 17 2) | 551 | 'mouse-face 'highlight)) |
| 552 | (put-text-property this-buffer-line-start name-end | 552 | (let ((size (format "%8d" this-buffer-size)) |
| 553 | 'buffer-name name) | 553 | (mode this-buffer-mode-name) |
| 554 | (put-text-property this-buffer-line-start (point) | 554 | (excess (- (current-column) 17))) |
| 555 | 'buffer buffer) | 555 | (while (and (> excess 0) (= (aref size 0) ?\ )) |
| 556 | (put-text-property this-buffer-line-start name-end | 556 | (setq size (substring size 1) |
| 557 | 'mouse-face 'highlight)) | 557 | excess (1- excess))) |
| 558 | (let (size | 558 | (princ size) |
| 559 | mode | 559 | (indent-to 27 1) |
| 560 | (excess (- (current-column) 17))) | 560 | (princ mode)) |
| 561 | (setq size (format "%8d" this-buffer-size)) | 561 | (indent-to 40 1) |
| 562 | ;; Ack -- if looking at the *Buffer List* buffer, | 562 | (or file (setq file this-buffer-directory)) |
| 563 | ;; always use "Buffer Menu" mode. Otherwise the | 563 | (when file |
| 564 | ;; first time the buffer is created, the mode will be wrong. | 564 | (princ (abbreviate-file-name file))) |
| 565 | (setq mode this-buffer-mode-name) | 565 | (princ "\n"))))) |
| 566 | (while (and (> excess 0) (= (aref size 0) ?\ )) | ||
| 567 | (setq size (substring size 1)) | ||
| 568 | (setq excess (1- excess))) | ||
| 569 | (princ size) | ||
| 570 | (indent-to 27 1) | ||
| 571 | (princ mode)) | ||
| 572 | (indent-to 40 1) | ||
| 573 | (or file (setq file this-buffer-directory)) | ||
| 574 | (if file | ||
| 575 | (princ (abbreviate-file-name file))) | ||
| 576 | (princ "\n")))) | ||
| 577 | (setq bl (cdr bl)))) | ||
| 578 | (Buffer-menu-mode) | 566 | (Buffer-menu-mode) |
| 579 | ;; DESIRED-POINT doesn't have to be set; it is not when the | 567 | ;; DESIRED-POINT doesn't have to be set; it is not when the |
| 580 | ;; current buffer is not displayed for some reason. | 568 | ;; current buffer is not displayed for some reason. |