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

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

Wrong behavior of bs-delete, bs-delete-backward if buffer is not actuall


From: Juanma Barranquero
Subject: Wrong behavior of bs-delete, bs-delete-backward if buffer is not actually killed
Date: Thu, 15 Nov 2001 15:47:52 +0100

Currently, when trying to kill a buffer from within bs-show,
`bs-delete' and `bs-delete-backward' do the wrong thing if the buffer
can not be deleted (because one of the kill-buffer-query-functions
returned nil, or any other reason). With this patch applied, those
functions show a message ("Buffer was not deleted") and do not delete
the buffer from the bs list.


                                                           /L/e/k/t/u



2001-11-15  Juanma Barranquero  <address@hidden>

        * bs.el (bs-delete): Show message and do nothing if buffer could
        not be deleted.
        (bs-delete-backward): Likewise.


--- bs.el.orig  Mon Oct 22 13:15:32 2001
+++ bs.el       Thu Nov 15 14:58:21 2001
@@ -924,25 +924,28 @@
   (interactive)
   (let ((current (bs--current-buffer))
        (inhibit-read-only t))
-    (setq bs-current-list (delq current bs-current-list))
-    (kill-buffer current)
-    (beginning-of-line)
-    (delete-region (point) (save-excursion
-                            (end-of-line)
-                            (if (eobp) (point) (1+ (point)))))
-    (if (eobp)
-       (progn
-         (backward-delete-char 1)
-         (beginning-of-line)
-         (recenter -1)))
-    (bs--set-window-height)))
+    (if (not (kill-buffer current))
+        (bs-message-without-log "Buffer was not deleted")
+      (setq bs-current-list (delq current bs-current-list))
+      (beginning-of-line)
+      (delete-region (point) (save-excursion
+                               (end-of-line)
+                               (if (eobp) (point) (1+ (point)))))
+      (if (eobp)
+          (progn
+            (backward-delete-char 1)
+            (beginning-of-line)
+            (recenter -1)))
+      (bs--set-window-height))))
 
 (defun bs-delete-backward ()
   "Like `bs-delete' but go to buffer in front of current."
   (interactive)
-  (let ((on-last-line-p (save-excursion (end-of-line) (eobp))))
+  (let ((on-last-line-p (save-excursion (end-of-line) (eobp)))
+        (current (bs--current-buffer)))
     (bs-delete)
-    (unless on-last-line-p
+    (unless (or (eq current (bs--current-buffer))
+                on-last-line-p)
       (bs-up 1))))
 
 (defun bs-show-sorted ()




reply via email to

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