1 Patch backported by Sage.
3 Fix from upstream that happens to work around
4 https://trac.sagemath.org/ticket/23011
5 diff --git a/src/lsp/format.lsp b/src/lsp/format.lsp
6 index 77ca799..53b887c 100644
7 --- a/src/lsp/format.lsp
8 +++ b/src/lsp/format.lsp
10 :start (format-directive-start struct)
11 :end (format-directive-end struct))))
13 +(defconstant +format-directive-limit+ (1+ (char-code #\~)))
16 (defparameter *format-directive-expanders*
17 - (make-array char-code-limit :initial-element nil))
18 + (make-array +format-directive-limit+ :initial-element nil))
19 (defparameter *format-directive-interpreters*
20 - (make-array char-code-limit :initial-element nil))
21 + (make-array +format-directive-limit+ :initial-element nil))
23 (defparameter *default-format-error-control-string* nil)
24 (defparameter *default-format-error-offset* nil)
26 (write-string directive stream)
27 (interpret-directive-list stream (cdr directives) orig-args args))
28 (#-ecl format-directive #+ecl vector
29 + (multiple-value-bind
30 + (new-directives new-args)
31 + (let* ((code (char-code (format-directive-character directive)))
33 + (and (< code +format-directive-limit+)
34 + (svref *format-directive-interpreters* code)))
35 + (*default-format-error-offset*
36 + (1- (format-directive-end directive))))
38 + (error 'format-error
39 + :complaint "Unknown format directive."))
41 (new-directives new-args)
43 - (svref *format-directive-interpreters*
44 - (char-code (format-directive-character
46 - (*default-format-error-offset*
47 - (1- (format-directive-end directive))))
49 - (error 'format-error
50 - :complaint "Unknown format directive."))
51 - (multiple-value-bind
52 - (new-directives new-args)
53 - (funcall function stream directive
54 - (cdr directives) orig-args args)
55 - (values new-directives new-args)))
56 - (interpret-directive-list stream new-directives
57 - orig-args new-args)))))
58 + (funcall function stream directive
59 + (cdr directives) orig-args args)
60 + (values new-directives new-args)))
61 + (interpret-directive-list stream new-directives
62 + orig-args new-args)))))
67 (values `(write-string ,directive stream)
71 - (aref *format-directive-expanders*
72 - (char-code (format-directive-character directive))))
73 - (*default-format-error-offset*
74 - (1- (format-directive-end directive))))
75 + (let* ((code (char-code (format-directive-character directive)))
77 + (and (< code +format-directive-limit+)
78 + (svref *format-directive-expanders* code)))
79 + (*default-format-error-offset*
80 + (1- (format-directive-end directive))))
82 (funcall expander directive more-directives)