[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs Makefile buffer.c qe-doc.html qe-doc.tex...
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs Makefile buffer.c qe-doc.html qe-doc.tex... |
Date: |
Thu, 20 Dec 2007 16:27:22 +0000 |
CVSROOT: /cvsroot/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 07/12/20 16:27:22
Modified files:
. : Makefile buffer.c qe-doc.html qe-doc.texi qe.c
qe.h qeconfig.h shell.c
Log message:
raw_save_buffer takes range and returns number of bytes written
added eb_write_buffer, returns number of bytes written
renamed save_buffer to eb_save_buffer, returns number of bytes written
added range in buffer_save method in EditBufferDataType
no longer reset undo log upon file saving
renamed do_save to do_save_buffer
added do_write_region (bound to C-X w)
renamed command execute-extended-command to execute-command
renamed command vc-toggle-read-only to toggle-read-only
fixed mark-whole-buffer to set point to start and mark to end of buffer
query-replace accept upper-case Y and N, and . for replace and quit.
shell passes universal argument to do_shell
bind next-error to C-X `
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/Makefile?cvsroot=qemacs&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/qemacs/buffer.c?cvsroot=qemacs&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe-doc.html?cvsroot=qemacs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe-doc.texi?cvsroot=qemacs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/qemacs/qeconfig.h?cvsroot=qemacs&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.29&r2=1.30
Patches:
Index: Makefile
===================================================================
RCS file: /cvsroot/qemacs/qemacs/Makefile,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- Makefile 18 Dec 2007 18:07:03 -0000 1.20
+++ Makefile 20 Dec 2007 16:27:21 -0000 1.21
@@ -402,5 +402,5 @@
make -C tests test
# documentation
-qe-doc.html: qe-doc.texi
- texi2html -monolithic -number $<
+qe-doc.html: qe-doc.texi Makefile
+ LANGUAGE=en_US LC_ALL=en_US.UTF-8 texi2html -monolithic -number $<
Index: buffer.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/buffer.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- buffer.c 20 Dec 2007 11:49:54 -0000 1.21
+++ buffer.c 20 Dec 2007 16:27:21 -0000 1.22
@@ -1398,30 +1398,46 @@
return ret;
}
-static int raw_save_buffer(EditBuffer *b, const char *filename)
+/* Write bytes between <start> and <end> to file filename,
+ * return bytes written or -1 if error
+ */
+static int raw_save_buffer(EditBuffer *b, int start, int end,
+ const char *filename)
{
- int fd, len, size;
+ int fd, len, size, written;
unsigned char buf[IOBUF_SIZE];
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd < 0)
return -1;
- size = b->total_size;
+ if (end < start) {
+ int tmp = start;
+ start = end;
+ end = tmp;
+ }
+ if (start < 0)
+ start = 0;
+ if (end > b->total_size)
+ end = b->total_size;
+ written = 0;
+ size = end - start;
while (size > 0) {
len = size;
if (len > IOBUF_SIZE)
len = IOBUF_SIZE;
- eb_read(b, b->total_size - size, buf, len);
+ eb_read(b, start, buf, len);
len = write(fd, buf, len);
if (len < 0) {
close(fd);
return -1;
}
+ written += len;
+ start += len;
size -= len;
}
close(fd);
- return 0;
+ return written;
}
static void raw_close_buffer(__unused__ EditBuffer *b)
@@ -1656,10 +1672,21 @@
*lp = bdt;
}
-/*
- * save buffer according to its data type
+/* Write buffer contents between <start> and <end> to file <filename>,
+ * return bytes written or -1 if error
+ */
+int eb_write_buffer(EditBuffer *b, int start, int end, const char *filename)
+{
+ if (!b->data_type->buffer_save)
+ return -1;
+
+ return b->data_type->buffer_save(b, start, end, filename);
+}
+
+/* Save buffer contents to buffer associated file, handle backups,
+ * return bytes written or -1 if error
*/
-int save_buffer(EditBuffer *b)
+int eb_save_buffer(EditBuffer *b)
{
int ret, mode;
char buf1[MAX_FILENAME_SIZE];
@@ -1678,9 +1705,10 @@
/* backup old file if present */
strcpy(buf1, filename);
strcat(buf1, "~");
+ // should check error code
rename(filename, buf1);
- ret = b->data_type->buffer_save(b, filename);
+ ret = b->data_type->buffer_save(b, 0, b->total_size, filename);
if (ret < 0)
return ret;
@@ -1690,9 +1718,9 @@
#endif
/* reset log */
/* CG: should not do this! */
- log_reset(b);
+ //log_reset(b);
b->modified = 0;
- return 0;
+ return ret;
}
/* invalidate buffer raw data */
Index: qe-doc.html
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe-doc.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- qe-doc.html 9 Dec 2006 18:37:12 -0000 1.3
+++ qe-doc.html 20 Dec 2007 16:27:22 -0000 1.4
@@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html401/loose.dtd">
<html>
-<!-- Created on December, 9 2006 by texi2html 1.76 -->
+<!-- Created on December, 20 2007 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <address@hidden> (original author)
Karl Berry <address@hidden>
@@ -340,7 +340,7 @@
C-x b : switch-to-buffer
C-x k : kill-buffer
C-x i : insert-file
-C-x C-q : vc-toggle-read-only
+C-x C-q : toggle-read-only
C-x C-b : list-buffers
</pre></td></tr></table>
<hr size="6">
@@ -387,7 +387,7 @@
</tr></table>
<h2 class="section"> 3.7 Command handling </h2>
-<table><tr><td> </td><td><pre class="example">M-x :
execute-extended-command
+<table><tr><td> </td><td><pre class="example">M-x :
execute-command
C-u : universal-argument
C-g : abort
C-x u, C-_ : undo
@@ -1725,7 +1725,7 @@
</tr></table>
<h1>About This Document</h1>
<p>
- This document was generated by <em>Olivier Guillaumin</em> on <em>December,
9 2006</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html
1.76</em></a>.
+ This document was generated by <em>Charlie Gordon</em> on <em>December, 20
2007</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html
1.76</em></a>.
</p>
<p>
The buttons in the navigation panels have the following meaning:
@@ -1827,7 +1827,7 @@
<hr size="1">
<p>
<font size="-1">
- This document was generated by <em>Olivier Guillaumin</em> on <em>December,
9 2006</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html
1.76</em></a>.
+ This document was generated by <em>Charlie Gordon</em> on <em>December, 20
2007</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html
1.76</em></a>.
</font>
<br>
Index: qe-doc.texi
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe-doc.texi,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- qe-doc.texi 9 Dec 2006 18:37:12 -0000 1.2
+++ qe-doc.texi 20 Dec 2007 16:27:22 -0000 1.3
@@ -45,7 +45,7 @@
@item Works on any VT100 terminals without termcap. UTF8 VT100 support
included with double width glyphs.
address@hidden X11 support. Support multiple proportionnal fonts at the same
time
address@hidden X11 support. Support multiple proportional fonts at the same time
(as XEmacs). X Input methods supported. Xft extension supported for
anti aliased font display.
@@ -173,7 +173,7 @@
C-x b : switch-to-buffer
C-x k : kill-buffer
C-x i : insert-file
-C-x C-q : vc-toggle-read-only
+C-x C-q : toggle-read-only
C-x C-b : list-buffers
@end example
@@ -188,7 +188,7 @@
@section Command handling
@example
-M-x : execute-extended-command
+M-x : execute-command
C-u : universal-argument
C-g : abort
C-x u, C-_ : undo
@@ -315,7 +315,7 @@
QEmacs fully supports the Unicode bidi algorithm.
-By default, in text editing mode, qemacs is not in bidirectionnal mode (it
+By default, in text editing mode, qemacs is not in bidirectional mode (it
may change soon). You can use 'C-x RET b' to toogle between bidi and normal
editing modes.
@@ -407,7 +407,7 @@
depend on HTML quirks.
@item Quite complete CSS2 support (including generated content and
counters).
address@hidden Full Bidirectionnal Unicode support.
address@hidden Full Bidirectional Unicode support.
@item Table support with both 'fixed' and 'auto' layout algorithms.
@item 'tty' and 'screen' CSS2 medias are supported.
@end itemize
Index: qe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- qe.c 15 Dec 2007 16:44:31 -0000 1.44
+++ qe.c 20 Dec 2007 16:27:22 -0000 1.45
@@ -1371,8 +1371,8 @@
void do_mark_whole_buffer(EditState *s)
{
- s->b->mark = 0;
- s->offset = s->b->total_size;
+ s->b->mark = s->b->total_size;
+ s->offset = 0;
}
EditBuffer *new_yank_buffer(void)
@@ -5142,7 +5142,7 @@
static void save_edit_cb(void *opaque, char *filename);
static void save_final(EditState *s);
-void do_save(EditState *s, int save_as)
+void do_save_buffer(EditState *s, int save_as)
{
char default_path[MAX_FILENAME_SIZE];
@@ -5175,15 +5175,28 @@
static void save_final(EditState *s)
{
- int ret;
- ret = save_buffer(s->b);
- if (ret == 0) {
- put_status(s, "Wrote %s", s->b->filename);
+ int res;
+
+ res = eb_save_buffer(s->b);
+ if (res >= 0) {
+ put_status(s, "Wrote %d bytes to %s", res, s->b->filename);
} else {
put_status(s, "Could not write %s", s->b->filename);
}
}
+void do_write_region(EditState *s, const char *filename)
+{
+ char absname[MAX_FILENAME_SIZE];
+ int res;
+
+ canonize_absolute_path(absname, sizeof(absname), filename);
+ res = eb_write_buffer(s->b, s->b->mark, s->offset, filename);
+ if (res >= 0) {
+ put_status(s, "Wrote %d bytes to %s", res, filename);
+ }
+}
+
typedef struct QuitState {
enum {
QS_ASK,
@@ -5236,7 +5249,7 @@
is->modified = 1;
break;
case QS_SAVE:
- save_buffer(b);
+ eb_save_buffer(b);
break;
}
}
@@ -5284,7 +5297,7 @@
is->state = QS_NOSAVE;
do_save:
b = is->b;
- save_buffer(b);
+ eb_save_buffer(b);
break;
case KEY_CTRL('g'):
/* abort */
@@ -5725,16 +5738,21 @@
QueryReplaceState *is = opaque;
switch (ch) {
+ case 'Y':
case 'y':
- case ' ':
+ case KEY_SPC:
query_replace_replace(is);
break;
case '!':
is->replace_all = 1;
break;
+ case 'N':
case 'n':
case KEY_DELETE:
break;
+ case '.':
+ query_replace_replace(is);
+ /* FALL THRU */
default:
query_replace_abort(is);
return;
@@ -6149,7 +6167,7 @@
void do_describe_key_briefly(EditState *s)
{
- put_status(s, "Describe key briefly:");
+ put_status(s, "Describe key: ");
key_ctx.describe_key = 1;
}
Index: qe.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- qe.h 20 Dec 2007 11:49:54 -0000 1.40
+++ qe.h 20 Dec 2007 16:27:22 -0000 1.41
@@ -703,7 +703,7 @@
typedef struct EditBufferDataType {
const char *name; /* name of buffer data type (text, image, ...) */
int (*buffer_load)(EditBuffer *b, FILE *f);
- int (*buffer_save)(EditBuffer *b, const char *filename);
+ int (*buffer_save)(EditBuffer *b, int start, int end, const char
*filename);
void (*buffer_close)(EditBuffer *b);
struct EditBufferDataType *next;
} EditBufferDataType;
@@ -756,7 +756,8 @@
int raw_load_buffer1(EditBuffer *b, FILE *f, int offset);
int mmap_buffer(EditBuffer *b, const char *filename);
-int save_buffer(EditBuffer *b);
+int eb_write_buffer(EditBuffer *b, int start, int end, const char *filename);
+int eb_save_buffer(EditBuffer *b);
// should rename to eb_set_buffername and eb_set_filename
void set_buffer_name(EditBuffer *b, const char *name1);
void set_filename(EditBuffer *b, const char *filename);
@@ -1405,7 +1406,8 @@
void do_switch_to_buffer(EditState *s, const char *bufname);
void do_break(EditState *s);
void do_insert_file(EditState *s, const char *filename);
-void do_save(EditState *s, int save_as);
+void do_save_buffer(EditState *s, int save_as);
+void do_write_region(EditState *s, const char *filename);
void do_isearch(EditState *s, int dir);
void do_refresh_complete(EditState *s);
void do_kill_buffer(EditState *s, const char *bufname1);
Index: qeconfig.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qeconfig.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- qeconfig.h 20 Dec 2007 11:45:12 -0000 1.18
+++ qeconfig.h 20 Dec 2007 16:27:22 -0000 1.19
@@ -56,8 +56,7 @@
CMD1( KEY_META('w'), KEY_NONE, "copy-region", do_kill_region, 0 )
CMD0( KEY_META('<'), KEY_CTRL_HOME, "beginning-of-buffer", do_bof )
CMD0( KEY_META('>'), KEY_CTRL_END, "end-of-buffer", do_eof )
- CMD_( KEY_META('x'), KEY_NONE, "execute-extended-command",
- do_execute_command,
+ CMD_( KEY_META('x'), KEY_NONE, "execute-command", do_execute_command,
"s{Command: }[command]|command|i") /* u? */
/* A-- should start negative universal argument */
CMD0( KEY_CTRL('u'), KEY_NONE, "universal-argument",
@@ -66,10 +65,13 @@
CMD_( KEY_META('y'), KEY_NONE, "yank-pop", do_yank_pop, "*")
/* do_tab will not change read only buffer */
CMD0( KEY_CTRL('i'), KEY_NONE, "tabulate", do_tab) /* u? */
- /* do_space ? */
+ //CMD0( KEY_SPC, KEY_NONE, "space", do_space) /* u? */
CMD_( KEY_CTRL('q'), KEY_NONE, "quoted-insert", do_quote, "*") /* u? */
- CMD1( KEY_CTRLX(KEY_CTRL('s')), KEY_NONE, "save-buffer", do_save, 0 )
- CMD1( KEY_CTRLX(KEY_CTRL('w')), KEY_NONE, "write-file", do_save, 1 )
+ CMD1( KEY_CTRLX(KEY_CTRL('s')), KEY_NONE, "save-buffer", do_save_buffer, 0
) /* u? */
+ // should use regular prompt system
+ CMD1( KEY_CTRLX(KEY_CTRL('w')), KEY_NONE, "write-file", do_save_buffer, 1
) /* u? */
+ CMD_( KEY_CTRLX('w'), KEY_NONE, "write-region", do_write_region,
+ "s{Write region to file: }[file]|file|") /* u? */
CMD0( KEY_CTRLX(KEY_CTRL('c')), KEY_NONE, "exit-qemacs", do_quit ) /* u? */
CMD_( KEY_CTRLX(KEY_CTRL('f')), KEY_NONE, "find-file", do_load,
"s{Find file: }[file]|file|") /* u? */
@@ -88,8 +90,8 @@
"s{Search forward: }|search|v")
CMDV( KEY_NONE, KEY_NONE, "search-backward", do_search_string, -1,
"s{Search backward: }|search|v")
- CMD1( KEY_CTRL('s'), KEY_NONE, "isearch-forward", do_isearch, 1 ) /* u? */
CMD1( KEY_CTRL('r'), KEY_NONE, "isearch-backward", do_isearch, -1 ) /* u?
*/
+ CMD1( KEY_CTRL('s'), KEY_NONE, "isearch-forward", do_isearch, 1 ) /* u? */
CMD_( KEY_META('%'), KEY_NONE, "query-replace", do_query_replace,
"*s{Query replace: }|search|s{With: }|replace|")
CMD_( KEY_META('r'), KEY_NONE, "replace-string", do_replace_string,
@@ -100,9 +102,9 @@
CMDV( KEY_META('g'), KEY_NONE, "goto-line", do_goto, 'l', "us{Goto line:
}v")
CMDV( KEY_CTRLX('g'), KEY_NONE, "goto-char", do_goto, 'c', "us{Goto char:
}v")
- CMD0( KEY_CTRLX(KEY_CTRL('q')), KEY_NONE, "vc-toggle-read-only",
+ CMD0( KEY_CTRLX(KEY_CTRL('q')), KEY_NONE, "toggle-read-only",
do_toggle_read_only)
- CMD0( KEY_META('~'), KEY_NONE, "not-modified", do_not_modified)
+ CMD0( KEY_META('~'), KEY_NONE, "not-modified", do_not_modified) /* u */
CMD_( KEY_META('q'), KEY_NONE, "fill-paragraph", do_fill_paragraph, "*")
CMD0( KEY_META('{'), KEY_NONE, "backward-paragraph", do_backward_paragraph)
CMD0( KEY_META('}'), KEY_NONE, "forward-paragraph", do_forward_paragraph)
Index: shell.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/shell.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- shell.c 18 Dec 2007 12:18:54 -0000 1.29
+++ shell.c 20 Dec 2007 16:27:22 -0000 1.30
@@ -1402,13 +1402,13 @@
/* compilation commands */
static CmdDef compile_commands[] = {
- CMD_( KEY_CTRLXRET('\r'), KEY_NONE, "shell", do_shell, "i")
+ CMD_( KEY_CTRLXRET('\r'), KEY_NONE, "shell", do_shell, "ui")
CMD_( KEY_CTRLX(KEY_CTRL('e')), KEY_NONE, "compile", do_compile,
"s{Compile command: }|compile|")
CMD1( KEY_CTRLX(KEY_CTRL('p')), KEY_NONE, "previous-error",
- do_compile_error, -1)
- CMD1( KEY_CTRLX(KEY_CTRL('n')), KEY_NONE, "next-error",
- do_compile_error, 1)
+ do_compile_error, -1) /* u */
+ CMD1( KEY_CTRLX(KEY_CTRL('n')), KEY_CTRLX('`'), "next-error",
+ do_compile_error, 1) /* u */
CMD_DEF_END,
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs Makefile buffer.c qe-doc.html qe-doc.tex...,
Charlie Gordon <=