Adding the option --unix (and 'set unix'),
to save a file by default in Unix format. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5342 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
95e1f55574
Коммит
70cbbda87c
@ -1,3 +1,8 @@
|
||||
2015-08-04 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/nano.c (main), src/files.c (read_file), src/rcfile.c,
|
||||
doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Add
|
||||
the option --unix, to save a file by default in Unix format.
|
||||
|
||||
2015-08-03 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/rcfile.c (parse_binding): Check the value of shortcut->toggle
|
||||
only if it actually is a toggle. Found with valgrind.
|
||||
|
@ -222,6 +222,11 @@ Use this alternative spell checker command.
|
||||
Always save a changed buffer without prompting. Same as Pico's \fB\-t\fP
|
||||
option.
|
||||
.TP
|
||||
.BR \-u ", " \-\-unix
|
||||
Save a file by default in Unix format. This overrides nano's
|
||||
default behavior of saving a file in the format that it had.
|
||||
(This option has no effect when you also use \fB\-\-noconvert\fR.)
|
||||
.TP
|
||||
.BR \-v ", " \-\-view
|
||||
View-file (read-only) mode.
|
||||
.TP
|
||||
|
@ -242,6 +242,11 @@ Valid color names for foreground and background are:
|
||||
.BR white , \ black , \ red , \ blue , \ green , \ yellow , \ magenta ", and " cyan .
|
||||
And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
|
||||
.TP
|
||||
.B set unix
|
||||
Save a file by default in Unix format. This overrides nano's
|
||||
default behavior of saving a file in the format that it had.
|
||||
(This option has no effect when you also use \fBset noconvert\fR.)
|
||||
.TP
|
||||
.B set view
|
||||
Disallow file modification.
|
||||
.TP
|
||||
|
@ -6,7 +6,7 @@ syntax "nanorc" "\.?nanorc$"
|
||||
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$"
|
||||
|
||||
# Keywords
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const(antshow)?|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|pos(ition)?log|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|view|wordbounds)\>"
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const(antshow)?|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|pos(ition)?log|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|unix|view|wordbounds)\>"
|
||||
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor|statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace)[[:space:]]+"
|
||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)+[[:space:]]*$"
|
||||
|
@ -325,6 +325,12 @@ Don't ask whether or not to save the current contents of the file when
|
||||
exiting, assume yes. This is most useful when using @command{nano} as the
|
||||
composer of a mailer program.
|
||||
|
||||
@item -u
|
||||
@item --unix
|
||||
Save a file by default in Unix format. This overrides nano's
|
||||
+default behavior of saving a file in the format that it had.
|
||||
(This option has no effect when you also use @code{--noconvert}.)
|
||||
|
||||
@item -v
|
||||
@itemx --view
|
||||
Don't allow the contents of the file to be altered. Note that this
|
||||
@ -799,6 +805,11 @@ Valid color names for foreground and background are:
|
||||
white, black, red, blue, green, yellow, magenta, and cyan.
|
||||
And either @var{fgcolor} or @var{,bgcolor} may be left out.
|
||||
|
||||
@item set unix
|
||||
Save a file by default in Unix format. This overrides nano's
|
||||
default behavior of saving a file in the format that it had.
|
||||
(This option has no effect when you also use @code{set noconvert}.)
|
||||
|
||||
@item set view
|
||||
Disallow file modification.
|
||||
|
||||
|
@ -908,6 +908,9 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
|
||||
statusbar(P_("Read %lu line (Warning: No write permission)",
|
||||
"Read %lu lines (Warning: No write permission)",
|
||||
(unsigned long)num_lines), (unsigned long)num_lines);
|
||||
|
||||
if (ISSET(MAKE_IT_UNIX))
|
||||
openfile->fmt = NIX_FILE;
|
||||
}
|
||||
|
||||
/* Open the file (and decide if it exists). If newfie is TRUE, display
|
||||
|
@ -2168,6 +2168,7 @@ int main(int argc, char **argv)
|
||||
{"speller", 1, NULL, 's'},
|
||||
#endif
|
||||
{"tempfile", 0, NULL, 't'},
|
||||
{"unix", 0, NULL, 'u'},
|
||||
{"view", 0, NULL, 'v'},
|
||||
#ifndef DISABLE_WRAPPING
|
||||
{"nowrap", 0, NULL, 'w'},
|
||||
@ -2228,11 +2229,11 @@ int main(int argc, char **argv)
|
||||
while ((optchr =
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
getopt_long(argc, argv,
|
||||
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tvwxz$",
|
||||
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tuvwxz$",
|
||||
long_options, NULL)
|
||||
#else
|
||||
getopt(argc, argv,
|
||||
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tvwxz$")
|
||||
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tuvwxz$")
|
||||
#endif
|
||||
) != -1) {
|
||||
switch (optchr) {
|
||||
@ -2396,6 +2397,9 @@ int main(int argc, char **argv)
|
||||
case 't':
|
||||
SET(TEMP_FILE);
|
||||
break;
|
||||
case 'u':
|
||||
SET(MAKE_IT_UNIX);
|
||||
break;
|
||||
case 'v':
|
||||
SET(VIEW_MODE);
|
||||
break;
|
||||
|
@ -531,7 +531,8 @@ enum
|
||||
SOFTWRAP,
|
||||
POS_HISTORY,
|
||||
LOCKING,
|
||||
NOREAD_MODE
|
||||
NOREAD_MODE,
|
||||
MAKE_IT_UNIX
|
||||
};
|
||||
|
||||
/* Flags for the menus in which a given function should be present. */
|
||||
|
@ -82,6 +82,7 @@ static const rcoption rcopts[] = {
|
||||
{"suspend", SUSPEND},
|
||||
{"tabsize", 0},
|
||||
{"tempfile", TEMP_FILE},
|
||||
{"unix", MAKE_IT_UNIX},
|
||||
{"view", VIEW_MODE},
|
||||
#ifndef NANO_TINY
|
||||
{"allow_insecure_backup", INSECURE_BACKUP},
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user