[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MIT-Scheme-devel] Patch and a question re: opening files with Edwin

From: Rich Loveland
Subject: [MIT-Scheme-devel] Patch and a question re: opening files with Edwin
Date: Thu, 3 Oct 2013 16:12:17 -0400
User-agent: IMAIL/1.21; Edwin/3.116; MIT-Scheme/9.1.99


I've made a little patch (attached) to src/edwin/editor.scm that, when
combined with the shell script and Scheme code below, lets me open
Edwin directly on a file from the terminal like so:

  $ edwin file.txt
  ... (new Edwin opens with file.txt loaded)

I'm not submitting this patch for inclusion as it is, it's not very
nice; instead I have questions:

* Is there a way to open Edwin directly on a file without doing this?

* If there currently isn't an official way to do this, I'd appreciate
  any comments on how to do this in a less roundabout way so that it
  could be submitted for the ``official'' Edwin.

* This starts a new Scheme/Edwin every time, which is OK but sort of
  uncool. Is there a way to send a message to a currently running
  Edwin to open the file in a new frame or buffer?

Here's the shell script:

  /Users/rloveland/bin/scheme --args $EDIT_FILE --load $SCHEME_FILE
And the `edit-file.scm' loaded by Scheme above is:

  (load-option 'FORMAT)
  (define (build-plausible-filename candidate)
    (let ((longname (string-append (->namestring (pwd)) candidate)))
       ((file-exists? longname) longname)
       ((file-exists? candidate) candidate)
       (else #f))))
  (define (edit-file)
    (let* ((args (command-line))
           (maybe-file (car args)) ; (list-tail args (- (length args) 1))))
           (file (build-plausible-filename maybe-file)))
      (format #t "~%;Editing ~A~%" file)
      (edit file)))


Attachment: edwin-editor-load-file.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]