/[climacs]/climacs/core.lisp
ViewVC logotype

Diff of /climacs/core.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.25 by thenriksen, Sun Jan 27 08:13:54 2008 UTC revision 1.26 by thenriksen, Sun May 18 09:05:11 2008 UTC
# Line 323  file if necessary." Line 323  file if necessary."
323           (display-message "~A is a directory name." filepath)           (display-message "~A is a directory name." filepath)
324           (beep))           (beep))
325          (t          (t
326           (let ((existing-view (find-view-with-pathname filepath)))           (handler-case
327             (if (and existing-view (if readonlyp (read-only-p (buffer existing-view)) t))               (let ((existing-view (find-view-with-pathname filepath)))
328                 (switch-to-view (current-window) existing-view)                 (if (and existing-view (if readonlyp (read-only-p (buffer existing-view)) t))
329               (progn                     (switch-to-view (current-window) existing-view)
330                 (when readonlyp                     (let* ((newp (not (probe-file filepath)))
331                   (unless (probe-file filepath)                            (buffer (if (and newp (not readonlyp))
332                     (beep)                                        (make-new-buffer)
333                     (display-message "No such file: ~A" filepath)                                        (with-open-file (stream filepath :direction :input)
334                     (return-from find-file-impl nil)))                                          (make-buffer-from-stream stream))))
335                 (let* ((newp (not (probe-file filepath)))                            (view (make-new-view-for-climacs
336                        (buffer (if newp                                   *esa-instance* 'textual-drei-syntax-view
337                                    (make-new-buffer)                                   :name (filepath-filename filepath)
338                                    (with-open-file (stream filepath :direction :input)                                   :buffer buffer)))
339                                      (make-buffer-from-stream stream))))                       (unless (buffer-pane-p (current-window))
340                        (view (make-new-view-for-climacs                         (other-window (or (find-if #'(lambda (window)
341                               *esa-instance* 'textual-drei-syntax-view                                                        (typep window 'climacs-pane))
342                               :name (filepath-filename filepath)                                                    (windows *esa-instance*))
343                               :buffer buffer)))                                           (split-window t))))
344                   (unless (buffer-pane-p (current-window))                       (setf (offset (point buffer)) (offset (point view))
345                     (other-window (or (find-if #'(lambda (window)                             (syntax view) (make-syntax-for-view view (syntax-class-name-for-filepath filepath))
346                                                    (typep window 'climacs-pane))                             (file-write-time buffer) (if newp (get-universal-time) (file-write-date filepath))
347                                                (windows *esa-instance*))                             (needs-saving buffer) nil
348                                       (split-window t))))                             (name buffer) (filepath-filename filepath))
349                   (setf (offset (point buffer)) (offset (point view))                       (setf (current-view (current-window)) view)
350                         (syntax view) (make-syntax-for-view view (syntax-class-name-for-filepath filepath))                       (evaluate-attribute-line view)
351                         (file-write-time buffer) (if newp (get-universal-time) (file-write-date filepath))                       (setf (filepath buffer) (pathname filepath)
352                         (needs-saving buffer) nil                             (read-only-p buffer) readonlyp)
353                         (name buffer) (filepath-filename filepath))                       (beginning-of-buffer (point view))
354                   (setf (current-view (current-window)) view)                       buffer)))
355                   (evaluate-attribute-line view)             (file-error (c)
356                   (setf (filepath buffer) (pathname filepath)               (display-message "~A" c))))))
                        (read-only-p buffer) readonlyp)  
                  (beginning-of-buffer (point view))  
                  buffer)))))))  
357    
358  (defmethod frame-find-file ((application-frame climacs) filepath)  (defmethod frame-find-file ((application-frame climacs) filepath)
359    (find-file-impl filepath nil))    (find-file-impl filepath nil))

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

  ViewVC Help
Powered by ViewVC 1.1.5