1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 15:26:23 -05:00

Tag most view mode incompatible functions in function names table.

This commit is contained in:
Renaud 2021-07-19 20:50:32 +08:00
parent f0fe1ec194
commit 695b5d37da
8 changed files with 138 additions and 86 deletions

14
file.c
View File

@ -11,6 +11,7 @@
* modified by Petri Kutvonen * modified by Petri Kutvonen
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -101,8 +102,9 @@ int insfile( int f, int n) {
if( restflag) /* don't allow this command if restricted */ if( restflag) /* don't allow this command if restricted */
return resterr() ; return resterr() ;
if( curbp->b_mode & MDVIEW) /* don't allow this command if */ // if( curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly() ; /* we are in read only mode */ // return rdonly() ; /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
status = newmlarg( &fname, "Insert file: ", sizeof( fname_t)) ; status = newmlarg( &fname, "Insert file: ", sizeof( fname_t)) ;
if( status == TRUE) { if( status == TRUE) {
@ -119,7 +121,7 @@ int insfile( int f, int n) {
/* /*
* Select a file for editing. * Select a file for editing.
* Look around to see if you can find the * Look around to see if you can find the
* fine in another buffer; if you can find it * file in another buffer; if you can find it
* just switch to the buffer. If you cannot find * just switch to the buffer. If you cannot find
* the file, create a new buffer, read in the * the file, create a new buffer, read in the
* text, and switch to the new buffer. * text, and switch to the new buffer.
@ -476,8 +478,10 @@ int filewrite( int f, int n) {
* get called by "C-Z". * get called by "C-Z".
*/ */
int filesave( int f, int n) { int filesave( int f, int n) {
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if ((curbp->b_flag & BFCHG) == 0) /* Return, no changes. */ if ((curbp->b_flag & BFCHG) == 0) /* Return, no changes. */
return TRUE; return TRUE;
if (curbp->b_fname[0] == 0) { /* Must have a name. */ if (curbp->b_fname[0] == 0) { /* Must have a name. */

23
line.c
View File

@ -251,6 +251,7 @@ void lchange(int flag)
*/ */
int insspace(int f, int n) int insspace(int f, int n)
{ {
assert( !(curbp->b_mode & MDVIEW)) ;
linsert(n, ' '); linsert(n, ' ');
backchar(f, n); backchar(f, n);
return TRUE; return TRUE;
@ -373,8 +374,9 @@ boolean linsert_byte( int n, int c) {
int linsert( int n, unicode_t c) { int linsert( int n, unicode_t c) {
assert( n >= 0) ; assert( n >= 0) ;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if( n > 0) { if( n > 0) {
char utf8[ 4] ; char utf8[ 4] ;
@ -453,8 +455,10 @@ int lnewline(void)
int doto; int doto;
struct window *wp; struct window *wp;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
#if SCROLLCODE #if SCROLLCODE
lchange(WFHARD | WFINS); lchange(WFHARD | WFINS);
#else #else
@ -540,8 +544,9 @@ boolean ldelete( long n, boolean kflag) {
int chunk; int chunk;
struct window *wp; struct window *wp;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
while( n > 0) { while( n > 0) {
dotp = curwp->w_dotp; dotp = curwp->w_dotp;
@ -792,8 +797,10 @@ int yank(int f, int n)
char *sp; /* pointer into string to insert */ char *sp; /* pointer into string to insert */
struct kill *kp; /* pointer into kill buffer */ struct kill *kp; /* pointer into kill buffer */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if (n < 0) if (n < 0)
return FALSE; return FALSE;
/* make sure there is something to yank */ /* make sure there is something to yank */

56
names.c
View File

@ -38,11 +38,11 @@ const name_bind names[] = {
{"beginning-of-line", (fnp_t) gotobol, 0} , {"beginning-of-line", (fnp_t) gotobol, 0} ,
{"bind-to-key", bindtokey, 0} , {"bind-to-key", bindtokey, 0} ,
{"buffer-position", showcpos, 0} , {"buffer-position", showcpos, 0} ,
{"case-region-lower", lowerregion, 0} , {"case-region-lower", lowerregion, 1} ,
{"case-region-upper", upperregion, 0} , {"case-region-upper", upperregion, 1} ,
{"case-word-capitalize", capword, 0} , {"case-word-capitalize", capword, 1} ,
{"case-word-lower", lowerword, 0} , {"case-word-lower", lowerword, 1} ,
{"case-word-upper", upperword, 0} , {"case-word-upper", upperword, 1} ,
{"change-file-name", filename, 0} , {"change-file-name", filename, 0} ,
{"change-screen-size", newsize, 0} , {"change-screen-size", newsize, 0} ,
{"change-screen-width", newwidth, 0} , {"change-screen-width", newwidth, 0} ,
@ -53,26 +53,26 @@ const name_bind names[] = {
{"count-words", wordcount, 0} , {"count-words", wordcount, 0} ,
#endif #endif
{"ctlx-prefix", cex, 0} , {"ctlx-prefix", cex, 0} ,
{"delete-blank-lines", deblank, 0} , {"delete-blank-lines", deblank, 1} ,
{"delete-buffer", killbuffer, 0} , {"delete-buffer", killbuffer, 0} ,
{"delete-mode", delmode, 0} , {"delete-mode", delmode, 0} ,
{"delete-global-mode", delgmode, 0} , {"delete-global-mode", delgmode, 0} ,
{"delete-next-character", forwdel, 0} , {"delete-next-character", forwdel, 1} ,
{"delete-next-word", delfword, 0} , {"delete-next-word", delfword, 1} ,
{"delete-other-windows", onlywind, 0} , {"delete-other-windows", onlywind, 0} ,
{"delete-previous-character", backdel, 0} , {"delete-previous-character", backdel, 1} ,
{"delete-previous-word", delbword, 0} , {"delete-previous-word", delbword, 1} ,
{"delete-window", delwind, 0} , {"delete-window", delwind, 0} ,
{"describe-bindings", desbind, 0} , {"describe-bindings", desbind, 0} ,
{"describe-key", deskey, 0} , {"describe-key", deskey, 0} ,
#if AEDIT #if AEDIT
{"detab-line", detab, 0} , {"detab-line", detab, 1} ,
#endif #endif
{"end-macro", ctlxrp, 0} , {"end-macro", ctlxrp, 0} ,
{"end-of-file", (fnp_t) gotoeob, 0} , {"end-of-file", (fnp_t) gotoeob, 0} ,
{"end-of-line", (fnp_t) gotoeol, 0} , {"end-of-line", (fnp_t) gotoeol, 0} ,
#if AEDIT #if AEDIT
{"entab-line", entab, 0} , {"entab-line", entab, 1} ,
#endif #endif
{"exchange-point-and-mark", (fnp_t) swapmark, 0} , {"exchange-point-and-mark", (fnp_t) swapmark, 0} ,
{"execute-buffer", execbuf, 0} , {"execute-buffer", execbuf, 0} ,
@ -128,7 +128,7 @@ const name_bind names[] = {
#if WORDPRO #if WORDPRO
{"fill-paragraph", fillpara, 1} , {"fill-paragraph", fillpara, 1} ,
#endif #endif
{"filter-buffer", filter_buffer, 0} , {"filter-buffer", filter_buffer, 1} ,
{"find-file", filefind, 0} , {"find-file", filefind, 0} ,
{"forward-character", (fnp_t) forwchar, 0} , {"forward-character", (fnp_t) forwchar, 0} ,
{"goto-line", gotoline, 0} , {"goto-line", gotoline, 0} ,
@ -144,8 +144,8 @@ const name_bind names[] = {
#if ISRCH #if ISRCH
{"incremental-search", fisearch, 0} , {"incremental-search", fisearch, 0} ,
#endif #endif
{"insert-file", insfile, 0} , {"insert-file", insfile, 1} ,
{"insert-space", insspace, 0} , {"insert-space", insspace, 1} ,
{"insert-string", istring, 1} , {"insert-string", istring, 1} ,
#if WORDPRO #if WORDPRO
#if PKCODE #if PKCODE
@ -153,15 +153,15 @@ const name_bind names[] = {
#endif #endif
{"kill-paragraph", killpara, 1} , {"kill-paragraph", killpara, 1} ,
#endif #endif
{"kill-region", killregion, 0} , {"kill-region", killregion, 1} ,
{"kill-to-end-of-line", killtext, 0} , {"kill-to-end-of-line", killtext, 1} ,
{"list-buffers", listbuffers, 0} , {"list-buffers", listbuffers, 0} ,
{"meta-prefix", metafn, 0} , {"meta-prefix", metafn, 0} ,
{"move-window-down", mvdnwind, 0} , {"move-window-down", mvdnwind, 0} ,
{"move-window-up", mvupwind, 0} , {"move-window-up", mvupwind, 0} ,
{"name-buffer", namebuffer, 0} , {"name-buffer", namebuffer, 0} ,
{"newline", insert_newline, 0} , {"newline", insert_newline, 1} ,
{"newline-and-indent", indent, 0} , {"newline-and-indent", indent, 1} ,
{"next-buffer", nextbuffer, 0} , {"next-buffer", nextbuffer, 0} ,
{"next-line", (fnp_t) forwline, 0} , {"next-line", (fnp_t) forwline, 0} ,
{"next-page", (fnp_t) forwpage, 0} , {"next-page", (fnp_t) forwpage, 0} ,
@ -171,7 +171,7 @@ const name_bind names[] = {
{"next-window", nextwind, 0} , {"next-window", nextwind, 0} ,
{"next-word", forwword, 0} , {"next-word", forwword, 0} ,
{"nop", nullproc, 0} , {"nop", nullproc, 0} ,
{"open-line", openline, 0} , {"open-line", openline, 1} ,
{"overwrite-string", ovstring, 0} , {"overwrite-string", ovstring, 0} ,
{"pipe-command", pipecmd, 0} , {"pipe-command", pipecmd, 0} ,
{"previous-line", (fnp_t) backline, 0} , {"previous-line", (fnp_t) backline, 0} ,
@ -181,21 +181,21 @@ const name_bind names[] = {
#endif #endif
{"previous-window", prevwind, 0} , {"previous-window", prevwind, 0} ,
{"previous-word", backword, 0} , {"previous-word", backword, 0} ,
{"query-replace-string", qreplace, 0} , {"query-replace-string", qreplace, 1} ,
{"quick-exit", quickexit, 0} , {"quick-exit", quickexit, 0} ,
{"quote-character", quote, 0} , {"quote-character", quote, 1} ,
{"read-file", fileread, 0} , {"read-file", fileread, 1} ,
{"redraw-display", reposition, 0} , {"redraw-display", reposition, 0} ,
{"resize-window", resize, 0} , {"resize-window", resize, 0} ,
{"restore-window", restwnd, 0} , {"restore-window", restwnd, 0} ,
{"replace-string", sreplace, 0} , {"replace-string", sreplace, 1} ,
#if ISRCH #if ISRCH
{"reverse-incremental-search", risearch, 0} , {"reverse-incremental-search", risearch, 0} ,
#endif #endif
#if PROC #if PROC
{"run", execproc, 0} , {"run", execproc, 0} ,
#endif #endif
{"save-file", filesave, 0} , {"save-file", filesave, 1} ,
{"save-window", savewnd, 0} , {"save-window", savewnd, 0} ,
{"scroll-next-up", scrnextup, 0} , {"scroll-next-up", scrnextup, 0} ,
{"scroll-next-down", scrnextdw, 0} , {"scroll-next-down", scrnextdw, 0} ,
@ -215,9 +215,9 @@ const name_bind names[] = {
#if BSD | SVR4 #if BSD | SVR4
{"suspend-emacs", bktoshell, 0} , {"suspend-emacs", bktoshell, 0} ,
#endif #endif
{"transpose-characters", (fnp_t) twiddle, 0} , {"transpose-characters", (fnp_t) twiddle, 1} ,
#if AEDIT #if AEDIT
{"trim-line", trim, 0} , {"trim-line", trim, 1} ,
#endif #endif
{"unbind-key", unbindkey, 0} , {"unbind-key", unbindkey, 0} ,
{"universal-argument", unarg, 0} , {"universal-argument", unarg, 0} ,
@ -227,7 +227,7 @@ const name_bind names[] = {
{"wrap-word", wrapword, 0} , {"wrap-word", wrapword, 0} ,
{"write-file", filewrite, 0} , {"write-file", filewrite, 0} ,
{"write-message", writemsg, 0} , {"write-message", writemsg, 0} ,
{"yank", yank, 0} , {"yank", yank, 1} ,
{"", NULL, 0} {"", NULL, 0}
}; };

View File

@ -9,6 +9,7 @@
* Modified by Petri Kutvonen * Modified by Petri Kutvonen
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -226,8 +227,9 @@ boolean twiddle( int f, int n) {
int len ; int len ;
boolean eof_f = FALSE ; boolean eof_f = FALSE ;
if( curbp->b_mode & MDVIEW) /* don't allow this command if */ // if( curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly() ; /* we are in read only mode */ // return rdonly() ; /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
len = llength( curwp->w_dotp) ; len = llength( curwp->w_dotp) ;
if( len < 2 || curwp->w_doto == 0) /* at least 2 chars & not bol */ if( len < 2 || curwp->w_doto == 0) /* at least 2 chars & not bol */
@ -261,11 +263,13 @@ boolean twiddle( int f, int n) {
*/ */
int quote(int f, int n) int quote(int f, int n)
{ {
int c; // int c;
//
// if (curbp->b_mode & MDVIEW) /* don't allow this command if */
// return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ int c = tgetc();
return rdonly(); /* we are in read only mode */
c = tgetc();
if (n < 0) if (n < 0)
return FALSE; return FALSE;
if (n == 0) if (n == 0)
@ -315,8 +319,10 @@ int detab(int f, int n)
{ {
int inc; /* increment to next line [sgn(n)] */ int inc; /* increment to next line [sgn(n)] */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if (f == FALSE) if (f == FALSE)
n = 1; n = 1;
@ -363,8 +369,10 @@ int entab(int f, int n)
int inc; /* increment to next line [sgn(n)] */ int inc; /* increment to next line [sgn(n)] */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if (f == FALSE) if (f == FALSE)
n = 1; n = 1;
@ -436,8 +444,10 @@ int trim(int f, int n)
{ {
int inc; /* increment to next line [sgn(n)] */ int inc; /* increment to next line [sgn(n)] */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if (f == FALSE) if (f == FALSE)
n = 1; n = 1;
@ -483,8 +493,10 @@ int openline(int f, int n)
int i; int i;
int s; int s;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if (n < 0) if (n < 0)
return FALSE; return FALSE;
if (n == 0) if (n == 0)
@ -504,8 +516,10 @@ int openline(int f, int n)
*/ */
int insert_newline(int f, int n) int insert_newline(int f, int n)
{ {
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if (n < 0) if (n < 0)
return FALSE; return FALSE;
@ -610,8 +624,10 @@ int deblank(int f, int n)
struct line *lp2; struct line *lp2;
long nld; long nld;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
lp1 = curwp->w_dotp; lp1 = curwp->w_dotp;
while (llength(lp1) == 0 && (lp2 = lback(lp1)) != curbp->b_linep) while (llength(lp1) == 0 && (lp2 = lback(lp1)) != curbp->b_linep)
lp1 = lp2; lp1 = lp2;
@ -638,8 +654,10 @@ int indent( int f, int n) {
int nicol ; int nicol ;
int i ; int i ;
if( curbp->b_mode & MDVIEW) /* don't allow this command if */ // if( curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly() ; /* we are in read only mode */ // return rdonly() ; /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if( n < 0) if( n < 0)
return FALSE ; return FALSE ;
@ -676,8 +694,10 @@ int indent( int f, int n) {
* of text if typed with a big argument. Normally bound to "C-D". * of text if typed with a big argument. Normally bound to "C-D".
*/ */
int forwdel( int f, int n) { int forwdel( int f, int n) {
if( curbp->b_mode & MDVIEW) /* don't allow this command if */ // if( curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly() ; /* we are in read only mode */ // return rdonly() ; /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if( n == 0) if( n == 0)
return TRUE ; return TRUE ;
@ -700,8 +720,10 @@ int forwdel( int f, int n) {
* both "RUBOUT" and "C-H". * both "RUBOUT" and "C-H".
*/ */
int backdel( int f, int n) { int backdel( int f, int n) {
if( curbp->b_mode & MDVIEW) /* don't allow this command if */ // if( curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly() ; /* we are in read only mode */ // return rdonly() ; /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if( n == 0) if( n == 0)
return TRUE ; return TRUE ;
@ -730,8 +752,10 @@ int killtext(int f, int n)
struct line *nextp; struct line *nextp;
long chunk; long chunk;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if ((lastflag & CFKILL) == 0) /* Clear kill buffer if */ if ((lastflag & CFKILL) == 0) /* Clear kill buffer if */
kdelete(); /* last wasn't a kill. */ kdelete(); /* last wasn't a kill. */
thisflag |= CFKILL; thisflag |= CFKILL;

View File

@ -10,6 +10,7 @@
* Modified by Petri Kutvonen * Modified by Petri Kutvonen
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include "buffer.h" #include "buffer.h"
@ -30,8 +31,10 @@ int killregion(int f, int n)
int s; int s;
struct region region; struct region region;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if ((s = getregion(&region)) != TRUE) if ((s = getregion(&region)) != TRUE)
return s; return s;
if ((lastflag & CFKILL) == 0) /* This is a kill type */ if ((lastflag & CFKILL) == 0) /* This is a kill type */
@ -94,8 +97,10 @@ int lowerregion(int f, int n)
int s; int s;
struct region region; struct region region;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if ((s = getregion(&region)) != TRUE) if ((s = getregion(&region)) != TRUE)
return s; return s;
lchange(WFHARD); lchange(WFHARD);
@ -131,8 +136,10 @@ int upperregion(int f, int n)
int s; int s;
struct region region; struct region region;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if ((s = getregion(&region)) != TRUE) if ((s = getregion(&region)) != TRUE)
return s; return s;
lchange(WFHARD); lchange(WFHARD);

View File

@ -60,6 +60,7 @@
* Modified by Petri Kutvonen * Modified by Petri Kutvonen
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -832,12 +833,13 @@ static int replaces(int kind, int f, int n)
struct line *lastline; /* position of last replace and */ struct line *lastline; /* position of last replace and */
int lastoff; /* offset (for 'u' query option) */ int lastoff; /* offset (for 'u' query option) */
/* rfi */ ///* rfi */
lastline = NULL ; lastline = NULL ;
lastoff = 0 ; lastoff = 0 ;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ // if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ // return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
/* Check for negative repetitions. /* Check for negative repetitions.
*/ */

View File

@ -8,6 +8,7 @@
* Modified by Petri Kutvonen * Modified by Petri Kutvonen
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -289,8 +290,9 @@ int filter_buffer( int f, int n) {
if( restflag) if( restflag)
return resterr() ; return resterr() ;
if( curbp->b_mode & MDVIEW) /* don't allow this command if */ // if( curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly() ; /* we are in read only mode */ // return rdonly() ; /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
/* get the filter name and its args */ /* get the filter name and its args */
s = newmlarg( &mlarg, "#", 0) ; s = newmlarg( &mlarg, "#", 0) ;

22
word.c
View File

@ -152,8 +152,10 @@ static boolean uniflip( boolean toupper_f) { /* flip unicode case and forward */
} }
static boolean capcapword( int n, boolean first_f, boolean rest_f) { static boolean capcapword( int n, boolean first_f, boolean rest_f) {
if( curbp->b_mode & MDVIEW) /* don't allow this command if */ // if( curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly() ; /* we are in read only mode */ // return rdonly() ; /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;
if( n < 0) if( n < 0)
return FALSE ; return FALSE ;
@ -213,9 +215,11 @@ int delfword(int f, int n)
int c; /* temp char */ int c; /* temp char */
long size; /* # of chars to delete */ long size; /* # of chars to delete */
/* don't allow this command if we are in read only mode */ // /* don't allow this command if we are in read only mode */
if (curbp->b_mode & MDVIEW) // if (curbp->b_mode & MDVIEW)
return rdonly(); // return rdonly();
assert( !(curbp->b_mode & MDVIEW)) ;
/* ignore the command if there is a negative argument */ /* ignore the command if there is a negative argument */
if (n < 0) if (n < 0)
@ -299,9 +303,11 @@ int delbword(int f, int n)
{ {
long size; long size;
/* don't allow this command if we are in read only mode */ // /* don't allow this command if we are in read only mode */
if (curbp->b_mode & MDVIEW) // if (curbp->b_mode & MDVIEW)
return rdonly(); // return rdonly();
assert( !(curbp->b_mode & MDVIEW)) ;
/* ignore the command if there is a nonpositive argument */ /* ignore the command if there is a nonpositive argument */
if (n <= 0) if (n <= 0)