This commit was generated by cvs2svn to compensate for changes in r5323,
[elisp/gnus.git-] / lisp / nnheader.el
index e0de0a4..7ef13f2 100644 (file)
@@ -400,7 +400,6 @@ the line could be found."
     (unless (gnus-buffer-live-p nntp-server-buffer)
       (setq nntp-server-buffer (get-buffer-create " *nntpd*")))
     (set-buffer nntp-server-buffer)
-    (buffer-disable-undo (current-buffer))
     (erase-buffer)
     (kill-all-local-variables)
     (setq case-fold-search t)          ;Should ignore case.
@@ -774,20 +773,20 @@ find-file-hooks, etc.
        (auto-mode-alist (nnheader-auto-mode-alist))
        (default-major-mode 'fundamental-mode)
        (enable-local-variables nil)
-        (after-insert-file-functions nil)
-       (find-file-hooks nil)
-       (coding-system-for-read nnheader-file-coding-system))
-    (insert-file-contents filename visit beg end replace)))
+       (after-insert-file-functions nil)
+       (find-file-hooks nil))
+    (insert-file-contents-as-coding-system
+     nnheader-file-coding-system filename visit beg end replace)))
 
 (defun nnheader-find-file-noselect (&rest args)
   (let ((format-alist nil)
        (auto-mode-alist (nnheader-auto-mode-alist))
        (default-major-mode 'fundamental-mode)
        (enable-local-variables nil)
-        (after-insert-file-functions nil)
-       (find-file-hooks nil)
-       (coding-system-for-read nnheader-file-coding-system))
-    (apply 'find-file-noselect args)))
+       (after-insert-file-functions nil)
+       (find-file-hooks nil))
+    (apply 'find-file-noselect-as-coding-system
+          nnheader-file-coding-system args)))
 
 (defun nnheader-auto-mode-alist ()
   "Return an `auto-mode-alist' with only the .gz (etc) thingies."
@@ -857,6 +856,23 @@ find-file-hooks, etc.
 (fset 'nnheader-cancel-timer 'cancel-timer)
 (fset 'nnheader-cancel-function-timers 'cancel-function-timers)
 
+(defun nnheader-Y-or-n-p (prompt)
+  "Ask user a \"Y/n\" question. Return t if answer is neither \"n\", \"N\" nor \"C-g\"."
+  (let ((cursor-in-echo-area t)
+       (echo-keystrokes 0)
+       (inhibit-quit t)
+       ans)
+    (let (message-log-max)
+      (while (not (memq ans '(?\  ?N ?Y ?\C-g ?\e ?\n ?\r ?n ?y)))
+       (message "%s(Y/n) " prompt)
+       (setq ans (read-char-exclusive))))
+    (if (memq ans '(?\C-g ?N ?n))
+       (progn
+         (message "%s(Y/n) No" prompt)
+         nil)
+      (message "%s(Y/n) Yes" prompt)
+      t)))
+
 (when (string-match "XEmacs\\|Lucid" emacs-version)
   (require 'nnheaderxm))