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
162612e4
Commit
162612e4
authored
May 18, 2008
by
Troels Henriksen
Browse files
Handle file-errors when finding files.
parent
baec023e
Changes
1
Hide whitespace changes
Inline
Side-by-side
core.lisp
View file @
162612e4
...
...
@@ -323,40 +323,37 @@ file if necessary."
(
display-message
"~A is a directory name."
filepath
)
(
beep
))
(
t
(
let
((
existing-view
(
find-view-with-pathname
filepath
)))
(
if
(
and
existing-view
(
if
readonlyp
(
read-only-p
(
buffer
existing-view
))
t
))
(
switch-to-view
(
current-window
)
existing-view
)
(
progn
(
when
readonlyp
(
unless
(
probe-file
filepath
)
(
beep
)
(
display-message
"No such file: ~A"
filepath
)
(
return-from
find-file-impl
nil
)))
(
let*
((
newp
(
not
(
probe-file
filepath
)))
(
buffer
(
if
newp
(
make-new-buffer
)
(
with-open-file
(
stream
filepath
:direction
:input
)
(
make-buffer-from-stream
stream
))))
(
view
(
make-new-view-for-climacs
*esa-instance*
'textual-drei-syntax-view
:name
(
filepath-filename
filepath
)
:buffer
buffer
)))
(
unless
(
buffer-pane-p
(
current-window
))
(
other-window
(
or
(
find-if
#'
(
lambda
(
window
)
(
typep
window
'climacs-pane
))
(
windows
*esa-instance*
))
(
split-window
t
))))
(
setf
(
offset
(
point
buffer
))
(
offset
(
point
view
))
(
syntax
view
)
(
make-syntax-for-view
view
(
syntax-class-name-for-filepath
filepath
))
(
file-write-time
buffer
)
(
if
newp
(
get-universal-time
)
(
file-write-date
filepath
))
(
needs-saving
buffer
)
nil
(
name
buffer
)
(
filepath-filename
filepath
))
(
setf
(
current-view
(
current-window
))
view
)
(
evaluate-attribute-line
view
)
(
setf
(
filepath
buffer
)
(
pathname
filepath
)
(
read-only-p
buffer
)
readonlyp
)
(
beginning-of-buffer
(
point
view
))
buffer
)))))))
(
handler-case
(
let
((
existing-view
(
find-view-with-pathname
filepath
)))
(
if
(
and
existing-view
(
if
readonlyp
(
read-only-p
(
buffer
existing-view
))
t
))
(
switch-to-view
(
current-window
)
existing-view
)
(
let*
((
newp
(
not
(
probe-file
filepath
)))
(
buffer
(
if
(
and
newp
(
not
readonlyp
))
(
make-new-buffer
)
(
with-open-file
(
stream
filepath
:direction
:input
)
(
make-buffer-from-stream
stream
))))
(
view
(
make-new-view-for-climacs
*esa-instance*
'textual-drei-syntax-view
:name
(
filepath-filename
filepath
)
:buffer
buffer
)))
(
unless
(
buffer-pane-p
(
current-window
))
(
other-window
(
or
(
find-if
#'
(
lambda
(
window
)
(
typep
window
'climacs-pane
))
(
windows
*esa-instance*
))
(
split-window
t
))))
(
setf
(
offset
(
point
buffer
))
(
offset
(
point
view
))
(
syntax
view
)
(
make-syntax-for-view
view
(
syntax-class-name-for-filepath
filepath
))
(
file-write-time
buffer
)
(
if
newp
(
get-universal-time
)
(
file-write-date
filepath
))
(
needs-saving
buffer
)
nil
(
name
buffer
)
(
filepath-filename
filepath
))
(
setf
(
current-view
(
current-window
))
view
)
(
evaluate-attribute-line
view
)
(
setf
(
filepath
buffer
)
(
pathname
filepath
)
(
read-only-p
buffer
)
readonlyp
)
(
beginning-of-buffer
(
point
view
))
buffer
)))
(
file-error
(
c
)
(
display-message
"~A"
c
))))))
(
defmethod
frame-find-file
((
application-frame
climacs
)
filepath
)
(
find-file-impl
filepath
nil
))
...
...
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