- Subject: Re: How do I get text from the buffer? SLang?
- From: jeremy@xxxxxxxxxx
- Date: Mon, 27 Sep 2004 20:02:00 -0400
Quoting John E. Davis <davis@xxxxxxxxxxxxx>:
> goto_column (a);
> push_mark ();
> goto_column (b);
> return bufsubstr ();
I have taken the portions of code I thought were necessary and created
the following function:
define change_name()
{
variable fname, lname, bvcd_line;
!if (bsearch("BEGIN:VCARD")) { beep; return; }
bvcd_line = what_line ();
% ===
% Find the N:John;Doe; line
!if (fsearch("N:")) { add_name(); return; }
% Get the First Name
right(2); push_mark();
!if (fsearch(";")) { add_name(); return; }
fname = bufsubstr (); pop_mark ();
right(1); push_mark();
% Get the Last Name
!if (fsearch(";")) { return; }
lname = bufsubstr (); pop_mark ();
% ===
% Read the new first/last name
fname = read_mini("First Name:", fname, "");
lname = read_mini("Last Name:", lname, "");
% ===
% Delete old, insert new
% Handle FN: line
goto_line (bvcd_line);
() = fsearch("FN:");
bol (); push_mark ();
eol (); del_region (); pop_mark ();
insert("FN:"+fname+" "+lname);
% Handle N: line
goto_line (bvcd_line);
() = fsearch("N:");
bol (); push_mark ();
eol (); del_region (); pop_mark ();
insert("N:"+fname+";"+lname);
}
This is what my file looks like:
BEGIN:VCARD
FN:Jeremy Cowgar
N:Jeremy;Cowgar;
END:VCARD
When I run this command on the above file, when it comes time to
prompty for first name the default value is:
BEGIN:VCARD^JFN:Jeremy Cowgar:JN:Jeremy;Cowgar;
I am not certian why that is happing. Any ideas? Thanks!
Jeremy Cowgar
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2004 date index]
[2004 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]