<NME> editor.c
<BEF> /**
 * @file    editor.c
 * @brief
 *
 * Copyright (C) 2009 Gummi Developers
 * All Rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */


#include "editor.h"

#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>

#include <gtksourceview/gtksource.h>
#include <gtkspell/gtkspell.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include <unistd.h>

#include "configfile.h"
#include "constants.h"
#include "environment.h"
#include "utils.h"

static void on_inserted_text(GtkTextBuffer *textbuffer,GtkTextIter *location,
                             gchar *text,gint len, gpointer user_data);
static void on_delete_range(GtkTextBuffer *textbuffer,GtkTextIter *start,
                             GtkTextIter *end, gpointer user_data);

const gchar style[][3][20] = {
    { "tool_bold", "\\textbf{", "}" },
    { "tool_italic", "\\emph{", "}" },
    { "tool_unline", "\\underline{", "}" },
    { "tool_left", "\\begin{flushleft}", "\\end{flushleft}"},
    { "tool_center", "\\begin{center}", "\\end{center}"},
    { "tool_right", "\\begin{flushright}", "\\end{flushright}"}
};

GuEditor* editor_new (GuMotion* mc) {
    GuEditor* ec = g_new0 (GuEditor, 1);

    /* File related member initialization */
    ec->workfd = -1;
    ec->fdname = NULL;
    ec->filename = NULL;   /* current opened file name in workspace */
    ec->basename = NULL;   /* use this to form .dvi/.ps/.log etc. files */
    ec->pdffile = NULL;
    ec->workfile = NULL;
    ec->bibfile = NULL;
    ec->projfile = NULL;

    GtkSourceLanguageManager* manager = gtk_source_language_manager_new ();
    GtkSourceLanguage* lang = gtk_source_language_manager_get_language (manager,
            "latex");
    ec->buffer = gtk_source_buffer_new_with_language (lang);
    ec->view = GTK_SOURCE_VIEW (gtk_source_view_new_with_buffer (ec->buffer));
    ec->stylemanager = gtk_source_style_scheme_manager_get_default ();
    ec->errortag = gtk_text_tag_new ("error");
    ec->searchtag = gtk_text_tag_new ("search");
    ec->editortags = gtk_text_buffer_get_tag_table (ec_buffer);
    ec->replace_activated = FALSE;
    ec->term = NULL;

    ec->css = gtk_css_provider_new();

    /* Set source view style provider so we can use ec->css to set font later */
    GtkStyleContext* context = gtk_widget_get_style_context (GTK_WIDGET(ec->view));
    gtk_style_context_add_provider(context,
                                   GTK_STYLE_PROVIDER(ec->css),
                                   GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

    gtk_source_view_set_tab_width
        (ec->view, config_get_integer ("Editor", "tabwidth"));
    gtk_source_view_set_insert_spaces_instead_of_tabs
        (ec->view, config_get_boolean ("Editor", "spaces_instof_tabs"));
    gtk_source_view_set_auto_indent
        (ec->view, config_get_boolean ("Editor", "autoindentation"));

    if (config_get_boolean ("Editor", "spelling"))
        editor_activate_spellchecking (ec, TRUE);

    editor_sourceview_config (ec);
    gtk_text_buffer_set_modified (ec_buffer, FALSE);

    /* Register motion callback */
    ec->sigid[0] = g_signal_connect (ec->view, "key-press-event",
                G_CALLBACK (on_key_press_cb), mc);
    ec->sigid[1] = g_signal_connect (ec->view, "key-release-event",
                G_CALLBACK (on_key_release_cb), mc);
    ec->sigid[2] = g_signal_connect (ec->buffer, "changed",
                G_CALLBACK (check_preview_timer), NULL);

    ec->sigid[3] = g_signal_connect_after(ec->buffer, "insert-text",
                G_CALLBACK(on_inserted_text), ec);
    ec->sigid[4] = g_signal_connect_after(ec->buffer, "delete-range",
                G_CALLBACK(on_delete_range), ec);

    return ec;
}

void editor_destroy (GuEditor* ec) {
    int i = 0;

    for (i = 0; i < 2; ++i)
        g_signal_handler_disconnect(ec, ec->sigid[i]);

    if (ec->filename) {
        gchar* dirname = g_path_get_dirname(ec->filename);
    for (i = 2; i < 5; ++i) {
        if (g_signal_handler_is_connected (ec->buffer, ec->sigid[i])) {
            g_signal_handler_disconnect (ec->buffer, ec->sigid[i]);
        }
    }

    editor_fileinfo_cleanup (ec);
    g_free(ec);
}

static void on_inserted_text(GtkTextBuffer *textbuffer,GtkTextIter *location,
                             gchar *text,gint len, gpointer user_data) {

    if (location == NULL || user_data == NULL) {
        return;
    }
    GuEditor* e = GU_EDITOR(user_data);

    e->last_edit = *location;
    e->sync_to_last_edit = TRUE;
}

static void on_delete_range(GtkTextBuffer *textbuffer,GtkTextIter *start,
                             GtkTextIter *end, gpointer user_data) {

    if (start == NULL || user_data == NULL) {
        return;
    }
    GuEditor* e = GU_EDITOR(user_data);

    e->last_edit = *start;
    e->sync_to_last_edit = TRUE;
}

/* FileInfo:
 * When a TeX document includes materials from other files (image, documents,
 * bibliography ... etc), pdflatex will try to find those files under the
 * working directory if the include path is not absolute.
 * Before Gummi svn505, gummi copies the TeX file to a temporarily directory
 * and compile there, because of this, the included files can't be located if
 * the include path is not absolute. In svn505 we copy the TeX file to the
 * same directory as the original TeX document but named it as '.FILENAME.swp'.
 * Since pdflatex refuses to compile TeX files with '.' prefixed, we have to
 * set the environment variable 'openout_any=a'.
 *
 * For a newly created document, all files including the TeX file are stored
 * under the ~/.cache folder (freedesktop XDG standard). For files that are 
 * already saved, only the workfile is saved under DIRNAME (FILENAME). 
 * Other compilation-related files are located in the temp directory.
 *
 * P.S. pdflatex will automatically strip the suffix, so for a file named
 * FILE.tex under /absolute/path/:
 *
 * filename = /absolute/path/FILE.tex
 * workfile = /absolute/path/.FILE.tex.swp
 * pdffile = ~/cache/gummi/.FILE.tex.pdf
 */
void editor_fileinfo_update (GuEditor* ec, const gchar* filename) {

    // directory should exist, but if not create ~/.cache/gummi:
    if (!g_file_test (C_TMPDIR, G_FILE_TEST_IS_DIR)) {
            slog (L_WARNING, "gummi cache directory does not exist, creating..\n");
            g_mkdir_with_parents (C_TMPDIR, DIR_PERMS);
    }

    if (ec->workfd != -1)
        editor_fileinfo_cleanup (ec);

    ec->fdname = g_build_filename (C_TMPDIR, "gummi_XXXXXX", NULL);
    ec->workfd = g_mkstemp (ec->fdname);

    // This is required for Windows 7, but not for Linux. It may also
    // be the proper way for *nix, but I don't want to change this
    // crucial piece of code at this stage of development -alexander
    #ifdef WIN32
		close(ec->workfd);
	#endif

    if (filename) {
        gchar* fname = NULL;
        if (!g_path_is_absolute (filename)) {
            fname = g_strdup_printf ("%s%c%s", g_get_current_dir(),
                                     G_DIR_SEPARATOR, filename);
        } else {
            fname = g_strdup (filename);
        }

        gchar* base = g_path_get_basename (fname);
        gchar* dir = g_path_get_dirname (fname);
        ec->filename = g_strdup (fname);
        ec->basename = g_strdup_printf ("%s%c.%s", dir, G_DIR_SEPARATOR, base);
        ec->workfile = g_strdup_printf ("%s.swp", ec->basename);
        ec->pdffile =  g_strdup_printf ("%s%c.%s.pdf", C_TMPDIR,
                                       G_DIR_SEPARATOR, base);
        // Get last modified time
        struct stat attr;
        stat(fname, &attr);
        ec->last_modtime = attr.st_mtime;

        g_free (fname);
        g_free (base);
        g_free (dir);
    } else {
        ec->workfile = g_strdup (ec->fdname);
        ec->basename = g_strdup (ec->fdname);
        ec->pdffile =  g_strdup_printf ("%s.pdf", ec->fdname);
    }
}

gboolean editor_fileinfo_update_biblio (GuEditor* ec,  const gchar* filename) {
    g_free (ec->bibfile);

    if (ec->filename && !g_path_is_absolute (filename)) {
        gchar* dirname = g_path_get_dirname (ec->filename);
        ec->bibfile = g_build_filename (dirname, filename, NULL);
        g_free (dirname);
    } else
        ec->bibfile = g_strdup (filename);
    return utils_path_exists (ec->bibfile);
}

void editor_fileinfo_cleanup (GuEditor* ec) {
    gchar* auxfile = NULL;
    gchar* logfile = NULL;
    gchar* syncfile = NULL;

    if (ec->filename) {
        gchar* dirname = g_path_get_dirname (ec->filename);
        gchar* basename = g_path_get_basename (ec->filename);
        auxfile = g_strdup_printf ("%s%c.%s.aux", C_TMPDIR,
                G_DIR_SEPARATOR, basename);
        logfile = g_strdup_printf ("%s%c.%s.log", C_TMPDIR,
                G_DIR_SEPARATOR, basename);
        syncfile = g_strdup_printf ("%s%c.%s.synctex.gz", C_TMPDIR,
                G_DIR_SEPARATOR, basename);
        g_free (basename);
        g_free (dirname);
    } else {
        gchar* dirname = g_path_get_dirname (ec->workfile);
        gchar* basename = g_path_get_basename (ec->workfile);
        auxfile = g_strdup_printf ("%s.aux", ec->fdname);
        logfile = g_strdup_printf ("%s.log", ec->fdname);
        syncfile = g_strdup_printf ("%s.synctex.gz", ec->fdname);
        g_free (basename);
        g_free (dirname);
    }

    // TODO: make a loop or maybe make register of created files? proc?

    close (ec->workfd);
    ec->workfd = -1;

    g_remove (auxfile);
    g_remove (logfile);
    g_remove (syncfile);
    g_remove (ec->fdname);
    g_remove (ec->workfile);
    g_remove (ec->pdffile);
    g_remove (ec->basename);

    g_free (auxfile);
    g_free (logfile);
    g_free (syncfile);
    g_free (ec->fdname);
    g_free (ec->filename);
    g_free (ec->workfile);
    g_free (ec->pdffile);
    g_free (ec->basename);

    ec->fdname = NULL;
    ec->filename = NULL;
    ec->workfile = NULL;
    ec->pdffile = NULL;
    ec->basename = NULL;
}

void editor_sourceview_config (GuEditor* ec) {
    GtkWrapMode wrapmode = 0;

    gtk_source_buffer_set_highlight_matching_brackets (ec->buffer, TRUE);

    const gchar* style_scheme = config_get_string ("Editor", "style_scheme");
    editor_set_style_scheme_by_id (ec, style_scheme);

    editor_set_font (ec, config_get_string ("Editor", "font_css"));

    gtk_source_view_set_show_line_numbers (
                            GTK_SOURCE_VIEW (ec->view),
                            config_get_boolean ("Editor", "line_numbers"));
    gtk_source_view_set_highlight_current_line (
                            GTK_SOURCE_VIEW (ec->view),
                            config_get_boolean ("Editor", "highlighting"));

    // The condition 'textwrapping=False && wordwrapping=True' can't happen
    if (config_get_boolean ("Editor", "textwrapping"))
        wrapmode += 1;
    if (config_get_boolean ("Editor", "wordwrapping"))
        wrapmode += 1;

    gtk_text_view_set_wrap_mode (ec_view, wrapmode);
}

void editor_activate_spellchecking (GuEditor* ec, gboolean status) {
    const gchar* lang = config_get_string ("Editor", "spelling_lang");
    GError* err = NULL;
    GtkSpellChecker* spell = 0;
    if (status) {
        spell = gtk_spell_checker_new();

        if (! (gtk_spell_checker_set_language (spell, lang, &err))) {
            slog (L_ERROR, "gtk_spell_checker_set_language (): %s\n", err->message);
            g_error_free (err);
        }
        if (! (gtk_spell_checker_attach (spell, ec_view))) {
            slog (L_ERROR, "gtk_spell_checker_attach failed\n");
        }
    } else {
        GtkSpellChecker* spell = gtk_spell_checker_get_from_text_view (ec_view);
        if (spell)
            gtk_spell_checker_detach (spell);
    }
    // TODO g_object_unref (spell); ?
}

void editor_fill_buffer (GuEditor* ec, const gchar* text) {
    gtk_text_buffer_begin_user_action (ec_buffer);
    gtk_source_buffer_begin_not_undoable_action (ec->buffer);
    gtk_widget_set_sensitive (GTK_WIDGET (ec->view), FALSE);
    gtk_text_buffer_set_text (ec_buffer, text, strlen (text));
    gtk_widget_set_sensitive (GTK_WIDGET (ec->view), TRUE);
    gtk_source_buffer_end_not_undoable_action (ec->buffer);
    gtk_text_buffer_end_user_action (ec_buffer);

    // place cursor in the beginning of the document
    GtkTextIter start;
    gtk_text_buffer_get_start_iter (ec_buffer, &start);
    gtk_text_buffer_place_cursor (ec_buffer, &start);
    gtk_widget_grab_focus (GTK_WIDGET (ec->view));
    ec->sync_to_last_edit = FALSE;
}

gchar* editor_grab_buffer (GuEditor* ec) {
    GtkTextIter start, end;
    gtk_text_buffer_get_bounds (ec_buffer, &start, &end);
    gchar* pstr = gtk_text_iter_get_text (&start, &end);
    return pstr;
}

gboolean editor_buffer_changed (GuEditor* ec) {
    if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (ec->buffer))) {
        return TRUE;
    }
    return FALSE;
}

void editor_insert_package (GuEditor* ec, const gchar* package, const gchar* options) {
    GtkTextIter start, mstart, mend, sstart, send;

    gchar* pkgstr = NULL;
    if (options == NULL) {
        pkgstr = g_strdup_printf ("\\usepackage{%s}\n", package);
    }
    else {
        pkgstr = g_strdup_printf ("\\usepackage[%s]{%s}\n", options, package);
    }

    gtk_text_buffer_get_start_iter (ec_buffer, &start);
    gtk_text_iter_forward_search (&start, (gchar*)"\\begin{document}", 0,
            &mstart, &mend, NULL);
    if (!gtk_text_iter_backward_search (&mstart, pkgstr, 0, &sstart, &send,
                NULL)) {
        gtk_source_buffer_begin_not_undoable_action (ec->buffer);
        gtk_text_buffer_begin_user_action (ec_buffer);
        gtk_text_buffer_insert (ec_buffer, &mstart, pkgstr, -1);
        gtk_text_buffer_end_user_action (ec_buffer);
        gtk_source_buffer_end_not_undoable_action (ec->buffer);
        gtk_text_buffer_set_modified (ec_buffer, TRUE);
    }
    g_free (pkgstr);
}

void editor_insert_bib (GuEditor* ec, const gchar* package) {
    GtkTextIter start, end, mstart, mend, sstart, send;
    gchar* pkgstr = g_strdup_printf (
            "\\bibliography{%s}{}\n\\bibliographystyle{plain}\n", package);
    gtk_text_buffer_get_start_iter (ec_buffer, &start);
    gtk_text_buffer_get_end_iter (ec_buffer, &end);
    gtk_text_iter_backward_search (&end, (gchar*)"\\end{document}", 0,
            &mstart, &mend, NULL);
    if (!gtk_text_iter_forward_search (&start, "\\bibliography{", 0,
                &sstart, &send, NULL)) {
        gtk_source_buffer_begin_not_undoable_action (ec->buffer);
        gtk_text_buffer_begin_user_action (ec_buffer);
        gtk_text_buffer_insert (ec_buffer, &mstart, pkgstr, -1);
        gtk_text_buffer_end_user_action (ec_buffer);
        gtk_source_buffer_end_not_undoable_action (ec->buffer);
        gtk_text_buffer_set_modified (ec_buffer, TRUE);
    }
    g_free (pkgstr);
}

void editor_set_selection_textstyle (GuEditor* ec, const gchar* type) {
    GtkTextIter start, end;
    gint i = 0, selected = 0;
    const gchar* selected_text = 0;
    gint style_size = sizeof (style) / sizeof (style[0]);
    gchar** result = NULL;
    GError* err = NULL;
    GRegex* match_str = NULL;
    GMatchInfo* match_info = NULL;
    gchar* outtext = NULL;
    gchar* regexbuf = NULL;

    /* grab selected text */
    gtk_text_buffer_get_selection_bounds (ec_buffer, &start, &end);
    selected_text = gtk_text_iter_get_text (&start, &end);

    /* select style */
    for (i = 0; i < style_size; ++i)
        if (STR_EQU (style[i][0], type)) {
            selected = i;
            break;
        }

    /* generate regex expression */
    regexbuf = g_strdup_printf ("(.*)%s%s(.*)%s%s(.*)",
            (style[selected][1][0] == '\\')? "\\": "",
            style[selected][1],
            (style[selected][2][0] == '\\')? "\\": "",
            style[selected][2]);

    if (! (match_str = g_regex_new (regexbuf, G_REGEX_DOTALL, 0, &err))) {
        slog (L_ERROR, "g_regex_new (): %s\n", err->message);
        g_error_free (err);
        goto cleanup;
    }

    if (g_regex_match (match_str, selected_text, 0, &match_info)) {
        result = g_match_info_fetch_all (match_info);
        if (strlen (result[1]) == 0 && strlen (result[3]) == 0) {
            /* already applied, so we remove it */
            outtext = g_strdup (result[2]);
        } else if (strlen (result[1]) != 0 || strlen (result[3]) != 0) {
            /* the text contains a partially styled text, remove it and apply
             * style to the whole text */
            outtext = g_strdup_printf ("%s%s%s%s%s",
                    style[selected][1], result[1], result[2], result[3],
                    style[selected][2]);
        }
    } else { /* no previous style applied */
        outtext = g_strdup_printf ("%s%s%s",
                style[selected][1], selected_text, style[selected][2]);
    }

    gtk_text_buffer_begin_user_action (ec_buffer);
    gtk_text_buffer_delete (ec_buffer, &start, &end);
    gtk_text_buffer_insert (ec_buffer, &start, outtext, -1);
    end = start;
    gtk_text_iter_backward_chars (&start, strlen (outtext));
    gtk_text_buffer_select_range (ec_buffer, &start, &end);
    gtk_text_buffer_end_user_action (ec_buffer);
    gtk_text_buffer_set_modified (ec_buffer, TRUE);

cleanup:
    g_free (outtext);
    g_free (regexbuf);
    g_strfreev (result);
    g_match_info_free (match_info);
    g_regex_unref (match_str);
}

void editor_apply_errortags (GuEditor* ec, gint* lines) {
    GtkTextIter start, end;
    gint count = 0;
    /* remove the tag from the table if it is in threre */
    if (gtk_text_tag_table_lookup (ec->editortags, "error"))
        gtk_text_tag_table_remove (ec->editortags, ec->errortag);

    gtk_text_tag_table_add (ec->editortags, ec->errortag);
    while (lines[count]) {
        gtk_text_buffer_get_iter_at_line (ec_buffer,&start,lines[count]-1);
        gtk_text_buffer_get_iter_at_line (ec_buffer, &end, lines[count]);
        gtk_text_buffer_apply_tag (ec_buffer, ec->errortag, &start, &end);
        ++count;
    }
}

void editor_jumpto_search_result (GuEditor* ec, gint direction) {
    if (!ec->term) return;
    if (direction == 1)
        editor_search_next (ec, FALSE);
    else
        editor_search_next (ec, TRUE);
}

void editor_start_search (GuEditor* ec, const gchar* term,
        gboolean backwards, gboolean wholeword, gboolean matchcase) {
    /* save options */
    if (ec->term != term) {
        g_free (ec->term);
        ec->term = g_strdup (term);
    }

    ec->backwards = backwards;
    ec->wholeword = wholeword;
    ec->matchcase = matchcase;

    editor_apply_searchtag (ec);
    editor_search_next (ec, FALSE);
}

void editor_apply_searchtag (GuEditor* ec) {
    GtkTextIter start, mstart, mend;
    gboolean ret = FALSE;

    gtk_text_buffer_get_start_iter (ec_buffer, &start);

    if (gtk_text_tag_table_lookup (ec->editortags, "search"))
        gtk_text_tag_table_remove (ec->editortags, ec->searchtag);
    gtk_text_tag_table_add (ec->editortags, ec->searchtag);

    while (TRUE) {
		do {
			ret = gtk_text_iter_forward_search (&start, ec->term,
	                (ec->matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),
	                &mstart, &mend, NULL);
			start = mend;
		} while (ec->wholeword && ret && (!gtk_text_iter_starts_word(&mstart) ||
				!gtk_text_iter_ends_word(&mend)));

        if (ret) {
            gtk_text_buffer_apply_tag (ec_buffer, ec->searchtag,
                    &mstart, &mend);
//            start =  mend;
        } else break;
    }
}

void editor_search_next (GuEditor* ec, gboolean inverse) {
    GtkTextIter current, start, end, mstart, mend;
    gboolean ret = FALSE, response = FALSE;

    editor_get_current_iter (ec, &current);
	
	do {
	    if (ec->backwards ^ inverse) {
	        ret = gtk_text_iter_backward_search (&current, ec->term,
	                (ec->matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),
	                &mstart, &mend, NULL);
	    } else {
	        gtk_text_iter_forward_chars (&current, strlen (ec->term));
	        ret = gtk_text_iter_forward_search (&current, ec->term,
	                (ec->matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),
	                &mstart, &mend, NULL);
		}
		current = mend;
	} while (ec->wholeword && ret && (!gtk_text_iter_starts_word(&mstart) ||
			!gtk_text_iter_ends_word(&mend)));

    if (ret) {
        gtk_text_buffer_select_range (ec_buffer, &mstart, &mend);
        editor_scroll_to_cursor (ec);
    }
    /* check if the top/bottom is reached */
    gtk_text_buffer_get_start_iter (ec_buffer, &start);
    gtk_text_buffer_get_end_iter (ec_buffer, &end);

    if (!ret) {
        if (ec->backwards ^ inverse) {
            response = utils_yes_no_dialog (
                    _("Top reached, search from bottom?"));
            if (GTK_RESPONSE_YES == response) {
                gtk_text_buffer_place_cursor (ec_buffer, &end);
                editor_search_next (ec, inverse);
            }
        } else {
            response = utils_yes_no_dialog (
                    _("Bottom reached, search from top?"));
            if (GTK_RESPONSE_YES == response) {
                gtk_text_buffer_place_cursor (ec_buffer, &start);
                editor_search_next (ec, inverse);
            }
        }
    }
}

void editor_start_replace_next (GuEditor* ec, const gchar* term,
        const gchar* rterm, gboolean backwards, gboolean wholeword,
        gboolean matchcase) {
    GtkTextIter current, mstart, mend;
    gboolean ret = FALSE;

    if (!ec->replace_activated) {
        ec->replace_activated = TRUE;
        editor_start_search (ec, term, backwards, wholeword, matchcase);
        return;
    }

    /* place cursor to the next result */
    editor_get_current_iter (ec, &current);

    if (backwards)
       ret = gtk_text_iter_backward_search (&current, term,
                (matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),
                &mstart, &mend, NULL);
    else
       ret = gtk_text_iter_forward_search (&current, term,
                (matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),
                &mstart, &mend, NULL);

    if (ret && (!wholeword || (wholeword
            && gtk_text_iter_starts_word (&mstart)
            && gtk_text_iter_ends_word (&mend)))) {
        gtk_text_buffer_begin_user_action (ec_buffer);
        gtk_text_buffer_delete (ec_buffer, &mstart, &mend);
        gtk_text_buffer_insert (ec_buffer, &mstart, rterm, -1);
        gtk_text_buffer_end_user_action (ec_buffer);
        editor_search_next (ec, FALSE);
    }
    return;
}

void editor_start_replace_all (GuEditor* ec, const gchar* term,
        const gchar* rterm, gboolean backwards, gboolean wholeword,
        gboolean matchcase) {
    GtkTextIter start, mstart, mend;
    gboolean ret = FALSE;
    gboolean action_started = FALSE;

    gtk_text_buffer_get_start_iter (ec_buffer, &start);

    while (TRUE) {
        ret = gtk_text_iter_forward_search (&start, term,
                (matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),
                &mstart, &mend, NULL);

        if (ret && (!wholeword || (wholeword
                && gtk_text_iter_starts_word (&mstart)
                && gtk_text_iter_ends_word (&mend)))) {
            if (!action_started) {
                gtk_text_buffer_begin_user_action (ec_buffer);
                action_started = TRUE;
            }
            gtk_text_buffer_delete (ec_buffer, &mstart, &mend);
            gtk_text_buffer_insert (ec_buffer, &mstart, rterm, -1);
            start =  mstart;
        } else break;
    }
    if (action_started) {
        gtk_text_buffer_end_user_action (ec_buffer);
    }
}

void editor_get_current_iter (GuEditor* ec, GtkTextIter* current) {
    GtkTextMark* mark = gtk_text_buffer_get_insert (ec_buffer);
    gtk_text_buffer_get_iter_at_mark (ec_buffer, current, mark);
}

void editor_scroll_to_cursor (GuEditor* ec) {
    gtk_text_view_scroll_to_mark (ec_view,
                                 gtk_text_buffer_get_insert (ec_buffer),
                                 0.25, FALSE, 0.0, 0.0);
}

void editor_scroll_to_line (GuEditor* ec, gint line) {
    if (ec == NULL) {
        return;
    }
    GtkTextIter iter;
    gtk_text_buffer_get_iter_at_line(ec_buffer, &iter, line);
    gtk_text_buffer_place_cursor(ec_buffer, &iter);
    editor_scroll_to_cursor(ec);
    ec->sync_to_last_edit = FALSE;
}

void editor_undo_change (GuEditor* ec) {
    GtkTextIter current;
    if (gtk_source_buffer_can_undo (ec->buffer)) {
        gtk_source_buffer_undo (ec->buffer);
        editor_get_current_iter (ec, &current);
        editor_scroll_to_cursor (ec);
        gtk_text_buffer_set_modified (ec_buffer, TRUE);
    }
}

void editor_redo_change (GuEditor* ec) {
    GtkTextIter current;
    if (gtk_source_buffer_can_redo (ec->buffer)) {
        gtk_source_buffer_redo (ec->buffer);
        editor_get_current_iter (ec, &current);
        editor_scroll_to_cursor (ec);
        gtk_text_buffer_set_modified (ec_buffer, TRUE);
    }
}

void editor_set_font (GuEditor* ec, const gchar* font_css) {
    gtk_css_provider_load_from_data (ec->css, font_css, -1, NULL);
}


void editor_set_style_scheme_by_id (GuEditor* ec, const gchar* id) {

    GtkSourceStyleScheme* scheme =
        gtk_source_style_scheme_manager_get_scheme (ec->stylemanager, id);
    slog (L_INFO, "Setting styles scheme to %s\n", id);

    if (!scheme) {
        slog (L_ERROR, "No style scheme %s found, setting to classic\n", id);
        scheme = gtk_source_style_scheme_manager_get_scheme (ec->stylemanager,
                "classic");
    }
    gtk_source_buffer_set_style_scheme (ec->buffer, scheme);

    set_style_fg_bg(G_OBJECT (ec->searchtag), scheme, "search-match", "yellow");
    set_style_fg_bg(G_OBJECT (ec->errortag), scheme,"def:error",  "red");
}

static inline gdouble gdk_rgba_luminance (GdkRGBA c) {
    return 0.2126 * c.red + 0.7152 * c.green + 0.0722 * c.blue;
}

/**
 *  Sets a object's fore- and background color to that of scheme's style
 *  "styleName". If no background color is defined in the style, defaultBG is
 *  used. defaultBG can be any valid parameter to gdk_rgba_parse().
 *  If only a foreground color was defined and it has not enough contrast to the
 *  default background, it will be overwritten. The foreground color will either
 *  be white or black, which has more contrast.
 */
void set_style_fg_bg (GObject* obj, GtkSourceStyleScheme* scheme,
                      gchar* styleName, gchar* defaultBG) {
    GtkSourceStyle *style = NULL;

    gchar *bg = NULL;
    gchar *fg = NULL;
    gboolean foreground_set;
    gboolean background_set;
    GdkRGBA foreground;
    GdkRGBA background;


    if (scheme == NULL) {
        goto set_style_fg_bg_return_defaults;
    }

    style = gtk_source_style_scheme_get_style (scheme, styleName);

    if (style == NULL) {
        goto set_style_fg_bg_return_defaults;
    }

    // Get properties of style
    g_object_get (style,
                  "foreground-set", &foreground_set,
                  "foreground", &fg,
                  "background-set", &background_set,
                  "background", &bg,
                  NULL);

    if (foreground_set) {
        if (fg == NULL || !gdk_rgba_parse(&foreground, fg))
            foreground_set = FALSE;
    }

    if (background_set) {
        if (bg == NULL || !gdk_rgba_parse(&background, bg))
            background_set = FALSE;
    }

    g_free(fg);
    g_free(bg);

    if (background_set && foreground_set) {
        // We trust the style to set both to good values
        // Do nothing
    } else if (!background_set && foreground_set) {
        // Set bg to default and check if fg has enough contrast
        gdk_rgba_parse(&background, defaultBG);

        gdouble diff = ABS(gdk_rgba_luminance(foreground) -
                           gdk_rgba_luminance(background));

        if (diff < 0.5) {
            slog(L_INFO, "Style \"%s\" defines a foreground, but no background "
                         "color. As the fourground color has not enough "
                         "contrast to Gummis default background color, the "
                         "foreground color has been adjusted.\n", styleName);
            if (gdk_rgba_luminance(background) > 0.5) {
                gdk_rgba_parse(&foreground, "black");
            } else {
                gdk_rgba_parse(&foreground, "white");
            }
        }
    } else if (background_set && !foreground_set) {
        // Choose a fg = white or black, which has more contrast
        if (gdk_rgba_luminance(background) > 0.5) {
            gdk_rgba_parse(&foreground, "black");
        } else {
            gdk_rgba_parse(&foreground, "white");
        }
    } else {
        // none set, set defaults
        goto set_style_fg_bg_return_defaults;
    }

    g_object_set(obj, "foreground", gdk_rgba_to_string(&foreground),
                      "background", gdk_rgba_to_string(&background), 
                       NULL);
    return;

set_style_fg_bg_return_defaults:

    // No valid style, set defaults
    gdk_rgba_parse(&background, defaultBG);

    if (gdk_rgba_luminance(background) > 0.5) {
        gdk_rgba_parse(&foreground, "black");
    } else {
        gdk_rgba_parse(&foreground, "white");
    }

    g_object_set (obj, "foreground-gdk", &foreground,
                        "background-gdk", &background, NULL);

}

/* The following functions are taken from gedit and partially modified */

gint schemes_compare (gconstpointer a, gconstpointer b) {
    GtkSourceStyleScheme *scheme_a = (GtkSourceStyleScheme *)a;
    GtkSourceStyleScheme *scheme_b = (GtkSourceStyleScheme *)b;

    const gchar *name_a = gtk_source_style_scheme_get_name (scheme_a);
    const gchar *name_b = gtk_source_style_scheme_get_name (scheme_b);

    return g_utf8_collate (name_a, name_b);
}

GList* editor_list_style_scheme_sorted (void) {
    const gchar * const * scheme_ids;
    GList *schemes = NULL;
    GtkSourceStyleSchemeManager* manager =
        gtk_source_style_scheme_manager_get_default();

    // add custom style path ~/.config/gummi/styles:
    gchar* custom = g_build_path (G_DIR_SEPARATOR_S, C_GUMMI_CONFDIR, "styles", NULL);
    if (g_file_test (custom, G_FILE_TEST_IS_DIR)) {
        gtk_source_style_scheme_manager_append_search_path (manager, custom);
    }
    g_free (custom);

    scheme_ids = gtk_source_style_scheme_manager_get_scheme_ids (manager);

    while (*scheme_ids != NULL) {
        GtkSourceStyleScheme *scheme;
        scheme = gtk_source_style_scheme_manager_get_scheme (manager,
                *scheme_ids);
        schemes = g_list_prepend (schemes, scheme);
        ++scheme_ids;
    }

    if (schemes != NULL)
        schemes = g_list_sort (schemes, (GCompareFunc)schemes_compare);

    return schemes;
}

<MSG> Fix typo for disconnecting signal

<DFF> @@ -125,7 +125,7 @@ void editor_destroy(GuEditor* ec) {
     int i = 0;
 
     for (i = 0; i < 2; ++i)
-        g_signal_handler_disconnect(ec, ec->sigid[i]);
+        g_signal_handler_disconnect(ec->sourceview, ec->sigid[i]);
 
     if (ec->filename) {
         gchar* dirname = g_path_get_dirname(ec->filename);

{'commit': 'diff --git a/aclocal.m4 b/aclocal.m4\nindex e20f508..6feea65 100644\n--- a/aclocal.m4\n+++ b/aclocal.m4\n@@ -13,8 +13,8 @@\n \n m4_ifndef([AC_AUTOCONF_VERSION],\n   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl\n-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,\n-[m4_warning([this file was generated for autoconf 2.65.\n+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,\n+[m4_warning([this file was generated for autoconf 2.68.\n You have another version of autoconf.  It may work, but is not guaranteed to.\n If you have problems, you may need to regenerate the build system entirely.\n To do so, use the procedure documented by the package, typically `autoreconf\'.])])\ndiff --git a/configure b/configure\nindex 9752b97..85ae811 100755\n--- a/configure\n+++ b/configure\n@@ -1,13 +1,13 @@\n #! /bin/sh\n # Guess values for system-dependent variables and create Makefiles.\n-# Generated by GNU Autoconf 2.65 for Gummi svn641.\n+# Generated by GNU Autoconf 2.68 for Gummi svn641.\n #\n # Report bugs to <alexvandermey@gmail.com>.\n #\n #\n # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,\n-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,\n-# Inc.\n+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software\n+# Foundation, Inc.\n #\n #\n # This configure script is free software; the Free Software Foundation\n@@ -91,6 +91,7 @@ fi\n IFS=" ""\t$as_nl"\n \n # Find who we are.  Look in the path if we contain no directory separator.\n+as_myself=\n case $0 in #((\n   *[\\\\/]* ) as_myself=$0 ;;\n   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\n@@ -216,11 +217,18 @@ IFS=$as_save_IFS\n   # We cannot yet assume a decent shell, so we have to provide a\n \t# neutralization value for shells without unset; and this also\n \t# works around shells that cannot unset nonexistent variables.\n+\t# Preserve -v and -x to the replacement shell.\n \tBASH_ENV=/dev/null\n \tENV=/dev/null\n \t(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV\n \texport CONFIG_SHELL\n-\texec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}\n+\tcase $- in # ((((\n+\t  *v*x* | *x*v* ) as_opts=-vx ;;\n+\t  *v* ) as_opts=-v ;;\n+\t  *x* ) as_opts=-x ;;\n+\t  * ) as_opts= ;;\n+\tesac\n+\texec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}\n fi\n \n     if test x$as_have_required = xno; then :\n@@ -319,7 +327,7 @@ $as_echo X"$as_dir" |\n       test -d "$as_dir" && break\n     done\n     test -z "$as_dirs" || eval "mkdir $as_dirs"\n-  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"\n+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"\n \n \n } # as_fn_mkdir_p\n@@ -359,19 +367,19 @@ else\n fi # as_fn_arith\n \n \n-# as_fn_error ERROR [LINENO LOG_FD]\n-# ---------------------------------\n+# as_fn_error STATUS ERROR [LINENO LOG_FD]\n+# ----------------------------------------\n # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are\n # provided, also output the error to LOG_FD, referencing LINENO. Then exit the\n-# script with status $?, using 1 if that was 0.\n+# script with STATUS, using 1 if that was 0.\n as_fn_error ()\n {\n-  as_status=$?; test $as_status -eq 0 && as_status=1\n-  if test "$3"; then\n-    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3\n+  as_status=$1; test $as_status -eq 0 && as_status=1\n+  if test "$4"; then\n+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4\n   fi\n-  $as_echo "$as_me: error: $1" >&2\n+  $as_echo "$as_me: error: $2" >&2\n   as_fn_exit $as_status\n } # as_fn_error\n \n@@ -533,7 +541,7 @@ test -n "$DJDIR" || exec 7<&0 </dev/null\n exec 6>&1\n \n # Name of the host.\n-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,\n+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,\n # so uname gets run too.\n ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`\n \n@@ -817,8 +825,9 @@ do\n   fi\n \n   case $ac_option in\n-  *=*)\tac_optarg=`expr "X$ac_option" : \'[^=]*=\\(.*\\)\'` ;;\n-  *)\tac_optarg=yes ;;\n+  *=?*) ac_optarg=`expr "X$ac_option" : \'[^=]*=\\(.*\\)\'` ;;\n+  *=)   ac_optarg= ;;\n+  *)    ac_optarg=yes ;;\n   esac\n \n   # Accept the important Cygnus configure options, so we can diagnose typos.\n@@ -863,7 +872,7 @@ do\n     ac_useropt=`expr "x$ac_option" : \'x-*disable-\\(.*\\)\'`\n     # Reject names that are not valid shell variable names.\n     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&\n-      as_fn_error "invalid feature name: $ac_useropt"\n+      as_fn_error $? "invalid feature name: $ac_useropt"\n     ac_useropt_orig=$ac_useropt\n     ac_useropt=`$as_echo "$ac_useropt" | sed \'s/[-+.]/_/g\'`\n     case $ac_user_opts in\n@@ -889,7 +898,7 @@ do\n     ac_useropt=`expr "x$ac_option" : \'x-*enable-\\([^=]*\\)\'`\n     # Reject names that are not valid shell variable names.\n     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&\n-      as_fn_error "invalid feature name: $ac_useropt"\n+      as_fn_error $? "invalid feature name: $ac_useropt"\n     ac_useropt_orig=$ac_useropt\n     ac_useropt=`$as_echo "$ac_useropt" | sed \'s/[-+.]/_/g\'`\n     case $ac_user_opts in\n@@ -1093,7 +1102,7 @@ do\n     ac_useropt=`expr "x$ac_option" : \'x-*with-\\([^=]*\\)\'`\n     # Reject names that are not valid shell variable names.\n     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&\n-      as_fn_error "invalid package name: $ac_useropt"\n+      as_fn_error $? "invalid package name: $ac_useropt"\n     ac_useropt_orig=$ac_useropt\n     ac_useropt=`$as_echo "$ac_useropt" | sed \'s/[-+.]/_/g\'`\n     case $ac_user_opts in\n@@ -1109,7 +1118,7 @@ do\n     ac_useropt=`expr "x$ac_option" : \'x-*without-\\(.*\\)\'`\n     # Reject names that are not valid shell variable names.\n     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&\n-      as_fn_error "invalid package name: $ac_useropt"\n+      as_fn_error $? "invalid package name: $ac_useropt"\n     ac_useropt_orig=$ac_useropt\n     ac_useropt=`$as_echo "$ac_useropt" | sed \'s/[-+.]/_/g\'`\n     case $ac_user_opts in\n@@ -1139,8 +1148,8 @@ do\n   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)\n     x_libraries=$ac_optarg ;;\n \n-  -*) as_fn_error "unrecognized option: \\`$ac_option\'\n-Try \\`$0 --help\' for more information."\n+  -*) as_fn_error $? "unrecognized option: \\`$ac_option\'\n+Try \\`$0 --help\' for more information"\n     ;;\n \n   *=*)\n@@ -1148,7 +1157,7 @@ Try \\`$0 --help\' for more information."\n     # Reject names that are not valid shell variable names.\n     case $ac_envvar in #(\n       \'\' | [0-9]* | *[!_$as_cr_alnum]* )\n-      as_fn_error "invalid variable name: \\`$ac_envvar\'" ;;\n+      as_fn_error $? "invalid variable name: \\`$ac_envvar\'" ;;\n     esac\n     eval $ac_envvar=\\$ac_optarg\n     export $ac_envvar ;;\n@@ -1158,7 +1167,7 @@ Try \\`$0 --help\' for more information."\n     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2\n     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&\n       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2\n-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}\n+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"\n     ;;\n \n   esac\n@@ -1166,13 +1175,13 @@ done\n \n if test -n "$ac_prev"; then\n   ac_option=--`echo $ac_prev | sed \'s/_/-/g\'`\n-  as_fn_error "missing argument to $ac_option"\n+  as_fn_error $? "missing argument to $ac_option"\n fi\n \n if test -n "$ac_unrecognized_opts"; then\n   case $enable_option_checking in\n     no) ;;\n-    fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;\n+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;\n     *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;\n   esac\n fi\n@@ -1195,7 +1204,7 @@ do\n     [\\\\/$]* | ?:[\\\\/]* )  continue;;\n     NONE | \'\' ) case $ac_var in *prefix ) continue;; esac;;\n   esac\n-  as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"\n+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"\n done\n \n # There might be people who depend on the old broken behavior: `$host\'\n@@ -1209,8 +1218,8 @@ target=$target_alias\n if test "x$host_alias" != x; then\n   if test "x$build_alias" = x; then\n     cross_compiling=maybe\n-    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don\'t use --host.\n-    If a cross compiler is detected then cross compile mode will be used." >&2\n+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don\'t use --host.\n+    If a cross compiler is detected then cross compile mode will be used" >&2\n   elif test "x$build_alias" != "x$host_alias"; then\n     cross_compiling=yes\n   fi\n@@ -1225,9 +1234,9 @@ test "$silent" = yes && exec 6>/dev/null\n ac_pwd=`pwd` && test -n "$ac_pwd" &&\n ac_ls_di=`ls -di .` &&\n ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||\n-  as_fn_error "working directory cannot be determined"\n+  as_fn_error $? "working directory cannot be determined"\n test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||\n-  as_fn_error "pwd does not report name of working directory"\n+  as_fn_error $? "pwd does not report name of working directory"\n \n \n # Find the source files, if location was not specified.\n@@ -1266,11 +1275,11 @@ else\n fi\n if test ! -r "$srcdir/$ac_unique_file"; then\n   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."\n-  as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"\n+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"\n fi\n ac_msg="sources are in $srcdir, but \\`cd $srcdir\' does not work"\n ac_abs_confdir=`(\n-\tcd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"\n+\tcd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"\n \tpwd)`\n # When building in place, set srcdir=.\n if test "$ac_abs_confdir" = "$ac_pwd"; then\n@@ -1310,7 +1319,7 @@ Configuration:\n       --help=short        display options specific to this package\n       --help=recursive    display the short help of all the included packages\n   -V, --version           display version information and exit\n-  -q, --quiet, --silent   do not print \\`checking...\' messages\n+  -q, --quiet, --silent   do not print \\`checking ...\' messages\n       --cache-file=FILE   cache test results in FILE [disabled]\n   -C, --config-cache      alias for \\`--cache-file=config.cache\'\n   -n, --no-create         do not create output files\n@@ -1472,9 +1481,9 @@ test -n "$ac_init_help" && exit $ac_status\n if $ac_init_version; then\n   cat <<\\_ACEOF\n Gummi configure svn641\n-generated by GNU Autoconf 2.65\n+generated by GNU Autoconf 2.68\n \n-Copyright (C) 2009 Free Software Foundation, Inc.\n+Copyright (C) 2010 Free Software Foundation, Inc.\n This configure script is free software; the Free Software Foundation\n gives unlimited permission to copy, distribute and modify it.\n _ACEOF\n@@ -1518,7 +1527,7 @@ sed \'s/^/| /\' conftest.$ac_ext >&5\n \n \tac_retval=1\n fi\n-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}\n+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n   as_fn_set_status $ac_retval\n \n } # ac_fn_c_try_compile\n@@ -1564,7 +1573,7 @@ fi\n   # interfere with the next link command; also delete a directory that is\n   # left behind by Apple\'s compiler.  We do this before executing the actions.\n   rm -rf conftest.dSYM conftest_ipa8_conftest.oo\n-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}\n+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n   as_fn_set_status $ac_retval\n \n } # ac_fn_c_try_link\n@@ -1577,7 +1586,7 @@ ac_fn_c_check_func ()\n   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5\n $as_echo_n "checking for $2... " >&6; }\n-if { as_var=$3; eval "test \\"\\${$as_var+set}\\" = set"; }; then :\n+if eval \\${$3+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n@@ -1632,7 +1641,7 @@ fi\n eval ac_res=\\$$3\n \t       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5\n $as_echo "$ac_res" >&6; }\n-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}\n+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n \n } # ac_fn_c_check_func\n \n@@ -1673,7 +1682,7 @@ sed \'s/^/| /\' conftest.$ac_ext >&5\n        ac_retval=$ac_status\n fi\n   rm -rf conftest.dSYM conftest_ipa8_conftest.oo\n-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}\n+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n   as_fn_set_status $ac_retval\n \n } # ac_fn_c_try_run\n@@ -1699,7 +1708,7 @@ $as_echo "$ac_try_echo"; } >&5\n     mv -f conftest.er1 conftest.err\n   fi\n   $as_echo "$as_me:${as_lineno-$LINENO}: \\$? = $ac_status" >&5\n-  test $ac_status = 0; } >/dev/null && {\n+  test $ac_status = 0; } > conftest.i && {\n \t test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||\n \t test ! -s conftest.err\n        }; then :\n@@ -1710,7 +1719,7 @@ sed \'s/^/| /\' conftest.$ac_ext >&5\n \n     ac_retval=1\n fi\n-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}\n+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n   as_fn_set_status $ac_retval\n \n } # ac_fn_c_try_cpp\n@@ -1723,10 +1732,10 @@ fi\n ac_fn_c_check_header_mongrel ()\n {\n   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n-  if { as_var=$3; eval "test \\"\\${$as_var+set}\\" = set"; }; then :\n+  if eval \\${$3+:} false; then :\n   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5\n $as_echo_n "checking for $2... " >&6; }\n-if { as_var=$3; eval "test \\"\\${$as_var+set}\\" = set"; }; then :\n+if eval \\${$3+:} false; then :\n   $as_echo_n "(cached) " >&6\n fi\n eval ac_res=\\$$3\n@@ -1762,7 +1771,7 @@ if ac_fn_c_try_cpp "$LINENO"; then :\n else\n   ac_header_preproc=no\n fi\n-rm -f conftest.err conftest.$ac_ext\n+rm -f conftest.err conftest.i conftest.$ac_ext\n { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5\n $as_echo "$ac_header_preproc" >&6; }\n \n@@ -1785,17 +1794,15 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}\n $as_echo "$as_me: WARNING: $2:     section \\"Present But Cannot Be Compiled\\"" >&2;}\n     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler\'s result" >&5\n $as_echo "$as_me: WARNING: $2: proceeding with the compiler\'s result" >&2;}\n-( cat <<\\_ASBOX\n-## -------------------------------------- ##\n+( $as_echo "## -------------------------------------- ##\n ## Report this to alexvandermey@gmail.com ##\n-## -------------------------------------- ##\n-_ASBOX\n+## -------------------------------------- ##"\n      ) | sed "s/^/$as_me: WARNING:     /" >&2\n     ;;\n esac\n   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5\n $as_echo_n "checking for $2... " >&6; }\n-if { as_var=$3; eval "test \\"\\${$as_var+set}\\" = set"; }; then :\n+if eval \\${$3+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   eval "$3=\\$ac_header_compiler"\n@@ -1804,7 +1811,7 @@ eval ac_res=\\$$3\n \t       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5\n $as_echo "$ac_res" >&6; }\n fi\n-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}\n+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n \n } # ac_fn_c_check_header_mongrel\n \n@@ -1817,7 +1824,7 @@ ac_fn_c_check_header_compile ()\n   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5\n $as_echo_n "checking for $2... " >&6; }\n-if { as_var=$3; eval "test \\"\\${$as_var+set}\\" = set"; }; then :\n+if eval \\${$3+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n@@ -1835,7 +1842,7 @@ fi\n eval ac_res=\\$$3\n \t       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5\n $as_echo "$ac_res" >&6; }\n-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}\n+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n \n } # ac_fn_c_check_header_compile\n \n@@ -1848,7 +1855,7 @@ ac_fn_c_check_type ()\n   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5\n $as_echo_n "checking for $2... " >&6; }\n-if { as_var=$3; eval "test \\"\\${$as_var+set}\\" = set"; }; then :\n+if eval \\${$3+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   eval "$3=no"\n@@ -1889,7 +1896,7 @@ fi\n eval ac_res=\\$$3\n \t       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5\n $as_echo "$ac_res" >&6; }\n-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}\n+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n \n } # ac_fn_c_check_type\n cat >config.log <<_ACEOF\n@@ -1897,7 +1904,7 @@ This file contains any messages produced by compilers while\n running configure, to aid debugging if configure makes a mistake.\n \n It was created by Gummi $as_me svn641, which was\n-generated by GNU Autoconf 2.65.  Invocation command line was\n+generated by GNU Autoconf 2.68.  Invocation command line was\n \n   $ $0 $@\n \n@@ -2007,11 +2014,9 @@ trap \'exit_status=$?\n   {\n     echo\n \n-    cat <<\\_ASBOX\n-## ---------------- ##\n+    $as_echo "## ---------------- ##\n ## Cache variables. ##\n-## ---------------- ##\n-_ASBOX\n+## ---------------- ##"\n     echo\n     # The following way of writing the cache mishandles newlines in values,\n (\n@@ -2045,11 +2050,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;\n )\n     echo\n \n-    cat <<\\_ASBOX\n-## ----------------- ##\n+    $as_echo "## ----------------- ##\n ## Output variables. ##\n-## ----------------- ##\n-_ASBOX\n+## ----------------- ##"\n     echo\n     for ac_var in $ac_subst_vars\n     do\n@@ -2062,11 +2065,9 @@ _ASBOX\n     echo\n \n     if test -n "$ac_subst_files"; then\n-      cat <<\\_ASBOX\n-## ------------------- ##\n+      $as_echo "## ------------------- ##\n ## File substitutions. ##\n-## ------------------- ##\n-_ASBOX\n+## ------------------- ##"\n       echo\n       for ac_var in $ac_subst_files\n       do\n@@ -2080,11 +2081,9 @@ _ASBOX\n     fi\n \n     if test -s confdefs.h; then\n-      cat <<\\_ASBOX\n-## ----------- ##\n+      $as_echo "## ----------- ##\n ## confdefs.h. ##\n-## ----------- ##\n-_ASBOX\n+## ----------- ##"\n       echo\n       cat confdefs.h\n       echo\n@@ -2139,7 +2138,12 @@ _ACEOF\n ac_site_file1=NONE\n ac_site_file2=NONE\n if test -n "$CONFIG_SITE"; then\n-  ac_site_file1=$CONFIG_SITE\n+  # We do not want a PATH search for config.site.\n+  case $CONFIG_SITE in #((\n+    -*)  ac_site_file1=./$CONFIG_SITE;;\n+    */*) ac_site_file1=$CONFIG_SITE;;\n+    *)   ac_site_file1=./$CONFIG_SITE;;\n+  esac\n elif test "x$prefix" != xNONE; then\n   ac_site_file1=$prefix/share/config.site\n   ac_site_file2=$prefix/etc/config.site\n@@ -2154,7 +2158,11 @@ do\n     { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5\n $as_echo "$as_me: loading site script $ac_site_file" >&6;}\n     sed \'s/^/| /\' "$ac_site_file" >&5\n-    . "$ac_site_file"\n+    . "$ac_site_file" \\\n+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd\':" >&5\n+$as_echo "$as_me: error: in \\`$ac_pwd\':" >&2;}\n+as_fn_error $? "failed to load site script $ac_site_file\n+See \\`config.log\' for more details" "$LINENO" 5; }\n   fi\n done\n \n@@ -2230,7 +2238,7 @@ if $ac_cache_corrupted; then\n $as_echo "$as_me: error: in \\`$ac_pwd\':" >&2;}\n   { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5\n $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}\n-  as_fn_error "run \\`make distclean\' and/or \\`rm $cache_file\' and start over" "$LINENO" 5\n+  as_fn_error $? "run \\`make distclean\' and/or \\`rm $cache_file\' and start over" "$LINENO" 5\n fi\n ## -------------------- ##\n ## Main body of script. ##\n@@ -2247,16 +2255,22 @@ am__api_version=\'1.11\'\n \n ac_aux_dir=\n for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do\n-  for ac_t in install-sh install.sh shtool; do\n-    if test -f "$ac_dir/$ac_t"; then\n-      ac_aux_dir=$ac_dir\n-      ac_install_sh="$ac_aux_dir/$ac_t -c"\n-      break 2\n-    fi\n-  done\n+  if test -f "$ac_dir/install-sh"; then\n+    ac_aux_dir=$ac_dir\n+    ac_install_sh="$ac_aux_dir/install-sh -c"\n+    break\n+  elif test -f "$ac_dir/install.sh"; then\n+    ac_aux_dir=$ac_dir\n+    ac_install_sh="$ac_aux_dir/install.sh -c"\n+    break\n+  elif test -f "$ac_dir/shtool"; then\n+    ac_aux_dir=$ac_dir\n+    ac_install_sh="$ac_aux_dir/shtool install -c"\n+    break\n+  fi\n done\n if test -z "$ac_aux_dir"; then\n-  as_fn_error "cannot find install-sh, install.sh, or shtool in \\"$srcdir\\" \\"$srcdir/..\\" \\"$srcdir/../..\\"" "$LINENO" 5\n+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \\"$srcdir\\" \\"$srcdir/..\\" \\"$srcdir/../..\\"" "$LINENO" 5\n fi\n \n # These three variables are undocumented and unsupported,\n@@ -2285,7 +2299,7 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don\'t use this var.\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5\n $as_echo_n "checking for a BSD-compatible install... " >&6; }\n if test -z "$INSTALL"; then\n-if test "${ac_cv_path_install+set}" = set; then :\n+if ${ac_cv_path_install+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\n@@ -2372,11 +2386,11 @@ am_lf=\'\n \'\n case `pwd` in\n   *[\\\\\\"\\#\\$\\&\\\'\\`$am_lf]*)\n-    as_fn_error "unsafe absolute working directory name" "$LINENO" 5;;\n+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;\n esac\n case $srcdir in\n   *[\\\\\\"\\#\\$\\&\\\'\\`$am_lf\\ \\\t]*)\n-    as_fn_error "unsafe srcdir value: \\`$srcdir\'" "$LINENO" 5;;\n+    as_fn_error $? "unsafe srcdir value: \\`$srcdir\'" "$LINENO" 5;;\n esac\n \n # Do `set\' in a subshell so we don\'t clobber the current shell\'s\n@@ -2398,7 +2412,7 @@ if (\n       # if, for instance, CONFIG_SHELL is bash and it inherits a\n       # broken ls alias from the environment.  This has actually\n       # happened.  Such a system could not be considered "sane".\n-      as_fn_error "ls -t appears to fail.  Make sure there is not a broken\n+      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken\n alias in your environment" "$LINENO" 5\n    fi\n \n@@ -2408,7 +2422,7 @@ then\n    # Ok.\n    :\n else\n-   as_fn_error "newly created file is older than distributed files!\n+   as_fn_error $? "newly created file is older than distributed files!\n Check your system clock" "$LINENO" 5\n fi\n { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5\n@@ -2462,7 +2476,7 @@ if test "$cross_compiling" != no; then\n set dummy ${ac_tool_prefix}strip; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_prog_STRIP+set}" = set; then :\n+if ${ac_cv_prog_STRIP+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -n "$STRIP"; then\n@@ -2502,7 +2516,7 @@ if test -z "$ac_cv_prog_STRIP"; then\n set dummy strip; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :\n+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -n "$ac_ct_STRIP"; then\n@@ -2555,7 +2569,7 @@ INSTALL_STRIP_PROGRAM="\\$(install_sh) -c -s"\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5\n $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }\n if test -z "$MKDIR_P"; then\n-  if test "${ac_cv_path_mkdir+set}" = set; then :\n+  if ${ac_cv_path_mkdir+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\n@@ -2606,7 +2620,7 @@ do\n set dummy $ac_prog; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_prog_AWK+set}" = set; then :\n+if ${ac_cv_prog_AWK+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -n "$AWK"; then\n@@ -2646,7 +2660,7 @@ done\n $as_echo_n "checking whether ${MAKE-make} sets \\$(MAKE)... " >&6; }\n set x ${MAKE-make}\n ac_make=`$as_echo "$2" | sed \'s/+/p/g; s/[^a-zA-Z0-9_]/_/g\'`\n-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \\"\\${$as_var+set}\\" = set"; }; then :\n+if eval \\${ac_cv_prog_make_${ac_make}_set+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   cat >conftest.make <<\\_ACEOF\n@@ -2654,7 +2668,7 @@ SHELL = /bin/sh\n all:\n \t@echo \'@@@%%%=$(MAKE)=@@@%%%\'\n _ACEOF\n-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.\n+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.\n case `${MAKE-make} -f conftest.make 2>/dev/null` in\n   *@@@%%%=?*=@@@%%%*)\n     eval ac_cv_prog_make_${ac_make}_set=yes;;\n@@ -2688,7 +2702,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then\n   am__isrc=\' -I$(srcdir)\'\n   # test to see if srcdir already configured\n   if test -f $srcdir/config.status; then\n-    as_fn_error "source directory already configured; run \\"make distclean\\" there first" "$LINENO" 5\n+    as_fn_error $? "source directory already configured; run \\"make distclean\\" there first" "$LINENO" 5\n   fi\n fi\n \n@@ -2772,7 +2786,7 @@ if test -n "$ac_tool_prefix"; then\n set dummy ${ac_tool_prefix}gcc; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_prog_CC+set}" = set; then :\n+if ${ac_cv_prog_CC+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -n "$CC"; then\n@@ -2812,7 +2826,7 @@ if test -z "$ac_cv_prog_CC"; then\n set dummy gcc; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :\n+if ${ac_cv_prog_ac_ct_CC+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -n "$ac_ct_CC"; then\n@@ -2865,7 +2879,7 @@ if test -z "$CC"; then\n set dummy ${ac_tool_prefix}cc; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_prog_CC+set}" = set; then :\n+if ${ac_cv_prog_CC+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -n "$CC"; then\n@@ -2905,7 +2919,7 @@ if test -z "$CC"; then\n set dummy cc; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_prog_CC+set}" = set; then :\n+if ${ac_cv_prog_CC+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -n "$CC"; then\n@@ -2964,7 +2978,7 @@ if test -z "$CC"; then\n set dummy $ac_tool_prefix$ac_prog; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_prog_CC+set}" = set; then :\n+if ${ac_cv_prog_CC+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -n "$CC"; then\n@@ -3008,7 +3022,7 @@ do\n set dummy $ac_prog; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :\n+if ${ac_cv_prog_ac_ct_CC+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -n "$ac_ct_CC"; then\n@@ -3062,8 +3076,8 @@ fi\n \n test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd\':" >&5\n $as_echo "$as_me: error: in \\`$ac_pwd\':" >&2;}\n-as_fn_error "no acceptable C compiler found in \\$PATH\n-See \\`config.log\' for more details." "$LINENO" 5; }\n+as_fn_error $? "no acceptable C compiler found in \\$PATH\n+See \\`config.log\' for more details" "$LINENO" 5; }\n \n # Provide some information about the compiler.\n $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5\n@@ -3177,9 +3191,8 @@ sed \'s/^/| /\' conftest.$ac_ext >&5\n \n { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd\':" >&5\n $as_echo "$as_me: error: in \\`$ac_pwd\':" >&2;}\n-{ as_fn_set_status 77\n-as_fn_error "C compiler cannot create executables\n-See \\`config.log\' for more details." "$LINENO" 5; }; }\n+as_fn_error 77 "C compiler cannot create executables\n+See \\`config.log\' for more details" "$LINENO" 5; }\n else\n   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5\n $as_echo "yes" >&6; }\n@@ -3221,8 +3234,8 @@ done\n else\n   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd\':" >&5\n $as_echo "$as_me: error: in \\`$ac_pwd\':" >&2;}\n-as_fn_error "cannot compute suffix of executables: cannot compile and link\n-See \\`config.log\' for more details." "$LINENO" 5; }\n+as_fn_error $? "cannot compute suffix of executables: cannot compile and link\n+See \\`config.log\' for more details" "$LINENO" 5; }\n fi\n rm -f conftest conftest$ac_cv_exeext\n { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5\n@@ -3279,9 +3292,9 @@ $as_echo "$ac_try_echo"; } >&5\n     else\n \t{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd\':" >&5\n $as_echo "$as_me: error: in \\`$ac_pwd\':" >&2;}\n-as_fn_error "cannot run C compiled programs.\n+as_fn_error $? "cannot run C compiled programs.\n If you meant to cross compile, use \\`--host\'.\n-See \\`config.log\' for more details." "$LINENO" 5; }\n+See \\`config.log\' for more details" "$LINENO" 5; }\n     fi\n   fi\n fi\n@@ -3292,7 +3305,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out\n ac_clean_files=$ac_clean_files_save\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5\n $as_echo_n "checking for suffix of object files... " >&6; }\n-if test "${ac_cv_objext+set}" = set; then :\n+if ${ac_cv_objext+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n@@ -3332,8 +3345,8 @@ sed \'s/^/| /\' conftest.$ac_ext >&5\n \n { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd\':" >&5\n $as_echo "$as_me: error: in \\`$ac_pwd\':" >&2;}\n-as_fn_error "cannot compute suffix of object files: cannot compile\n-See \\`config.log\' for more details." "$LINENO" 5; }\n+as_fn_error $? "cannot compute suffix of object files: cannot compile\n+See \\`config.log\' for more details" "$LINENO" 5; }\n fi\n rm -f conftest.$ac_cv_objext conftest.$ac_ext\n fi\n@@ -3343,7 +3356,7 @@ OBJEXT=$ac_cv_objext\n ac_objext=$OBJEXT\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5\n $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }\n-if test "${ac_cv_c_compiler_gnu+set}" = set; then :\n+if ${ac_cv_c_compiler_gnu+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n@@ -3380,7 +3393,7 @@ ac_test_CFLAGS=${CFLAGS+set}\n ac_save_CFLAGS=$CFLAGS\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5\n $as_echo_n "checking whether $CC accepts -g... " >&6; }\n-if test "${ac_cv_prog_cc_g+set}" = set; then :\n+if ${ac_cv_prog_cc_g+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   ac_save_c_werror_flag=$ac_c_werror_flag\n@@ -3458,7 +3471,7 @@ else\n fi\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5\n $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }\n-if test "${ac_cv_prog_cc_c89+set}" = set; then :\n+if ${ac_cv_prog_cc_c89+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   ac_cv_prog_cc_c89=no\n@@ -3619,7 +3632,7 @@ depcc="$CC"   am_compiler_list=\n \n { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5\n $as_echo_n "checking dependency style of $depcc... " >&6; }\n-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :\n+if ${am_cv_CC_dependencies_compiler_type+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then\n@@ -3751,7 +3764,7 @@ $as_echo_n "checking whether cc understands -c and -o together... " >&6; }\n fi\n set dummy $CC; ac_cc=`$as_echo "$2" |\n \t\t      sed \'s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/\'`\n-if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \\"\\${$as_var+set}\\" = set"; }; then :\n+if eval \\${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n@@ -3872,7 +3885,7 @@ $as_echo "$USE_NLS" >&6; }\n \n case "$am__api_version" in\n     1.01234)\n-\tas_fn_error "Automake 1.5 or newer is required to use intltool" "$LINENO" 5\n+\tas_fn_error $? "Automake 1.5 or newer is required to use intltool" "$LINENO" 5\n     ;;\n     *)\n     ;;\n@@ -3889,14 +3902,14 @@ $as_echo_n "checking for intltool >= ... " >&6; }\n     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_APPLIED_VERSION found" >&5\n $as_echo "$INTLTOOL_APPLIED_VERSION found" >&6; }\n     test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||\n-\tas_fn_error "Your intltool is too old.  You need intltool  or later." "$LINENO" 5\n+\tas_fn_error $? "Your intltool is too old.  You need intltool  or later." "$LINENO" 5\n fi\n \n # Extract the first word of "intltool-update", so it can be a program name with args.\n set dummy intltool-update; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_INTLTOOL_UPDATE+set}" = set; then :\n+if ${ac_cv_path_INTLTOOL_UPDATE+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $INTLTOOL_UPDATE in\n@@ -3936,7 +3949,7 @@ fi\n set dummy intltool-merge; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_INTLTOOL_MERGE+set}" = set; then :\n+if ${ac_cv_path_INTLTOOL_MERGE+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $INTLTOOL_MERGE in\n@@ -3976,7 +3989,7 @@ fi\n set dummy intltool-extract; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_INTLTOOL_EXTRACT+set}" = set; then :\n+if ${ac_cv_path_INTLTOOL_EXTRACT+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $INTLTOOL_EXTRACT in\n@@ -4013,7 +4026,7 @@ fi\n \n \n if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then\n-    as_fn_error "The intltool scripts were not found. Please install intltool." "$LINENO" 5\n+    as_fn_error $? "The intltool scripts were not found. Please install intltool." "$LINENO" 5\n fi\n \n   INTLTOOL_DESKTOP_RULE=\'%.desktop:   %.desktop.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@\'\n@@ -4137,7 +4150,7 @@ INTLTOOL_SOUNDLIST_RULE=\'%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcar\n set dummy xgettext; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_XGETTEXT+set}" = set; then :\n+if ${ac_cv_path_XGETTEXT+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $XGETTEXT in\n@@ -4177,7 +4190,7 @@ fi\n set dummy msgmerge; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_MSGMERGE+set}" = set; then :\n+if ${ac_cv_path_MSGMERGE+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $MSGMERGE in\n@@ -4217,7 +4230,7 @@ fi\n set dummy msgfmt; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_MSGFMT+set}" = set; then :\n+if ${ac_cv_path_MSGFMT+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $MSGFMT in\n@@ -4257,7 +4270,7 @@ fi\n set dummy gmsgfmt; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_GMSGFMT+set}" = set; then :\n+if ${ac_cv_path_GMSGFMT+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $GMSGFMT in\n@@ -4295,20 +4308,20 @@ fi\n \n \n if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then\n-    as_fn_error "GNU gettext tools not found; required for intltool" "$LINENO" 5\n+    as_fn_error $? "GNU gettext tools not found; required for intltool" "$LINENO" 5\n fi\n xgversion="`$XGETTEXT --version|grep \'(GNU \' 2> /dev/null`"\n mmversion="`$MSGMERGE --version|grep \'(GNU \' 2> /dev/null`"\n mfversion="`$MSGFMT --version|grep \'(GNU \' 2> /dev/null`"\n if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then\n-    as_fn_error "GNU gettext tools not found; required for intltool" "$LINENO" 5\n+    as_fn_error $? "GNU gettext tools not found; required for intltool" "$LINENO" 5\n fi\n \n # Extract the first word of "perl", so it can be a program name with args.\n set dummy perl; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_INTLTOOL_PERL+set}" = set; then :\n+if ${ac_cv_path_INTLTOOL_PERL+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $INTLTOOL_PERL in\n@@ -4345,13 +4358,13 @@ fi\n \n \n if test -z "$INTLTOOL_PERL"; then\n-   as_fn_error "perl not found" "$LINENO" 5\n+   as_fn_error $? "perl not found" "$LINENO" 5\n fi\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl >= 5.8.1" >&5\n $as_echo_n "checking for perl >= 5.8.1... " >&6; }\n $INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1\n if test $? -ne 0; then\n-   as_fn_error "perl 5.8.1 is required for intltool" "$LINENO" 5\n+   as_fn_error $? "perl 5.8.1 is required for intltool" "$LINENO" 5\n else\n    IT_PERL_VERSION="`$INTLTOOL_PERL -e \\"printf \'%vd\', $^V\\"`"\n    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IT_PERL_VERSION" >&5\n@@ -4364,7 +4377,7 @@ $as_echo_n "checking for XML::Parser... " >&6; }\n        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5\n $as_echo "ok" >&6; }\n    else\n-       as_fn_error "XML::Parser perl module is required for intltool" "$LINENO" 5\n+       as_fn_error $? "XML::Parser perl module is required for intltool" "$LINENO" 5\n    fi\n fi\n \n@@ -4392,7 +4405,7 @@ else\n   case $host in\n     *-*-solaris*)\n                         ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset"\n-if test "x$ac_cv_func_bind_textdomain_codeset" = x""yes; then :\n+if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then :\n   DATADIRNAME=share\n else\n   DATADIRNAME=lib\n@@ -4485,7 +4498,7 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then\n set dummy ${ac_tool_prefix}pkg-config; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :\n+if ${ac_cv_path_PKG_CONFIG+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $PKG_CONFIG in\n@@ -4528,7 +4541,7 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then\n set dummy pkg-config; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :\n+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $ac_pt_PKG_CONFIG in\n@@ -4789,7 +4802,7 @@ rm -f core conftest.err conftest.$ac_objext \\\n      GLIB_GENMARSHAL=""\n      GOBJECT_QUERY=""\n      GLIB_MKENUMS=""\n-     as_fn_error "You need Glib >= 2.16.0 to build $PACKAGE" "$LINENO" 5\n+     as_fn_error $? "You need Glib >= 2.16.0 to build $PACKAGE" "$LINENO" 5\n   fi\n \n \n@@ -4823,7 +4836,7 @@ fi\n set dummy pkg-config; ac_word=$2\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5\n $as_echo_n "checking for $ac_word... " >&6; }\n-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :\n+if ${ac_cv_path_PKG_CONFIG+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   case $PKG_CONFIG in\n@@ -5055,7 +5068,7 @@ rm -f core conftest.err conftest.$ac_objext \\\n      fi\n      GTK_CFLAGS=""\n      GTK_LIBS=""\n-     as_fn_error "You need Gtk+ >= 2.16.0 to build $PACKAGE" "$LINENO" 5\n+     as_fn_error $? "You need Gtk+ >= 2.16.0 to build $PACKAGE" "$LINENO" 5\n   fi\n \n \n@@ -5119,11 +5132,11 @@ fi\n \t# Put the nasty error message in config.log where it belongs\n \techo "$gtksourceview_PKG_ERRORS" >&5\n \n-\tas_fn_error "You need GtkSourceView2 >= 2.2.1 to build $PACKAGE" "$LINENO" 5\n+\tas_fn_error $? "You need GtkSourceView2 >= 2.2.1 to build $PACKAGE" "$LINENO" 5\n elif test $pkg_failed = untried; then\n      \t{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5\n $as_echo "no" >&6; }\n-\tas_fn_error "You need GtkSourceView2 >= 2.2.1 to build $PACKAGE" "$LINENO" 5\n+\tas_fn_error $? "You need GtkSourceView2 >= 2.2.1 to build $PACKAGE" "$LINENO" 5\n else\n \tgtksourceview_CFLAGS=$pkg_cv_gtksourceview_CFLAGS\n \tgtksourceview_LIBS=$pkg_cv_gtksourceview_LIBS\n@@ -5191,11 +5204,11 @@ fi\n \t# Put the nasty error message in config.log where it belongs\n \techo "$poppler_PKG_ERRORS" >&5\n \n-\tas_fn_error "You need Poppler to build $PACKAGE" "$LINENO" 5\n+\tas_fn_error $? "You need Poppler to build $PACKAGE" "$LINENO" 5\n elif test $pkg_failed = untried; then\n      \t{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5\n $as_echo "no" >&6; }\n-\tas_fn_error "You need Poppler to build $PACKAGE" "$LINENO" 5\n+\tas_fn_error $? "You need Poppler to build $PACKAGE" "$LINENO" 5\n else\n \tpoppler_CFLAGS=$pkg_cv_poppler_CFLAGS\n \tpoppler_LIBS=$pkg_cv_poppler_LIBS\n@@ -5264,11 +5277,11 @@ fi\n \t# Put the nasty error message in config.log where it belongs\n \techo "$gtkspell_PKG_ERRORS" >&5\n \n-\tas_fn_error "You need GtkSpell  to build $PACKAGE" "$LINENO" 5\n+\tas_fn_error $? "You need GtkSpell  to build $PACKAGE" "$LINENO" 5\n elif test $pkg_failed = untried; then\n      \t{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5\n $as_echo "no" >&6; }\n-\tas_fn_error "You need GtkSpell  to build $PACKAGE" "$LINENO" 5\n+\tas_fn_error $? "You need GtkSpell  to build $PACKAGE" "$LINENO" 5\n else\n \tgtkspell_CFLAGS=$pkg_cv_gtkspell_CFLAGS\n \tgtkspell_LIBS=$pkg_cv_gtkspell_LIBS\n@@ -5293,7 +5306,7 @@ if test -n "$CPP" && test -d "$CPP"; then\n   CPP=\n fi\n if test -z "$CPP"; then\n-  if test "${ac_cv_prog_CPP+set}" = set; then :\n+  if ${ac_cv_prog_CPP+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n       # Double quotes because CPP needs to be expanded\n@@ -5323,7 +5336,7 @@ else\n   # Broken: fails on valid input.\n continue\n fi\n-rm -f conftest.err conftest.$ac_ext\n+rm -f conftest.err conftest.i conftest.$ac_ext\n \n   # OK, works on sane cases.  Now check whether nonexistent headers\n   # can be detected and how.\n@@ -5339,11 +5352,11 @@ else\n ac_preproc_ok=:\n break\n fi\n-rm -f conftest.err conftest.$ac_ext\n+rm -f conftest.err conftest.i conftest.$ac_ext\n \n done\n # Because of `break\', _AC_PREPROC_IFELSE\'s cleaning code was skipped.\n-rm -f conftest.err conftest.$ac_ext\n+rm -f conftest.i conftest.err conftest.$ac_ext\n if $ac_preproc_ok; then :\n   break\n fi\n@@ -5382,7 +5395,7 @@ else\n   # Broken: fails on valid input.\n continue\n fi\n-rm -f conftest.err conftest.$ac_ext\n+rm -f conftest.err conftest.i conftest.$ac_ext\n \n   # OK, works on sane cases.  Now check whether nonexistent headers\n   # can be detected and how.\n@@ -5398,18 +5411,18 @@ else\n ac_preproc_ok=:\n break\n fi\n-rm -f conftest.err conftest.$ac_ext\n+rm -f conftest.err conftest.i conftest.$ac_ext\n \n done\n # Because of `break\', _AC_PREPROC_IFELSE\'s cleaning code was skipped.\n-rm -f conftest.err conftest.$ac_ext\n+rm -f conftest.i conftest.err conftest.$ac_ext\n if $ac_preproc_ok; then :\n \n else\n   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd\':" >&5\n $as_echo "$as_me: error: in \\`$ac_pwd\':" >&2;}\n-as_fn_error "C preprocessor \\"$CPP\\" fails sanity check\n-See \\`config.log\' for more details." "$LINENO" 5; }\n+as_fn_error $? "C preprocessor \\"$CPP\\" fails sanity check\n+See \\`config.log\' for more details" "$LINENO" 5; }\n fi\n \n ac_ext=c\n@@ -5421,7 +5434,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu\n \n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5\n $as_echo_n "checking for grep that handles long lines and -e... " >&6; }\n-if test "${ac_cv_path_GREP+set}" = set; then :\n+if ${ac_cv_path_GREP+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if test -z "$GREP"; then\n@@ -5470,7 +5483,7 @@ esac\n   done\n IFS=$as_save_IFS\n   if test -z "$ac_cv_path_GREP"; then\n-    as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5\n+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5\n   fi\n else\n   ac_cv_path_GREP=$GREP\n@@ -5484,7 +5497,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }\n \n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5\n $as_echo_n "checking for egrep... " >&6; }\n-if test "${ac_cv_path_EGREP+set}" = set; then :\n+if ${ac_cv_path_EGREP+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   if echo a | $GREP -E \'(a|b)\' >/dev/null 2>&1\n@@ -5536,7 +5549,7 @@ esac\n   done\n IFS=$as_save_IFS\n   if test -z "$ac_cv_path_EGREP"; then\n-    as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5\n+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5\n   fi\n else\n   ac_cv_path_EGREP=$EGREP\n@@ -5551,7 +5564,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }\n \n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5\n $as_echo_n "checking for ANSI C header files... " >&6; }\n-if test "${ac_cv_header_stdc+set}" = set; then :\n+if ${ac_cv_header_stdc+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n@@ -5668,8 +5681,7 @@ do :\n   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`\n ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default\n "\n-eval as_val=\\$$as_ac_Header\n-   if test "x$as_val" = x""yes; then :\n+if eval test \\"x\\$"$as_ac_Header"\\" = x"yes"; then :\n   cat >>confdefs.h <<_ACEOF\n #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1\n _ACEOF\n@@ -5683,8 +5695,7 @@ for ac_header in libintl.h locale.h netdb.h stdlib.h string.h sys/socket.h sys/t\n do :\n   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`\n ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"\n-eval as_val=\\$$as_ac_Header\n-   if test "x$as_val" = x""yes; then :\n+if eval test \\"x\\$"$as_ac_Header"\\" = x"yes"; then :\n   cat >>confdefs.h <<_ACEOF\n #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1\n _ACEOF\n@@ -5697,7 +5708,7 @@ done\n # Checks for typedefs, structures, and compiler characteristics.\n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5\n $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }\n-if test "${ac_cv_header_stdbool_h+set}" = set; then :\n+if ${ac_cv_header_stdbool_h+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n@@ -5729,7 +5740,7 @@ else\n \tchar b[false == 0 ? 1 : -1];\n \tchar c[__bool_true_false_are_defined == 1 ? 1 : -1];\n \tchar d[(bool) 0.5 == true ? 1 : -1];\n-\tbool e = &s;\n+\t/* See body of main program for \'e\'.  */\n \tchar f[(_Bool) 0.0 == false ? 1 : -1];\n \tchar g[true];\n \tchar h[sizeof (_Bool)];\n@@ -5740,25 +5751,6 @@ else\n \t_Bool n[m];\n \tchar o[sizeof n == m * sizeof n[0] ? 1 : -1];\n \tchar p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];\n-#\tif defined __xlc__ || defined __GNUC__\n-\t /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0\n-\t    reported by James Lemley on 2005-10-05; see\n-\t    http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html\n-\t    This test is not quite right, since xlc is allowed to\n-\t    reject this program, as the initializer for xlcbug is\n-\t    not one of the forms that C requires support for.\n-\t    However, doing the test right would require a runtime\n-\t    test, and that would make cross-compilation harder.\n-\t    Let us hope that IBM fixes the xlc bug, and also adds\n-\t    support for this kind of constant expression.  In the\n-\t    meantime, this test will reject xlc, which is OK, since\n-\t    our stdbool.h substitute should suffice.  We also test\n-\t    this with GCC, where it should work, to detect more\n-\t    quickly whether someone messes up the test in the\n-\t    future.  */\n-\t char digs[] = "0123456789";\n-\t int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);\n-#\tendif\n \t/* Catch a bug in an HP-UX C compiler.  See\n \t   http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html\n \t   http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html\n@@ -5770,6 +5762,7 @@ int\n main ()\n {\n \n+\tbool e = &s;\n \t*pq |= q;\n \t*pq |= ! q;\n \t/* Refer to every declared value, to avoid compiler optimizations.  */\n@@ -5790,7 +5783,7 @@ fi\n { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5\n $as_echo "$ac_cv_header_stdbool_h" >&6; }\n ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"\n-if test "x$ac_cv_type__Bool" = x""yes; then :\n+if test "x$ac_cv_type__Bool" = xyes; then :\n \n cat >>confdefs.h <<_ACEOF\n #define HAVE__BOOL 1\n@@ -5807,7 +5800,7 @@ fi\n \n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5\n $as_echo_n "checking for an ANSI C-conforming const... " >&6; }\n-if test "${ac_cv_c_const+set}" = set; then :\n+if ${ac_cv_c_const+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n@@ -5887,7 +5880,7 @@ fi\n \n { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5\n $as_echo_n "checking for inline... " >&6; }\n-if test "${ac_cv_c_inline+set}" = set; then :\n+if ${ac_cv_c_inline+:} false; then :\n   $as_echo_n "(cached) " >&6\n else\n   ac_cv_c_inline=no\n@@ -5928,7 +5921,7 @@ _ACEOF\n esac\n \n ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"\n-if test "x$ac_cv_type_size_t" = x""yes; then :\n+if test "x$ac_cv_type_size_t" = xyes; then :\n \n else\n \n@@ -5944,8 +5937,7 @@ for ac_func in gethostbyname memset setlocale socket strstr\n do :\n   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`\n ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"\n-eval as_val=\\$$as_ac_var\n-   if test "x$as_val" = x""yes; then :\n+if eval test \\"x\\$"$as_ac_var"\\" = x"yes"; then :\n   cat >>confdefs.h <<_ACEOF\n #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1\n _ACEOF\n@@ -6022,10 +6014,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;\n      :end\' >>confcache\n if diff "$cache_file" confcache >/dev/null 2>&1; then :; else\n   if test -w "$cache_file"; then\n-    test "x$cache_file" != "x/dev/null" &&\n+    if test "x$cache_file" != "x/dev/null"; then\n       { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5\n $as_echo "$as_me: updating cache $cache_file" >&6;}\n-    cat confcache >$cache_file\n+      if test ! -f "$cache_file" || test -h "$cache_file"; then\n+\tcat confcache >"$cache_file"\n+      else\n+        case $cache_file in #(\n+        */* | ?:*)\n+\t  mv -f confcache "$cache_file"$$ &&\n+\t  mv -f "$cache_file"$$ "$cache_file" ;; #(\n+        *)\n+\t  mv -f confcache "$cache_file" ;;\n+\tesac\n+      fi\n+    fi\n   else\n     { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5\n $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}\n@@ -6041,6 +6044,7 @@ DEFS=-DHAVE_CONFIG_H\n \n ac_libobjs=\n ac_ltlibobjs=\n+U=\n for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue\n   # 1. Remove the extension, and $U if already installed.\n   ac_script=\'s/\\$U\\././;s/\\.o$//;s/\\.obj$//\'\n@@ -6064,11 +6068,11 @@ else\n fi\n \n if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then\n-  as_fn_error "conditional \\"AMDEP\\" was never defined.\n+  as_fn_error $? "conditional \\"AMDEP\\" was never defined.\n Usually this means the macro was only invoked conditionally." "$LINENO" 5\n fi\n if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then\n-  as_fn_error "conditional \\"am__fastdepCC\\" was never defined.\n+  as_fn_error $? "conditional \\"am__fastdepCC\\" was never defined.\n Usually this means the macro was only invoked conditionally." "$LINENO" 5\n fi\n \n@@ -6076,7 +6080,7 @@ fi\n \n \n \n-: ${CONFIG_STATUS=./config.status}\n+: "${CONFIG_STATUS=./config.status}"\n ac_write_fail=0\n ac_clean_files_save=$ac_clean_files\n ac_clean_files="$ac_clean_files $CONFIG_STATUS"\n@@ -6177,6 +6181,7 @@ fi\n IFS=" ""\t$as_nl"\n \n # Find who we are.  Look in the path if we contain no directory separator.\n+as_myself=\n case $0 in #((\n   *[\\\\/]* ) as_myself=$0 ;;\n   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\n@@ -6222,19 +6227,19 @@ export LANGUAGE\n (unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n \n \n-# as_fn_error ERROR [LINENO LOG_FD]\n-# ---------------------------------\n+# as_fn_error STATUS ERROR [LINENO LOG_FD]\n+# ----------------------------------------\n # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are\n # provided, also output the error to LOG_FD, referencing LINENO. Then exit the\n-# script with status $?, using 1 if that was 0.\n+# script with STATUS, using 1 if that was 0.\n as_fn_error ()\n {\n-  as_status=$?; test $as_status -eq 0 && as_status=1\n-  if test "$3"; then\n-    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3\n+  as_status=$1; test $as_status -eq 0 && as_status=1\n+  if test "$4"; then\n+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4\n   fi\n-  $as_echo "$as_me: error: $1" >&2\n+  $as_echo "$as_me: error: $2" >&2\n   as_fn_exit $as_status\n } # as_fn_error\n \n@@ -6430,7 +6435,7 @@ $as_echo X"$as_dir" |\n       test -d "$as_dir" && break\n     done\n     test -z "$as_dirs" || eval "mkdir $as_dirs"\n-  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"\n+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"\n \n \n } # as_fn_mkdir_p\n@@ -6484,7 +6489,7 @@ cat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n # values after options handling.\n ac_log="\n This file was extended by Gummi $as_me svn641, which was\n-generated by GNU Autoconf 2.65.  Invocation command line was\n+generated by GNU Autoconf 2.68.  Invocation command line was\n \n   CONFIG_FILES    = $CONFIG_FILES\n   CONFIG_HEADERS  = $CONFIG_HEADERS\n@@ -6551,10 +6556,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n ac_cs_config="`$as_echo "$ac_configure_args" | sed \'s/^ //; s/[\\\\""\\`\\$]/\\\\\\\\&/g\'`"\n ac_cs_version="\\\\\n Gummi config.status svn641\n-configured by $0, generated by GNU Autoconf 2.65,\n+configured by $0, generated by GNU Autoconf 2.68,\n   with options \\\\"\\$ac_cs_config\\\\"\n \n-Copyright (C) 2009 Free Software Foundation, Inc.\n+Copyright (C) 2010 Free Software Foundation, Inc.\n This config.status script is free software; the Free Software Foundation\n gives unlimited permission to copy, distribute and modify it."\n \n@@ -6572,11 +6577,16 @@ ac_need_defaults=:\n while test $# != 0\n do\n   case $1 in\n-  --*=*)\n+  --*=?*)\n     ac_option=`expr "X$1" : \'X\\([^=]*\\)=\'`\n     ac_optarg=`expr "X$1" : \'X[^=]*=\\(.*\\)\'`\n     ac_shift=:\n     ;;\n+  --*=)\n+    ac_option=`expr "X$1" : \'X\\([^=]*\\)=\'`\n+    ac_optarg=\n+    ac_shift=:\n+    ;;\n   *)\n     ac_option=$1\n     ac_optarg=$2\n@@ -6598,6 +6608,7 @@ do\n     $ac_shift\n     case $ac_optarg in\n     *\\\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/\'/\'\\\\\\\\\\\\\\\\\'\'/g"` ;;\n+    \'\') as_fn_error $? "missing file argument" ;;\n     esac\n     as_fn_append CONFIG_FILES " \'$ac_optarg\'"\n     ac_need_defaults=false;;\n@@ -6610,7 +6621,7 @@ do\n     ac_need_defaults=false;;\n   --he | --h)\n     # Conflict between --help and --header\n-    as_fn_error "ambiguous option: \\`$1\'\n+    as_fn_error $? "ambiguous option: \\`$1\'\n Try \\`$0 --help\' for more information.";;\n   --help | --hel | -h )\n     $as_echo "$ac_cs_usage"; exit ;;\n@@ -6619,7 +6630,7 @@ Try \\`$0 --help\' for more information.";;\n     ac_cs_silent=: ;;\n \n   # This is an error.\n-  -*) as_fn_error "unrecognized option: \\`$1\'\n+  -*) as_fn_error $? "unrecognized option: \\`$1\'\n Try \\`$0 --help\' for more information." ;;\n \n   *) as_fn_append ac_config_targets " $1"\n@@ -6682,7 +6693,7 @@ do\n     "data/$PACKAGE.desktop") CONFIG_FILES="$CONFIG_FILES data/$PACKAGE.desktop" ;;\n     "po/stamp-it") CONFIG_COMMANDS="$CONFIG_COMMANDS po/stamp-it" ;;\n \n-  *) as_fn_error "invalid argument: \\`$ac_config_target\'" "$LINENO" 5;;\n+  *) as_fn_error $? "invalid argument: \\`$ac_config_target\'" "$LINENO" 5;;\n   esac\n done\n \n@@ -6705,9 +6716,10 @@ fi\n # after its creation but before its name has been assigned to `$tmp\'.\n $debug ||\n {\n-  tmp=\n+  tmp= ac_tmp=\n   trap \'exit_status=$?\n-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status\n+  : "${ac_tmp:=$tmp}"\n+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status\n \' 0\n   trap \'as_fn_exit 1\' 1 2 13 15\n }\n@@ -6715,12 +6727,13 @@ $debug ||\n \n {\n   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&\n-  test -n "$tmp" && test -d "$tmp"\n+  test -d "$tmp"\n }  ||\n {\n   tmp=./conf$$-$RANDOM\n   (umask 077 && mkdir "$tmp")\n-} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5\n+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5\n+ac_tmp=$tmp\n \n # Set up the scripts for CONFIG_FILES section.\n # No need to generate them if there are no CONFIG_FILES.\n@@ -6737,12 +6750,12 @@ if test "x$ac_cr" = x; then\n fi\n ac_cs_awk_cr=`$AWK \'BEGIN { print "a\\rb" }\' </dev/null 2>/dev/null`\n if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then\n-  ac_cs_awk_cr=\'\\r\'\n+  ac_cs_awk_cr=\'\\\\r\'\n else\n   ac_cs_awk_cr=$ac_cr\n fi\n \n-echo \'BEGIN {\' >"$tmp/subs1.awk" &&\n+echo \'BEGIN {\' >"$ac_tmp/subs1.awk" &&\n _ACEOF\n \n \n@@ -6751,18 +6764,18 @@ _ACEOF\n   echo "$ac_subst_vars" | sed \'s/.*/&!$&$ac_delim/\' &&\n   echo "_ACEOF"\n } >conf$$subs.sh ||\n-  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5\n-ac_delim_num=`echo "$ac_subst_vars" | grep -c \'$\'`\n+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5\n+ac_delim_num=`echo "$ac_subst_vars" | grep -c \'^\'`\n ac_delim=\'%!_!# \'\n for ac_last_try in false false false false false :; do\n   . ./conf$$subs.sh ||\n-    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5\n+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5\n \n   ac_delim_n=`sed -n "s/.*$ac_delim\\$/X/p" conf$$subs.awk | grep -c X`\n   if test $ac_delim_n = $ac_delim_num; then\n     break\n   elif $ac_last_try; then\n-    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5\n+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5\n   else\n     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "\n   fi\n@@ -6770,7 +6783,7 @@ done\n rm -f conf$$subs.sh\n \n cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n-cat >>"\\$tmp/subs1.awk" <<\\\\_ACAWK &&\n+cat >>"\\$ac_tmp/subs1.awk" <<\\\\_ACAWK &&\n _ACEOF\n sed -n \'\n h\n@@ -6818,7 +6831,7 @@ t delim\n rm -f conf$$subs.awk\n cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n _ACAWK\n-cat >>"\\$tmp/subs1.awk" <<_ACAWK &&\n+cat >>"\\$ac_tmp/subs1.awk" <<_ACAWK &&\n   for (key in S) S_is_set[key] = 1\n   FS = "\x07"\n \n@@ -6850,21 +6863,29 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then\n   sed "s/$ac_cr\\$//; s/$ac_cr/$ac_cs_awk_cr/g"\n else\n   cat\n-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \\\n-  || as_fn_error "could not setup config files machinery" "$LINENO" 5\n+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \\\n+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5\n _ACEOF\n \n-# VPATH may cause trouble with some makes, so we remove $(srcdir),\n-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and\n+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),\n+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and\n # trailing colons and then remove the whole line if VPATH becomes empty\n # (actually we leave an empty line to preserve line numbers).\n if test "x$srcdir" = x.; then\n-  ac_vpsub=\'/^[\t ]*VPATH[\t ]*=/{\n-s/:*\\$(srcdir):*/:/\n-s/:*\\${srcdir}:*/:/\n-s/:*@srcdir@:*/:/\n-s/^\\([^=]*=[\t ]*\\):*/\\1/\n+  ac_vpsub=\'/^[\t ]*VPATH[\t ]*=[\t ]*/{\n+h\n+s///\n+s/^/:/\n+s/[\t ]*$/:/\n+s/:\\$(srcdir):/:/g\n+s/:\\${srcdir}:/:/g\n+s/:@srcdir@:/:/g\n+s/^:*//\n s/:*$//\n+x\n+s/\\(=[\t ]*\\).*/\\1/\n+G\n+s/\\n//\n s/^[^=]*=[\t ]*$//\n }\'\n fi\n@@ -6876,7 +6897,7 @@ fi # test -n "$CONFIG_FILES"\n # No need to generate them if there are no CONFIG_HEADERS.\n # This happens for instance with `./config.status Makefile\'.\n if test -n "$CONFIG_HEADERS"; then\n-cat >"$tmp/defines.awk" <<\\_ACAWK ||\n+cat >"$ac_tmp/defines.awk" <<\\_ACAWK ||\n BEGIN {\n _ACEOF\n \n@@ -6888,11 +6909,11 @@ _ACEOF\n # handling of long lines.\n ac_delim=\'%!_!# \'\n for ac_last_try in false false :; do\n-  ac_t=`sed -n "/$ac_delim/p" confdefs.h`\n-  if test -z "$ac_t"; then\n+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`\n+  if test -z "$ac_tt"; then\n     break\n   elif $ac_last_try; then\n-    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5\n+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5\n   else\n     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "\n   fi\n@@ -6977,7 +6998,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n _ACAWK\n _ACEOF\n cat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n-  as_fn_error "could not setup config headers machinery" "$LINENO" 5\n+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5\n fi # test -n "$CONFIG_HEADERS"\n \n \n@@ -6990,7 +7011,7 @@ do\n   esac\n   case $ac_mode$ac_tag in\n   :[FHL]*:*);;\n-  :L* | :C*:*) as_fn_error "invalid tag \\`$ac_tag\'" "$LINENO" 5;;\n+  :L* | :C*:*) as_fn_error $? "invalid tag \\`$ac_tag\'" "$LINENO" 5;;\n   :[FH]-) ac_tag=-:-;;\n   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;\n   esac\n@@ -7009,7 +7030,7 @@ do\n     for ac_f\n     do\n       case $ac_f in\n-      -) ac_f="$tmp/stdin";;\n+      -) ac_f="$ac_tmp/stdin";;\n       *) # Look for the file first in the build tree, then in the source tree\n \t # (if the path is not absolute).  The absolute path cannot be DOS-style,\n \t # because $ac_f cannot contain `:\'.\n@@ -7018,7 +7039,7 @@ do\n \t   [\\\\/$]*) false;;\n \t   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;\n \t   esac ||\n-\t   as_fn_error "cannot find input file: \\`$ac_f\'" "$LINENO" 5;;\n+\t   as_fn_error 1 "cannot find input file: \\`$ac_f\'" "$LINENO" 5;;\n       esac\n       case $ac_f in *\\\'*) ac_f=`$as_echo "$ac_f" | sed "s/\'/\'\\\\\\\\\\\\\\\\\'\'/g"`;; esac\n       as_fn_append ac_file_inputs " \'$ac_f\'"\n@@ -7044,8 +7065,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}\n     esac\n \n     case $ac_tag in\n-    *:-:* | *:-) cat >"$tmp/stdin" \\\n-      || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;\n+    *:-:* | *:-) cat >"$ac_tmp/stdin" \\\n+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;\n     esac\n     ;;\n   esac\n@@ -7181,23 +7202,24 @@ s&@INSTALL@&$ac_INSTALL&;t t\n s&@MKDIR_P@&$ac_MKDIR_P&;t t\n $ac_datarootdir_hack\n "\n-eval sed \\"\\$ac_sed_extra\\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \\\n-  || as_fn_error "could not create $ac_file" "$LINENO" 5\n+eval sed \\"\\$ac_sed_extra\\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \\\n+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5\n \n test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&\n-  { ac_out=`sed -n \'/\\${datarootdir}/p\' "$tmp/out"`; test -n "$ac_out"; } &&\n-  { ac_out=`sed -n \'/^[\t ]*datarootdir[\t ]*:*=/p\' "$tmp/out"`; test -z "$ac_out"; } &&\n+  { ac_out=`sed -n \'/\\${datarootdir}/p\' "$ac_tmp/out"`; test -n "$ac_out"; } &&\n+  { ac_out=`sed -n \'/^[\t ]*datarootdir[\t ]*:*=/p\' \\\n+      "$ac_tmp/out"`; test -z "$ac_out"; } &&\n   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \\`datarootdir\'\n-which seems to be undefined.  Please make sure it is defined." >&5\n+which seems to be undefined.  Please make sure it is defined" >&5\n $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \\`datarootdir\'\n-which seems to be undefined.  Please make sure it is defined." >&2;}\n+which seems to be undefined.  Please make sure it is defined" >&2;}\n \n-  rm -f "$tmp/stdin"\n+  rm -f "$ac_tmp/stdin"\n   case $ac_file in\n-  -) cat "$tmp/out" && rm -f "$tmp/out";;\n-  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;\n+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;\n+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;\n   esac \\\n-  || as_fn_error "could not create $ac_file" "$LINENO" 5\n+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5\n  ;;\n   :H)\n   #\n@@ -7206,21 +7228,21 @@ which seems to be undefined.  Please make sure it is defined." >&2;}\n   if test x"$ac_file" != x-; then\n     {\n       $as_echo "/* $configure_input  */" \\\n-      && eval \'$AWK -f "$tmp/defines.awk"\' "$ac_file_inputs"\n-    } >"$tmp/config.h" \\\n-      || as_fn_error "could not create $ac_file" "$LINENO" 5\n-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then\n+      && eval \'$AWK -f "$ac_tmp/defines.awk"\' "$ac_file_inputs"\n+    } >"$ac_tmp/config.h" \\\n+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5\n+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then\n       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5\n $as_echo "$as_me: $ac_file is unchanged" >&6;}\n     else\n       rm -f "$ac_file"\n-      mv "$tmp/config.h" "$ac_file" \\\n-\t|| as_fn_error "could not create $ac_file" "$LINENO" 5\n+      mv "$ac_tmp/config.h" "$ac_file" \\\n+\t|| as_fn_error $? "could not create $ac_file" "$LINENO" 5\n     fi\n   else\n     $as_echo "/* $configure_input  */" \\\n-      && eval \'$AWK -f "$tmp/defines.awk"\' "$ac_file_inputs" \\\n-      || as_fn_error "could not create -" "$LINENO" 5\n+      && eval \'$AWK -f "$ac_tmp/defines.awk"\' "$ac_file_inputs" \\\n+      || as_fn_error $? "could not create -" "$LINENO" 5\n   fi\n # Compute "$ac_file"\'s index in $config_headers.\n _am_arg="$ac_file"\n@@ -7362,7 +7384,7 @@ $as_echo X"$file" |\n  ;;\n     "po/stamp-it":C)\n     if  ! grep "^# INTLTOOL_MAKEFILE$" "po/Makefile.in" > /dev/null ; then\n-       as_fn_error "po/Makefile.in.in was not created by intltoolize." "$LINENO" 5\n+       as_fn_error $? "po/Makefile.in.in was not created by intltoolize." "$LINENO" 5\n     fi\n     rm -f "po/stamp-it" "po/stamp-it.tmp" "po/POTFILES" "po/Makefile.tmp"\n     >"po/stamp-it.tmp"\n@@ -7390,7 +7412,7 @@ _ACEOF\n ac_clean_files=$ac_clean_files_save\n \n test $ac_write_fail = 0 ||\n-  as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5\n+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5\n \n \n # configure is writing to config.log, and then calls config.status.\n@@ -7411,7 +7433,7 @@ if test "$no_create" != yes; then\n   exec 5>>config.log\n   # Use ||, not &&, to avoid exiting from the if with $? = 1, which\n   # would make configure fail if this is the last instruction.\n-  $ac_cs_success || as_fn_exit $?\n+  $ac_cs_success || as_fn_exit 1\n fi\n if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then\n   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5\ndiff --git a/src/Makefile.am b/src/Makefile.am\nindex 969f3e4..1e593e9 100644\n--- a/src/Makefile.am\n+++ b/src/Makefile.am\n@@ -20,6 +20,7 @@ gummi_SOURCES = biblio.c  biblio.h \\\n \t\tiofunctions.c iofunctions.h \\\n \t\tlatex.c latex.h \\\n \t\tmotion.c motion.h \\\n+\t\tsnippets.c snippets.h \\\n \t\ttemplate.c template.h \\\n \t\tupdatecheck.c updatecheck.h \\\n \t\tutils.c utils.h \\\ndiff --git a/src/Makefile.in b/src/Makefile.in\nindex 86729c3..db2c2d8 100644\n--- a/src/Makefile.in\n+++ b/src/Makefile.in\n@@ -49,8 +49,9 @@ am_gummi_OBJECTS = biblio.$(OBJEXT) configfile.$(OBJEXT) \\\n \teditor.$(OBJEXT) environment.$(OBJEXT) gui-import.$(OBJEXT) \\\n \tgui-main.$(OBJEXT) gui-prefs.$(OBJEXT) gui-preview.$(OBJEXT) \\\n \tgui-search.$(OBJEXT) importer.$(OBJEXT) iofunctions.$(OBJEXT) \\\n-\tlatex.$(OBJEXT) motion.$(OBJEXT) template.$(OBJEXT) \\\n-\tupdatecheck.$(OBJEXT) utils.$(OBJEXT) main.$(OBJEXT)\n+\tlatex.$(OBJEXT) motion.$(OBJEXT) snippets.$(OBJEXT) \\\n+\ttemplate.$(OBJEXT) updatecheck.$(OBJEXT) utils.$(OBJEXT) \\\n+\tmain.$(OBJEXT)\n gummi_OBJECTS = $(am_gummi_OBJECTS)\n am__DEPENDENCIES_1 =\n gummi_DEPENDENCIES = $(am__DEPENDENCIES_1)\n@@ -205,6 +206,7 @@ gummi_SOURCES = biblio.c  biblio.h \\\n \t\tiofunctions.c iofunctions.h \\\n \t\tlatex.c latex.h \\\n \t\tmotion.c motion.h \\\n+\t\tsnippets.c snippets.h \\\n \t\ttemplate.c template.h \\\n \t\tupdatecheck.c updatecheck.h \\\n \t\tutils.c utils.h \\\n@@ -305,6 +307,7 @@ distclean-compile:\n @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/latex.Po@am__quote@\n @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@\n @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motion.Po@am__quote@\n+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snippets.Po@am__quote@\n @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/template.Po@am__quote@\n @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/updatecheck.Po@am__quote@\n @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@\ndiff --git a/src/editor.c b/src/editor.c\nindex 4515937..7ae6619 100644\n--- a/src/editor.c\n+++ b/src/editor.c\n@@ -125,7 +125,7 @@ void editor_destroy(GuEditor* ec) {\n     int i = 0;\n \n     for (i = 0; i < 2; ++i)\n-        g_signal_handler_disconnect(ec, ec->sigid[i]);\n+        g_signal_handler_disconnect(ec->sourceview, ec->sigid[i]);\n \n     if (ec->filename) {\n         gchar* dirname = g_path_get_dirname(ec->filename);\n', 'commit_subject': 'Fix typo for disconnecting signal', 'repo_name': 'alexandervdm/gummi', 'committer': {'name': 'AZ Huang', 'email': '42925055e90065d4b0db27aa744109896d0603ec@gmail.com', 'time_sec': '1298470531', 'tz_offset': '0', 'date': {'seconds': '1298470531'}}, 'commit_tree': '17fad2c559cc14a12f6d84e08b027be7a8791b18', 'commit_message': 'Fix typo for disconnecting signal\n', 'language_name': 'Shell', 'license': 'mit', 'hunks': '@@ -125,7 +125,7 @@ void editor_destroy(GuEditor* ec) {\n     int i = 0;\n \n     for (i = 0; i < 2; ++i)\n-        g_signal_handler_disconnect(ec, ec->sigid[i]);\n+        g_signal_handler_disconnect(ec->sourceview, ec->sigid[i]);\n \n     if (ec->filename) {\n         gchar* dirname = g_path_get_dirname(ec->filename);\n', 'addition_count': 1, 'deletion_count': 1, 'src_file': 'a/src/editor.c', 'tgt_file': 'b/src/editor.c', 'file_extension': '.c', 'before_file': '/**\n * @file    editor.c\n * @brief\n *\n * Copyright (C) 2009 Gummi Developers\n * All Rights reserved.\n *\n * Permission is hereby granted, free of charge, to any person\n * obtaining a copy of this software and associated documentation\n * files (the "Software"), to deal in the Software without\n * restriction, including without limitation the rights to use,\n * copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following\n * conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n * OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n#include "editor.h"\n\n#include <stdlib.h>\n#include <string.h>\n#include <sys/stat.h>\n\n#include <gtksourceview/gtksource.h>\n#include <gtkspell/gtkspell.h>\n#include <glib/gstdio.h>\n#include <gtk/gtk.h>\n#include <unistd.h>\n\n#include "configfile.h"\n#include "constants.h"\n#include "environment.h"\n#include "utils.h"\n\nstatic void on_inserted_text(GtkTextBuffer *textbuffer,GtkTextIter *location,\n                             gchar *text,gint len, gpointer user_data);\nstatic void on_delete_range(GtkTextBuffer *textbuffer,GtkTextIter *start,\n                             GtkTextIter *end, gpointer user_data);\n\nconst gchar style[][3][20] = {\n    { "tool_bold", "\\\\textbf{", "}" },\n    { "tool_italic", "\\\\emph{", "}" },\n    { "tool_unline", "\\\\underline{", "}" },\n    { "tool_left", "\\\\begin{flushleft}", "\\\\end{flushleft}"},\n    { "tool_center", "\\\\begin{center}", "\\\\end{center}"},\n    { "tool_right", "\\\\begin{flushright}", "\\\\end{flushright}"}\n};\n\nGuEditor* editor_new (GuMotion* mc) {\n    GuEditor* ec = g_new0 (GuEditor, 1);\n\n    /* File related member initialization */\n    ec->workfd = -1;\n    ec->fdname = NULL;\n    ec->filename = NULL;   /* current opened file name in workspace */\n    ec->basename = NULL;   /* use this to form .dvi/.ps/.log etc. files */\n    ec->pdffile = NULL;\n    ec->workfile = NULL;\n    ec->bibfile = NULL;\n    ec->projfile = NULL;\n\n    GtkSourceLanguageManager* manager = gtk_source_language_manager_new ();\n    GtkSourceLanguage* lang = gtk_source_language_manager_get_language (manager,\n            "latex");\n    ec->buffer = gtk_source_buffer_new_with_language (lang);\n    ec->view = GTK_SOURCE_VIEW (gtk_source_view_new_with_buffer (ec->buffer));\n    ec->stylemanager = gtk_source_style_scheme_manager_get_default ();\n    ec->errortag = gtk_text_tag_new ("error");\n    ec->searchtag = gtk_text_tag_new ("search");\n    ec->editortags = gtk_text_buffer_get_tag_table (ec_buffer);\n    ec->replace_activated = FALSE;\n    ec->term = NULL;\n\n    ec->css = gtk_css_provider_new();\n\n    /* Set source view style provider so we can use ec->css to set font later */\n    GtkStyleContext* context = gtk_widget_get_style_context (GTK_WIDGET(ec->view));\n    gtk_style_context_add_provider(context,\n                                   GTK_STYLE_PROVIDER(ec->css),\n                                   GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);\n\n    gtk_source_view_set_tab_width\n        (ec->view, config_get_integer ("Editor", "tabwidth"));\n    gtk_source_view_set_insert_spaces_instead_of_tabs\n        (ec->view, config_get_boolean ("Editor", "spaces_instof_tabs"));\n    gtk_source_view_set_auto_indent\n        (ec->view, config_get_boolean ("Editor", "autoindentation"));\n\n    if (config_get_boolean ("Editor", "spelling"))\n        editor_activate_spellchecking (ec, TRUE);\n\n    editor_sourceview_config (ec);\n    gtk_text_buffer_set_modified (ec_buffer, FALSE);\n\n    /* Register motion callback */\n    ec->sigid[0] = g_signal_connect (ec->view, "key-press-event",\n                G_CALLBACK (on_key_press_cb), mc);\n    ec->sigid[1] = g_signal_connect (ec->view, "key-release-event",\n                G_CALLBACK (on_key_release_cb), mc);\n    ec->sigid[2] = g_signal_connect (ec->buffer, "changed",\n                G_CALLBACK (check_preview_timer), NULL);\n\n    ec->sigid[3] = g_signal_connect_after(ec->buffer, "insert-text",\n                G_CALLBACK(on_inserted_text), ec);\n    ec->sigid[4] = g_signal_connect_after(ec->buffer, "delete-range",\n                G_CALLBACK(on_delete_range), ec);\n\n    return ec;\n}\n\nvoid editor_destroy (GuEditor* ec) {\n    int i = 0;\n\n    for (i = 0; i < 2; ++i)\n        g_signal_handler_disconnect(ec, ec->sigid[i]);\n\n    if (ec->filename) {\n        gchar* dirname = g_path_get_dirname(ec->filename);\n    for (i = 2; i < 5; ++i) {\n        if (g_signal_handler_is_connected (ec->buffer, ec->sigid[i])) {\n            g_signal_handler_disconnect (ec->buffer, ec->sigid[i]);\n        }\n    }\n\n    editor_fileinfo_cleanup (ec);\n    g_free(ec);\n}\n\nstatic void on_inserted_text(GtkTextBuffer *textbuffer,GtkTextIter *location,\n                             gchar *text,gint len, gpointer user_data) {\n\n    if (location == NULL || user_data == NULL) {\n        return;\n    }\n    GuEditor* e = GU_EDITOR(user_data);\n\n    e->last_edit = *location;\n    e->sync_to_last_edit = TRUE;\n}\n\nstatic void on_delete_range(GtkTextBuffer *textbuffer,GtkTextIter *start,\n                             GtkTextIter *end, gpointer user_data) {\n\n    if (start == NULL || user_data == NULL) {\n        return;\n    }\n    GuEditor* e = GU_EDITOR(user_data);\n\n    e->last_edit = *start;\n    e->sync_to_last_edit = TRUE;\n}\n\n/* FileInfo:\n * When a TeX document includes materials from other files (image, documents,\n * bibliography ... etc), pdflatex will try to find those files under the\n * working directory if the include path is not absolute.\n * Before Gummi svn505, gummi copies the TeX file to a temporarily directory\n * and compile there, because of this, the included files can\'t be located if\n * the include path is not absolute. In svn505 we copy the TeX file to the\n * same directory as the original TeX document but named it as \'.FILENAME.swp\'.\n * Since pdflatex refuses to compile TeX files with \'.\' prefixed, we have to\n * set the environment variable \'openout_any=a\'.\n *\n * For a newly created document, all files including the TeX file are stored\n * under the ~/.cache folder (freedesktop XDG standard). For files that are \n * already saved, only the workfile is saved under DIRNAME (FILENAME). \n * Other compilation-related files are located in the temp directory.\n *\n * P.S. pdflatex will automatically strip the suffix, so for a file named\n * FILE.tex under /absolute/path/:\n *\n * filename = /absolute/path/FILE.tex\n * workfile = /absolute/path/.FILE.tex.swp\n * pdffile = ~/cache/gummi/.FILE.tex.pdf\n */\nvoid editor_fileinfo_update (GuEditor* ec, const gchar* filename) {\n\n    // directory should exist, but if not create ~/.cache/gummi:\n    if (!g_file_test (C_TMPDIR, G_FILE_TEST_IS_DIR)) {\n            slog (L_WARNING, "gummi cache directory does not exist, creating..\\n");\n            g_mkdir_with_parents (C_TMPDIR, DIR_PERMS);\n    }\n\n    if (ec->workfd != -1)\n        editor_fileinfo_cleanup (ec);\n\n    ec->fdname = g_build_filename (C_TMPDIR, "gummi_XXXXXX", NULL);\n    ec->workfd = g_mkstemp (ec->fdname);\n\n    // This is required for Windows 7, but not for Linux. It may also\n    // be the proper way for *nix, but I don\'t want to change this\n    // crucial piece of code at this stage of development -alexander\n    #ifdef WIN32\n\t\tclose(ec->workfd);\n\t#endif\n\n    if (filename) {\n        gchar* fname = NULL;\n        if (!g_path_is_absolute (filename)) {\n            fname = g_strdup_printf ("%s%c%s", g_get_current_dir(),\n                                     G_DIR_SEPARATOR, filename);\n        } else {\n            fname = g_strdup (filename);\n        }\n\n        gchar* base = g_path_get_basename (fname);\n        gchar* dir = g_path_get_dirname (fname);\n        ec->filename = g_strdup (fname);\n        ec->basename = g_strdup_printf ("%s%c.%s", dir, G_DIR_SEPARATOR, base);\n        ec->workfile = g_strdup_printf ("%s.swp", ec->basename);\n        ec->pdffile =  g_strdup_printf ("%s%c.%s.pdf", C_TMPDIR,\n                                       G_DIR_SEPARATOR, base);\n        // Get last modified time\n        struct stat attr;\n        stat(fname, &attr);\n        ec->last_modtime = attr.st_mtime;\n\n        g_free (fname);\n        g_free (base);\n        g_free (dir);\n    } else {\n        ec->workfile = g_strdup (ec->fdname);\n        ec->basename = g_strdup (ec->fdname);\n        ec->pdffile =  g_strdup_printf ("%s.pdf", ec->fdname);\n    }\n}\n\ngboolean editor_fileinfo_update_biblio (GuEditor* ec,  const gchar* filename) {\n    g_free (ec->bibfile);\n\n    if (ec->filename && !g_path_is_absolute (filename)) {\n        gchar* dirname = g_path_get_dirname (ec->filename);\n        ec->bibfile = g_build_filename (dirname, filename, NULL);\n        g_free (dirname);\n    } else\n        ec->bibfile = g_strdup (filename);\n    return utils_path_exists (ec->bibfile);\n}\n\nvoid editor_fileinfo_cleanup (GuEditor* ec) {\n    gchar* auxfile = NULL;\n    gchar* logfile = NULL;\n    gchar* syncfile = NULL;\n\n    if (ec->filename) {\n        gchar* dirname = g_path_get_dirname (ec->filename);\n        gchar* basename = g_path_get_basename (ec->filename);\n        auxfile = g_strdup_printf ("%s%c.%s.aux", C_TMPDIR,\n                G_DIR_SEPARATOR, basename);\n        logfile = g_strdup_printf ("%s%c.%s.log", C_TMPDIR,\n                G_DIR_SEPARATOR, basename);\n        syncfile = g_strdup_printf ("%s%c.%s.synctex.gz", C_TMPDIR,\n                G_DIR_SEPARATOR, basename);\n        g_free (basename);\n        g_free (dirname);\n    } else {\n        gchar* dirname = g_path_get_dirname (ec->workfile);\n        gchar* basename = g_path_get_basename (ec->workfile);\n        auxfile = g_strdup_printf ("%s.aux", ec->fdname);\n        logfile = g_strdup_printf ("%s.log", ec->fdname);\n        syncfile = g_strdup_printf ("%s.synctex.gz", ec->fdname);\n        g_free (basename);\n        g_free (dirname);\n    }\n\n    // TODO: make a loop or maybe make register of created files? proc?\n\n    close (ec->workfd);\n    ec->workfd = -1;\n\n    g_remove (auxfile);\n    g_remove (logfile);\n    g_remove (syncfile);\n    g_remove (ec->fdname);\n    g_remove (ec->workfile);\n    g_remove (ec->pdffile);\n    g_remove (ec->basename);\n\n    g_free (auxfile);\n    g_free (logfile);\n    g_free (syncfile);\n    g_free (ec->fdname);\n    g_free (ec->filename);\n    g_free (ec->workfile);\n    g_free (ec->pdffile);\n    g_free (ec->basename);\n\n    ec->fdname = NULL;\n    ec->filename = NULL;\n    ec->workfile = NULL;\n    ec->pdffile = NULL;\n    ec->basename = NULL;\n}\n\nvoid editor_sourceview_config (GuEditor* ec) {\n    GtkWrapMode wrapmode = 0;\n\n    gtk_source_buffer_set_highlight_matching_brackets (ec->buffer, TRUE);\n\n    const gchar* style_scheme = config_get_string ("Editor", "style_scheme");\n    editor_set_style_scheme_by_id (ec, style_scheme);\n\n    editor_set_font (ec, config_get_string ("Editor", "font_css"));\n\n    gtk_source_view_set_show_line_numbers (\n                            GTK_SOURCE_VIEW (ec->view),\n                            config_get_boolean ("Editor", "line_numbers"));\n    gtk_source_view_set_highlight_current_line (\n                            GTK_SOURCE_VIEW (ec->view),\n                            config_get_boolean ("Editor", "highlighting"));\n\n    // The condition \'textwrapping=False && wordwrapping=True\' can\'t happen\n    if (config_get_boolean ("Editor", "textwrapping"))\n        wrapmode += 1;\n    if (config_get_boolean ("Editor", "wordwrapping"))\n        wrapmode += 1;\n\n    gtk_text_view_set_wrap_mode (ec_view, wrapmode);\n}\n\nvoid editor_activate_spellchecking (GuEditor* ec, gboolean status) {\n    const gchar* lang = config_get_string ("Editor", "spelling_lang");\n    GError* err = NULL;\n    GtkSpellChecker* spell = 0;\n    if (status) {\n        spell = gtk_spell_checker_new();\n\n        if (! (gtk_spell_checker_set_language (spell, lang, &err))) {\n            slog (L_ERROR, "gtk_spell_checker_set_language (): %s\\n", err->message);\n            g_error_free (err);\n        }\n        if (! (gtk_spell_checker_attach (spell, ec_view))) {\n            slog (L_ERROR, "gtk_spell_checker_attach failed\\n");\n        }\n    } else {\n        GtkSpellChecker* spell = gtk_spell_checker_get_from_text_view (ec_view);\n        if (spell)\n            gtk_spell_checker_detach (spell);\n    }\n    // TODO g_object_unref (spell); ?\n}\n\nvoid editor_fill_buffer (GuEditor* ec, const gchar* text) {\n    gtk_text_buffer_begin_user_action (ec_buffer);\n    gtk_source_buffer_begin_not_undoable_action (ec->buffer);\n    gtk_widget_set_sensitive (GTK_WIDGET (ec->view), FALSE);\n    gtk_text_buffer_set_text (ec_buffer, text, strlen (text));\n    gtk_widget_set_sensitive (GTK_WIDGET (ec->view), TRUE);\n    gtk_source_buffer_end_not_undoable_action (ec->buffer);\n    gtk_text_buffer_end_user_action (ec_buffer);\n\n    // place cursor in the beginning of the document\n    GtkTextIter start;\n    gtk_text_buffer_get_start_iter (ec_buffer, &start);\n    gtk_text_buffer_place_cursor (ec_buffer, &start);\n    gtk_widget_grab_focus (GTK_WIDGET (ec->view));\n    ec->sync_to_last_edit = FALSE;\n}\n\ngchar* editor_grab_buffer (GuEditor* ec) {\n    GtkTextIter start, end;\n    gtk_text_buffer_get_bounds (ec_buffer, &start, &end);\n    gchar* pstr = gtk_text_iter_get_text (&start, &end);\n    return pstr;\n}\n\ngboolean editor_buffer_changed (GuEditor* ec) {\n    if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (ec->buffer))) {\n        return TRUE;\n    }\n    return FALSE;\n}\n\nvoid editor_insert_package (GuEditor* ec, const gchar* package, const gchar* options) {\n    GtkTextIter start, mstart, mend, sstart, send;\n\n    gchar* pkgstr = NULL;\n    if (options == NULL) {\n        pkgstr = g_strdup_printf ("\\\\usepackage{%s}\\n", package);\n    }\n    else {\n        pkgstr = g_strdup_printf ("\\\\usepackage[%s]{%s}\\n", options, package);\n    }\n\n    gtk_text_buffer_get_start_iter (ec_buffer, &start);\n    gtk_text_iter_forward_search (&start, (gchar*)"\\\\begin{document}", 0,\n            &mstart, &mend, NULL);\n    if (!gtk_text_iter_backward_search (&mstart, pkgstr, 0, &sstart, &send,\n                NULL)) {\n        gtk_source_buffer_begin_not_undoable_action (ec->buffer);\n        gtk_text_buffer_begin_user_action (ec_buffer);\n        gtk_text_buffer_insert (ec_buffer, &mstart, pkgstr, -1);\n        gtk_text_buffer_end_user_action (ec_buffer);\n        gtk_source_buffer_end_not_undoable_action (ec->buffer);\n        gtk_text_buffer_set_modified (ec_buffer, TRUE);\n    }\n    g_free (pkgstr);\n}\n\nvoid editor_insert_bib (GuEditor* ec, const gchar* package) {\n    GtkTextIter start, end, mstart, mend, sstart, send;\n    gchar* pkgstr = g_strdup_printf (\n            "\\\\bibliography{%s}{}\\n\\\\bibliographystyle{plain}\\n", package);\n    gtk_text_buffer_get_start_iter (ec_buffer, &start);\n    gtk_text_buffer_get_end_iter (ec_buffer, &end);\n    gtk_text_iter_backward_search (&end, (gchar*)"\\\\end{document}", 0,\n            &mstart, &mend, NULL);\n    if (!gtk_text_iter_forward_search (&start, "\\\\bibliography{", 0,\n                &sstart, &send, NULL)) {\n        gtk_source_buffer_begin_not_undoable_action (ec->buffer);\n        gtk_text_buffer_begin_user_action (ec_buffer);\n        gtk_text_buffer_insert (ec_buffer, &mstart, pkgstr, -1);\n        gtk_text_buffer_end_user_action (ec_buffer);\n        gtk_source_buffer_end_not_undoable_action (ec->buffer);\n        gtk_text_buffer_set_modified (ec_buffer, TRUE);\n    }\n    g_free (pkgstr);\n}\n\nvoid editor_set_selection_textstyle (GuEditor* ec, const gchar* type) {\n    GtkTextIter start, end;\n    gint i = 0, selected = 0;\n    const gchar* selected_text = 0;\n    gint style_size = sizeof (style) / sizeof (style[0]);\n    gchar** result = NULL;\n    GError* err = NULL;\n    GRegex* match_str = NULL;\n    GMatchInfo* match_info = NULL;\n    gchar* outtext = NULL;\n    gchar* regexbuf = NULL;\n\n    /* grab selected text */\n    gtk_text_buffer_get_selection_bounds (ec_buffer, &start, &end);\n    selected_text = gtk_text_iter_get_text (&start, &end);\n\n    /* select style */\n    for (i = 0; i < style_size; ++i)\n        if (STR_EQU (style[i][0], type)) {\n            selected = i;\n            break;\n        }\n\n    /* generate regex expression */\n    regexbuf = g_strdup_printf ("(.*)%s%s(.*)%s%s(.*)",\n            (style[selected][1][0] == \'\\\\\')? "\\\\": "",\n            style[selected][1],\n            (style[selected][2][0] == \'\\\\\')? "\\\\": "",\n            style[selected][2]);\n\n    if (! (match_str = g_regex_new (regexbuf, G_REGEX_DOTALL, 0, &err))) {\n        slog (L_ERROR, "g_regex_new (): %s\\n", err->message);\n        g_error_free (err);\n        goto cleanup;\n    }\n\n    if (g_regex_match (match_str, selected_text, 0, &match_info)) {\n        result = g_match_info_fetch_all (match_info);\n        if (strlen (result[1]) == 0 && strlen (result[3]) == 0) {\n            /* already applied, so we remove it */\n            outtext = g_strdup (result[2]);\n        } else if (strlen (result[1]) != 0 || strlen (result[3]) != 0) {\n            /* the text contains a partially styled text, remove it and apply\n             * style to the whole text */\n            outtext = g_strdup_printf ("%s%s%s%s%s",\n                    style[selected][1], result[1], result[2], result[3],\n                    style[selected][2]);\n        }\n    } else { /* no previous style applied */\n        outtext = g_strdup_printf ("%s%s%s",\n                style[selected][1], selected_text, style[selected][2]);\n    }\n\n    gtk_text_buffer_begin_user_action (ec_buffer);\n    gtk_text_buffer_delete (ec_buffer, &start, &end);\n    gtk_text_buffer_insert (ec_buffer, &start, outtext, -1);\n    end = start;\n    gtk_text_iter_backward_chars (&start, strlen (outtext));\n    gtk_text_buffer_select_range (ec_buffer, &start, &end);\n    gtk_text_buffer_end_user_action (ec_buffer);\n    gtk_text_buffer_set_modified (ec_buffer, TRUE);\n\ncleanup:\n    g_free (outtext);\n    g_free (regexbuf);\n    g_strfreev (result);\n    g_match_info_free (match_info);\n    g_regex_unref (match_str);\n}\n\nvoid editor_apply_errortags (GuEditor* ec, gint* lines) {\n    GtkTextIter start, end;\n    gint count = 0;\n    /* remove the tag from the table if it is in threre */\n    if (gtk_text_tag_table_lookup (ec->editortags, "error"))\n        gtk_text_tag_table_remove (ec->editortags, ec->errortag);\n\n    gtk_text_tag_table_add (ec->editortags, ec->errortag);\n    while (lines[count]) {\n        gtk_text_buffer_get_iter_at_line (ec_buffer,&start,lines[count]-1);\n        gtk_text_buffer_get_iter_at_line (ec_buffer, &end, lines[count]);\n        gtk_text_buffer_apply_tag (ec_buffer, ec->errortag, &start, &end);\n        ++count;\n    }\n}\n\nvoid editor_jumpto_search_result (GuEditor* ec, gint direction) {\n    if (!ec->term) return;\n    if (direction == 1)\n        editor_search_next (ec, FALSE);\n    else\n        editor_search_next (ec, TRUE);\n}\n\nvoid editor_start_search (GuEditor* ec, const gchar* term,\n        gboolean backwards, gboolean wholeword, gboolean matchcase) {\n    /* save options */\n    if (ec->term != term) {\n        g_free (ec->term);\n        ec->term = g_strdup (term);\n    }\n\n    ec->backwards = backwards;\n    ec->wholeword = wholeword;\n    ec->matchcase = matchcase;\n\n    editor_apply_searchtag (ec);\n    editor_search_next (ec, FALSE);\n}\n\nvoid editor_apply_searchtag (GuEditor* ec) {\n    GtkTextIter start, mstart, mend;\n    gboolean ret = FALSE;\n\n    gtk_text_buffer_get_start_iter (ec_buffer, &start);\n\n    if (gtk_text_tag_table_lookup (ec->editortags, "search"))\n        gtk_text_tag_table_remove (ec->editortags, ec->searchtag);\n    gtk_text_tag_table_add (ec->editortags, ec->searchtag);\n\n    while (TRUE) {\n\t\tdo {\n\t\t\tret = gtk_text_iter_forward_search (&start, ec->term,\n\t                (ec->matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),\n\t                &mstart, &mend, NULL);\n\t\t\tstart = mend;\n\t\t} while (ec->wholeword && ret && (!gtk_text_iter_starts_word(&mstart) ||\n\t\t\t\t!gtk_text_iter_ends_word(&mend)));\n\n        if (ret) {\n            gtk_text_buffer_apply_tag (ec_buffer, ec->searchtag,\n                    &mstart, &mend);\n//            start =  mend;\n        } else break;\n    }\n}\n\nvoid editor_search_next (GuEditor* ec, gboolean inverse) {\n    GtkTextIter current, start, end, mstart, mend;\n    gboolean ret = FALSE, response = FALSE;\n\n    editor_get_current_iter (ec, &current);\n\t\n\tdo {\n\t    if (ec->backwards ^ inverse) {\n\t        ret = gtk_text_iter_backward_search (&current, ec->term,\n\t                (ec->matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),\n\t                &mstart, &mend, NULL);\n\t    } else {\n\t        gtk_text_iter_forward_chars (&current, strlen (ec->term));\n\t        ret = gtk_text_iter_forward_search (&current, ec->term,\n\t                (ec->matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),\n\t                &mstart, &mend, NULL);\n\t\t}\n\t\tcurrent = mend;\n\t} while (ec->wholeword && ret && (!gtk_text_iter_starts_word(&mstart) ||\n\t\t\t!gtk_text_iter_ends_word(&mend)));\n\n    if (ret) {\n        gtk_text_buffer_select_range (ec_buffer, &mstart, &mend);\n        editor_scroll_to_cursor (ec);\n    }\n    /* check if the top/bottom is reached */\n    gtk_text_buffer_get_start_iter (ec_buffer, &start);\n    gtk_text_buffer_get_end_iter (ec_buffer, &end);\n\n    if (!ret) {\n        if (ec->backwards ^ inverse) {\n            response = utils_yes_no_dialog (\n                    _("Top reached, search from bottom?"));\n            if (GTK_RESPONSE_YES == response) {\n                gtk_text_buffer_place_cursor (ec_buffer, &end);\n                editor_search_next (ec, inverse);\n            }\n        } else {\n            response = utils_yes_no_dialog (\n                    _("Bottom reached, search from top?"));\n            if (GTK_RESPONSE_YES == response) {\n                gtk_text_buffer_place_cursor (ec_buffer, &start);\n                editor_search_next (ec, inverse);\n            }\n        }\n    }\n}\n\nvoid editor_start_replace_next (GuEditor* ec, const gchar* term,\n        const gchar* rterm, gboolean backwards, gboolean wholeword,\n        gboolean matchcase) {\n    GtkTextIter current, mstart, mend;\n    gboolean ret = FALSE;\n\n    if (!ec->replace_activated) {\n        ec->replace_activated = TRUE;\n        editor_start_search (ec, term, backwards, wholeword, matchcase);\n        return;\n    }\n\n    /* place cursor to the next result */\n    editor_get_current_iter (ec, &current);\n\n    if (backwards)\n       ret = gtk_text_iter_backward_search (&current, term,\n                (matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),\n                &mstart, &mend, NULL);\n    else\n       ret = gtk_text_iter_forward_search (&current, term,\n                (matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),\n                &mstart, &mend, NULL);\n\n    if (ret && (!wholeword || (wholeword\n            && gtk_text_iter_starts_word (&mstart)\n            && gtk_text_iter_ends_word (&mend)))) {\n        gtk_text_buffer_begin_user_action (ec_buffer);\n        gtk_text_buffer_delete (ec_buffer, &mstart, &mend);\n        gtk_text_buffer_insert (ec_buffer, &mstart, rterm, -1);\n        gtk_text_buffer_end_user_action (ec_buffer);\n        editor_search_next (ec, FALSE);\n    }\n    return;\n}\n\nvoid editor_start_replace_all (GuEditor* ec, const gchar* term,\n        const gchar* rterm, gboolean backwards, gboolean wholeword,\n        gboolean matchcase) {\n    GtkTextIter start, mstart, mend;\n    gboolean ret = FALSE;\n    gboolean action_started = FALSE;\n\n    gtk_text_buffer_get_start_iter (ec_buffer, &start);\n\n    while (TRUE) {\n        ret = gtk_text_iter_forward_search (&start, term,\n                (matchcase? 0: GTK_TEXT_SEARCH_CASE_INSENSITIVE),\n                &mstart, &mend, NULL);\n\n        if (ret && (!wholeword || (wholeword\n                && gtk_text_iter_starts_word (&mstart)\n                && gtk_text_iter_ends_word (&mend)))) {\n            if (!action_started) {\n                gtk_text_buffer_begin_user_action (ec_buffer);\n                action_started = TRUE;\n            }\n            gtk_text_buffer_delete (ec_buffer, &mstart, &mend);\n            gtk_text_buffer_insert (ec_buffer, &mstart, rterm, -1);\n            start =  mstart;\n        } else break;\n    }\n    if (action_started) {\n        gtk_text_buffer_end_user_action (ec_buffer);\n    }\n}\n\nvoid editor_get_current_iter (GuEditor* ec, GtkTextIter* current) {\n    GtkTextMark* mark = gtk_text_buffer_get_insert (ec_buffer);\n    gtk_text_buffer_get_iter_at_mark (ec_buffer, current, mark);\n}\n\nvoid editor_scroll_to_cursor (GuEditor* ec) {\n    gtk_text_view_scroll_to_mark (ec_view,\n                                 gtk_text_buffer_get_insert (ec_buffer),\n                                 0.25, FALSE, 0.0, 0.0);\n}\n\nvoid editor_scroll_to_line (GuEditor* ec, gint line) {\n    if (ec == NULL) {\n        return;\n    }\n    GtkTextIter iter;\n    gtk_text_buffer_get_iter_at_line(ec_buffer, &iter, line);\n    gtk_text_buffer_place_cursor(ec_buffer, &iter);\n    editor_scroll_to_cursor(ec);\n    ec->sync_to_last_edit = FALSE;\n}\n\nvoid editor_undo_change (GuEditor* ec) {\n    GtkTextIter current;\n    if (gtk_source_buffer_can_undo (ec->buffer)) {\n        gtk_source_buffer_undo (ec->buffer);\n        editor_get_current_iter (ec, &current);\n        editor_scroll_to_cursor (ec);\n        gtk_text_buffer_set_modified (ec_buffer, TRUE);\n    }\n}\n\nvoid editor_redo_change (GuEditor* ec) {\n    GtkTextIter current;\n    if (gtk_source_buffer_can_redo (ec->buffer)) {\n        gtk_source_buffer_redo (ec->buffer);\n        editor_get_current_iter (ec, &current);\n        editor_scroll_to_cursor (ec);\n        gtk_text_buffer_set_modified (ec_buffer, TRUE);\n    }\n}\n\nvoid editor_set_font (GuEditor* ec, const gchar* font_css) {\n    gtk_css_provider_load_from_data (ec->css, font_css, -1, NULL);\n}\n\n\nvoid editor_set_style_scheme_by_id (GuEditor* ec, const gchar* id) {\n\n    GtkSourceStyleScheme* scheme =\n        gtk_source_style_scheme_manager_get_scheme (ec->stylemanager, id);\n    slog (L_INFO, "Setting styles scheme to %s\\n", id);\n\n    if (!scheme) {\n        slog (L_ERROR, "No style scheme %s found, setting to classic\\n", id);\n        scheme = gtk_source_style_scheme_manager_get_scheme (ec->stylemanager,\n                "classic");\n    }\n    gtk_source_buffer_set_style_scheme (ec->buffer, scheme);\n\n    set_style_fg_bg(G_OBJECT (ec->searchtag), scheme, "search-match", "yellow");\n    set_style_fg_bg(G_OBJECT (ec->errortag), scheme,"def:error",  "red");\n}\n\nstatic inline gdouble gdk_rgba_luminance (GdkRGBA c) {\n    return 0.2126 * c.red + 0.7152 * c.green + 0.0722 * c.blue;\n}\n\n/**\n *  Sets a object\'s fore- and background color to that of scheme\'s style\n *  "styleName". If no background color is defined in the style, defaultBG is\n *  used. defaultBG can be any valid parameter to gdk_rgba_parse().\n *  If only a foreground color was defined and it has not enough contrast to the\n *  default background, it will be overwritten. The foreground color will either\n *  be white or black, which has more contrast.\n */\nvoid set_style_fg_bg (GObject* obj, GtkSourceStyleScheme* scheme,\n                      gchar* styleName, gchar* defaultBG) {\n    GtkSourceStyle *style = NULL;\n\n    gchar *bg = NULL;\n    gchar *fg = NULL;\n    gboolean foreground_set;\n    gboolean background_set;\n    GdkRGBA foreground;\n    GdkRGBA background;\n\n\n    if (scheme == NULL) {\n        goto set_style_fg_bg_return_defaults;\n    }\n\n    style = gtk_source_style_scheme_get_style (scheme, styleName);\n\n    if (style == NULL) {\n        goto set_style_fg_bg_return_defaults;\n    }\n\n    // Get properties of style\n    g_object_get (style,\n                  "foreground-set", &foreground_set,\n                  "foreground", &fg,\n                  "background-set", &background_set,\n                  "background", &bg,\n                  NULL);\n\n    if (foreground_set) {\n        if (fg == NULL || !gdk_rgba_parse(&foreground, fg))\n            foreground_set = FALSE;\n    }\n\n    if (background_set) {\n        if (bg == NULL || !gdk_rgba_parse(&background, bg))\n            background_set = FALSE;\n    }\n\n    g_free(fg);\n    g_free(bg);\n\n    if (background_set && foreground_set) {\n        // We trust the style to set both to good values\n        // Do nothing\n    } else if (!background_set && foreground_set) {\n        // Set bg to default and check if fg has enough contrast\n        gdk_rgba_parse(&background, defaultBG);\n\n        gdouble diff = ABS(gdk_rgba_luminance(foreground) -\n                           gdk_rgba_luminance(background));\n\n        if (diff < 0.5) {\n            slog(L_INFO, "Style \\"%s\\" defines a foreground, but no background "\n                         "color. As the fourground color has not enough "\n                         "contrast to Gummis default background color, the "\n                         "foreground color has been adjusted.\\n", styleName);\n            if (gdk_rgba_luminance(background) > 0.5) {\n                gdk_rgba_parse(&foreground, "black");\n            } else {\n                gdk_rgba_parse(&foreground, "white");\n            }\n        }\n    } else if (background_set && !foreground_set) {\n        // Choose a fg = white or black, which has more contrast\n        if (gdk_rgba_luminance(background) > 0.5) {\n            gdk_rgba_parse(&foreground, "black");\n        } else {\n            gdk_rgba_parse(&foreground, "white");\n        }\n    } else {\n        // none set, set defaults\n        goto set_style_fg_bg_return_defaults;\n    }\n\n    g_object_set(obj, "foreground", gdk_rgba_to_string(&foreground),\n                      "background", gdk_rgba_to_string(&background), \n                       NULL);\n    return;\n\nset_style_fg_bg_return_defaults:\n\n    // No valid style, set defaults\n    gdk_rgba_parse(&background, defaultBG);\n\n    if (gdk_rgba_luminance(background) > 0.5) {\n        gdk_rgba_parse(&foreground, "black");\n    } else {\n        gdk_rgba_parse(&foreground, "white");\n    }\n\n    g_object_set (obj, "foreground-gdk", &foreground,\n                        "background-gdk", &background, NULL);\n\n}\n\n/* The following functions are taken from gedit and partially modified */\n\ngint schemes_compare (gconstpointer a, gconstpointer b) {\n    GtkSourceStyleScheme *scheme_a = (GtkSourceStyleScheme *)a;\n    GtkSourceStyleScheme *scheme_b = (GtkSourceStyleScheme *)b;\n\n    const gchar *name_a = gtk_source_style_scheme_get_name (scheme_a);\n    const gchar *name_b = gtk_source_style_scheme_get_name (scheme_b);\n\n    return g_utf8_collate (name_a, name_b);\n}\n\nGList* editor_list_style_scheme_sorted (void) {\n    const gchar * const * scheme_ids;\n    GList *schemes = NULL;\n    GtkSourceStyleSchemeManager* manager =\n        gtk_source_style_scheme_manager_get_default();\n\n    // add custom style path ~/.config/gummi/styles:\n    gchar* custom = g_build_path (G_DIR_SEPARATOR_S, C_GUMMI_CONFDIR, "styles", NULL);\n    if (g_file_test (custom, G_FILE_TEST_IS_DIR)) {\n        gtk_source_style_scheme_manager_append_search_path (manager, custom);\n    }\n    g_free (custom);\n\n    scheme_ids = gtk_source_style_scheme_manager_get_scheme_ids (manager);\n\n    while (*scheme_ids != NULL) {\n        GtkSourceStyleScheme *scheme;\n        scheme = gtk_source_style_scheme_manager_get_scheme (manager,\n                *scheme_ids);\n        schemes = g_list_prepend (schemes, scheme);\n        ++scheme_ids;\n    }\n\n    if (schemes != NULL)\n        schemes = g_list_sort (schemes, (GCompareFunc)schemes_compare);\n\n    return schemes;\n}\n', 'message': 'Fix typo for disconnecting signal\n', 'author_name': 'AZ Huang', 'lang': 'c'}