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

Re: create empty new tab



In [emacs-w3m : No.11633] jidanni@xxxxxxxxxxx wrote:
> Just like Firefox has C-t to create an empty new tab,
> C-c C-t	Create a copy of the current page as a new session.
> is a wasteful way to create a new tab if one just wants a fresh empty one.
> There should be a new command added.

I've changed the default page[1], that a new tab visits, into
"about:blank".  Now you can create an empty new tab by
`G C-a C-k RET' or the `New Tab' button of the `Tab' menu bar.
It might not necessarily be your taste, though.  The patch is
attached (you can get it from CVS of course).

[1] The `w3m-new-session-url' variable controls the default page.

> P.S., CC me, as I can't read the mailing list on Gmane because the
> connection is broken.

I can connect to Gmane but it appears not to be working at least
for this list nowadays.  The last article is of the end of June.
--- w3m.el~	2011-09-02 05:00:57.515625000 +0000
+++ w3m.el	2011-09-02 05:02:32.390625000 +0000
@@ -1614,7 +1614,7 @@
   :group 'w3m
   :type 'boolean)
 
-(defcustom w3m-new-session-url "about://bookmark/"
+(defcustom w3m-new-session-url "about:blank"
   "*Default url to be opened in a tab or a session which is created newly."
   :group 'w3m
   :type '(radio
@@ -4586,10 +4586,12 @@
   (let (url)
     (w3m-arrived-setup)
     (cond ((null initial)
-	   (when (and (setq initial (w3m-active-region-or-url-at-point t))
-		      (not (string-match "[^\000-\177]" initial)))
-	     (setq initial (w3m-url-decode-string initial
-						  w3m-current-coding-system))))
+	   (when (setq initial (w3m-active-region-or-url-at-point t))
+	     (if (string-match "\\`about:" initial)
+		 (setq initial nil)
+	       (unless (string-match "[^\000-\177]" initial)
+		 (setq initial (w3m-url-decode-string
+				initial w3m-current-coding-system))))))
 	  ((string= initial "")
 	   (setq initial nil)))
     (when initial
@@ -4624,17 +4626,22 @@
 					 (substring prompt 0
 						    (match-beginning 0))))
 				 (concat prompt " (default "
-					 (if (equal default w3m-home-page)
-					     "HOME"
-					   default)
+					 (cond ((equal default "about:blank")
+						"BLANK")
+					       ((equal default w3m-home-page)
+						"HOME")
+					       (t default))
 					 "): "))
 			     prompt)
 			 (if default
 			     (format "URL %s(default %s): "
 				     (if feeling-lucky "or Keyword " "")
 				     (if (stringp default)
-					 (if (eq default w3m-home-page)
-					     "HOME" default)
+					 (cond ((string= default "about:blank")
+						"BLANK")
+					       ((string= default w3m-home-page)
+						"HOME")
+					       (t default))
 				       (prin1-to-string default)))
 			   (if feeling-lucky "URL or Keyword: " "URL: ")))
 		       'w3m-url-completion nil nil initial
@@ -9520,7 +9527,7 @@
 will be created by copying the current session.  Otherwise, the new
 session will start afresh."
   (interactive
-   (list (w3m-input-url nil nil	nil nil 'feeling-lucky)
+   (list (w3m-input-url nil nil w3m-new-session-url nil 'feeling-lucky)
 	 current-prefix-arg
 	 (w3m-static-if (fboundp 'universal-coding-system-argument)
 	     coding-system-for-read)