summaryrefslogtreecommitdiff
path: root/plugins/modelines
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/modelines')
-rw-r--r--plugins/modelines/modeline-parser.c74
-rw-r--r--plugins/modelines/modeline-parser.h4
-rw-r--r--plugins/modelines/pluma-modeline-plugin.c10
-rw-r--r--plugins/modelines/pluma-modeline-plugin.h2
4 files changed, 45 insertions, 45 deletions
diff --git a/plugins/modelines/modeline-parser.c b/plugins/modelines/modeline-parser.c
index c66c1ed5..3f347a7b 100644
--- a/plugins/modelines/modeline-parser.c
+++ b/plugins/modelines/modeline-parser.c
@@ -63,7 +63,7 @@ typedef struct _ModelineOptions
GtkWrapMode wrap_mode;
gboolean display_right_margin;
guint right_margin_position;
-
+
ModelineSet set;
} ModelineOptions;
@@ -94,7 +94,7 @@ modeline_parser_shutdown ()
if (kate_languages != NULL)
g_hash_table_destroy (kate_languages);
-
+
vim_languages = NULL;
emacs_languages = NULL;
kate_languages = NULL;
@@ -225,7 +225,7 @@ skip_whitespaces (gchar **s)
}
/* Parse vi(m) modelines.
- * Vi(m) modelines looks like this:
+ * Vi(m) modelines looks like this:
* - first form: [text]{white}{vi:|vim:|ex:}[white]{options}
* - second form: [text]{white}{vi:|vim:|ex:}[white]se[t] {options}:[text]
* They can happen on the three first or last lines.
@@ -290,7 +290,7 @@ parse_vim_modeline (gchar *s,
{
g_free (options->language_id);
options->language_id = get_language_id_vim (value->str);
-
+
options->set |= MODELINE_SET_LANGUAGE;
}
else if (strcmp (key->str, "et") == 0 ||
@@ -303,7 +303,7 @@ parse_vim_modeline (gchar *s,
strcmp (key->str, "tabstop") == 0)
{
intval = atoi (value->str);
-
+
if (intval)
{
options->tab_width = intval;
@@ -314,7 +314,7 @@ parse_vim_modeline (gchar *s,
strcmp (key->str, "shiftwidth") == 0)
{
intval = atoi (value->str);
-
+
if (intval)
{
options->indent_width = intval;
@@ -330,15 +330,15 @@ parse_vim_modeline (gchar *s,
else if (strcmp (key->str, "textwidth") == 0)
{
intval = atoi (value->str);
-
+
if (intval)
{
options->right_margin_position = intval;
options->display_right_margin = TRUE;
-
+
options->set |= MODELINE_SET_SHOW_RIGHT_MARGIN |
MODELINE_SET_RIGHT_MARGIN_POSITION;
-
+
}
}
}
@@ -407,13 +407,13 @@ parse_emacs_modeline (gchar *s,
{
g_free (options->language_id);
options->language_id = get_language_id_emacs (value->str);
-
+
options->set |= MODELINE_SET_LANGUAGE;
}
else if (strcmp (key->str, "tab-width") == 0)
{
intval = atoi (value->str);
-
+
if (intval)
{
options->tab_width = intval;
@@ -423,7 +423,7 @@ parse_emacs_modeline (gchar *s,
else if (strcmp (key->str, "indent-offset") == 0)
{
intval = atoi (value->str);
-
+
if (intval)
{
options->indent_width = intval;
@@ -434,14 +434,14 @@ parse_emacs_modeline (gchar *s,
{
intval = strcmp (value->str, "nil") == 0;
options->insert_spaces = intval;
-
+
options->set |= MODELINE_SET_INSERT_SPACES;
}
else if (strcmp (key->str, "autowrap") == 0)
{
intval = strcmp (value->str, "nil") != 0;
options->wrap_mode = intval ? GTK_WRAP_WORD : GTK_WRAP_NONE;
-
+
options->set |= MODELINE_SET_WRAP_MODE;
}
}
@@ -505,13 +505,13 @@ parse_kate_modeline (gchar *s,
{
g_free (options->language_id);
options->language_id = get_language_id_kate (value->str);
-
+
options->set |= MODELINE_SET_LANGUAGE;
}
else if (strcmp (key->str, "tab-width") == 0)
{
intval = atoi (value->str);
-
+
if (intval)
{
options->tab_width = intval;
@@ -540,17 +540,17 @@ parse_kate_modeline (gchar *s,
options->wrap_mode = intval ? GTK_WRAP_WORD : GTK_WRAP_NONE;
- options->set |= MODELINE_SET_WRAP_MODE;
+ options->set |= MODELINE_SET_WRAP_MODE;
}
else if (strcmp (key->str, "word-wrap-column") == 0)
{
intval = atoi (value->str);
-
+
if (intval)
{
options->right_margin_position = intval;
options->display_right_margin = TRUE;
-
+
options->set |= MODELINE_SET_RIGHT_MARGIN_POSITION |
MODELINE_SET_SHOW_RIGHT_MARGIN;
}
@@ -612,7 +612,7 @@ check_previous (GtkSourceView *view,
ModelineSet set)
{
GtkSourceBuffer *buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
-
+
/* Do not restore default when this is the first time */
if (!previous)
return FALSE;
@@ -649,7 +649,7 @@ check_previous (GtkSourceView *view,
case MODELINE_SET_LANGUAGE:
{
GtkSourceLanguage *language = gtk_source_buffer_get_language (buffer);
-
+
return (language == NULL && previous->language_id == NULL) ||
(language != NULL && g_strcmp0 (gtk_source_language_get_id (language),
previous->language_id) == 0);
@@ -675,7 +675,7 @@ modeline_parser_apply_modeline (GtkSourceView *view)
GtkTextBuffer *buffer;
GtkTextIter iter, liter;
gint line_count;
-
+
options.language_id = NULL;
options.set = MODELINE_SET_NONE;
@@ -758,7 +758,7 @@ modeline_parser_apply_modeline (GtkSourceView *view)
}
}
- ModelineOptions *previous = g_object_get_data (G_OBJECT (buffer),
+ ModelineOptions *previous = g_object_get_data (G_OBJECT (buffer),
MODELINE_OPTIONS_DATA_KEY);
/* Apply the options we got from modelines and restore defaults if
@@ -774,17 +774,17 @@ modeline_parser_apply_modeline (GtkSourceView *view)
(view,
pluma_prefs_manager_get_insert_spaces ());
}
-
+
if (has_option (&options, MODELINE_SET_TAB_WIDTH))
{
gtk_source_view_set_tab_width (view, options.tab_width);
}
else if (check_previous (view, previous, MODELINE_SET_TAB_WIDTH))
{
- gtk_source_view_set_tab_width (view,
+ gtk_source_view_set_tab_width (view,
pluma_prefs_manager_get_tabs_size ());
}
-
+
if (has_option (&options, MODELINE_SET_INDENT_WIDTH))
{
gtk_source_view_set_indent_width (view, options.indent_width);
@@ -793,37 +793,37 @@ modeline_parser_apply_modeline (GtkSourceView *view)
{
gtk_source_view_set_indent_width (view, -1);
}
-
+
if (has_option (&options, MODELINE_SET_WRAP_MODE))
{
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), options.wrap_mode);
}
else if (check_previous (view, previous, MODELINE_SET_WRAP_MODE))
{
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view),
+ gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view),
pluma_prefs_manager_get_wrap_mode ());
}
-
+
if (has_option (&options, MODELINE_SET_RIGHT_MARGIN_POSITION))
{
gtk_source_view_set_right_margin_position (view, options.right_margin_position);
}
else if (check_previous (view, previous, MODELINE_SET_RIGHT_MARGIN_POSITION))
{
- gtk_source_view_set_right_margin_position (view,
+ gtk_source_view_set_right_margin_position (view,
pluma_prefs_manager_get_right_margin_position ());
}
-
+
if (has_option (&options, MODELINE_SET_SHOW_RIGHT_MARGIN))
{
gtk_source_view_set_show_right_margin (view, options.display_right_margin);
}
else if (check_previous (view, previous, MODELINE_SET_SHOW_RIGHT_MARGIN))
{
- gtk_source_view_set_show_right_margin (view,
+ gtk_source_view_set_show_right_margin (view,
pluma_prefs_manager_get_display_right_margin ());
}
-
+
if (previous)
{
*previous = options;
@@ -834,13 +834,13 @@ modeline_parser_apply_modeline (GtkSourceView *view)
previous = g_slice_new (ModelineOptions);
*previous = options;
previous->language_id = g_strdup (options.language_id);
-
- g_object_set_data_full (G_OBJECT (buffer),
- MODELINE_OPTIONS_DATA_KEY,
+
+ g_object_set_data_full (G_OBJECT (buffer),
+ MODELINE_OPTIONS_DATA_KEY,
previous,
(GDestroyNotify)free_modeline_options);
}
-
+
g_free (options.language_id);
}
diff --git a/plugins/modelines/modeline-parser.h b/plugins/modelines/modeline-parser.h
index 72a1071f..ce6429b4 100644
--- a/plugins/modelines/modeline-parser.h
+++ b/plugins/modelines/modeline-parser.h
@@ -1,14 +1,14 @@
/*
* modelie-parser.h
* Emacs, Kate and Vim-style modelines support for pluma.
- *
+ *
* Copyright (C) 2005-2007 - Steve Frécinaux <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/plugins/modelines/pluma-modeline-plugin.c b/plugins/modelines/pluma-modeline-plugin.c
index cc7e461b..b4904a89 100644
--- a/plugins/modelines/pluma-modeline-plugin.c
+++ b/plugins/modelines/pluma-modeline-plugin.c
@@ -1,14 +1,14 @@
/*
* pluma-modeline-plugin.c
* Emacs, Kate and Vim-style modelines support for pluma.
- *
+ *
* Copyright (C) 2005-2007 - Steve Frécinaux <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
+
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -279,10 +279,10 @@ pluma_modeline_plugin_deactivate (PeasActivatable *activatable)
for (l = views; l != NULL; l = l->next)
{
disconnect_handlers (PLUMA_VIEW (l->data));
-
+
modeline_parser_deactivate (GTK_SOURCE_VIEW (l->data));
}
-
+
g_list_free (views);
}
diff --git a/plugins/modelines/pluma-modeline-plugin.h b/plugins/modelines/pluma-modeline-plugin.h
index c44faf36..f952b2ba 100644
--- a/plugins/modelines/pluma-modeline-plugin.h
+++ b/plugins/modelines/pluma-modeline-plugin.h
@@ -1,7 +1,7 @@
/*
* pluma-modeline-plugin.h
* Emacs, Kate and Vim-style modelines support for pluma.
- *
+ *
* Copyright (C) 2005-2007 - Steve Frécinaux <[email protected]>
*
* This program is free software; you can redistribute it and/or modify