+2004-08-24 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * gnus-util.el (gnus-bind-print-variables): New macro.
+ (gnus-prin1): Use it.
+ (gnus-prin1-to-string): Use it.
+ (gnus-pp): New function.
+ (gnus-pp-to-string): New function.
+
+ * gnus-cus.el (gnus-agent-cat-prepare-category-field): Replace
+ pp-to-string with gnus-pp-to-string.
+ * gnus-eform.el (gnus-edit-form): Replace pp with gnus-pp.
+ * gnus-group.el (gnus-group-make-kiboze-group): Ditto.
+ * gnus-msg.el (gnus-debug): Ditto.
+ * gnus-score.el (gnus-score-save): Ditto.
+ * gnus-spec.el (gnus-update-format): Replace pp-to-string with
+ gnus-pp-to-string.
+ * legacy-gnus-agent.el (gnus-agent-unlist-expire-days): Replace pp
+ with gnus-pp.
+ * score-mode.el (gnus-score-pretty-print): Ditto.
+ * webmail.el (webmail-debug): Ditto.
+
2004-08-23 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-art.el (article-display-face, article-display-x-face): Use
;;; gnus-cus.el --- customization commands for Gnus
;;
-;; Copyright (C) 1996, 1999, 2000, 2001, 2002, 2003
+;; Copyright (C) 1996, 1999, 2000, 2001, 2002, 2003, 2004
;; Free Software Foundation, Inc.
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
(val (,field info))
(deflt (if (,field defaults)
(concat " [" (gnus-trim-whitespace
- (pp-to-string (,field defaults))) "]")))
+ (gnus-pp-to-string (,field defaults)))
+ "]")))
symb)
(if (eq (car type) 'radio)
;;; gnus-eform.el --- a mode for editing forms for Gnus
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2004
;; Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
(insert ";; Type `C-c C-c' after you've finished editing.\n")
(insert "\n")
(let ((p (point)))
- (pp form (current-buffer))
+ (gnus-pp form)
(insert "\n")
(goto-char p))))
(make-directory score-dir))
(with-temp-file score-file
(let (emacs-lisp-mode-hook)
- (pp scores (current-buffer))))))
+ (gnus-pp scores)))))
(defun gnus-group-add-to-virtual (n vgroup)
"Add the current group to a virtual group."
(while olist
(if (boundp (car olist))
(ignore-errors
- (pp `(setq ,(car olist)
- ,(if (or (consp (setq sym (symbol-value (car olist))))
- (and (symbolp sym)
- (not (or (eq sym nil)
- (eq sym t)))))
- (list 'quote (symbol-value (car olist)))
- (symbol-value (car olist))))
- (current-buffer)))
+ (gnus-pp
+ `(setq ,(car olist)
+ ,(if (or (consp (setq sym (symbol-value (car olist))))
+ (and (symbolp sym)
+ (not (or (eq sym nil)
+ (eq sym t)))))
+ (list 'quote (symbol-value (car olist)))
+ (symbol-value (car olist))))))
(insert ";; (makeunbound '" (symbol-name (car olist)) ")\n"))
(setq olist (cdr olist)))
;; Remove any control chars - they seem to cause trouble for some
;; This is a normal score file, so we print it very
;; prettily.
(let ((lisp-mode-syntax-table score-mode-syntax-table))
- (pp score (current-buffer)))))
+ (gnus-pp score))))
(gnus-make-directory (file-name-directory file))
;; If the score file is empty, we delete it.
(if (zerop (buffer-size))
;;; gnus-spec.el --- format spec functions for Gnus
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
;; Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
(pop-to-buffer "*Gnus Format*")
(erase-buffer)
(lisp-interaction-mode)
- (insert (pp-to-string spec))))
+ (insert (gnus-pp-to-string spec))))
(put 'gnus-search-or-regist-spec 'lisp-indent-function 1)
(defmacro gnus-search-or-regist-spec (mspec &rest body)
;;; gnus-util.el --- utility functions for Semi-gnus
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
;; Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
(define-key (symbol-value (intern (format "gnus-%s-mode-map" type)))
[menu-bar edit] 'undefined))
+(defmacro gnus-bind-print-variables (&rest forms)
+ "Bind print-* variables and evaluate FORMS.
+This macro is used with `prin1', `pp', etc. in order to ensure printed
+Lisp objects are loadable. Bind `print-quoted' and `print-readably'
+to t, and `print-escape-multibyte', `print-escape-newlines',
+`print-escape-nonascii', `print-length', `print-level' and
+`print-string-length' to nil."
+ `(let ((print-quoted t)
+ (print-readably t)
+ ;;print-circle
+ ;;print-continuous-numbering
+ print-escape-multibyte
+ print-escape-newlines
+ print-escape-nonascii
+ ;;print-gensym
+ print-length
+ print-level
+ print-string-length)
+ ,@forms))
+
(defun gnus-prin1 (form)
"Use `prin1' on FORM in the current buffer.
-Bind `print-quoted' and `print-readably' to t while printing."
- (let ((print-quoted t)
- (print-readably t)
- (print-escape-multibyte nil)
- print-level print-length)
- (prin1 form (current-buffer))))
+Bind `print-quoted' and `print-readably' to t, and `print-length' and
+`print-level' to nil. See also `gnus-bind-print-variables'."
+ (gnus-bind-print-variables (prin1 form (current-buffer))))
(defun gnus-prin1-to-string (form)
"The same as `prin1'.
-Bind `print-quoted' and `print-readably' to t, and `print-length'
-and `print-level' to nil."
- (let ((print-quoted t)
- (print-readably t)
- (print-length nil)
- (print-level nil))
- (prin1-to-string form)))
+Bind `print-quoted' and `print-readably' to t, and `print-length' and
+`print-level' to nil. See also `gnus-bind-print-variables'."
+ (gnus-bind-print-variables (prin1-to-string form)))
+
+(defun gnus-pp (form)
+ "Use `pp' on FORM in the current buffer.
+Bind `print-quoted' and `print-readably' to t, and `print-length' and
+`print-level' to nil. See also `gnus-bind-print-variables'."
+ (gnus-bind-print-variables (pp form (current-buffer))))
+
+(defun gnus-pp-to-string (form)
+ "The same as `pp-to-string'.
+Bind `print-quoted' and `print-readably' to t, and `print-length' and
+`print-level' to nil. See also `gnus-bind-print-variables'."
+ (gnus-bind-print-variables (pp-to-string form)))
(defun gnus-make-directory (directory)
"Make DIRECTORY (and all its parents) if it doesn't exist."
(set-buffer buffer)
(erase-buffer)
(insert "The definition of gnus-agent-expire-days has been changed.\nYou currently have it set to the list:\n ")
- (let (print-level print-length) (pp gnus-agent-expire-days (current-buffer)))
+ (gnus-pp gnus-agent-expire-days)
(insert "\nIn order to use version '" converting-to "' of gnus, you will need to set\n")
(insert "gnus-agent-expire-days to an integer. If you still wish to set different\n")
;;; score-mode.el --- mode for editing Gnus score files
-;; Copyright (C) 1996, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001, 2004 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: news, mail
(eval-when-compile (require 'cl))
(eval-when-compile (require 'static))
+(require 'gnus-util) ; for gnus-pp
(defvar gnus-score-mode-hook nil
"*Hook run in score mode buffers.")
(let ((form (read (current-buffer))))
(erase-buffer)
(let ((emacs-lisp-mode-syntax-table score-mode-syntax-table))
- (pp form (current-buffer))))
+ (gnus-pp form)))
(goto-char (point-min)))
(defun gnus-score-edit-exit ()
;;; webmail.el --- interface of web mail
-;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
;; Keywords: hotmail netaddress my-deja netscape
(insert "\n---------------- A bug at " str " ------------------\n")
(mapcar #'(lambda (sym)
(if (boundp sym)
- (pp `(setq ,sym ',(eval sym)) (current-buffer))))
+ (gnus-pp `(setq ,sym ',(eval sym)))))
'(webmail-type user))
(insert "---------------- webmail buffer ------------------\n\n")
(insert-buffer-substring webmail-buffer)