diff --git a/qe.c b/qe.c index 61518be..10501dc 100644 --- a/qe.c +++ b/qe.c @@ -1858,7 +1858,9 @@ void do_quoted_insert(EditState *s, int argval) { } void do_overwrite_mode(EditState *s, int argval) { - /*@ + /*@CMD + ### `overwrite-mode(argval)` + Toggle overwrite mode. With a prefix argument, turn overwrite mode on if the argument @@ -1867,10 +1869,10 @@ void do_overwrite_mode(EditState *s, int argval) { existing text without moving the rest of the line, rather than shifting it to the right. Characters typed before a newline extend the line. Space created by TAB characters is filled until - the tabulation stop is reached as. + the tabulation stop is reached. Backspace erases the previous character and sets point to it. - C-q still inserts characters in overwrite mode for convenience to - insert characters when necessary. + C-q still inserts characters in overwrite mode as a convenient way + to insert characters when necessary. */ if (argval == NO_ARG) @@ -7945,8 +7947,8 @@ void do_insert_file(EditState *s, const char *filename) void do_set_visited_file_name(EditState *s, const char *filename, const char *renamefile) { - /*@ - set_visited_file_name(string FILENAME, string RENAMEFILE) + /*@CMD + ### `set-visited-file-name(string FILENAME, string RENAMEFILE)` Change the name of file visited in current buffer to FILENAME. This also renames the buffer to correspond to the new file. The @@ -8349,7 +8351,8 @@ void do_delete_window(EditState *s, int force) return; if (s->flags & WF_POPUP) { - e1 = check_window(&s->target_window); + // XXX: this causes a crash on C-g from bufed + //e1 = check_window(&s->target_window); } else { /* Try to merge the window with adjacent windows. * If this cannot be done, just leave a hole and force full diff --git a/search.c b/search.c index 72e71bd..848198d 100644 --- a/search.c +++ b/search.c @@ -812,11 +812,12 @@ static void query_replace_key(void *opaque, int key) { QueryReplaceState *is = opaque; EditState *s = is->s; - QEmacsState *qs = &qe_state; + QEmacsState *qs = s->qe_state; if (is->help_window) { do_delete_window(is->help_window, 0); is->help_window = NULL; + qs->active_window = s; edit_display(is->s->qe_state); dpy_flush(is->s->screen); return; @@ -935,30 +936,32 @@ static void query_replace(EditState *s, const char *search_str, void do_query_replace(EditState *s, const char *search_str, const char *replace_str, int argval) { - /*@ - query-replace(FROM-STRING, TO-STRING, DELIMITED=argval, START=point, END=end) + /*@CMD + ### `query-replace(string FROM-STRING, string TO-STRING, + int DELIMITED=argval, int START=point, int END=end)` Replace some occurrences of FROM-STRING with TO-STRING. As each match is found, the user must type a character saying - what to do with it. For directions, type C-h at that time. + what to do with it. For directions, type '?' at that time. - In Transient Mark mode, if the mark is active, operate on the contents - of the region. Otherwise, operate from point to the end of the buffer. - - Matching is independent of case if `case-fold-search' is non-nil and + Matching is independent of case if `case-fold-search` is non-zero and FROM-STRING has no uppercase letters. Replacement transfers the case - pattern of the old text to the new text, if `case-replace' and - `case-fold-search' are non-nil and FROM-STRING has no uppercase + pattern of the old text to the new text, if `case-replace` and + `case-fold-search` are non-zero and FROM-STRING has no uppercase letters. (Transferring the case pattern means that if the old text matched is all caps, or capitalized, then its replacement is upcased or capitalized.) - Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace - only matches surrounded by word boundaries. + Third arg DELIMITED (prefix arg if interactive), if non-zero, means + replace only matches surrounded by word boundaries. - Fourth and fifth arg START and END specify the region to operate on. + Fourth and fifth arg START and END specify the region to operate on: + if these arguments are not provided, if the current region is + highlighted, operate on the contents of the region, otherwise, + operate from point to the end of the buffer. - To customize possible responses, change the "bindings" in `query-replace-map'. + To customize possible responses, change the "bindings" in + `query-replace-mode`. */ // TODO: region restriction int flags = SEARCH_FLAG_SMARTCASE; @@ -970,21 +973,23 @@ void do_query_replace(EditState *s, const char *search_str, void do_replace_string(EditState *s, const char *search_str, const char *replace_str, int argval) { - /*@ - replace_string(FROM-STRING, TO-STRING, DELIMITED=argval, START=point, END=end) + /*@CMD + ### `replace-string(string FROM-STRING, string TO-STRING, + int DELIMITED=argval, int START=point, int END=end)` Replace occurrences of FROM-STRING with TO-STRING. Preserve case in each match if `case-replace' and `case-fold-search' are non-zero and FROM-STRING has no uppercase letters. - (Preserving case means that if the string matched is all caps, or capitalized, - then its replacement is upcased or capitalized.) + (Preserving case means that if the string matched is all caps, or + capitalized, then its replacement is upcased or capitalized.) - In Transient Mark mode, if the mark is active, operate on the contents - of the region. Otherwise, operate from point to the end of the buffer. + Third arg DELIMITED (prefix arg if interactive), if non-zero, means + replace only matches surrounded by word boundaries. - Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace - only matches surrounded by word boundaries. - Fourth and fifth arg START and END specify the region to operate on. + Fourth and fifth arg START and END specify the region to operate on: + if these arguments are not provided, if the current region is + highlighted, operate on the contents of the region, otherwise, + operate from point to the end of the buffer. This function is usually the wrong thing to use in a qscript program. What you probably want is a loop like this: diff --git a/util.c b/util.c index 45a1059..e30c843 100644 --- a/util.c +++ b/util.c @@ -341,16 +341,18 @@ char *reduce_filename(char *dest, int size, const char *filename) char *file_load(const char *filename, int max_size, int *sizep) { /*@API - load a file in memory, return allocated block and size. + ### `char *file_load(const char *filename, int max_size, int *sizep);` - fail if file cannot be opened for reading - fail if file size is greater or equal to `max_size` (errno = ERANGE) - fail if memory cannot be allocated - otherwise load the file contents into a block of memory, + Load a file in memory, return allocated block and size. + + * fail if file cannot be opened for reading, + * fail if file size is greater or equal to `max_size` (`errno` = `ERANGE`), + * fail if memory cannot be allocated, + * otherwise load the file contents into a block of memory, null terminate the block and return a pointer to allocated memory along with the number of bytes read error codes are returned in `errno`. - memory should be freed with qe_free(). + memory should be freed with `qe_free()`. */ FILE *fp; long length;