Mercurial > hg > xemacs-beta
diff lisp/wid-edit.el @ 221:6c0ae1f9357f r20-4b9
Import from CVS: tag r20-4b9
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:10:02 +0200 |
parents | 262b8bb4a523 |
children | 0e522484dd2a |
line wrap: on
line diff
--- a/lisp/wid-edit.el Mon Aug 13 10:09:36 2007 +0200 +++ b/lisp/wid-edit.el Mon Aug 13 10:10:02 2007 +0200 @@ -155,10 +155,14 @@ (defun widget-prettyprint-to-string (object) ;; Like pp-to-string, but uses `cl-prettyprint' - ;; #### FIX ME!!!! (with-current-buffer (get-buffer-create " *widget-tmp*") (erase-buffer) (cl-prettyprint object) + ;; `cl-prettyprint' always surrounds the text with newlines. + (when (eq (char-after (point-min)) ?\n) + (delete-region (point-min) (1+ (point-min)))) + (when (eq (char-before (point-max)) ?\n) + (delete-region (1- (point-max)) (point-max))) (buffer-string))) (defun widget-clear-undo () @@ -3357,10 +3361,7 @@ (let ((pp (if (symbolp value) (prin1-to-string value) (widget-prettyprint-to-string value)))) - (while (string-match "\n\\'" pp) - (setq pp (substring pp 0 -1))) - (if (and (> (length pp) 40) - (not (string-match "\\`\n" pp))) + (if (> (length pp) 40) (concat "\n" pp) pp)))