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

[BUGFIX] quitting an fb-mode session [PATCH]



The attached patch fixes a bug I mentioned a few days ago in which
quitting an fb-mode session in one frame transfers into that frame an
fb-mode session that should only be appearing in another frame.

It also clear up two docstrings, I hope. The serious confusion I had was
with `w3m-close-window' whose docstring had prior claimed that it would
be "quitting all emacs-w3m sessions" when all it is doing is burying
buffers and closing frames.


-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
Index: ChangeLog
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/ChangeLog,v
retrieving revision 1.3648
diff -u -r1.3648 ChangeLog
--- ChangeLog	16 Feb 2018 06:53:15 -0000	1.3648
+++ ChangeLog	18 Feb 2018 18:41:41 -0000
@@ -1,3 +1,13 @@
+2018-02-18  Boruch Baum  <boruch_baum@xxxxxxx>
+
+	* w3m.el (w3m-quit): Maintain frame isolation when in fb-mode. Update
+	docstring.
+	(w3m-close-window): Update doscstring.
+
+	* w3m-fb.el (w3m-fb-delete-frame-buffers): Kill all buffers directly
+	instead of incrementally moving to next one. This also is part of the
+	fix so that frame isolation is maintained in fb-mode after quitting.
+
 2018-02-16  Katsumi Yamaoka  <yamaoka@xxxxxxx>

 	* w3m-fb.el (w3m-fb-mode, w3m-fb-delete-frame-kill-buffers):
Index: w3m.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m.el,v
retrieving revision 1.1701
diff -u -r1.1701 w3m.el
--- w3m.el	15 Feb 2018 08:05:52 -0000	1.1701
+++ w3m.el	18 Feb 2018 18:41:44 -0000
@@ -8525,11 +8525,14 @@
       buf)))

 (defun w3m-quit (&optional force)
-  "Return to a peaceful life (exiting all emacs-w3m sessions).
-This command lets you quit browsing web after updating the arrived
-URLs database.  Quit browsing immediately if the prefix argument FORCE
-is specified, otherwise prompt you for the confirmation.  See also
-`w3m-close-window'."
+  "Quit emacs-w3m.
+
+Quit browsing immediately if the prefix argument FORCE is
+specified, otherwise prompt you for the confirmation.
+
+See also`w3m-close-window'.
+
+This command updates the `arrived URLs' database."
   (interactive "P")
   (let ((buffers (w3m-list-buffers t))
 	(all-buffers (let ((w3m-fb-mode nil))
@@ -8558,15 +8561,23 @@
 	    (when w3m-use-cookies
 	      (w3m-cookie-shutdown))
 	    (w3m-kill-all-buffer)))
+      ; starting here is condition of fb-mode active and in use
       (w3m-session-automatic-save)
+      (let (buf)
+       (while (setq buf (get-buffer " *w3m buffers*"))
+         (delete-windows-on buf t)
+         (kill-buffer buf)))
       (w3m-fb-delete-frame-buffers)
-      (w3m-fb-select-buffer))))
+      (display-buffer-same-window (other-buffer) nil))))

 (defun w3m-close-window ()
-  "Return to a restless life (quitting all emacs-w3m sessions).
-This command closes all emacs-w3m windows, but all the emacs-w3m
-buffers remain.  Frames created for emacs-w3m sessions will also be
-closed.  See also `w3m-quit'."
+  "Bury emacs-w3m buffers and close windows and frames.
+
+The buffers remain, and the sessions continue to exist, so you
+can return to them by either running `M-x w3m' or by switching to
+one of the buffers.
+
+See also `w3m-quit'."
   (interactive)
   (w3m-history-store-position)
   ;; `w3m-list-buffers' won't return all the emacs-w3m buffers if
@@ -10612,7 +10623,7 @@
 	    current (cadar w3m-history)))
     (insert "\
 <head><title>URL history</title></head><body>
-<h1>List of all the links you have visited in this session.</h1><pre>\n")
+<h1>List of all the links you have visited in this tab.</h1><pre>\n")
     (setq start (point))
     (when history
       (let ((form
Index: w3m-fb.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m-fb.el,v
retrieving revision 1.5
diff -u -r1.5 w3m-fb.el
--- w3m-fb.el	16 Feb 2018 00:53:31 -0000	1.5
+++ w3m-fb.el	18 Feb 2018 18:41:45 -0000
@@ -93,10 +93,8 @@
 	 ;; to other frames.
 	 (w3m-fb-mode nil)
 	 (w3m-fb-inhibit-buffer-selection t))
-    (save-window-excursion
-      (dolist (b buffers)
-	(with-current-buffer b
-	  (w3m-delete-buffer))))))
+    (dolist (b buffers)
+      (kill-buffer b))))

 ;; Could use set-frame-parameter here, but it isn't portable
 (defun w3m-fb-set-frame-parameter (frame parameter value)