Mercurial > emacs
comparison lisp/buff-menu.el @ 83221:0fc4928cc48e
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-616
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-617
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-618
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-619
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-620
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-621
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-622
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-623
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-624
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-625
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-51
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-52
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-53
Merge from emacs--cvs-trunk--0
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-261
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Tue, 19 Oct 2004 17:00:02 +0000 |
parents | 716fe8f547c3 |
children | 56342493afe3 f3ec05478165 |
comparison
equal
deleted
inserted
replaced
83220:fe1db7935e1a | 83221:0fc4928cc48e |
---|---|
195 (interactive) | 195 (interactive) |
196 (revert-buffer)) | 196 (revert-buffer)) |
197 | 197 |
198 (defun Buffer-menu-revert-function (ignore1 ignore2) | 198 (defun Buffer-menu-revert-function (ignore1 ignore2) |
199 ;; We can not use save-excursion here. The buffer gets erased. | 199 ;; We can not use save-excursion here. The buffer gets erased. |
200 (let ((old-point (point))) | 200 (let ((ocol (current-column)) |
201 (oline (progn (move-to-column 4) | |
202 (get-text-property (point) 'buffer))) | |
203 (prop (point-min))) | |
201 (list-buffers-noselect Buffer-menu-files-only) | 204 (list-buffers-noselect Buffer-menu-files-only) |
202 (goto-char old-point))) | 205 (while (setq prop (next-single-property-change prop 'buffer)) |
206 (when (eq (get-text-property prop 'buffer) oline) | |
207 (goto-char prop) | |
208 (move-to-column ocol))))) | |
203 | 209 |
204 (defun Buffer-menu-toggle-files-only (arg) | 210 (defun Buffer-menu-toggle-files-only (arg) |
205 "Toggle whether the current buffer-menu displays only file buffers. | 211 "Toggle whether the current buffer-menu displays only file buffers. |
206 With a positive ARG display only file buffers. With zero or | 212 With a positive ARG display only file buffers. With zero or |
207 negative ARG, display other buffers as well." | 213 negative ARG, display other buffers as well." |
352 (if (= (char-after) (if arg ? ?*)) | 358 (if (= (char-after) (if arg ? ?*)) |
353 (let ((buffer-read-only nil)) | 359 (let ((buffer-read-only nil)) |
354 (delete-char 1) | 360 (delete-char 1) |
355 (insert (if arg ?* ? )))))) | 361 (insert (if arg ?* ? )))))) |
356 | 362 |
363 (defun Buffer-menu-beginning () | |
364 (goto-char (point-min)) | |
365 (unless Buffer-menu-use-header-line | |
366 (forward-line))) | |
367 | |
357 (defun Buffer-menu-execute () | 368 (defun Buffer-menu-execute () |
358 "Save and/or delete buffers marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-save] or \\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands." | 369 "Save and/or delete buffers marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-save] or \\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands." |
359 (interactive) | 370 (interactive) |
360 (save-excursion | 371 (save-excursion |
361 (goto-char (point-min)) | 372 (Buffer-menu-beginning) |
362 (unless Buffer-menu-use-header-line | |
363 (forward-line 1)) | |
364 (while (re-search-forward "^..S" nil t) | 373 (while (re-search-forward "^..S" nil t) |
365 (let ((modp nil)) | 374 (let ((modp nil)) |
366 (save-excursion | 375 (save-excursion |
367 (set-buffer (Buffer-menu-buffer t)) | 376 (set-buffer (Buffer-menu-buffer t)) |
368 (save-buffer) | 377 (save-buffer) |
369 (setq modp (buffer-modified-p))) | 378 (setq modp (buffer-modified-p))) |
370 (let ((buffer-read-only nil)) | 379 (let ((buffer-read-only nil)) |
371 (delete-char -1) | 380 (delete-char -1) |
372 (insert (if modp ?* ? )))))) | 381 (insert (if modp ?* ? )))))) |
373 (save-excursion | 382 (save-excursion |
374 (goto-char (point-min)) | 383 (Buffer-menu-beginning) |
375 (unless Buffer-menu-use-header-line | |
376 (forward-line 1)) | |
377 (let ((buff-menu-buffer (current-buffer)) | 384 (let ((buff-menu-buffer (current-buffer)) |
378 (buffer-read-only nil)) | 385 (buffer-read-only nil)) |
379 (while (re-search-forward "^D" nil t) | 386 (while (re-search-forward "^D" nil t) |
380 (forward-char -1) | 387 (forward-char -1) |
381 (let ((buf (Buffer-menu-buffer nil))) | 388 (let ((buf (Buffer-menu-buffer nil))) |
397 (interactive) | 404 (interactive) |
398 (let ((buff (Buffer-menu-buffer t)) | 405 (let ((buff (Buffer-menu-buffer t)) |
399 (menu (current-buffer)) | 406 (menu (current-buffer)) |
400 (others ()) | 407 (others ()) |
401 tem) | 408 tem) |
402 (goto-char (point-min)) | 409 (Buffer-menu-beginning) |
403 (unless Buffer-menu-use-header-line | |
404 (forward-line 1)) | |
405 (while (re-search-forward "^>" nil t) | 410 (while (re-search-forward "^>" nil t) |
406 (setq tem (Buffer-menu-buffer t)) | 411 (setq tem (Buffer-menu-buffer t)) |
407 (let ((buffer-read-only nil)) | 412 (let ((buffer-read-only nil)) |
408 (delete-char -1) | 413 (delete-char -1) |
409 (insert ?\ )) | 414 (insert ?\ )) |
579 (when column | 584 (when column |
580 (setq column (prefix-numeric-value column)) | 585 (setq column (prefix-numeric-value column)) |
581 (if (< column 2) (setq column 2)) | 586 (if (< column 2) (setq column 2)) |
582 (if (> column 5) (setq column 5))) | 587 (if (> column 5) (setq column 5))) |
583 (setq Buffer-menu-sort-column column) | 588 (setq Buffer-menu-sort-column column) |
584 (Buffer-menu-revert)) | 589 (let (buffer-read-only l buf m1 m2) |
590 (save-excursion | |
591 (Buffer-menu-beginning) | |
592 (while (not (eobp)) | |
593 (when (buffer-live-p (setq buf (get-text-property (+ (point) 4) 'buffer))) | |
594 (setq m1 (char-after) | |
595 m1 (if (memq m1 '(?> ?D)) m1) | |
596 m2 (char-after (+ (point) 2)) | |
597 m2 (if (eq m2 ?S) m2)) | |
598 (if (or m1 m2) | |
599 (push (list buf m1 m2) l))) | |
600 (forward-line))) | |
601 (Buffer-menu-revert) | |
602 (setq buffer-read-only) | |
603 (save-excursion | |
604 (Buffer-menu-beginning) | |
605 (while (not (eobp)) | |
606 (when (setq buf (assq (get-text-property (+ (point) 4) 'buffer) l)) | |
607 (setq m1 (cadr buf) | |
608 m2 (cadr (cdr buf))) | |
609 (when m1 | |
610 (delete-char 1) | |
611 (insert m1) | |
612 (backward-char 1)) | |
613 (when m2 | |
614 (forward-char 2) | |
615 (delete-char 1) | |
616 (insert m2))) | |
617 (forward-line))))) | |
585 | 618 |
586 (defun Buffer-menu-make-sort-button (name column) | 619 (defun Buffer-menu-make-sort-button (name column) |
587 (if (equal column Buffer-menu-sort-column) (setq column nil)) | 620 (if (equal column Buffer-menu-sort-column) (setq column nil)) |
588 (propertize name | 621 (propertize name |
589 'help-echo (if column | 622 'help-echo (if column |
590 (concat "mouse-2: sort by " (downcase name)) | 623 (concat "mouse-2: sort by " (downcase name)) |
591 "mouse-2: sort by visited order") | 624 "mouse-2: sort by visited order") |
592 'mouse-face 'highlight | 625 'mouse-face 'highlight |
593 'keymap (let ((map (make-sparse-keymap))) | 626 'keymap (let ((map (make-sparse-keymap))) |
594 (define-key map [header-line mouse-2] | 627 (define-key map [header-line mouse-2] |
595 `(lambda () (interactive) | 628 `(lambda (e) |
629 (interactive "e") | |
630 (if e (set-buffer (window-buffer (posn-window (event-end e))))) | |
596 (Buffer-menu-sort ,column))) | 631 (Buffer-menu-sort ,column))) |
597 map))) | 632 map))) |
598 | 633 |
599 (defun list-buffers-noselect (&optional files-only) | 634 (defun list-buffers-noselect (&optional files-only) |
600 "Create and return a buffer with a list of names of existing buffers. | 635 "Create and return a buffer with a list of names of existing buffers. |