From 4281b6becb58208306e3e688b85e97af00e048ad Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 25 Oct 2019 17:17:48 +0200 Subject: [PATCH] commands: rename 'fixer' to 'formatter', to be less misleading The word "fixer" sounds too much as if the command would be able to fix mistakes or correct errors. Especially when seen next to "linter", it sounds as if one does a syntax check and the other fixes the found mistakes. (Although the command might in theory be used for this, it is not its intended purpose.) --- doc/cheatsheet.html | 2 +- doc/nano.texi | 6 +++--- doc/nanorc.5 | 6 +++--- src/global.c | 14 +++++++------- src/nano.h | 4 ++-- src/proto.h | 2 +- src/rcfile.c | 8 ++++---- src/text.c | 8 ++++---- syntax/go.nanorc | 2 +- syntax/nanorc.nanorc | 6 +++--- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/doc/cheatsheet.html b/doc/cheatsheet.html index 8da71b73..deccbb19 100644 --- a/doc/cheatsheet.html +++ b/doc/cheatsheet.html @@ -66,7 +66,7 @@ Ctrl+JJustify paragraph or region Alt+JJustify entire buffer Alt+BRun a syntax check -Alt+FRun a "fixer"/formatter/arranger +Alt+FRun a formatter/fixer/arranger Alt+:Start/stop recording of macro Alt+;Replay macro diff --git a/doc/nano.texi b/doc/nano.texi index 27ca3125..ac7ce3d3 100644 --- a/doc/nano.texi +++ b/doc/nano.texi @@ -1047,7 +1047,7 @@ file, to determine whether this syntax should be used for it. (This functionality only works when @code{libmagic} is installed on the system and will be silently ignored otherwise.) -@item fixer @var{program} [@var{arg} @dots{}] +@item formatter @var{program} [@var{arg} @dots{}] Run the given @var{program} on the full contents of the current buffer. (The current buffer is written out to a temporary file, the program is run on it, and then the temporary file is read back in, replacing the @@ -1109,7 +1109,7 @@ to @code{icolor}. @item extendsyntax @var{name} @var{command} [@var{arg} @dots{}] Extend the syntax previously defined as "@var{name}" with another @var{command}. This allows you to add a new @code{color}, @code{icolor}, @code{header}, -@code{magic}, @code{comment}, @code{linter}, or @code{fixer} command to an already +@code{magic}, @code{comment}, @code{linter}, or @code{formatter} command to an already defined syntax --- useful when you want to slightly improve a syntax defined in one of the system-installed files (which normally are not writable). @@ -1250,7 +1250,7 @@ Counts the number of words, lines and characters in the current buffer. Invokes a spell-checking program, either the default one, or the one defined by @option{--speller} or @code{set speller}. -@item fixer +@item formatter Invokes a full-buffer-processing program (if the active syntax defines one). @item linter diff --git a/doc/nanorc.5 b/doc/nanorc.5 index 9f4085ea..0b2426be 100644 --- a/doc/nanorc.5 +++ b/doc/nanorc.5 @@ -381,7 +381,7 @@ file, to determine whether this syntax should be used for it. (This functionality only works when \fBlibmagic\fP is installed on the system and will be silently ignored otherwise.) .TP -.BI fixer " program " \fR[ "arg " \fR...] +.BI formatter " program " \fR[ "arg " \fR...] Run the given \fIprogram\fR on the full contents of the current buffer. (The current buffer is written out to a temporary file, the program is run on it, and then the temporary file is read back in, replacing the @@ -443,7 +443,7 @@ to \fBicolor\fP. .BI extendsyntax " name command " \fR[ "arg " \fR...] Extend the syntax previously defined as \fIname\fR with another \fIcommand\fR. This allows adding a new \fBcolor\fP, \fBicolor\fP, -\fBheader\fP, \fBmagic\fP, \fBcomment\fP, \fBlinter\fP, or \fBfixer\fR +\fBheader\fP, \fBmagic\fP, \fBcomment\fP, \fBlinter\fP, or \fBformatter\fR command to an already defined syntax -- useful when you want to slightly improve a syntax defined in one of the system-installed files (which normally are not writable). @@ -575,7 +575,7 @@ Counts the number of words, lines and characters in the current buffer. Invokes a spell-checking program, either the default one, or the one defined by \fB\-\-speller\fR or \fBset speller\fR. .TP -.B fixer +.B formatter Invokes a full-buffer-processing program (if the active syntax defines one). .TP .B linter diff --git a/src/global.c b/src/global.c index 9755f76a..9fb6c90f 100644 --- a/src/global.c +++ b/src/global.c @@ -694,8 +694,8 @@ void shortcut_init(void) const char *prevlint_gist = N_("Go to previous linter msg"); const char *nextlint_gist = N_("Go to next linter msg"); #ifdef ENABLE_SPELLER - const char *fixer_gist = - N_("Invoke a program to fix/format/arrange the buffer"); + const char *formatter_gist = + N_("Invoke a program to format/arrange/manipulate the buffer"); #endif #endif #endif /* ENABLE_HELP */ @@ -1009,8 +1009,8 @@ void shortcut_init(void) add_to_funcs(do_linter, MMAIN, N_("To Linter"), WITHORSANS(lint_gist), TOGETHER, NOVIEW); #ifdef ENABLE_SPELLER - add_to_funcs(do_fixer, MMAIN, - N_("Manipulate"), WITHORSANS(fixer_gist), BLANKAFTER, NOVIEW); + add_to_funcs(do_formatter, MMAIN, + N_("Formatter"), WITHORSANS(formatter_gist), BLANKAFTER, NOVIEW); #endif } #endif @@ -1134,7 +1134,7 @@ void shortcut_init(void) #ifdef ENABLE_COLOR add_to_sclist(MMAIN, "M-B", 0, do_linter, 0); #ifdef ENABLE_SPELLER - add_to_sclist(MMAIN, "M-F", 0, do_fixer, 0); + add_to_sclist(MMAIN, "M-F", 0, do_formatter, 0); #endif #endif add_to_sclist(MMAIN, "^C", 0, do_cursorpos_void, 0); @@ -1515,8 +1515,8 @@ keystruct *strtosc(const char *input) else if (!strcasecmp(input, "linter")) s->func = do_linter; #ifdef ENABLE_SPELLER - else if (!strcasecmp(input, "fixer")) - s->func = do_fixer; + else if (!strcasecmp(input, "formatter")) + s->func = do_formatter; #endif #endif else if (!strcasecmp(input, "curpos")) diff --git a/src/nano.h b/src/nano.h index 1740a0a7..ba05501c 100644 --- a/src/nano.h +++ b/src/nano.h @@ -231,8 +231,8 @@ typedef struct syntaxtype { /* The list of libmagic results that this syntax applies to. */ char *linter; /* The command with which to lint this type of file. */ - char *fixer; - /* The command with which to "fix"/format/modify this type of file. */ + char *formatter; + /* The command with which to format/modify/arrange this type of file. */ char *tab; /* What the Tab key should produce; NULL for default behavior. */ #ifdef ENABLE_COMMENT diff --git a/src/proto.h b/src/proto.h index 8e4f753d..29c496b5 100644 --- a/src/proto.h +++ b/src/proto.h @@ -551,7 +551,7 @@ void do_spell(void); #endif #ifdef ENABLE_COLOR void do_linter(void); -void do_fixer(void); +void do_formatter(void); #endif #ifndef NANO_TINY void do_wordlinechar_count(void); diff --git a/src/rcfile.c b/src/rcfile.c index 581b7f38..f517da44 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -338,7 +338,7 @@ void begin_new_syntax(char *ptr) live_syntax->headers = NULL; live_syntax->magics = NULL; live_syntax->linter = NULL; - live_syntax->fixer = NULL; + live_syntax->formatter = NULL; live_syntax->tab = NULL; #ifdef ENABLE_COMMENT live_syntax->comment = copy_of(GENERAL_COMMENT_CHARACTER); @@ -960,8 +960,8 @@ bool parse_syntax_commands(char *keyword, char *ptr) #endif } else if (strcasecmp(keyword, "linter") == 0) pick_up_name("linter", ptr, &live_syntax->linter); - else if (strcasecmp(keyword, "fixer") == 0) - pick_up_name("fixer", ptr, &live_syntax->fixer); + else if (strcasecmp(keyword, "formatter") == 0) + pick_up_name("formatter", ptr, &live_syntax->formatter); else return FALSE; @@ -1119,7 +1119,7 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only) strcasecmp(keyword, "comment") == 0 || strcasecmp(keyword, "tabgives") == 0 || strcasecmp(keyword, "linter") == 0 || - strcasecmp(keyword, "fixer") == 0)) { + strcasecmp(keyword, "formatter") == 0)) { if (!opensyntax) jot_error(N_("A '%s' command requires a preceding " "'syntax' command"), keyword); diff --git a/src/text.c b/src/text.c index 60a1cf8f..506242bc 100644 --- a/src/text.c +++ b/src/text.c @@ -3058,7 +3058,7 @@ void do_linter(void) #ifdef ENABLE_SPELLER /* Run a manipulation program on the contents of the buffer. */ -void do_fixer(void) +void do_formatter(void) { FILE *stream; char *temp_name; @@ -3068,8 +3068,8 @@ void do_fixer(void) if (in_restricted_mode()) return; - if (!openfile->syntax || !openfile->syntax->fixer) { - statusbar(_("No fixer is defined for this type of file")); + if (!openfile->syntax || !openfile->syntax->formatter) { + statusbar(_("No formatter is defined for this type of file")); return; } @@ -3084,7 +3084,7 @@ void do_fixer(void) return; } - result_msg = treat(temp_name, openfile->syntax->fixer, FALSE); + result_msg = treat(temp_name, openfile->syntax->formatter, FALSE); if (result_msg != NULL) statusline(ALERT, result_msg); diff --git a/syntax/go.nanorc b/syntax/go.nanorc index fffece5c..1c8fa7ae 100644 --- a/syntax/go.nanorc +++ b/syntax/go.nanorc @@ -1,7 +1,7 @@ ## Here is an example for Go. syntax go "\.go$" -fixer gofmt -w +formatter gofmt -w comment "//" # Types. diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc index a96c82c1..2f7d9bb6 100644 --- a/syntax/nanorc.nanorc +++ b/syntax/nanorc.nanorc @@ -13,9 +13,9 @@ color brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|fu color brightgreen "^[[:space:]]*set[[:space:]]+(fill[[:space:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:space:]]+[1-9][0-9]*)\>" color brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" color brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" -color brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|fixer|linter|tabgives)[[:space:]]+.*" -color brightgreen "^[[:space:]]*(syntax[[:space:]]+[^[:blank:]]+|(fixer|linter)[[:space:]]+.+)" -color green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|fixer|linter|tabgives|extendsyntax)\>" +color brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|formatter|linter|tabgives)[[:space:]]+.*" +color brightgreen "^[[:space:]]*(syntax[[:space:]]+[^[:blank:]]+|(formatter|linter)[[:space:]]+.+)" +color green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|formatter|linter|tabgives|extendsyntax)\>" # Strings color brightmagenta "([[:space:]]|(start|end)=)".+"([[:space:]]|$)"