diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/buffer.c b/src/buffer.c index 6632e603514..80d4ece06a1 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -912,18 +912,14 @@ DEFUN ("bury-buffer", Fbury_buffer, Sbury_buffer, 0, 1, "", | |||
| 912 | "Put BUFFER at the end of the list of all buffers.\n\ | 912 | "Put BUFFER at the end of the list of all buffers.\n\ |
| 913 | There it is the least likely candidate for `other-buffer' to return;\n\ | 913 | There it is the least likely candidate for `other-buffer' to return;\n\ |
| 914 | thus, the least likely buffer for \\[switch-to-buffer] to select by default.\n\ | 914 | thus, the least likely buffer for \\[switch-to-buffer] to select by default.\n\ |
| 915 | If the argument is nil, bury the current buffer\n\ | 915 | BUFFER is also removed from the selected window if it was displayed there.\n\ |
| 916 | and switch to some other buffer in the selected window.") | 916 | If BUFFER is omitted, the current buffer is buried.") |
| 917 | (buf) | 917 | (buf) |
| 918 | register Lisp_Object buf; | 918 | register Lisp_Object buf; |
| 919 | { | 919 | { |
| 920 | register Lisp_Object aelt, link; | 920 | /* Figure out what buffer we're going to bury. */ |
| 921 | |||
| 922 | if (NILP (buf)) | 921 | if (NILP (buf)) |
| 923 | { | 922 | XSET (buf, Lisp_Buffer, current_buffer); |
| 924 | XSET (buf, Lisp_Buffer, current_buffer); | ||
| 925 | Fswitch_to_buffer (Fother_buffer (buf), Qnil); | ||
| 926 | } | ||
| 927 | else | 923 | else |
| 928 | { | 924 | { |
| 929 | Lisp_Object buf1; | 925 | Lisp_Object buf1; |
| @@ -932,13 +928,23 @@ and switch to some other buffer in the selected window.") | |||
| 932 | if (NILP (buf1)) | 928 | if (NILP (buf1)) |
| 933 | nsberror (buf); | 929 | nsberror (buf); |
| 934 | buf = buf1; | 930 | buf = buf1; |
| 935 | } | 931 | } |
| 932 | |||
| 933 | /* Remove it from the screen. */ | ||
| 934 | if (EQ (buf, XWINDOW (selected_frame)->buffer)) | ||
| 935 | Fswitch_to_buffer (Fother_buffer (buf), Qnil); | ||
| 936 | |||
| 937 | /* Move it to the end of the buffer list. */ | ||
| 938 | { | ||
| 939 | register Lisp_Object aelt, link; | ||
| 940 | |||
| 941 | aelt = Frassq (buf, Vbuffer_alist); | ||
| 942 | link = Fmemq (aelt, Vbuffer_alist); | ||
| 943 | Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); | ||
| 944 | XCONS (link)->cdr = Qnil; | ||
| 945 | Vbuffer_alist = nconc2 (Vbuffer_alist, link); | ||
| 946 | } | ||
| 936 | 947 | ||
| 937 | aelt = Frassq (buf, Vbuffer_alist); | ||
| 938 | link = Fmemq (aelt, Vbuffer_alist); | ||
| 939 | Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); | ||
| 940 | XCONS (link)->cdr = Qnil; | ||
| 941 | Vbuffer_alist = nconc2 (Vbuffer_alist, link); | ||
| 942 | return Qnil; | 948 | return Qnil; |
| 943 | } | 949 | } |
| 944 | 950 | ||