[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: form submitでのnew-session表示
- From: Hideyuki SHIRAI (白井秀行) <shirai@xxxxxxxxxxx>
- Date: Sat, 25 Nov 2006 06:40:07 +0900 (JST)
- X-ml-name: emacs-w3m
- X-mail-count: 08966
- References: <u64d5eyob.wl%tsuyoshi_cho@yahoo.co.jp>
From: Tsuyoshi CHO <tsuyoshi_cho@xxxxxxxxx> さん曰く
Subject: [emacs-w3m:08964] form submitでのnew-session表示
Message-ID: <u64d5eyob.wl%tsuyoshi_cho@xxxxxxxxxxx>
Date: Fri, 24 Nov 2006 22:56:04 +0900
> 以下で話しがあったのですが、
> http://slashdot.jp/~cheekcat/journal/383567
確かに、バッファの複製作って検索ってよくやりますね。
> submitでのページ遷移の先を別バッファにしてみよう。といろいろやってみました。
> が、
スーパー手抜きだったら、↓とか。
(defvar w3m-form-submit-new-session nil)
(defun w3m-view-this-url-new-session ()
"Display the page of the link under point in a new session.
If the region is active, use the `w3m-open-all-links-in-new-session'
command instead."
(interactive)
(if (w3m-region-active-p)
(call-interactively 'w3m-open-all-links-in-new-session)
(let ((w3m-form-submit-new-session t))
(w3m-view-this-url nil t))))
(defun w3m-submit-form (&optional new-session)
"Submit the form at point."
(interactive)
(let ((submit (w3m-submit)))
(if (and submit
w3m-current-url
(w3m-url-valid w3m-current-url))
(let ((w3m-form-submit-new-session new-session))
(eval submit))
(w3m-message "Can't submit form at this point"))))
(defun w3m-form-submit-goto-url (&rest args)
(apply (if w3m-form-submit-new-session
'w3m-goto-url-new-session
'w3m-goto-url)
args))
(defun w3m-form-submit (form &optional id name value)
(if (w3m-anchor (point))
;; cf SA17565
(w3m-form-submit-goto-url (w3m-anchor (point)))
(when (and id name
(> (length name) 0))
(w3m-form-put form id name value))
(let* ((orig-url w3m-current-url)
(url (or (w3m-form-action form)
(if (string-match "\\?" w3m-current-url)
(substring w3m-current-url 0 (match-beginning 0))
w3m-current-url))))
(setq w3m-form-textarea-post-files
(w3m-form-submit-get-textarea-files form))
(cond ((and (not (string= url orig-url))
(string-match "^https://" orig-url)
(string-match "^http://" url)
(not (y-or-n-p (format "Send POST data to '%s'?" url))))
(ding))
((or (eq 'post (w3m-form-method form))
;; While some sites, e.g., emacswiki.org, specify the
;; `get' method for the enctype `multipart/form-data',
;; we use the `post' method according to the proposal
;; of RFC2070.
(eq 'multipart/form-data (w3m-form-enctype form)))
(w3m-form-submit-goto-url url 'reload nil
(w3m-form-make-form-data form)
w3m-current-url))
((eq 'get (w3m-form-method form))
(w3m-form-submit-goto-url
(concat url "?" (w3m-form-make-form-data form))))
(t
(w3m-message "This form's method has not been supported: %s"
(let (print-level print-length)
(prin1-to-string (w3m-form-method form)))))))))
--
白井秀行 (mailto:shirai@xxxxxxxxxxx)