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

Re: w3m-clear-display-while-reading vs C-c C-k stop



In [emacs-w3m : No.12633]
	On Tue, 14 Mar 2017 10:46:22 +1100, Kevin Ryde wrote:
> When w3m-clear-display-while-reading is t (the default), if a web server
> is unresponsive then going C-c C-k to stop the sub-process (as invited
> by the usual echo area message) leaves the display cleared and showing
> "Reading http://...";

> I wonder if C-c C-k could redraw the page it came from.  The status bar
> seems to show the title, but no content in the buffer.  If a cancel of
> the first fetch of a session then maybe blank or something.

How about this one?  Unfortunately it seems hard (or no way?) to
restore the previous window configuration for the point and
h/v-scroll.

   * w3m-proc.el (w3m-process-stop): Reload prev page if possible.
   (w3m-process-kill-stray-processes):
   Separate it from w3m-process-start-queued-processes.
   [emacs-w3m:12633]

#v+
--- w3m-proc.el~	2017-02-03 05:49:02.275501200 +0000
+++ w3m-proc.el	2017-03-14 05:09:12.493055700 +0000
@@ -236,7 +236,6 @@
 (defun w3m-process-start-queued-processes ()
   "Start a process which is registerd in `w3m-process-queue' if the
 number of current working processes is less than `w3m-process-max'."
-  (w3m-process-kill-stray-processes)
   (let ((num 0))
     (catch 'last
       (dolist (obj (reverse w3m-process-queue))
@@ -292,7 +291,23 @@
   (when (buffer-name buffer)
     (with-current-buffer buffer
       (setq w3m-current-process nil)))
-  (w3m-process-start-queued-processes)
+  (w3m-process-kill-stray-processes)
+  (if w3m-process-queue
+      (w3m-process-start-queued-processes)
+    (when (and w3m-clear-display-while-reading
+	       (progn
+		 (goto-char (point-min))
+		 (looking-at
+		  "\n*\\( *\\)\\(Reading\\(?: [^\n ]+\\)+\\.\\.\\.\\)\\'")))
+      (let ((inhibit-read-only t))
+	(goto-char (match-end 2))
+	(insert "\n" (match-string 1) "Aborted")
+	(put-text-property (goto-char (match-beginning 2)) (point-at-eol)
+			   'face 'w3m-strike-through))
+      (if w3m-current-url
+	  (let (w3m-clear-display-while-reading)
+	    (w3m-goto-url w3m-current-url t))
+	(goto-char (point-min)))))
   (w3m-force-window-update-later buffer))
 
 (defun w3m-process-shutdown ()
@@ -573,6 +588,7 @@
 		(throw 'last nil)))))
       (delete-process process)
       (unless ignore-queue
+	(w3m-process-kill-stray-processes)
 	(w3m-process-start-queued-processes)))))
 
 (defun w3m-process-filter (process string)
#v-