diff --git a/geany.glade b/geany.glade
index eebd478..b76ba57 100644
--- a/geany.glade
+++ b/geany.glade
@@ -7057,26 +7057,6 @@ Match braces</property>
 				      <property name="fill">False</property>
 				    </packing>
 				  </child>
-
-				  <child>
-				    <widget class="GtkRadioButton" id="radio_long_line_disabled">
-				      <property name="visible">True</property>
-				      <property name="can_focus">True</property>
-				      <property name="label" translatable="yes">Disabled</property>
-				      <property name="use_underline">True</property>
-				      <property name="relief">GTK_RELIEF_NORMAL</property>
-				      <property name="focus_on_click">True</property>
-				      <property name="active">False</property>
-				      <property name="inconsistent">False</property>
-				      <property name="draw_indicator">True</property>
-				      <property name="group">radio_long_line_line</property>
-				    </widget>
-				    <packing>
-				      <property name="padding">0</property>
-				      <property name="expand">False</property>
-				      <property name="fill">False</property>
-				    </packing>
-				  </child>
 				</widget>
 				<packing>
 				  <property name="left_attach">1</property>
@@ -7093,22 +7073,16 @@ Match braces</property>
 		      </child>
 
 		      <child>
-			<widget class="GtkLabel" id="label155">
+			<widget class="GtkCheckButton" id="check_long_line">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">&lt;b&gt;Long line marker&lt;/b&gt;</property>
-			  <property name="use_underline">False</property>
-			  <property name="use_markup">True</property>
-			  <property name="justify">GTK_JUSTIFY_LEFT</property>
-			  <property name="wrap">False</property>
-			  <property name="selectable">False</property>
-			  <property name="xalign">0.5</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xpad">0</property>
-			  <property name="ypad">0</property>
-			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			  <property name="width_chars">-1</property>
-			  <property name="single_line_mode">False</property>
-			  <property name="angle">0</property>
+			  <property name="can_focus">True</property>
+			  <property name="label" translatable="yes">Long line marker</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</property>
+			  <property name="focus_on_click">True</property>
+			  <property name="active">False</property>
+			  <property name="inconsistent">False</property>
+			  <property name="draw_indicator">True</property>
 			</widget>
 			<packing>
 			  <property name="type">label_item</property>
@@ -9845,6 +9819,254 @@ Match braces</property>
 	      <property name="type">tab</property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkVBox" id="vbox47">
+	      <property name="border_width">6</property>
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">3</property>
+
+	      <child>
+		<widget class="GtkFrame" id="frame40">
+		  <property name="visible">True</property>
+		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
+		  <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment48">
+		      <property name="visible">True</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">1</property>
+		      <property name="yscale">1</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">12</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkTable" id="table18">
+			  <property name="visible">True</property>
+			  <property name="n_rows">4</property>
+			  <property name="n_columns">2</property>
+			  <property name="homogeneous">False</property>
+			  <property name="row_spacing">3</property>
+			  <property name="column_spacing">12</property>
+
+			  <child>
+			    <widget class="GtkLabel" id="label241">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">Display:</property>
+			      <property name="use_underline">False</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">0</property>
+			      <property name="right_attach">1</property>
+			      <property name="top_attach">0</property>
+			      <property name="bottom_attach">1</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkLabel" id="label240">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">Long line marker:</property>
+			      <property name="use_underline">False</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">0</property>
+			      <property name="right_attach">1</property>
+			      <property name="top_attach">3</property>
+			      <property name="bottom_attach">4</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkRadioButton" id="radio_long_line_disabled">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Disabled</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">1</property>
+			      <property name="right_attach">2</property>
+			      <property name="top_attach">0</property>
+			      <property name="bottom_attach">1</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkRadioButton" id="radio_long_line_custom">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Custom</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			      <property name="group">radio_long_line_disabled</property>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">1</property>
+			      <property name="right_attach">2</property>
+			      <property name="top_attach">2</property>
+			      <property name="bottom_attach">3</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkRadioButton" id="radio_long_line_default">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Use global settings</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			      <property name="group">radio_long_line_disabled</property>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">1</property>
+			      <property name="right_attach">2</property>
+			      <property name="top_attach">1</property>
+			      <property name="bottom_attach">2</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkSpinButton" id="spin_long_line">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="climb_rate">1</property>
+			      <property name="digits">0</property>
+			      <property name="numeric">True</property>
+			      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+			      <property name="snap_to_ticks">False</property>
+			      <property name="wrap">True</property>
+			      <property name="adjustment">72 0 1000 1 10 0</property>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">1</property>
+			      <property name="right_attach">2</property>
+			      <property name="top_attach">3</property>
+			      <property name="bottom_attach">4</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label239">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">&lt;b&gt;Long line marker&lt;/b&gt;</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">True</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="type">label_item</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<placeholder/>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="tab_expand">False</property>
+	      <property name="tab_fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label238">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">Editor</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="type">tab</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
diff --git a/src/editor.c b/src/editor.c
index 8916747..82b8d08 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -272,6 +272,35 @@ static gboolean is_style_php(gint style)
 }
 
 
+gint editor_get_long_line_type(void)
+{
+	if (app->project)
+		switch (app->project->long_line_behaviour)
+		{
+			case 0: /* marker disabled */
+				return 2;
+			case 1: /* use global settings */
+				break;
+			case 2: /* custom (enabled) */
+				return editor_prefs.long_line_global_type;
+		}
+
+	if (!editor_prefs.long_line_global_enabled)
+		return 2;
+	else
+		return editor_prefs.long_line_global_type;
+}
+
+
+gint editor_get_long_line_column(void)
+{
+	if (app->project && app->project->long_line_behaviour != 1 /* use global settings */)
+		return app->project->long_line_column;
+	else
+		return editor_prefs.long_line_global_column;
+}
+
+
 void editor_toggle_fold(GeanyEditor *editor, gint line, gint modifiers)
 {
 	ScintillaObject *sci;
@@ -4840,8 +4869,8 @@ void editor_apply_update_prefs(GeanyEditor *editor)
 
 	sci = editor->sci;
 
-	sci_set_mark_long_lines(sci, editor_prefs.long_line_type,
-		editor_prefs.long_line_column, editor_prefs.long_line_color);
+	sci_set_mark_long_lines(sci, editor_get_long_line_type(),
+		editor_get_long_line_column(), editor_prefs.long_line_color);
 
 	/* update indent width, tab width */
 	editor_set_indent_type(editor, editor->indent_type);
diff --git a/src/editor.h b/src/editor.h
index 599cc2a..4afc979 100644
--- a/src/editor.h
+++ b/src/editor.h
@@ -100,8 +100,13 @@ typedef struct GeanyEditorPrefs
 	gboolean	show_white_space;
 	gboolean	show_indent_guide;
 	gboolean	show_line_endings;
-	gint		long_line_type; /* 0 - line, 1 - background, 2 - none */
-	gint		long_line_column;
+	/* This setting may be overriden when a project is opened. Use @c editor_get_long_line_type(). */
+	gint		long_line_global_enabled;
+	/* 0 - line, 1 - background. This setting may be overriden when a project is opened. Use
+	 * @c editor_get_long_line_type(). */
+	gint		long_line_global_type;
+	/* This setting may be overriden when a project is opened. Use @c editor_get_long_line_column(). */
+	gint		long_line_global_column;
 	gchar		*long_line_color;
 	gboolean	show_markers_margin;		/* view menu */
 	gboolean	show_linenumber_margin;		/* view menu */
@@ -214,6 +219,11 @@ void editor_snippets_init(void);
 
 void editor_snippets_free(void);
 
+/* 0 - line, 1 - background, 2 - disabled */
+gint editor_get_long_line_type(void);
+
+gint editor_get_long_line_column(void);
+
 /* General editing functions */
 
 void editor_find_current_word(GeanyEditor *editor, gint pos, gchar *word, size_t wordlen,
diff --git a/src/interface.c b/src/interface.c
index 6cfa062..26f9422 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -2579,8 +2579,7 @@ create_prefs_dialog (void)
   GtkWidget *radio_long_line_line;
   GSList *radio_long_line_line_group = NULL;
   GtkWidget *radio_long_line_background;
-  GtkWidget *radio_long_line_disabled;
-  GtkWidget *label155;
+  GtkWidget *check_long_line;
   GtkWidget *label213;
   GtkWidget *label95;
   GtkWidget *vbox18;
@@ -3995,16 +3994,9 @@ create_prefs_dialog (void)
   gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_background), radio_long_line_line_group);
   radio_long_line_line_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_background));
 
-  radio_long_line_disabled = gtk_radio_button_new_with_mnemonic (NULL, _("Disabled"));
-  gtk_widget_show (radio_long_line_disabled);
-  gtk_box_pack_start (GTK_BOX (hbox5), radio_long_line_disabled, FALSE, FALSE, 0);
-  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_disabled), radio_long_line_line_group);
-  radio_long_line_line_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_disabled));
-
-  label155 = gtk_label_new (_("<b>Long line marker</b>"));
-  gtk_widget_show (label155);
-  gtk_frame_set_label_widget (GTK_FRAME (frame8), label155);
-  gtk_label_set_use_markup (GTK_LABEL (label155), TRUE);
+  check_long_line = gtk_check_button_new_with_mnemonic (_("Long line marker"));
+  gtk_widget_show (check_long_line);
+  gtk_frame_set_label_widget (GTK_FRAME (frame8), check_long_line);
 
   label213 = gtk_label_new (_("Display"));
   gtk_widget_show (label213);
@@ -4945,8 +4937,7 @@ create_prefs_dialog (void)
   GLADE_HOOKUP_OBJECT (prefs_dialog, hbox5, "hbox5");
   GLADE_HOOKUP_OBJECT (prefs_dialog, radio_long_line_line, "radio_long_line_line");
   GLADE_HOOKUP_OBJECT (prefs_dialog, radio_long_line_background, "radio_long_line_background");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, radio_long_line_disabled, "radio_long_line_disabled");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, label155, "label155");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, check_long_line, "check_long_line");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label213, "label213");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label95, "label95");
   GLADE_HOOKUP_OBJECT (prefs_dialog, vbox18, "vbox18");
@@ -5109,6 +5100,20 @@ create_project_dialog (void)
   GtkObject *spin_tab_width_adj;
   GtkWidget *spin_tab_width;
   GtkWidget *label227;
+  GtkWidget *vbox47;
+  GtkWidget *frame40;
+  GtkWidget *alignment48;
+  GtkWidget *table18;
+  GtkWidget *label241;
+  GtkWidget *label240;
+  GtkWidget *radio_long_line_disabled;
+  GSList *radio_long_line_disabled_group = NULL;
+  GtkWidget *radio_long_line_custom;
+  GtkWidget *radio_long_line_default;
+  GtkObject *spin_long_line_adj;
+  GtkWidget *spin_long_line;
+  GtkWidget *label239;
+  GtkWidget *label238;
   GtkWidget *dialog_action_area4;
   GtkWidget *cancelbutton1;
   GtkWidget *okbutton1;
@@ -5238,6 +5243,83 @@ create_project_dialog (void)
   gtk_widget_show (label227);
   gtk_notebook_set_tab_label (GTK_NOTEBOOK (project_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (project_notebook), 0), label227);
 
+  vbox47 = gtk_vbox_new (FALSE, 3);
+  gtk_widget_show (vbox47);
+  gtk_container_add (GTK_CONTAINER (project_notebook), vbox47);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox47), 6);
+
+  frame40 = gtk_frame_new (NULL);
+  gtk_widget_show (frame40);
+  gtk_box_pack_start (GTK_BOX (vbox47), frame40, FALSE, TRUE, 0);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame40), GTK_SHADOW_NONE);
+
+  alignment48 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_show (alignment48);
+  gtk_container_add (GTK_CONTAINER (frame40), alignment48);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment48), 0, 0, 12, 0);
+
+  table18 = gtk_table_new (4, 2, FALSE);
+  gtk_widget_show (table18);
+  gtk_container_add (GTK_CONTAINER (alignment48), table18);
+  gtk_table_set_row_spacings (GTK_TABLE (table18), 3);
+  gtk_table_set_col_spacings (GTK_TABLE (table18), 12);
+
+  label241 = gtk_label_new (_("Display:"));
+  gtk_widget_show (label241);
+  gtk_table_attach (GTK_TABLE (table18), label241, 0, 1, 0, 1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label241), 0, 0.5);
+
+  label240 = gtk_label_new (_("Long line marker:"));
+  gtk_widget_show (label240);
+  gtk_table_attach (GTK_TABLE (table18), label240, 0, 1, 3, 4,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label240), 0, 0.5);
+
+  radio_long_line_disabled = gtk_radio_button_new_with_mnemonic (NULL, _("Disabled"));
+  gtk_widget_show (radio_long_line_disabled);
+  gtk_table_attach (GTK_TABLE (table18), radio_long_line_disabled, 1, 2, 0, 1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_disabled), radio_long_line_disabled_group);
+  radio_long_line_disabled_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_disabled));
+
+  radio_long_line_custom = gtk_radio_button_new_with_mnemonic (NULL, _("Custom"));
+  gtk_widget_show (radio_long_line_custom);
+  gtk_table_attach (GTK_TABLE (table18), radio_long_line_custom, 1, 2, 2, 3,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_custom), radio_long_line_disabled_group);
+  radio_long_line_disabled_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_custom));
+
+  radio_long_line_default = gtk_radio_button_new_with_mnemonic (NULL, _("Use global settings"));
+  gtk_widget_show (radio_long_line_default);
+  gtk_table_attach (GTK_TABLE (table18), radio_long_line_default, 1, 2, 1, 2,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_default), radio_long_line_disabled_group);
+  radio_long_line_disabled_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_default));
+
+  spin_long_line_adj = gtk_adjustment_new (72, 0, 1000, 1, 10, 0);
+  spin_long_line = gtk_spin_button_new (GTK_ADJUSTMENT (spin_long_line_adj), 1, 0);
+  gtk_widget_show (spin_long_line);
+  gtk_table_attach (GTK_TABLE (table18), spin_long_line, 1, 2, 3, 4,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_long_line), TRUE);
+  gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_long_line), TRUE);
+
+  label239 = gtk_label_new (_("<b>Long line marker</b>"));
+  gtk_widget_show (label239);
+  gtk_frame_set_label_widget (GTK_FRAME (frame40), label239);
+  gtk_label_set_use_markup (GTK_LABEL (label239), TRUE);
+
+  label238 = gtk_label_new (_("Editor"));
+  gtk_widget_show (label238);
+  gtk_notebook_set_tab_label (GTK_NOTEBOOK (project_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (project_notebook), 1), label238);
+
   dialog_action_area4 = GTK_DIALOG (project_dialog)->action_area;
   gtk_widget_show (dialog_action_area4);
   gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area4), GTK_BUTTONBOX_END);
@@ -5271,6 +5353,18 @@ create_project_dialog (void)
   GLADE_HOOKUP_OBJECT (project_dialog, label231, "label231");
   GLADE_HOOKUP_OBJECT (project_dialog, spin_tab_width, "spin_tab_width");
   GLADE_HOOKUP_OBJECT (project_dialog, label227, "label227");
+  GLADE_HOOKUP_OBJECT (project_dialog, vbox47, "vbox47");
+  GLADE_HOOKUP_OBJECT (project_dialog, frame40, "frame40");
+  GLADE_HOOKUP_OBJECT (project_dialog, alignment48, "alignment48");
+  GLADE_HOOKUP_OBJECT (project_dialog, table18, "table18");
+  GLADE_HOOKUP_OBJECT (project_dialog, label241, "label241");
+  GLADE_HOOKUP_OBJECT (project_dialog, label240, "label240");
+  GLADE_HOOKUP_OBJECT (project_dialog, radio_long_line_disabled, "radio_long_line_disabled");
+  GLADE_HOOKUP_OBJECT (project_dialog, radio_long_line_custom, "radio_long_line_custom");
+  GLADE_HOOKUP_OBJECT (project_dialog, radio_long_line_default, "radio_long_line_default");
+  GLADE_HOOKUP_OBJECT (project_dialog, spin_long_line, "spin_long_line");
+  GLADE_HOOKUP_OBJECT (project_dialog, label239, "label239");
+  GLADE_HOOKUP_OBJECT (project_dialog, label238, "label238");
   GLADE_HOOKUP_OBJECT_NO_REF (project_dialog, dialog_action_area4, "dialog_action_area4");
   GLADE_HOOKUP_OBJECT (project_dialog, cancelbutton1, "cancelbutton1");
   GLADE_HOOKUP_OBJECT (project_dialog, okbutton1, "okbutton1");
diff --git a/src/keybindings.c b/src/keybindings.c
index aae8624..44fe494 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -2306,10 +2306,10 @@ static void reflow_paragraph(GeanyEditor *editor)
 		/* use line break column if enabled */
 		column = editor_prefs.line_break_column;
 	}
-	else if (editor_prefs.long_line_type != 2)
+	else if (editor_get_long_line_type() != 2)
 	{
 		/* use long line if enabled */
-		column = editor_prefs.long_line_column;
+		column = editor_get_long_line_column();
 	}
 	else
 	{
diff --git a/src/keyfile.c b/src/keyfile.c
index 35f2b25..12037fd 100644
--- a/src/keyfile.c
+++ b/src/keyfile.c
@@ -362,8 +362,9 @@ static void save_dialog_prefs(GKeyFile *config)
 	g_key_file_set_boolean(config, PACKAGE, "show_line_endings", editor_prefs.show_line_endings);
 	g_key_file_set_boolean(config, PACKAGE, "show_markers_margin", editor_prefs.show_markers_margin);
 	g_key_file_set_boolean(config, PACKAGE, "show_linenumber_margin", editor_prefs.show_linenumber_margin);
-	g_key_file_set_integer(config, PACKAGE, "long_line_type", editor_prefs.long_line_type);
-	g_key_file_set_integer(config, PACKAGE, "long_line_column", editor_prefs.long_line_column);
+	g_key_file_set_boolean(config, PACKAGE, "long_line_enabled", editor_prefs.long_line_global_enabled);
+	g_key_file_set_integer(config, PACKAGE, "long_line_type", editor_prefs.long_line_global_type);
+	g_key_file_set_integer(config, PACKAGE, "long_line_column", editor_prefs.long_line_global_column);
 	g_key_file_set_string(config, PACKAGE, "long_line_color", editor_prefs.long_line_color);
 
 	/* editor */
@@ -654,9 +655,15 @@ static void load_dialog_prefs(GKeyFile *config)
 	interface_prefs.msgwin_scribble_visible = utils_get_setting_boolean(config, PACKAGE, "msgwin_scribble_visible", TRUE);
 
 	/* display, editor */
-	editor_prefs.long_line_type = utils_get_setting_integer(config, PACKAGE, "long_line_type", 0);
+	editor_prefs.long_line_global_enabled = utils_get_setting_boolean(config, PACKAGE, "long_line_enabled", TRUE);
+	editor_prefs.long_line_global_type = utils_get_setting_integer(config, PACKAGE, "long_line_type", 0);
+	if (editor_prefs.long_line_global_type == 2) /* backward compatibility */
+	{
+		editor_prefs.long_line_global_type = 0;
+		editor_prefs.long_line_global_enabled = FALSE;
+	}
 	editor_prefs.long_line_color = utils_get_setting_string(config, PACKAGE, "long_line_color", "#C2EBC2");
-	editor_prefs.long_line_column = utils_get_setting_integer(config, PACKAGE, "long_line_column", 72);
+	editor_prefs.long_line_global_column = utils_get_setting_integer(config, PACKAGE, "long_line_column", 72);
 	editor_prefs.symbolcompletion_min_chars = utils_get_setting_integer(config, PACKAGE, "symbolcompletion_min_chars", GEANY_MIN_SYMBOLLIST_CHARS);
 	editor_prefs.symbolcompletion_max_height = utils_get_setting_integer(config, PACKAGE, "symbolcompletion_max_height", GEANY_MAX_SYMBOLLIST_HEIGHT);
 	editor_prefs.line_wrapping = utils_get_setting_boolean(config, PACKAGE, "line_wrapping", FALSE); /* default is off for better performance */
@@ -1106,4 +1113,3 @@ void configuration_finalize(void)
 	g_ptr_array_free(keyfile_groups, TRUE);
 	g_ptr_array_free(pref_groups, TRUE);
 }
-
diff --git a/src/plugindata.h b/src/plugindata.h
index 669aff2..5bb5a78 100644
--- a/src/plugindata.h
+++ b/src/plugindata.h
@@ -50,7 +50,7 @@
 enum {
 	/** The Application Programming Interface (API) version, incremented
 	 * whenever any plugin data types are modified or appended to. */
-	GEANY_API_VERSION = 172,
+	GEANY_API_VERSION = 173,
 
 	/** The Application Binary Interface (ABI) version, incremented whenever
 	 * existing fields in the plugin data types have to be changed or reordered. */
diff --git a/src/prefs.c b/src/prefs.c
index 5e78d96..8ea6ef0 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -399,13 +399,15 @@ static void prefs_init_dialog(void)
 	gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), interface_prefs.editor_font);
 
 	widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_long_line");
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.long_line_column);
+	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.long_line_global_column);
 
-	switch (editor_prefs.long_line_type)
+	widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_long_line");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.long_line_global_enabled);
+
+	switch (editor_prefs.long_line_global_type)
 	{
 		case 0: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_line"); break;
 		case 1: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_background"); break;
-		default: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_disabled"); break;
 	}
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
 
@@ -806,18 +808,18 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
 		widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles");
 		interface_prefs.sidebar_openfiles_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
+		widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_long_line");
+		editor_prefs.long_line_global_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
 		widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_line");
-		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) editor_prefs.long_line_type = 0;
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+			editor_prefs.long_line_global_type = 0;
 		else
-		{
-			widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_background");
-			if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) editor_prefs.long_line_type = 1;
-			else
-			{	/* now only the disabled radio remains, so disable it */
-				editor_prefs.long_line_type = 2;
-			}
-		}
-		if (editor_prefs.long_line_column == 0) editor_prefs.long_line_type = 2;
+			/* now only the "background" radio remains */
+			editor_prefs.long_line_global_type = 1;
+
+		if (editor_prefs.long_line_global_column == 0)
+			editor_prefs.long_line_global_enabled = FALSE;
 
 		widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs");
 		interface_prefs.show_notebook_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -907,7 +909,7 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
 		widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_long_line");
 		/* note: use stash for new code - it updates spin buttons itself */
 		gtk_spin_button_update(GTK_SPIN_BUTTON(widget));
-		editor_prefs.long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+		editor_prefs.long_line_global_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
 
 		widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_folding");
 		editor_prefs.folding = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -1716,4 +1718,3 @@ void prefs_show_dialog(void)
 	prefs_init_dialog();
 	gtk_window_present(GTK_WINDOW(ui_widgets.prefs_dialog));
 }
-
diff --git a/src/project.c b/src/project.c
index df7f5f6..4391d08 100644
--- a/src/project.c
+++ b/src/project.c
@@ -88,6 +88,8 @@ static gboolean load_config(const gchar *filename);
 static gboolean write_config(gboolean emit_signal);
 static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements *e);
 static void on_entries_changed(GtkEditable *editable, PropertyDialogElements *e);
+static void on_radio_long_line_custom_toggled(GtkToggleButton *radio, GtkWidget *spin_long_line);
+static void apply_editor_prefs();
 
 
 #define SHOW_ERR(args) dialogs_show_msgbox(GTK_MESSAGE_ERROR, args)
@@ -367,6 +369,8 @@ void project_close(gboolean open_default)
 	g_free(app->project);
 	app->project = NULL;
 
+	apply_editor_prefs(); /* ensure that global settings are restored */
+
 	if (project_prefs.project_session)
 	{
 		/* close all existing tabs first */
@@ -500,6 +504,9 @@ static void create_properties_dialog(PropertyDialogElements *e)
 					(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
 					(GtkAttachOptions) (GTK_FILL), 0, 0);
 
+	g_signal_connect(ui_lookup_widget(e->dialog, "radio_long_line_custom"), "toggled",
+		G_CALLBACK(on_radio_long_line_custom_toggled), ui_lookup_widget(e->dialog, "spin_long_line"));
+
 #if 0
 	label = gtk_label_new(_("File patterns:"));
 	/* <small>Separate multiple patterns by a new line</small> */
@@ -531,6 +538,8 @@ void project_properties(void)
 	PropertyDialogElements *e = g_new(PropertyDialogElements, 1);
 	GeanyProject *p = app->project;
 	gint response;
+	GtkWidget *widget = NULL;
+	GtkWidget *radio_long_line_custom;
 
 	g_return_if_fail(app->project != NULL);
 
@@ -542,6 +551,21 @@ void project_properties(void)
 
 	/* fill the elements with the appropriate data */
 	gtk_entry_set_text(GTK_ENTRY(e->name), p->name);
+	gtk_entry_set_text(GTK_ENTRY(e->file_name), p->file_name);
+	gtk_entry_set_text(GTK_ENTRY(e->base_path), p->base_path);
+
+	radio_long_line_custom = ui_lookup_widget(e->dialog, "radio_long_line_custom");
+	switch (p->long_line_behaviour)
+	{
+		case 0: widget = ui_lookup_widget(e->dialog, "radio_long_line_disabled"); break;
+		case 1: widget = ui_lookup_widget(e->dialog, "radio_long_line_default"); break;
+		case 2: widget = radio_long_line_custom; break;
+	}
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
+
+	widget = ui_lookup_widget(e->dialog, "spin_long_line");
+	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), (gdouble)p->long_line_column);
+	on_radio_long_line_custom_toggled(GTK_TOGGLE_BUTTON(radio_long_line_custom), widget);
 
 	if (p->description != NULL)
 	{	/* set text */
@@ -570,8 +594,6 @@ void project_properties(void)
 	}
 #endif
 
-	gtk_entry_set_text(GTK_ENTRY(e->file_name), p->file_name);
-	gtk_entry_set_text(GTK_ENTRY(e->base_path), p->base_path);
 	gtk_widget_show_all(e->dialog);
 
 	retry:
@@ -621,6 +643,9 @@ static GeanyProject *create_project(void)
 	priv.indentation = &indentation;
 	project->priv = &priv;
 
+	project->long_line_behaviour = 1 /* use global settings */;
+	project->long_line_column = editor_prefs.long_line_global_column;
+
 	app->project = project;
 	return project;
 }
@@ -729,6 +754,7 @@ static gboolean update_config(const PropertyDialogElements *e)
 		BuildDestination 	 menu_dst;
 		GeanyBuildCommand 	*oldvalue;
 		GeanyFiletype 		*ft = NULL;
+		GtkWidget 		*widget;
 
 		/* get and set the project description */
 		buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->description));
@@ -764,6 +790,23 @@ static gboolean update_config(const PropertyDialogElements *e)
 		}
 		build_menu_update(doc);
 
+		widget = ui_lookup_widget(e->dialog, "radio_long_line_disabled");
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+			p->long_line_behaviour = 0;
+		else
+		{
+			widget = ui_lookup_widget(e->dialog, "radio_long_line_default");
+			if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+				p->long_line_behaviour = 1;
+			else
+				/* "Custom" radio button must be checked */
+				p->long_line_behaviour = 2;
+		}
+
+		widget = ui_lookup_widget(e->dialog, "spin_long_line");
+		p->long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+		apply_editor_prefs();
+
 #if 0
 		/* get and set the project file patterns */
 		buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->patterns));
@@ -916,6 +959,12 @@ static void on_entries_changed(GtkEditable *editable, PropertyDialogElements *e)
 }
 
 
+static void on_radio_long_line_custom_toggled(GtkToggleButton *radio, GtkWidget *spin_long_line)
+{
+	gtk_widget_set_sensitive(spin_long_line, gtk_toggle_button_get_active(radio));
+}
+
+
 gboolean project_load_file(const gchar *locale_file_name)
 {
 	g_return_val_if_fail(locale_file_name != NULL, FALSE);
@@ -970,6 +1019,10 @@ static gboolean load_config(const gchar *filename)
 	p->base_path = utils_get_setting_string(config, "project", "base_path", "");
 	p->file_patterns = g_key_file_get_string_list(config, "project", "file_patterns", NULL, NULL);
 
+	p->long_line_behaviour = g_key_file_get_integer(config, "long line marker", "long_line_behaviour", NULL);
+	p->long_line_column = g_key_file_get_integer(config, "long line marker", "long_line_column", NULL);
+	apply_editor_prefs();
+
 	build_load_menu(config, GEANY_BCS_PROJ, (gpointer)p);
 	if (project_prefs.project_session)
 	{
@@ -988,6 +1041,14 @@ static gboolean load_config(const gchar *filename)
 }
 
 
+static void apply_editor_prefs()
+{
+	gint i;
+	foreach_document(i)
+		editor_apply_update_prefs(documents[i]->editor);
+}
+
+
 /* Write the project settings as well as the project session files into its configuration files.
  * emit_signal defines whether the project-save signal should be emitted. When write_config()
  * is called while closing a project, this is used to skip emitting the signal because
@@ -1021,6 +1082,9 @@ static gboolean write_config(gboolean emit_signal)
 		g_key_file_set_string_list(config, "project", "file_patterns",
 			(const gchar**) p->file_patterns, g_strv_length(p->file_patterns));
 
+	g_key_file_set_integer(config, "long line marker", "long_line_behaviour", p->long_line_behaviour);
+	g_key_file_set_integer(config, "long line marker", "long_line_column", p->long_line_column);
+
 	/* store the session files into the project too */
 	if (project_prefs.project_session)
 		configuration_save_session_files(config);
@@ -1165,4 +1229,3 @@ void project_finalize(void)
 {
 	stash_group_free(indent_group);
 }
-
diff --git a/src/project.h b/src/project.h
index 67c04fb..20d78e3 100644
--- a/src/project.h
+++ b/src/project.h
@@ -39,6 +39,8 @@ typedef struct GeanyProject
 	 * by a plugin. */
 	gint type;
 	gchar **file_patterns;	/**< Array of filename extension patterns. */
+	gint long_line_behaviour; /**< 0 - disabled, 1 - follow global settings, 2 - enabled (custom) */
+	gint long_line_column; /**< Long line marker position. */
 
 	struct GeanyProjectPrivate	*priv;	/* must be last, append fields before this item */
 #ifdef GEANY_PRIVATE
