Don't use ellipses while cl-printing strings.
This fixes bug#65680. The former use of print-length as a bound on the length of the printed string was erroneous, causing error messages preceding backtracees to get unnecessarily truncated to 50 characters. * lisp/emacs-lisp/cl-print.el (cl-print-object <string>): Remove the substitution of ellipses for long strings. * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-ellipsis-string): Remove this test.
This commit is contained in:
parent
ea5ae08b06
commit
761f8901ff
2 changed files with 5 additions and 30 deletions
|
@ -264,27 +264,17 @@ into a button whose action shows the function's disassembly.")
|
|||
(cl-defmethod cl-print-object ((object string) stream)
|
||||
(unless stream (setq stream standard-output))
|
||||
(let* ((has-properties (or (text-properties-at 0 object)
|
||||
(next-property-change 0 object)))
|
||||
(len (length object))
|
||||
(limit (if (natnump print-length) (min print-length len) len)))
|
||||
(next-property-change 0 object))))
|
||||
(if (and has-properties
|
||||
cl-print--depth
|
||||
(natnump print-level)
|
||||
(> cl-print--depth print-level))
|
||||
(cl-print-insert-ellipsis object nil stream)
|
||||
;; Print all or part of the string
|
||||
;; Print the string.
|
||||
(when has-properties
|
||||
(princ "#(" stream))
|
||||
(if (= limit len)
|
||||
(prin1 (if has-properties (substring-no-properties object) object)
|
||||
stream)
|
||||
(let ((part (concat (substring-no-properties object 0 limit) "...")))
|
||||
(prin1 part stream)
|
||||
(when (bufferp stream)
|
||||
(with-current-buffer stream
|
||||
(cl-print-propertize-ellipsis object limit
|
||||
(- (point) 4)
|
||||
(- (point) 1) stream)))))
|
||||
(prin1 (if has-properties (substring-no-properties object) object)
|
||||
stream)
|
||||
;; Print the property list.
|
||||
(when has-properties
|
||||
(cl-print--string-props object 0 stream)
|
||||
|
|
|
@ -58,21 +58,6 @@
|
|||
(cl-print-tests-check-ellipsis-expansion
|
||||
[a [b [c [d [e]]]]] "[a [b [c ...]]]" "[d [e]]")))
|
||||
|
||||
(ert-deftest cl-print-tests-ellipsis-string ()
|
||||
"Ellipsis expansion works in strings."
|
||||
(let ((print-length 4)
|
||||
(print-level 3))
|
||||
(cl-print-tests-check-ellipsis-expansion
|
||||
"abcdefg" "\"abcd...\"" "efg")
|
||||
(cl-print-tests-check-ellipsis-expansion
|
||||
"abcdefghijk" "\"abcd...\"" "efgh...")
|
||||
(cl-print-tests-check-ellipsis-expansion
|
||||
'(1 (2 (3 #("abcde" 0 5 (test t)))))
|
||||
"(1 (2 (3 ...)))" "#(\"abcd...\" 0 5 (test t))")
|
||||
(cl-print-tests-check-ellipsis-expansion
|
||||
#("abcd" 0 1 (bold t) 1 2 (invisible t) 3 4 (italic t))
|
||||
"#(\"abcd\" 0 1 (bold t) ...)" "1 2 (invisible t) ...")))
|
||||
|
||||
(ert-deftest cl-print-tests-ellipsis-struct ()
|
||||
"Ellipsis expansion works in structures."
|
||||
(let ((print-length 4)
|
||||
|
@ -144,7 +129,7 @@
|
|||
|
||||
;; Print something which needs to be abbreviated and which can be.
|
||||
(should (< (length (cl-print-to-string-with-limit #'cl-prin1 thing100 100))
|
||||
100
|
||||
150 ;; 100. The LIMIT argument is advisory rather than absolute.
|
||||
(length (cl-prin1-to-string thing100))))
|
||||
|
||||
;; Print something resistant to easy abbreviation.
|
||||
|
|
Loading…
Add table
Reference in a new issue