patch 8.1.2101: write_session_file() often defined but not used

Problem:    write_session_file() often defined but not used.
Solution:   Adjust the #ifdef. (Yegappan Lakshmanan, closes #4998)
diff --git a/src/session.c b/src/session.c
index 7139c52..41835db 100644
--- a/src/session.c
+++ b/src/session.c
@@ -985,7 +985,9 @@
     }
 }
 
-#if defined(FEAT_GUI) || defined(PROTO)
+# if defined(USE_GNOME_SESSION) \
+	|| (defined(GUI_MAY_SPAWN) && defined(EXPERIMENTAL_GUI_CMD)) \
+	|| defined(PROTO)
 /*
  * Generate a script that can be used to restore the current editing session.
  * Save the value of v:this_session before running :mksession in order to make