build: fix compilation when configured with --enable-tiny

And when configured with --enable-tiny --enable-nanorc.
master
Benno Schulenberg 2018-02-14 17:47:08 +01:00
parent 3e1fc6385b
commit 0cf455bc48
3 changed files with 10 additions and 0 deletions

View File

@ -318,9 +318,11 @@ void flip_newbuffer(void)
void discard_buffer(void)
{
}
#ifdef ENABLE_NANORC
void implant(void)
{
}
#endif
/* Add a function to the function list. */
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
@ -1385,11 +1387,13 @@ void set_spell_shortcuts(void)
/* Execute the function of the given shortcut. */
void execute(const sc *shortcut)
{
#ifdef ENABLE_NANORC
if (shortcut->scfunc == implant)
/* Insert the corresponding string into the keyboard buffer. */
for (int i = strlen(shortcut->expansion); i > 0; i--)
put_back(shortcut->expansion[i - 1]);
else
#endif
shortcut->scfunc();
}

View File

@ -439,6 +439,8 @@ typedef struct sc {
int ordinal;
/* The how-manieth toggle this is, in order to be able to
* keep them in sequence. */
#endif
#ifdef ENABLE_NANORC
char *expansion;
/* The string of keycodes to which this shortcut is expanded. */
#endif

View File

@ -335,6 +335,8 @@ bool is_universal(void (*func)(void))
func == do_home || func == do_end ||
#ifndef NANO_TINY
func == do_prev_word_void || func == do_next_word_void ||
#endif
#ifndef ENABLE_NANORC
func == implant ||
#endif
func == do_delete || func == do_backspace ||
@ -420,7 +422,9 @@ void parse_binding(char *ptr, bool dobind)
newsc = nmalloc(sizeof(sc));
newsc->scfunc = implant;
newsc->expansion = mallocstrcpy(NULL, funcptr + 1);
#ifndef NANO_TINY
newsc->toggle = 0;
#endif
} else
newsc = strtosc(funcptr);