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

[PATCH] w3m-select-buffer-delete-buffer



When a user has many tabs (buffers) open and wants to delete a few
using the tab list window, each time he deletes a single tab, the
cursor jumps to the buffer's point-min.

The attached patch to function `w3m-select-buffer-delete-buffer' in
`w3m.el' maintains the cursor's row and column position.

Also, the documentation for that function was unclear to me when it
said "(which see)". What does that mean? Can it be re-worded?

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
--- -	2017-06-12 17:02:13.413735154 -0400
+++ ./w3m.el	2017-06-12 10:13:55.391571508 -0400
@@ -11068,19 +11068,22 @@
 terminating the emacs-w3m session; the prefix argument FORCE will be
 passed to the `w3m-quit' function (which see)."
   (interactive "P")
-  (w3m-select-buffer-show-this-line)
-  (if (= 1 (count-lines (point-min) (point-max)))
-      (w3m-quit force)
-    (let ((buffer (w3m-select-buffer-current-buffer)))
-      (forward-line -1)
-      (w3m-process-stop buffer)
-      (w3m-idle-images-show-unqueue buffer)
-      (kill-buffer buffer)
-      (when w3m-use-form
-	(w3m-form-kill-buffer buffer))
-      (run-hooks 'w3m-delete-buffer-hook)
-      (w3m-select-buffer-generate-contents (w3m-select-buffer-current-buffer))
-      (w3m-select-buffer-show-this-line))))
+  (let ((pos (point))
+        (buffer (w3m-select-buffer-show-this-line)))
+    (when (= 1 (count-lines (point-min) (point-max)))
+      (w3m-quit force))
+    (forward-line -1)
+    (w3m-process-stop buffer)
+    (w3m-idle-images-show-unqueue buffer)
+    (kill-buffer buffer)
+    (when w3m-use-form
+      (w3m-form-kill-buffer buffer))
+    (run-hooks 'w3m-delete-buffer-hook)
+    (w3m-select-buffer-generate-contents
+      (w3m-select-buffer-current-buffer))
+    (goto-char pos)
+    (w3m-select-buffer-show-this-line)
+    (goto-char pos)))
 
 (defun w3m-select-buffer-delete-other-buffers ()
   "Delete emacs-w3m buffers except for the buffer on the current menu."