home *** CD-ROM | disk | FTP | other *** search
- /*
- * Emacs kill-line embryo.
- * Killed lines will get copied into the block buffer before deleted. Note that
- * the first killed line will first clear the block buffer, and kills following
- * that one will append them to the current one.
- *
- * Paste the buffer with BlockPaste() or BlockPasteRect() just as usual blocks.
- */
-
- int __counter; /* internal counter, were we invoked last interactive round? */
- export int __yankID; /* ID of the block buffer */
-
- void export kill_line()
- {
- int this_count = ReadInfo("counter");
- if ((this_count != __counter)&&(this_count != __counter+1)) {
- /* We were not invoked this/last action, clear the buffer */
- Clean("Clear(__yankID);"); /* Clear the block without any hooks */
- }
- __counter = ReadInfo("counter");
- if(Isnewline(GetChar())) {
- /* standing on a newline character */
- int oldID = GetEntryID(); /* get current entry */
- Delete(); /* delete the newline character */
- CurrentBuffer(__yankID); /* switch to the block buffer */
- GotoLine(-1); /* jump to the bottom */
- GotoLine(ReadInfo("line"),
- ReadInfo("line_length")); /* jump to end of line */
- Output("\n"); /* add a newline to the buffer */
- CurrentBuffer(oldID); /* switch back to previous buffer */
- }
- else {
- /* delete to end of line */
- int curr_col = ReadInfo("column"); /* get current column */
- int end_col = GetCursor(ReadInfo("line_length")); /* get column of the
- end of line */
- int curr_line = ReadInfo("line"); /* get line number */
-
- BlockCopyAppend(__yankID, end_col, curr_line, curr_col, curr_line); /* append the line to the block */
-
- DeleteEol(); /* delete to the end of line */
- }
- }
-
- __yankID = GetBufferID("DefaultBlock");
-
-