diff --git a/src/nano.c b/src/nano.c index 0acd847..193ce0c 100644 --- a/src/nano.c +++ b/src/nano.c @@ -638,7 +638,7 @@ void die_save_file(const char *die_filename, struct stat *die_stat) /* If we're using restricted mode, don't write any emergency backup * files, since that would allow reading from or writing to files * not specified on the command line. */ - if (ISSET(RESTRICTED)) + if (ISSET(RESTRICTED) || ISSET(NO_DOTSAVE)) return; /* If we can't save, we have really bad problems, but we might as @@ -848,6 +848,7 @@ void usage(void) print_opt(_("-Y "), _("--syntax="), N_("Syntax definition to use for coloring")); #endif + print_opt("-Z", "--nodotsave", N_("Do not create \".save\" file")); print_opt("-c", "--constantshow", N_("Constantly show cursor position")); print_opt("-d", "--rebinddelete", N_("Fix Backspace/Delete confusion problem")); @@ -1921,6 +1922,7 @@ int main(int argc, char **argv) #ifndef DISABLE_COLOR {"syntax", 1, NULL, 'Y'}, #endif + {"nodotsave", 0, NULL, 'Z'}, {"constantshow", 0, NULL, 'c'}, {"rebinddelete", 0, NULL, 'd'}, #ifdef ENABLE_BROWSER @@ -2014,7 +2016,7 @@ int main(int argc, char **argv) while ((optchr = getopt_long(argc, argv, - "ABC:DEFGHIKLNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$", + "ABC:DEFGHIKLNOPQ:RST:UVWX:Y:Zabcdefghijklmno:pqr:s:tuvwxz$", long_options, NULL)) != -1) { switch (optchr) { case 'a': @@ -2121,6 +2123,9 @@ int main(int argc, char **argv) syntaxstr = mallocstrcpy(syntaxstr, optarg); break; #endif + case 'Z': + SET(NO_DOTSAVE); + break; case 'c': SET(CONSTANT_SHOW); break; diff --git a/src/nano.h b/src/nano.h index 1a030b6..b089769 100644 --- a/src/nano.h +++ b/src/nano.h @@ -519,7 +519,8 @@ enum JUSTIFY_TRIM, SHOW_CURSOR, LINE_NUMBERS, - NO_PAUSES + NO_PAUSES, + NO_DOTSAVE }; /* Flags for the menus in which a given function should be present. */ diff --git a/src/rcfile.c b/src/rcfile.c index 7d16031..a743126 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -60,6 +60,7 @@ static const rcoption rcopts[] = { {"multibuffer", MULTIBUFFER}, #endif {"nohelp", NO_HELP}, + {"nodotsave", NO_DOTSAVE}, {"nonewlines", NO_NEWLINES}, {"nopauses", NO_PAUSES}, #ifndef DISABLE_WRAPPING diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc index 5320872..265aea5 100644 --- a/syntax/nanorc.nanorc +++ b/syntax/nanorc.nanorc @@ -7,7 +7,7 @@ comment "#" icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|comment|magic|linter|i?color|extendsyntax).*$" # Keywords -icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cut|fill[[:space:]]+[[:digit:]]+|historylog|justifytrim|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[[:digit:]]+|tabstospaces|tempfile|unix|view|wordbounds)\>" +icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cut|fill[[:space:]]+[[:digit:]]+|historylog|justifytrim|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nodotsave|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[[:digit:]]+|tabstospaces|tempfile|unix|view|wordbounds)\>" icolor yellow "^[[:space:]]*set[[:space:]]+((function|key|number|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>" "[[:space:]]+[[:digit:]]+$" icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+" icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>address@hidden|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"