bug-gnu-emacs
[Top][All Lists]
Advanced

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

improving function "mode-line-unbury-buffer" in bindings.el


From: 恒吉 徹
Subject: improving function "mode-line-unbury-buffer" in bindings.el
Date: Fri, 12 Jul 2002 10:35:00 +0900 (JST)

Hello!!

This is the first report for me.
This report is not bug but improving as giving a subject.

I made files "bindings.el.diff", "ChangeLog", and "report.txt", which
are attached files. Please check them.

Addition:

(emacs-version)
        => "GNU Emacs 21.2.1 (i386-msvc-nt5.0.2195) of 2002-07-12 on localhost"

File "bindings.el.diff" is made, and is tested on this emacs version.

Improved function "mode-line-unbury-buffer" operate more precisely as
`unbury-buffer' symmetrically with `bury-buffer'.

--
Toru Tsuneyoshi
(Tokyo, Japan)
*** bindings.el.orig    Mon Jul  1 15:25:12 2002
--- bindings.el Fri Jul 12 00:20:49 2002
***************
*** 262,271 ****
    (interactive "e")
    (save-selected-window
      (select-window (posn-window (event-start event)))
!     (let ((list (reverse (buffer-list))))
!       (while (eq (aref (buffer-name (car list)) 0) ? )
!       (setq list (cdr list)))
!       (switch-to-buffer (car list)))))
  
  (defun mode-line-bury-buffer (event) "\
  Like bury-buffer, but temporarily select EVENT's window."
--- 262,286 ----
    (interactive "e")
    (save-selected-window
      (select-window (posn-window (event-start event)))
!     (let ((cur-buffer-name (buffer-name (current-buffer)))
!         (cur-buffer-list (mapcar (function buffer-name) (buffer-list)))
!         selected-buffer-name)
!       ;; Reverse buffer-list.
!       (mapcar
!        (function bury-buffer)
!        (reverse cur-buffer-list))
!       ;; Select the most likely candidate  for `other-buffer' to return.
!       (setq selected-buffer-name (buffer-name (other-buffer)))
!       (if (string= selected-buffer-name cur-buffer-name)
!         (setq selected-buffer-name "*scratch*"))
!       ;; Select buffer of selected-buffer-name in the current window.
!       (switch-to-buffer selected-buffer-name)
!       ;; Return to the original state (except a head) of buffer-list.
!       (delete selected-buffer-name cur-buffer-list)
!       (mapcar
!        (function bury-buffer)
!        cur-buffer-list)))
!   nil)
  
  (defun mode-line-bury-buffer (event) "\
  Like bury-buffer, but temporarily select EVENT's window."
2002-07-12  Toru Tsuneyoshi  <address@hidden>

        * bindings.el (mode-line-unbury-buffer): Improve so that this
        function may operate more precisely as `unbury-buffer'.

-*- mode: outline; outline-regexp: "\t*[*]+"; tab-width: 8 -*-

* spec of function "bury-buffer" called by "mode-line-bury-buffer"

        * example 1

                current-buffer
                  |
                  V
                ("A" "B" "C" "D" "E")   : (buffer-name of) buffer-list

                         |
                         | bury-buffer <f>
                         V
                
                ("B" "C" "D" "E" "A")

        * example 2

                ("A")

                         |
                         | bury-buffer <f>
                         V
                
                ("*scratch*" "A")       : "*scratch*" is made

        * example 3

                                not displayed yet
                                   |
                                   V
                ("A" "*scratch*" "*Messages*")

                         |
                         | bury-buffer <f>
                         V
                
                ("*scratch*" "*Messages*" "A")

                         |
                         | bury-buffer <f>
                         V

                ("A" "*Messages*" "*scratch*")  : "*Messages*" isn't displayed

* spec of original function "mode-line-unbury-buffer"

        * example 1

                ("A" "B" "C" "D" "E")

                         |
                         | mode-line-unbury-buffer <f>
                         V
                
                ("E" "A" "B" "C" "D")

        * example 2

                ("A")

                         |
                         | mode-line-unbury-buffer <f>
                         V
                
                ("A")                   : "*scratch*" isn't made

        * example 3

                                not displayed yet
                                   |
                                   V
                ("A" "*scratch*" "*Messages*")

                         |
                         | mode-line-unbury-buffer <f>
                         V
                
                ("*Messages*" "A" "*scratch*")  : "*Messages*" is displayed

                         |
                         | mode-line-unbury-buffer <f>
                         V

                ("*scratch*" "*Messages*" "A")

* spec of fixed function "mode-line-unbury-buffer"

        * example 1

                ("A" "B" "C" "D" "E")

                         |
                         | mode-line-unbury-buffer <f>
                         V
                
                ("E" "A" "B" "C" "D")

        * example 2

                ("A")

                         |
                         | mode-line-unbury-buffer <f>
                         V
                
                ("*scratch*" "A")       : "*scratch*" is made

        * example 3

                                not displayed yet
                                   |
                                   V
                ("A" "*scratch*" "*Messages*")

                         |
                         | mode-line-unbury-buffer <f>
                         V
                
                ("*scratch*" "A" "*Messages*")

                         |
                         | mode-line-unbury-buffer <f>
                         V

                ("A" "*scratch*" "*Messages*")  : "*Messages*" isn't displayed

reply via email to

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