Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
1af83384
Commit
1af83384
authored
2 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Address #139: Set terminal format to :locale
parent
bea34994
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/code/fd-stream.lisp
+3
-3
3 additions, 3 deletions
src/code/fd-stream.lisp
src/code/save.lisp
+16
-15
16 additions, 15 deletions
src/code/save.lisp
tests/issues.lisp
+17
-1
17 additions, 1 deletion
tests/issues.lisp
with
36 additions
and
19 deletions
src/code/fd-stream.lisp
+
3
−
3
View file @
1af83384
...
...
@@ -2397,10 +2397,10 @@
(
setf
*available-buffers*
nil
)
(
setf
*stdin*
(
make-fd-stream
0
:name
"Standard Input"
:input
t
:buffering
:line
:external-format
:
iso8859-1
))
:external-format
:
utf-8
))
(
setf
*stdout*
(
make-fd-stream
1
:name
"Standard Output"
:output
t
:buffering
:line
:external-format
:
iso8859-1
))
:external-format
:
utf-8
))
(
setf
*stderr*
(
make-fd-stream
2
:name
"Standard Error"
:output
t
:buffering
:line
:external-format
:iso8859-1
))
...
...
@@ -2410,7 +2410,7 @@
(
if
tty
(
make-fd-stream
tty
:name
"the Terminal"
:input
t
:output
t
:buffering
:line
:auto-close
t
:external-format
:
iso8859-1
)
:external-format
:
utf-8
)
(
make-two-way-stream
*stdin*
*stdout*
))))
nil
)
...
...
This diff is collapsed.
Click to expand it.
src/code/save.lisp
+
16
−
15
View file @
1af83384
...
...
@@ -145,24 +145,23 @@
(
defun
set-up-locale-external-format
()
"Add external format alias for :locale to the format specified by
the locale as set by setlocale(3C)."
(
let
((
codeset
(
unix::unix-get-locale-codeset
)))
(
let
((
codeset
(
unix::unix-get-locale-codeset
))
(
external-format
nil
))
(
cond
((
zerop
(
length
codeset
))
;; Codeset was the empty string, so just set :locale to
;; alias to the default external format.
(
setq
external-format
*default-external-format*
))
(
t
(
let
((
name
(
intern
codeset
"KEYWORD"
)))
(
setq
external-format
(
stream::ef-name
(
stream::find-external-format
name
nil
))))))
(
cond
(
external-format
(
setf
(
gethash
:locale
stream::*external-format-aliases*
)
*default-
external-format
*
))
external-format
))
(
t
(
let
((
codeset-format
(
intern
codeset
"KEYWORD"
)))
;; If we know the format, we can set the alias.
;; Otherwise, print a warning and use :iso8859-1 as the
;; alias.
(
setf
(
gethash
:locale
stream::*external-format-aliases*
)
(
if
(
stream::find-external-format
codeset-format
nil
)
codeset-format
(
progn
(
warn
"Unsupported external format; using :iso8859-1 instead: ~S"
codeset-format
)
:iso8859-1
)))))))
(
warn
"No external format found for codeset \"~S\"; using ~S instead"
codeset
*default-external-format*
)
(
setf
(
gethash
:locale
stream::*external-format-aliases*
)
*default-external-format*
))))
(
values
))
...
...
@@ -283,6 +282,8 @@
(
intl::setlocale
)
;; Set up :locale format
(
set-up-locale-external-format
)
;; Set terminal encodings to :locale
(
set-system-external-format
:locale
)
(
ext::process-command-strings
process-command-line
)
(
setf
*editor-lisp-p*
nil
)
(
macrolet
((
find-switch
(
name
)
...
...
This diff is collapsed.
Click to expand it.
tests/issues.lisp
+
17
−
1
View file @
1af83384
...
...
@@ -700,7 +700,23 @@
(
define-test
issue.139-default-external-format
(
:tag
:issues
)
(
assert-eq
:utf-8
stream:*default-external-format*
))
(
assert-eq
:utf-8
stream:*default-external-format*
)
;; Find the alias for :locale, and verify it exists and verify that
;; the system streams have that format.
(
let
((
locale-format
(
gethash
:locale
stream::*external-format-aliases*
)))
(
assert
locale-format
)
(
assert-eq
locale-format
(
stream-external-format
sys:*stdin*
))
(
assert-eq
locale-format
(
stream-external-format
sys:*stdout*
))
(
assert-eq
locale-format
(
stream-external-format
sys:*stderr*
))
;; sys:*tty* can either be an fd-stream or a two-way-stream.
(
etypecase
sys:*tty*
(
system:fd-stream
(
assert-eq
locale-format
(
stream-external-format
sys:*tty*
)))
(
two-way-stream
(
assert-eq
locale-format
(
stream-external-format
(
two-way-stream-input-stream
sys:*tty*
)))
(
assert-eq
locale-format
(
stream-external-format
(
two-way-stream-output-stream
sys:*tty*
)))))))
(
define-test
issue.139-default-external-format-read-file
(
:tag
:issues
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment