Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* w3m-bug.el (report-emacs-w3m-bug)

* w3m-session.el (w3m-session-save, w3m-session-automatic-save)
(w3m-session-deleted-save, w3m-session-crash-recovery-save)
* w3m.el (w3m-key-binding): Use save-current-buffer instead of
save-excursion.

* mew-w3m.el (mew-w3m-view-inline-image, mew-mime-text/html-w3m)
* w3m-xmas.el (w3m-window-hscroll)
* w3mhack.el (toplevel, w3mhack-generate-load-file): Use
with-current-buffer rather than save-excursion + set-buffer.

* w3m-cookie.el (w3m-cookie-parse-args): Use with-current-buffer rather
than save-excursion + set-buffer; no need to use save-restriction and
narrow-to-region; remove duplicate set-syntax-table.
  • Loading branch information...
commit 1399aefe97387cb49ed58867480c8dc1e962c167 1 parent 417ed9e
yamaoka authored
View
17 ChangeLog
@@ -1,3 +1,20 @@
+2010-01-13 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * w3m-bug.el (report-emacs-w3m-bug)
+ * w3m-session.el (w3m-session-save, w3m-session-automatic-save)
+ (w3m-session-deleted-save, w3m-session-crash-recovery-save)
+ * w3m.el (w3m-key-binding): Use save-current-buffer instead of
+ save-excursion.
+
+ * mew-w3m.el (mew-w3m-view-inline-image, mew-mime-text/html-w3m)
+ * w3m-xmas.el (w3m-window-hscroll)
+ * w3mhack.el (toplevel, w3mhack-generate-load-file): Use
+ with-current-buffer rather than save-excursion + set-buffer.
+
+ * w3m-cookie.el (w3m-cookie-parse-args): Use with-current-buffer rather
+ than save-excursion + set-buffer; no need to use save-restriction and
+ narrow-to-region; remove duplicate set-syntax-table.
+
2010-01-12 Katsumi Yamaoka <yamaoka@jpl.org>
* w3m.el (w3m-print-this-url): Exclude empty image-alt string.
View
8 mew-w3m.el
@@ -1,6 +1,6 @@
;; mew-w3m.el --- View Text/Html content with w3m in Mew
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010
;; TSUCHIYA Masatoshi <tsuchiya@namazu.org>
;; Author: Shun-ichi GOTO <gotoh@taiyo.co.jp>,
@@ -151,8 +151,7 @@ This variable is effective only in XEmacs, Emacs 21 and Emacs 22."
(mew-w3m-auto-insert-image t)
(mew-w3m-use-safe-url-regexp nil))
(mew-summary-display 'force))
- (save-excursion
- (set-buffer (mew-buffer-message))
+ (with-current-buffer (mew-buffer-message)
(let* ((image (get-text-property (point-min) 'w3m-images))
(w3m-display-inline-images image)
(w3m-safe-url-regexp (when mew-w3m-use-safe-url-regexp
@@ -275,8 +274,7 @@ This variable is effective only in XEmacs, Emacs 21 and Emacs 22."
(mew-w3m-region begin end xref (mew-charset-guess-region begin end)))
(t ;; Old Mew
(setq charset (or (mew-syntax-get-param params "charset")
- (save-excursion
- (set-buffer cache)
+ (with-current-buffer cache
(mew-charset-guess-region begin end))))
(if charset
(setq wcs (mew-charset-to-cs charset))
View
5 w3m-bug.el
@@ -1,6 +1,7 @@
;;; w3m-bug.el --- command to report emacs-w3m bugs -*- coding: euc-japan -*-
-;; Copyright (C) 2002, 2003, 2005, 2007 TSUCHIYA Masatoshi <tsuchiya@namazu.org>
+;; Copyright (C) 2002, 2003, 2005, 2007, 2010
+;; TSUCHIYA Masatoshi <tsuchiya@namazu.org>
;; Author: Katsumi Yamaoka <yamaoka@jpl.org>
;; Keywords: w3m, WWW, hypermedia
@@ -79,7 +80,7 @@ Prompts for bug subject. Leaves you in a mail buffer."
(buffers (cons buffer (delq buffer (buffer-list))))
(inhibit-point-motion-hooks t)
keymap)
- (save-excursion
+ (save-current-buffer
(while buffers
(setq buffer (car buffers)
buffers (cdr buffers))
View
88 w3m-cookie.el
@@ -1,6 +1,6 @@
;;; w3m-cookie.el --- Functions for cookie processing
-;; Copyright (C) 2002, 2003, 2005, 2006, 2008, 2009
+;; Copyright (C) 2002, 2003, 2005, 2006, 2008, 2009, 2010
;; TSUCHIYA Masatoshi <tsuchiya@namazu.org>
;; Authors: Teranishi Yuuichi <teranisi@gohome.org>
@@ -222,52 +222,46 @@ If ask, ask user whether accept bad cookies or not."
(modify-syntax-entry ?} ")" w3m-cookie-parse-args-syntax-table)
(defun w3m-cookie-parse-args (str &optional nodowncase)
- (let (name value results name-pos val-pos st nd)
- (save-excursion
- (save-restriction
- (set-buffer (get-buffer-create " *w3m-cookie-parse-temp*"))
- (set-syntax-table w3m-cookie-parse-args-syntax-table)
- (erase-buffer)
- (insert str)
- (setq st (point-min)
- nd (point-max))
- (set-syntax-table w3m-cookie-parse-args-syntax-table)
- (narrow-to-region st nd)
- (goto-char (point-min))
- (while (not (eobp))
- (skip-chars-forward "; \n\t")
- (setq name-pos (point))
- (skip-chars-forward "^ \n\t=;")
- (if (not nodowncase)
- (downcase-region name-pos (point)))
- (setq name (buffer-substring name-pos (point)))
- (skip-chars-forward " \t\n")
- (if (/= (or (char-after (point)) 0) ?=) ; There is no value
- (setq value nil)
- (skip-chars-forward " \t\n=")
- (setq val-pos (point)
- value
- (cond
- ((or (= (or (char-after val-pos) 0) ?\")
- (= (or (char-after val-pos) 0) ?'))
- (buffer-substring (1+ val-pos)
- (condition-case ()
- (prog2
- (forward-sexp 1)
- (1- (point))
- (skip-chars-forward "\""))
- (error
- (skip-chars-forward "^ \t\n")
- (point)))))
- (t
- (buffer-substring val-pos
- (progn
- (skip-chars-forward "^;")
- (skip-chars-backward " \t")
- (point)))))))
- (setq results (cons (cons name value) results))
- (skip-chars-forward "; \n\t"))
- results))))
+ (let (name value results name-pos val-pos)
+ (with-current-buffer (get-buffer-create " *w3m-cookie-parse-temp*")
+ (erase-buffer)
+ (set-syntax-table w3m-cookie-parse-args-syntax-table)
+ (insert str)
+ (goto-char (point-min))
+ (while (not (eobp))
+ (skip-chars-forward "; \n\t")
+ (setq name-pos (point))
+ (skip-chars-forward "^ \n\t=;")
+ (unless nodowncase
+ (downcase-region name-pos (point)))
+ (setq name (buffer-substring name-pos (point)))
+ (skip-chars-forward " \t\n")
+ (if (/= (or (char-after (point)) 0) ?=) ; There is no value
+ (setq value nil)
+ (skip-chars-forward " \t\n=")
+ (setq val-pos (point)
+ value
+ (cond
+ ((or (= (or (char-after val-pos) 0) ?\")
+ (= (or (char-after val-pos) 0) ?'))
+ (buffer-substring (1+ val-pos)
+ (condition-case ()
+ (prog2
+ (forward-sexp 1)
+ (1- (point))
+ (skip-chars-forward "\""))
+ (error
+ (skip-chars-forward "^ \t\n")
+ (point)))))
+ (t
+ (buffer-substring val-pos
+ (progn
+ (skip-chars-forward "^;")
+ (skip-chars-backward " \t")
+ (point)))))))
+ (push (cons name value) results)
+ (skip-chars-forward "; \n\t"))
+ results)))
(defun w3m-cookie-trusted-host-p (host)
"Returns non-nil when the HOST is specified as trusted by user."
View
8 w3m-session.el
@@ -224,7 +224,7 @@ Sorry, an error found in \"%s\"; may we remove it? "
(setq prompt "Again New session title: ")
(throw 'loop t))))
(setq cbuf (current-buffer))
- (save-excursion
+ (save-current-buffer
(while (setq buf (car bufs))
(setq bufs (cdr bufs))
(set-buffer buf)
@@ -265,7 +265,7 @@ Sorry, an error found in \"%s\"; may we remove it? "
tmp tmptitle tmptime tmpurls)
(when bufs
(setq cbuf (current-buffer))
- (save-excursion
+ (save-current-buffer
(while (setq buf (car bufs))
(setq bufs (cdr bufs))
(set-buffer buf)
@@ -312,7 +312,7 @@ Sorry, an error found in \"%s\"; may we remove it? "
tmp tmptitle tmptime tmpurls)
(when bufs
(setq bufs (sort bufs 'w3m-buffer-name-lessp))
- (save-excursion
+ (save-current-buffer
(while (setq buf (car bufs))
(setq bufs (cdr bufs))
(set-buffer buf)
@@ -348,7 +348,7 @@ Sorry, an error found in \"%s\"; may we remove it? "
(title w3m-session-crash-recovery-title)
urls buf tmp)
(when bufs
- (save-excursion
+ (save-current-buffer
(while (setq buf (car bufs))
(setq bufs (cdr bufs))
(set-buffer buf)
View
7 w3m-xmas.el
@@ -1,6 +1,6 @@
;;; w3m-xmas.el --- XEmacs stuff for emacs-w3m
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
;; TSUCHIYA Masatoshi <tsuchiya@namazu.org>
;; Authors: Yuuichi Teranishi <teranisi@gohome.org>,
@@ -964,8 +964,7 @@ necessarily solve the problem completely."
(epos (point-at-eol))
(buf (window-buffer window)))
(save-selected-window
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(beginning-of-line)
(condition-case nil
(forward-char hs)
@@ -997,7 +996,7 @@ necessarily solve the problem completely."
(defun w3m-form-coding-system-accept-region-p (&optional from to coding-system)
"Check whether `coding-system' can encode specified region."
- (let ((string (buffer-substring (or from (point-min))
+ (let ((string (buffer-substring (or from (point-min))
(or to (point-max)))))
(unless (string= (decode-coding-string
(encode-coding-string string coding-system)
View
2  w3m.el
@@ -624,7 +624,7 @@ nil which provides Lynx-like keys."
w3m-lynx-like-map)
w3m-minor-mode-map (w3m-make-minor-mode-keymap))))
(let ((buffers (buffer-list)))
- (save-excursion
+ (save-current-buffer
(while buffers
(set-buffer (car buffers))
(if (eq major-mode 'w3m-mode)
View
8 w3mhack.el
@@ -1,6 +1,6 @@
;;; w3mhack.el --- a hack to setup the environment for building w3m
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
;; TSUCHIYA Masatoshi <tsuchiya@namazu.org>
;; Author: Katsumi Yamaoka <yamaoka@jpl.org>
@@ -76,8 +76,7 @@ but do not execute them.")
(let ((test (lambda (shell)
(let ((buffer (generate-new-buffer " *temp*"))
(msg "Hello World"))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(condition-case nil
(call-process shell nil t nil "-c"
(concat "MESSAGE=\"" msg "\"&&"
@@ -930,8 +929,7 @@ NOTE: This function must be called from the top directory."
(message " `%s' is up to date" w3mhack-load-file)
(when (fboundp 'autoload-ensure-default-file)
(autoload-ensure-default-file generated-autoload-file))
- (save-excursion
- (set-buffer (find-file-noselect generated-autoload-file))
+ (with-current-buffer (find-file-noselect generated-autoload-file)
(if (fboundp 'autoload-ensure-default-file)
(let ((case-fold-search t))
(goto-char (point-min))
Please sign in to comment.
Something went wrong with that request. Please try again.