> [REBOL] editor for /core here Re:(2)
>
> Hi Volker!
>
> you wrote:
> [snipped quite a few things I cannot respond to right now. Later ...]
> >
> >Thanks for testing, whish-list, other feedback :)
> >i have more fun working on it now :)
>
> Since you appear to respond quite reasonably to my observations, here's more ;-
> )
i'll try :)
>
> (BTW, I've been using the editor on and off all day. Ran into a few out of rang
> e
> errors, but recovery apparently works quite well.)
>
too good :( i avoid to examine all this position-errors now.
recovery is to easy :)
if you get stuck if a changed file is not writable, 'restore it.
"or" shredder: func[][clear-cache key-text: none]
; need to select a file again!
> 1. I wasn't able to figure out how to load a pre-existing file. Apparently inte
> rnally
> the function open-t/cache filename works quite well, when you subsequently call
>
> ed. So I wrote my own little function.
>
> ef: func [filename [file!]] [ open-t/cache filename ed ]
>
> (Ok. So I basically copied your .readme function.)
>
> and added it to files.r.
>
> Unless I overlooked your "open existing file" macro/function, why not include i
> t?
History of Openings:
In the early beginning of edi.r, which was called ed.r
in this dark times, when crashing was often and real men
- but this is another story -
"try this" probe editor-files ...
"and" .user-ed ;you should have one if config worked right
i used filenames quite often and mapped them like
"this" .user: edits system/options/home/user.r cls source .user ...
Then, one morning, the "^l" glooms,
and there was the scratch-'.pad set in .user-ed,
full of lines like
open-t/cache edit~/readme.txt
"more about" end-l f-t "open with open-t" "but scroll back by hand :("
which was a quick thing too and even stronger after "^p"/"^n",
which allowed
open-t/cache edit~/readme.txt open-t system/options/home/user.r
and jumping around.
then, why writing too much? (oh the old times! the old men!)
edit~/readme.txt ; and press "^o" on this line (or '.o)
the newest version is
echo-dir system/options/home ; and "^o" to open files,
(and for the old men:
map "^r" [echo-dir do get-ed-line] ;browse subdirs, NEW, catch it!
)
So the need for
ef: func [filename [file!]] [ open-t/cache filename ed ]
has gone with the wind/time/development/evolution/featuritis/..
yes, i had 'ed in open-t a while. the problem with 'ed
is, rest of the line is never executed (stays in key-loop..)
open-t/cache edit~/readme.txt goto-top f-t Carl
would never find Carl, so i removed it.
oneliners i put usually in .user-ed , keeping it there a while.
but, thinking about it, .user-ed is on REBOL_HOME
and not moved with the editor, if you change computer.
for that are .neww and .new, or
the opening-stuff is in .efiles , place it there?
>
> 2. How do I tell edi to forget a file that's in the cache?
>
forget for forget or for reload?
forget:
source clear-cache
but then key-text keeps its file. see open-t/disk below
set key-text to none too.
reload:
open with open-t or open-t/disk .
but caution: only the last file is active, if a new is opened,
the old is saved before, if changed. but keept in cache.
(exactly if strict-not-equal? key-text/text key-text/original ,
or what key-text/save likes to do.)
so, if you want
write echo-text {Hello World} open-t/disk/nosave echo-text
or
save-t write echo-text {Hello Planet} open-t/disk echo-text
second is better, if you want to modify file.
save-t makes key-text unchanged => not saved again,
and disk is actual.
Needing this long explanation there may be something wrong with
my design?
> 3. Apparently cached files are not remembered from REBOL session to REBOL sessi
> on.
> Can I change this behavior? I.e. can I restart edi in a new REBOL session and e
> di
> will remember the files I had opened previously?
>
half work is done, see
open-t edit~/save-cache.r f-t load-cache ; or .save-c
open-t edit~/save-cache.r f-t save-cache n-t n-t ; or .save-c
find-files load-cache
the cursor-position is saved there, and the files are reloaded
but i forgot to save the history.. (todo!)
probe head files ... ; in original..
"or" probe head files-t ... ; if you replaced 'files, like me
> 4. tt and ^l work well enough. Very useful!
>
Thanks to Matt Dillon :)
this was easy with DME & ARexx long ago, now have it back :)
(someone knows his email? may he like it?)
> 5. Can opening of duplicate copies of the same file be prevented?
>
Opps! I use absolute filenames allways.
I have '~ set to my home-directory, '~~ to rebol-home, some more (edit~ ..).
so instead of %file i use ~/file , which results in an absolute filename.
i 'do my filename-input before using, so both ways work.
Thinking about a fix, i get this:
"try me" down home-l bs f-t --- be cb do block-begin ...
abs-path: func[a "current dir" b "file"][
either equal? first b #"/" [b][a/:b]]
cls do-demo[
a: system/script/path
abs-path a %/etc
abs-path a %etc
];---
should be placed at top of
source open-t ... ; ?
[abs-path system/script/path a]
developt in email :)
> There are a few things I plan to add, as soon as I have a moment.
>
Me too. stuff needs to go in the sourcecode :)
> TIA,
>
> ;- Elan [ : - ) ] / Oh, this email was also written in edi.r. What else? ;-)
>
Volker {: - ) }