[geany/geany] 75a69a: Added option to auto reload files changed on disk (#1246)

Mark O'Donovan git-noreply at xxxxx
Mon Jul 17 07:44:54 UTC 2017


Branch:      refs/heads/master
Author:      Mark O'Donovan <shiftee at tutanota.com>
Committer:   elextr <elextr at gmail.com>
Date:        Mon, 17 Jul 2017 07:44:54 UTC
Commit:      75a69aad932e81c97291b4944a738b90df75b033
             https://github.com/geany/geany/commit/75a69aad932e81c97291b4944a738b90df75b033

Log Message:
-----------
Added option to auto reload files changed on disk (#1246)

When option is enabled geany automatically reloads files which
have changed on disk but have no changes in the buffer.
When the option is disabled (default) geany shows the reload
dialog as before.

Tested @vfaronov


Modified Paths:
--------------
    doc/geany.txt
    src/document.c
    src/document.h
    src/keyfile.c

Modified: doc/geany.txt
5 lines changed, 5 insertions(+), 0 deletions(-)
===================================================================
@@ -2598,6 +2598,11 @@ gio_unsafe_save_backup            Make a backup when using GIO unsafe file     f
 keep_edit_history_on_reload       Whether to maintain the edit history when    true        immediately
                                   reloading a file, and allow the operation
                                   to be reverted.
+reload_clean_doc_on_file_change   Whether to automatically reload documents    false       immediately
+                                  that have no changes but which have changed
+                                  on disk.
+                                  If unsaved changes exist then the user is
+                                  prompted to reload manually.
 **Filetype related**
 extract_filetype_regex            Regex to extract filetype name from file     See below.  immediately
                                   via capture group one.


Modified: src/document.c
6 lines changed, 6 insertions(+), 0 deletions(-)
===================================================================
@@ -3609,6 +3609,12 @@ static void enable_key_intercept(GeanyDocument *doc, GtkWidget *bar)
 
 static void monitor_reload_file(GeanyDocument *doc)
 {
+	if (! doc->changed && file_prefs.reload_clean_doc_on_file_change)
+	{
+		document_reload_force(doc, doc->encoding);
+		return;
+	}
+
 	gchar *base_name = g_path_get_basename(doc->file_name);
 
 	/* show this message only once */


Modified: src/document.h
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -66,6 +66,7 @@ typedef struct GeanyFilePrefs
 	gboolean		tab_close_switch_to_mru;
 	gboolean		keep_edit_history_on_reload; /* Keep undo stack upon, and allow undoing of, document reloading. */
 	gboolean		show_keep_edit_history_on_reload_msg; /* whether to show the message introducing the above feature */
+ 	gboolean		reload_clean_doc_on_file_change;
 }
 GeanyFilePrefs;
 


Modified: src/keyfile.c
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -246,6 +246,8 @@ static void init_pref_groups(void)
 		"keep_edit_history_on_reload", TRUE);
 	stash_group_add_boolean(group, &file_prefs.show_keep_edit_history_on_reload_msg,
 		"show_keep_edit_history_on_reload_msg", TRUE);
+	stash_group_add_boolean(group, &file_prefs.reload_clean_doc_on_file_change,
+		"reload_clean_doc_on_file_change", FALSE);
 	/* for backwards-compatibility */
 	stash_group_add_integer(group, &editor_prefs.indentation->hard_tab_width,
 		"indent_hard_tab_width", 8);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list