1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-09-20 12:45:55 -04:00

Make use of logger to replace sequences of TTbeep-mlwrite-return.

This commit is contained in:
Renaud 2015-01-20 22:34:28 +08:00
parent 36f24332c2
commit 4ca3f53385
5 changed files with 27 additions and 44 deletions

View File

@ -123,11 +123,10 @@ depend: ${SRC}
# DO NOT DELETE THIS LINE -- make depend uses it # DO NOT DELETE THIS LINE -- make depend uses it
ansi.o: ansi.c estruct.h ansi.o: ansi.c estruct.h
basic.o: basic.c basic.h buffer.h crypt.h line.h utf8.h display.h \ basic.o: basic.c basic.h buffer.h crypt.h line.h utf8.h estruct.h input.h \
estruct.h input.h bind.h random.h terminal.h defines.h retcode.h \ bind.h log.h retcode.h random.h terminal.h defines.h window.h
window.h
bindable.o: bindable.c bindable.h defines.h buffer.h crypt.h line.h \ bindable.o: bindable.c bindable.h defines.h buffer.h crypt.h line.h \
utf8.h display.h estruct.h file.h retcode.h input.h bind.h lock.h \ utf8.h display.h estruct.h file.h retcode.h input.h bind.h log.h lock.h \
terminal.h terminal.h
bind.o: bind.c bind.h estruct.h bindable.h buffer.h crypt.h line.h utf8.h \ bind.o: bind.c bind.h estruct.h bindable.h buffer.h crypt.h line.h utf8.h \
display.h ebind.h exec.h retcode.h file.h flook.h input.h names.h \ display.h ebind.h exec.h retcode.h file.h flook.h input.h names.h \
@ -148,7 +147,7 @@ exec.o: exec.c exec.h retcode.h buffer.h crypt.h line.h utf8.h bind.h \
display.h estruct.h eval.h file.h flook.h input.h random.h window.h \ display.h estruct.h eval.h file.h flook.h input.h random.h window.h \
defines.h defines.h
execute.o: execute.c execute.h estruct.h bind.h random.h display.h file.h \ execute.o: execute.c execute.h estruct.h bind.h random.h display.h file.h \
buffer.h crypt.h line.h utf8.h retcode.h terminal.h defines.h window.h buffer.h crypt.h line.h utf8.h retcode.h log.h window.h defines.h
file.o: file.c file.h buffer.h crypt.h line.h utf8.h retcode.h defines.h \ file.o: file.c file.h buffer.h crypt.h line.h utf8.h retcode.h defines.h \
estruct.h execute.h fileio.h input.h bind.h lock.h log.h window.h estruct.h execute.h fileio.h input.h bind.h lock.h log.h window.h
fileio.o: fileio.c fileio.h crypt.h retcode.h defines.h fileio.o: fileio.c fileio.h crypt.h retcode.h defines.h

29
basic.c
View File

@ -19,10 +19,10 @@
#include <stdlib.h> #include <stdlib.h>
#include "buffer.h" #include "buffer.h"
#include "display.h"
#include "estruct.h" #include "estruct.h"
#include "input.h" #include "input.h"
#include "line.h" #include "line.h"
#include "log.h"
#include "random.h" #include "random.h"
#include "terminal.h" #include "terminal.h"
#include "utf8.h" #include "utf8.h"
@ -94,17 +94,16 @@ int gotoeol(int f, int n)
*/ */
int gotoline(int f, int n) int gotoline(int f, int n)
{ {
int status; int status ;
char arg[NSTRING]; /* Buffer to hold argument. */ char arg[ NSTRING] ; /* Buffer to hold argument. */
/* Get an argument if one doesnt exist. */ /* Get an argument if one doesnt exist. */
if (f == FALSE) { if( f == FALSE) {
if ((status = status = mlreply( "Line to GOTO: ", arg, sizeof arg) ;
mlreply("Line to GOTO: ", arg, NSTRING)) != TRUE) { if( status != TRUE)
mlwrite("(Aborted)"); return logger( status, FALSE, "(Aborted)") ;
return status;
} n = atoi( arg) ;
n = atoi(arg);
} }
/* Handle the case where the user may be passed something like this: /* Handle the case where the user may be passed something like this:
* em filename + * em filename +
@ -314,8 +313,7 @@ int setmark(int f, int n)
{ {
curwp->w_markp = curwp->w_dotp; curwp->w_markp = curwp->w_dotp;
curwp->w_marko = curwp->w_doto; curwp->w_marko = curwp->w_doto;
mlwrite("(Mark set)"); return logger( TRUE, FALSE, "(Mark set)") ;
return TRUE;
} }
/* /*
@ -329,10 +327,9 @@ int swapmark(int f, int n)
struct line *odotp; struct line *odotp;
int odoto; int odoto;
if (curwp->w_markp == NULL) { if( curwp->w_markp == NULL)
mlwrite("No mark in this window"); return logger( FALSE, FALSE, "No mark in this window") ;
return FALSE;
}
odotp = curwp->w_dotp; odotp = curwp->w_dotp;
odoto = curwp->w_doto; odoto = curwp->w_doto;
curwp->w_dotp = curwp->w_markp; curwp->w_dotp = curwp->w_markp;

View File

@ -10,6 +10,7 @@
#include "estruct.h" #include "estruct.h"
#include "file.h" #include "file.h"
#include "input.h" #include "input.h"
#include "log.h"
#include "lock.h" #include "lock.h"
#include "terminal.h" #include "terminal.h"
@ -147,12 +148,9 @@ int ctlxe(int f, int n)
* Beep the beeper. Kill off any keyboard macro, etc., that is in progress. * Beep the beeper. Kill off any keyboard macro, etc., that is in progress.
* Sometimes called as a routine, to do general aborting of stuff. * Sometimes called as a routine, to do general aborting of stuff.
*/ */
int ctrlg(int f, int n) int ctrlg( int f, int n) {
{ kbdmode = STOP ;
TTbeep(); return logger( ABORT, TRUE, "(Aborted)") ;
kbdmode = STOP;
mlwrite("(Aborted)");
return ABORT;
} }
/* user function that does NOTHING */ /* user function that does NOTHING */

View File

@ -8,7 +8,7 @@
#include "random.h" #include "random.h"
#include "display.h" #include "display.h"
#include "file.h" #include "file.h"
#include "terminal.h" #include "log.h"
#include "window.h" #include "window.h"
int gasave = 256 ; /* global ASAVE size */ int gasave = 256 ; /* global ASAVE size */
@ -100,9 +100,8 @@ int execute(int c, int f, int n)
lastflag = thisflag; lastflag = thisflag;
return status; return status;
} }
TTbeep();
mlwrite("(Key not bound)"); /* complain */ lastflag = 0 ; /* Fake last flags. */
lastflag = 0; /* Fake last flags. */ return logger( FALSE, TRUE, "(Key not bound)") ; /* Complain */
return FALSE;
} }

14
log.c
View File

@ -15,23 +15,13 @@ boolean (*logger)( boolean, boolean, const char *, ...) = logit ;
* tell the user that this command is illegal while we are in * tell the user that this command is illegal while we are in
* VIEW (read-only) mode * VIEW (read-only) mode
*/ */
boolean rdonly(void) boolean rdonly( void) {
{
/* TTbeep();
mlwrite("(Key illegal in VIEW mode)");
return FALSE;
*/
return logger( FALSE, TRUE, "(Key illegal in VIEW mode)"); return logger( FALSE, TRUE, "(Key illegal in VIEW mode)");
} }
boolean resterr(void) boolean resterr( void) {
{
/* TTbeep();
mlwrite("(That command is RESTRICTED)");
return FALSE;
*/
return logger( FALSE, TRUE, "(That command is RESTRICTED)"); return logger( FALSE, TRUE, "(That command is RESTRICTED)");
} }