From 3deea35c8985ac832673c1aa75cac13d30fabf70 Mon Sep 17 00:00:00 2001 From: Eugene Sharygin Date: Wed, 27 Feb 2019 03:03:03 +0300 Subject: [PATCH 1/2] w3m.el (w3m-select-buffer-delete-buffer): Change the order of show-this-line This puts the call to `w3m-select-buffer-show-this-line` past `goto-char` so that the buffer on the current menu line is shown at the end. --- w3m.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3m.el b/w3m.el index ee1a46259..5d1aef618 100644 --- a/w3m.el +++ b/w3m.el @@ -11351,9 +11351,9 @@ without prompting for confirmation." (run-hooks 'w3m-delete-buffer-hook) (w3m-select-buffer-generate-contents (w3m-select-buffer-current-buffer)) - (w3m-select-buffer-show-this-line) (goto-char (min pos (point-max))) - (beginning-of-line)))) + (beginning-of-line) + (w3m-select-buffer-show-this-line)))) (defun w3m-select-buffer-delete-other-buffers () "Delete emacs-w3m buffers except for the buffer on the current menu." From 390c4622eae6b71da64c67cbc3742603bd7c363c Mon Sep 17 00:00:00 2001 From: Eugene Sharygin Date: Wed, 27 Feb 2019 11:15:33 +0300 Subject: [PATCH 2/2] w3m.el (w3m-select-buffer-delete-buffer): Keep shown buffer unless it's deleted This prevents switching to other buffers after deleting a buffer not currently shown in the w3m window. --- w3m.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/w3m.el b/w3m.el index 5d1aef618..d6cd6ee2c 100644 --- a/w3m.el +++ b/w3m.el @@ -11339,8 +11339,9 @@ was called to terminate the emacs-w3m session. In this case, the optional prefix argument FORCE can be set non-nil to exit the session without prompting for confirmation." (interactive "P") - (let ((pos (point)) - (buffer (w3m-select-buffer-show-this-line))) + (let* ((pos (point)) + (buffer (w3m-select-buffer-current-buffer)) + (show-next (eq (window-buffer w3m-select-buffer-window) buffer))) (if (= 1 (count-lines (point-min) (point-max))) (w3m-quit force) (w3m-process-stop buffer) @@ -11353,7 +11354,8 @@ without prompting for confirmation." (w3m-select-buffer-current-buffer)) (goto-char (min pos (point-max))) (beginning-of-line) - (w3m-select-buffer-show-this-line)))) + (when show-next + (w3m-select-buffer-show-this-line))))) (defun w3m-select-buffer-delete-other-buffers () "Delete emacs-w3m buffers except for the buffer on the current menu."