Skip to content

Commit

Permalink
Tag most view mode incompatible functions in function names table.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfivet committed Jul 19, 2021
1 parent f0fe1ec commit 695b5d3
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 86 deletions.
14 changes: 9 additions & 5 deletions file.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* modified by Petri Kutvonen
*/

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -101,8 +102,9 @@ int insfile( int f, int n) {
if( restflag) /* don't allow this command if restricted */
return resterr() ;

if( curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly() ; /* we are in read only mode */
// if( curbp->b_mode & MDVIEW) /* don't allow this command if */
// return rdonly() ; /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;

status = newmlarg( &fname, "Insert file: ", sizeof( fname_t)) ;
if( status == TRUE) {
Expand All @@ -119,7 +121,7 @@ int insfile( int f, int n) {
/*
* Select a file for editing.
* 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
* the file, create a new buffer, read in the
* text, and switch to the new buffer.
Expand Down Expand Up @@ -476,8 +478,10 @@ int filewrite( int f, int n) {
* get called by "C-Z".
*/
int filesave( int f, int n) {
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */
// 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_flag & BFCHG) == 0) /* Return, no changes. */
return TRUE;
if (curbp->b_fname[0] == 0) { /* Must have a name. */
Expand Down
23 changes: 15 additions & 8 deletions line.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ void lchange(int flag)
*/
int insspace(int f, int n)
{
assert( !(curbp->b_mode & MDVIEW)) ;
linsert(n, ' ');
backchar(f, n);
return TRUE;
Expand Down Expand Up @@ -373,8 +374,9 @@ boolean linsert_byte( int n, int c) {

int linsert( int n, unicode_t c) {
assert( n >= 0) ;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */
// 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( n > 0) {
char utf8[ 4] ;
Expand Down Expand Up @@ -453,8 +455,10 @@ int lnewline(void)
int doto;
struct window *wp;

if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */
// 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 SCROLLCODE
lchange(WFHARD | WFINS);
#else
Expand Down Expand Up @@ -540,8 +544,9 @@ boolean ldelete( long n, boolean kflag) {
int chunk;
struct window *wp;

if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */
// if (curbp->b_mode & MDVIEW) /* don't allow this command if */
// return rdonly(); /* we are in read only mode */
assert( !(curbp->b_mode & MDVIEW)) ;

while( n > 0) {
dotp = curwp->w_dotp;
Expand Down Expand Up @@ -792,8 +797,10 @@ int yank(int f, int n)
char *sp; /* pointer into string to insert */
struct kill *kp; /* pointer into kill buffer */

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

{"", NULL, 0}
};
Expand Down
Loading

0 comments on commit 695b5d3

Please sign in to comment.