Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
2a4fc959
Commit
2a4fc959
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: transform the token DISABLE_SPELLER to ENABLE_SPELLER
parent
f034992e
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
configure.ac
+7
-5
configure.ac
src/files.c
+2
-2
src/files.c
src/global.c
+15
-15
src/global.c
src/help.c
+2
-2
src/help.c
src/nano.c
+9
-9
src/nano.c
src/proto.h
+4
-4
src/proto.h
src/rcfile.c
+3
-3
src/rcfile.c
src/search.c
+1
-1
src/search.c
src/text.c
+5
-5
src/text.c
src/utils.c
+2
-2
src/utils.c
with
50 additions
and
48 deletions
+50
-48
configure.ac
View file @
2a4fc959
...
...
@@ -214,8 +214,13 @@ fi
AC_ARG_ENABLE(speller,
AS_HELP_STRING([--disable-speller], [Disable the spell-checker functions]))
if test "x$enable_speller" = xno; then
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell-checker functions.])
if test "x$enable_tiny" = xyes; then
if test "x$enable_speller" != xyes; then
enable_speller=no
fi
fi
if test "x$enable_speller" != xno; then
AC_DEFINE(ENABLE_SPELLER, 1, [Define this to have the spell-checker functions.])
fi
AC_ARG_ENABLE(tabcomp,
...
...
@@ -285,9 +290,6 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_libmagic" != xyes; then
enable_libmagic=no
fi
if test "x$enable_speller" != xyes; then
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell-checker functions.])
fi
fi
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
...
...
This diff is collapsed.
Click to expand it.
src/files.c
View file @
2a4fc959
...
...
@@ -506,7 +506,7 @@ bool open_buffer(const char *filename, bool undoable)
return
TRUE
;
}
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
/* Open the specified file, and if that succeeds, blow away the text of
* the current buffer and read the file contents into its place. */
void
replace_buffer
(
const
char
*
filename
)
...
...
@@ -564,7 +564,7 @@ void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
UNSET
(
NO_NEWLINES
);
}
#endif
/* !NANO_TINY */
#endif
/*
!DIS
ABLE_SPELLER */
#endif
/*
EN
ABLE_SPELLER */
/* Update the titlebar and the multiline cache to match the current buffer. */
void
prepare_for_display
(
void
)
...
...
This diff is collapsed.
Click to expand it.
src/global.c
View file @
2a4fc959
...
...
@@ -174,7 +174,7 @@ char *operating_dir = NULL;
/* The path to our confining "operating" directory, when given. */
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
char
*
alt_speller
=
NULL
;
/* The command to use for the alternate spell checker. */
#endif
...
...
@@ -553,7 +553,7 @@ void shortcut_init(void)
const
char
*
uncut_gist
=
N_
(
"Uncut from the cutbuffer into the current line"
);
const
char
*
cursorpos_gist
=
N_
(
"Display the position of the cursor"
);
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
const
char
*
spell_gist
=
N_
(
"Invoke the spell checker, if available"
);
#endif
const
char
*
replace_gist
=
N_
(
"Replace a string or a regular expression"
);
...
...
@@ -674,7 +674,7 @@ void shortcut_init(void)
const
char
*
lint_gist
=
N_
(
"Invoke the linter, if available"
);
const
char
*
prevlint_gist
=
N_
(
"Go to previous linter msg"
);
const
char
*
nextlint_gist
=
N_
(
"Go to next linter msg"
);
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
const
char
*
formatter_gist
=
N_
(
"Invoke formatter, if available"
);
#endif
#endif
...
...
@@ -775,14 +775,14 @@ void shortcut_init(void)
justify_tag
,
WITHORSANS
(
justify_gist
),
TOGETHER
,
NOVIEW
);
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
add_to_funcs
(
do_spell
,
MMAIN
,
N_
(
"To Spell"
),
WITHORSANS
(
spell_gist
),
TOGETHER
,
NOVIEW
);
#endif
#ifndef DISABLE_COLOR
add_to_funcs
(
do_linter
,
MMAIN
,
N_
(
"To Linter"
),
WITHORSANS
(
lint_gist
),
TOGETHER
,
NOVIEW
);
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
add_to_funcs
(
do_formatter
,
MMAIN
,
N_
(
"Formatter"
),
WITHORSANS
(
formatter_gist
),
BLANKAFTER
,
NOVIEW
);
#endif
...
...
@@ -792,8 +792,8 @@ void shortcut_init(void)
add_to_funcs
(
do_cursorpos_void
,
MMAIN
,
N_
(
"Cur Pos"
),
WITHORSANS
(
cursorpos_gist
),
TOGETHER
,
VIEW
);
#if (defined(ENABLE_JUSTIFY) && (
!
defined(
DIS
ABLE_SPELLER) || !defined(DISABLE_COLOR)) || \
!defined(ENABLE_JUSTIFY) && defined(
DIS
ABLE_SPELLER) && defined(DISABLE_COLOR))
#if (defined(ENABLE_JUSTIFY) && (defined(
EN
ABLE_SPELLER) || !defined(DISABLE_COLOR)) || \
!defined(ENABLE_JUSTIFY) &&
!
defined(
EN
ABLE_SPELLER) && defined(DISABLE_COLOR))
/* Conditionally placing this one here or further on, to keep the
* help items nicely paired in most conditions. */
add_to_funcs
(
do_gotolinecolumn_void
,
MMAIN
,
...
...
@@ -906,8 +906,8 @@ void shortcut_init(void)
N_
(
"Next File"
),
WITHORSANS
(
nextfile_gist
),
BLANKAFTER
,
VIEW
);
#endif
#if (!defined(ENABLE_JUSTIFY) && (
!
defined(
DIS
ABLE_SPELLER) || !defined(DISABLE_COLOR)) || \
defined(ENABLE_JUSTIFY) && defined(
DIS
ABLE_SPELLER) && defined(DISABLE_COLOR))
#if (!defined(ENABLE_JUSTIFY) && (defined(
EN
ABLE_SPELLER) || !defined(DISABLE_COLOR)) || \
defined(ENABLE_JUSTIFY) &&
!
defined(
EN
ABLE_SPELLER) && defined(DISABLE_COLOR))
add_to_funcs
(
do_gotolinecolumn_void
,
MMAIN
,
gotoline_tag
,
WITHORSANS
(
gotoline_gist
),
BLANKAFTER
,
VIEW
);
#endif
...
...
@@ -1106,7 +1106,7 @@ void shortcut_init(void)
add_to_sclist
(
MMAIN
,
"^J"
,
0
,
do_justify_void
,
0
);
add_to_sclist
(
MMAIN
,
"F4"
,
0
,
do_justify_void
,
0
);
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
add_to_sclist
(
MMAIN
,
"^T"
,
0
,
do_spell
,
0
);
add_to_sclist
(
MMAIN
,
"F12"
,
0
,
do_spell
,
0
);
#else
...
...
@@ -1365,7 +1365,7 @@ void shortcut_init(void)
#ifndef DISABLE_COLOR
void
set_lint_or_format_shortcuts
(
void
)
{
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
if
(
openfile
->
syntax
->
formatter
)
{
replace_scs_for
(
do_spell
,
do_formatter
);
replace_scs_for
(
do_linter
,
do_formatter
);
...
...
@@ -1378,7 +1378,7 @@ void set_lint_or_format_shortcuts(void)
void
set_spell_shortcuts
(
void
)
{
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
replace_scs_for
(
do_formatter
,
do_spell
);
replace_scs_for
(
do_linter
,
do_spell
);
#endif
...
...
@@ -1502,7 +1502,7 @@ sc *strtosc(const char *input)
else
if
(
!
strcasecmp
(
input
,
"mark"
))
s
->
scfunc
=
do_mark
;
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
else
if
(
!
strcasecmp
(
input
,
"tospell"
)
||
!
strcasecmp
(
input
,
"speller"
))
s
->
scfunc
=
do_spell
;
...
...
@@ -1744,7 +1744,7 @@ int strtomenu(const char *input)
else
if
(
!
strcasecmp
(
input
,
"help"
))
return
MHELP
;
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
else
if
(
!
strcasecmp
(
input
,
"spell"
))
return
MSPELL
;
#endif
...
...
@@ -1791,7 +1791,7 @@ void thanks_for_all_the_fish(void)
free
(
answer
);
free
(
last_search
);
free
(
present_path
);
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
free
(
alt_speller
);
#endif
free_filestruct
(
cutbuffer
);
...
...
This diff is collapsed.
Click to expand it.
src/help.c
View file @
2a4fc959
...
...
@@ -389,7 +389,7 @@ void help_init(void)
htx
[
2
]
=
NULL
;
}
#endif
/* ENABLE_BROWSER */
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
else
if
(
currmenu
==
MSPELL
)
{
htx
[
0
]
=
N_
(
"Spell Check Help Text
\n\n
"
"The spell checker checks the spelling of all text in "
...
...
@@ -403,7 +403,7 @@ void help_init(void)
htx
[
1
]
=
NULL
;
htx
[
2
]
=
NULL
;
}
#endif
/*
!DIS
ABLE_SPELLER */
#endif
/*
EN
ABLE_SPELLER */
#ifndef NANO_TINY
else
if
(
currmenu
==
MEXTCMD
)
{
htx
[
0
]
=
N_
(
"Execute Command Help Text
\n\n
"
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
2a4fc959
...
...
@@ -889,7 +889,7 @@ void usage(void)
print_opt
(
_
(
"-r <#cols>"
),
_
(
"--fill=<#cols>"
),
N_
(
"Set hard-wrapping point at column #cols"
));
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
if
(
!
ISSET
(
RESTRICTED
))
print_opt
(
_
(
"-s <prog>"
),
_
(
"--speller=<prog>"
),
N_
(
"Enable alternate speller"
));
...
...
@@ -963,7 +963,7 @@ void version(void)
#ifdef ENABLE_OPERATINGDIR
printf
(
" --enable-operatingdir"
);
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
printf
(
" --enable-speller"
);
#endif
#ifdef ENABLE_TABCOMP
...
...
@@ -1012,7 +1012,7 @@ void version(void)
#ifndef ENABLE_OPERATINGDIR
printf
(
" --disable-operatingdir"
);
#endif
#ifdef
DIS
ABLE_SPELLER
#if
n
def
EN
ABLE_SPELLER
printf
(
" --disable-speller"
);
#endif
#ifndef ENABLE_TABCOMP
...
...
@@ -1948,7 +1948,7 @@ int main(int argc, char **argv)
#ifdef ENABLED_WRAPORJUSTIFY
{
"fill"
,
1
,
NULL
,
'r'
},
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
{
"speller"
,
1
,
NULL
,
's'
},
#endif
{
"tempfile"
,
0
,
NULL
,
't'
},
...
...
@@ -2183,7 +2183,7 @@ int main(int argc, char **argv)
#endif
break
;
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
case
's'
:
alt_speller
=
mallocstrcpy
(
alt_speller
,
optarg
);
break
;
...
...
@@ -2265,7 +2265,7 @@ int main(int argc, char **argv)
#ifdef ENABLE_JUSTIFY
char
*
quotestr_cpy
=
quotestr
;
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
char
*
alt_speller_cpy
=
alt_speller
;
#endif
ssize_t
tabsize_cpy
=
tabsize
;
...
...
@@ -2284,7 +2284,7 @@ int main(int argc, char **argv)
#ifdef ENABLE_JUSTIFY
quotestr
=
NULL
;
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
alt_speller
=
NULL
;
#endif
...
...
@@ -2322,7 +2322,7 @@ int main(int argc, char **argv)
quotestr
=
quotestr_cpy
;
}
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
if
(
alt_speller_cpy
!=
NULL
)
{
free
(
alt_speller
);
alt_speller
=
alt_speller_cpy
;
...
...
@@ -2416,7 +2416,7 @@ int main(int argc, char **argv)
}
#endif
/* ENABLE_JUSTIFY */
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
/* If we don't have an alternative spell checker after reading the
* command line and/or rcfile(s), check $SPELL for one, as Pico
* does (unless we're using restricted mode, in which case spell
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
2a4fc959
...
...
@@ -141,7 +141,7 @@ extern const char *locking_suffix;
extern
char
*
operating_dir
;
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
extern
char
*
alt_speller
;
#endif
...
...
@@ -271,7 +271,7 @@ void do_uncut_text(void);
/* Most functions in files.c. */
void
initialize_buffer_text
(
void
);
bool
open_buffer
(
const
char
*
filename
,
bool
undoable
);
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
void
replace_buffer
(
const
char
*
filename
);
#ifndef NANO_TINY
void
replace_marked_buffer
(
const
char
*
filename
,
filestruct
*
top
,
size_t
top_x
,
...
...
@@ -565,7 +565,7 @@ void do_justify(bool full_justify);
void
do_justify_void
(
void
);
void
do_full_justify
(
void
);
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
void
do_spell
(
void
);
#endif
#ifndef DISABLE_COLOR
...
...
@@ -590,7 +590,7 @@ void null_at(char **data, size_t index);
void
unsunder
(
char
*
str
,
size_t
true_len
);
void
sunder
(
char
*
str
);
const
char
*
fixbounds
(
const
char
*
r
);
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
bool
is_separate_word
(
size_t
position
,
size_t
length
,
const
char
*
buf
);
#endif
const
char
*
strstrwrapper
(
const
char
*
haystack
,
const
char
*
needle
,
...
...
This diff is collapsed.
Click to expand it.
src/rcfile.c
View file @
2a4fc959
...
...
@@ -79,7 +79,7 @@ static const rcoption rcopts[] = {
{
"rebinddelete"
,
REBIND_DELETE
},
{
"rebindkeypad"
,
REBIND_KEYPAD
},
{
"regexp"
,
USE_REGEXP
},
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
{
"speller"
,
0
},
#endif
{
"suspend"
,
SUSPEND
},
...
...
@@ -994,7 +994,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
else
if
(
strcasecmp
(
keyword
,
"linter"
)
==
0
)
pick_up_name
(
"linter"
,
ptr
,
&
live_syntax
->
linter
);
else
if
(
strcasecmp
(
keyword
,
"formatter"
)
==
0
)
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
pick_up_name
(
"formatter"
,
ptr
,
&
live_syntax
->
formatter
);
#else
;
...
...
@@ -1165,7 +1165,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
word_chars
=
option
;
else
#endif
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
if
(
strcasecmp
(
rcopts
[
i
].
name
,
"speller"
)
==
0
)
alt_speller
=
option
;
else
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
2a4fc959
...
...
@@ -273,7 +273,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
/* When doing a regex search, compute the length of the match. */
if
(
ISSET
(
USE_REGEXP
))
found_len
=
regmatches
[
0
].
rm_eo
-
regmatches
[
0
].
rm_so
;
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
/* When we're spell checking, a match should be a separate word;
* if it's not, continue looking in the rest of the line. */
if
(
whole_word_only
&&
!
is_separate_word
(
found
-
line
->
data
,
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
2a4fc959
...
...
@@ -73,7 +73,7 @@ void do_mark(void)
}
#endif
/* !NANO_TINY */
#if !defined(DISABLE_COLOR) ||
!
defined(
DIS
ABLE_SPELLER)
#if !defined(DISABLE_COLOR) || defined(
EN
ABLE_SPELLER)
/* Return an error message containing the given name. */
char
*
invocation_error
(
const
char
*
name
)
{
...
...
@@ -2558,7 +2558,7 @@ void do_full_justify(void)
}
#endif
/* ENABLE_JUSTIFY */
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
/* A word is misspelled in the file. Let the user replace it. We
* return FALSE if the user cancels. */
bool
do_int_spell_fix
(
const
char
*
word
)
...
...
@@ -3049,7 +3049,7 @@ void do_spell(void)
}
else
statusbar
(
_
(
"Finished checking spelling"
));
}
#endif
/*
!DIS
ABLE_SPELLER */
#endif
/*
EN
ABLE_SPELLER */
#ifndef DISABLE_COLOR
/* Run a linting program on the current buffer. Return NULL for normal
...
...
@@ -3373,7 +3373,7 @@ void do_linter(void)
}
}
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
/* Run a formatter for the current syntax. This expects the formatter
* to be non-interactive and operate on a file in-place, which we'll
* pass it on the command line. */
...
...
@@ -3497,7 +3497,7 @@ void do_formatter(void)
/* If there were any messages, clear them off. */
total_refresh
();
}
#endif
/*
!DIS
ABLE_SPELLER */
#endif
/*
EN
ABLE_SPELLER */
#endif
/* !DISABLE_COLOR */
#ifndef NANO_TINY
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
View file @
2a4fc959
...
...
@@ -201,7 +201,7 @@ const char *fixbounds(const char *r)
return
r
;
}
#if
n
def
DIS
ABLE_SPELLER
#ifdef
EN
ABLE_SPELLER
/* Is the word starting at the given position in buf and of the given length
* a separate word? That is: is it not part of a longer word?*/
bool
is_separate_word
(
size_t
position
,
size_t
length
,
const
char
*
buf
)
...
...
@@ -219,7 +219,7 @@ bool is_separate_word(size_t position, size_t length, const char *buf)
return
((
position
==
0
||
!
is_alpha_mbchar
(
before
))
&&
(
buf
[
word_end
]
==
'\0'
||
!
is_alpha_mbchar
(
after
)));
}
#endif
/*
!DIS
ABLE_SPELLER */
#endif
/*
EN
ABLE_SPELLER */
/* Return the position of the needle in the haystack, or NULL if not found.
* When searching backwards, we will find the last match that starts no later
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help