From 2e10c9ef0b697fe55d6a5162312a217bc22133a1 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 16 Jun 2023 13:21:15 -0400 Subject: [PATCH 3/5] pp.el (pp-buffer): Mark as obsolete * lisp/emacs-lisp/pp.el (pp-buffer): Mark as obsolete * lisp/org/org-table.el (org-table-fedit-lisp-indent): * lisp/emacs-lisp/lisp-mode.el (indent-pp-sexp): * lisp/emacs-lisp/backtrace.el (backtrace--multi-line): * lisp/ielm.el (ielm-eval-input): * lisp/help-fns.el (describe-variable): Use the new `pp` calling convention instead of `pp-buffer`. (help-fns-edit-variable): Use `pp` instead of `prin1` + `pp-buffer`. Use the new `pp` --- lisp/emacs-lisp/backtrace.el | 2 +- lisp/emacs-lisp/lisp-mode.el | 2 +- lisp/emacs-lisp/pp.el | 1 + lisp/help-fns.el | 9 ++++----- lisp/ielm.el | 2 +- lisp/org/org-table.el | 5 ++++- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el index 57912c854b0..81cfafa5738 100644 --- a/lisp/emacs-lisp/backtrace.el +++ b/lisp/emacs-lisp/backtrace.el @@ -556,7 +556,7 @@ backtrace-multi-line (defun backtrace--multi-line () "Pretty print the current buffer, then remove the trailing newline." (set-syntax-table emacs-lisp-mode-syntax-table) - (pp-buffer) + (pp (point-min) (point-max)) (goto-char (1- (point-max))) (delete-char 1)) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 9914ededb85..83b374551fc 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1418,7 +1418,7 @@ indent-pp-sexp (save-excursion (save-restriction (narrow-to-region (point) (progn (forward-sexp 1) (point))) - (pp-buffer) + (pp (point-min) (point-max)) (goto-char (point-max)) (if (eq (char-before) ?\n) (delete-char -1))))) diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el index 0798e46f735..65325dea6f1 100644 --- a/lisp/emacs-lisp/pp.el +++ b/lisp/emacs-lisp/pp.el @@ -146,6 +146,7 @@ pp-to-string ;;;###autoload (defun pp-buffer () "Prettify the current buffer with printed representation of a Lisp object." + (declare (obsolete pp "30")) (interactive) (pp (point-min) (point-max))) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index b9388b45397..79a2b9a495b 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1341,7 +1341,7 @@ describe-variable (lisp-data-mode) (set-syntax-table emacs-lisp-mode-syntax-table) (insert print-rep) - (pp-buffer) + (pp (point-min) (point-max)) (font-lock-ensure) (let ((pp-buffer (current-buffer))) (with-current-buffer buf @@ -1368,7 +1368,7 @@ describe-variable (cl-prin1 origval)) (save-restriction (narrow-to-region from (point)) - (save-excursion (pp-buffer))) + (save-excursion (pp (point-min) (point-max)))) (help-fns--editable-variable from (point) variable origval buffer) (if (< (point) (+ from 20)) @@ -1399,7 +1399,7 @@ describe-variable (cl-prin1 global-val) (save-restriction (narrow-to-region from (point)) - (save-excursion (pp-buffer))) + (save-excursion (pp (point-min) (point-max)))) ;; See previous comment for this function. ;; (help-xref-on-pp from (point)) (if (< (point) (+ from 20)) @@ -1479,8 +1479,7 @@ help-fns-edit-variable (unless var (error "No variable under point")) (pop-to-buffer-same-window (format "*edit %s*" (nth 0 var))) - (prin1 (nth 1 var) (current-buffer)) - (pp-buffer) + (pp (nth 1 var) (current-buffer)) (goto-char (point-min)) (help-fns--edit-value-mode) (insert (format ";; Edit the `%s' variable.\n" (nth 0 var)) diff --git a/lisp/ielm.el b/lisp/ielm.el index 5c370733c05..f7984ea162c 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el @@ -436,7 +436,7 @@ ielm-eval-input ;; right buffer! (with-current-buffer ielmbuf (cl-prin1 result tmpbuf)) - (pp-buffer) + (pp (point-min) (point-max)) (concat (buffer-string) aux)))))) (error (setq error-type "IELM Error") diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 42f234790c5..ecd17c76ec2 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -3717,7 +3717,10 @@ org-table-fedit-lisp-indent (setq this-command nil) (while (re-search-forward "[ \t]*\n[ \t]*" nil t) (replace-match " "))) - (pp-buffer) + (if (fboundp 'pp-buffer) ;Obsolete since Emacs-30 + (with-suppressed-warnings ((obsolete pp-buffer)) + (pp-buffer)) + (pp (point-min) (point-max))) (untabify (point-min) (point-max)) (goto-char (1+ (point-min))) (while (re-search-forward "^." nil t) -- 2.39.2