Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
climacs
climacs
Commits
bd1ebe6e
Commit
bd1ebe6e
authored
Jan 13, 2008
by
Troels Henriksen
Browse files
Signal an error when trying to save a buffer that contains a
non-character.
parent
92326ff7
Changes
1
Hide whitespace changes
Inline
Side-by-side
io.lisp
View file @
bd1ebe6e
...
...
@@ -24,9 +24,31 @@
(
in-package
:climacs-core
)
(
define-condition
buffer-contains-noncharacter
(
buffer-writing-error
)
()
(
:report
(
lambda
(
condition
stream
)
(
format
stream
"Buffer ~A contains non-character object"
(
name
(
buffer
condition
)))))
(
:documentation
"This error is signalled whenever an attempt is
made to save a buffer that contains a non-character object."
))
(
defun
buffer-contains-noncharacter
(
buffer
filepath
)
"Signal an error of type `buffer-contains-noncharacter' with
the buffer `buffer' and the filepath `filepath'."
(
error
'buffer-contains-noncharacter
:buffer
buffer
:filepath
filepath
))
(
defmethod
check-buffer-writability
((
application-frame
climacs
)
(
filepath
pathname
)
(
buffer
drei-buffer
))
(
do-buffer-region
(
object
offset
buffer
0
(
size
buffer
))
(
unless
(
characterp
object
)
(
buffer-contains-noncharacter
buffer
filepath
)))
(
call-next-method
))
(
defmethod
frame-save-buffer-to-stream
((
application-frame
climacs
)
(
buffer
climacs-buffer
)
stream
)
(
let
((
seq
(
buffer-sequence
buffer
0
(
size
buffer
))))
(
write-sequence
seq
stream
)))
(
if
(
every
#'
characterp
seq
)
(
write-sequence
seq
stream
)
(
display-message
"Cannot save to file, buffer contains non-character object"
))))
(
defun
input-from-stream
(
stream
buffer
offset
)
(
let*
((
seq
(
make-string
(
file-length
stream
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment