=== modified file 'common/basicframe.cpp'
--- common/basicframe.cpp	2016-03-11 16:40:24 +0000
+++ common/basicframe.cpp	2016-03-17 19:36:29 +0000
@@ -441,26 +441,18 @@
 
 void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
 {
-    wxFileName  fn = Pgm().GetEditorName();
-    wxString    wildcard( wxT( "*" ) );
-
-#ifdef __WINDOWS__
-    wildcard += wxT( ".exe" );
-#endif
-
-    wildcard.Printf( _( "Executable file (%s)|%s" ),
-                     GetChars( wildcard ), GetChars( wildcard ) );
-
-    wxFileDialog dlg( this, _( "Select Preferred Editor" ), fn.GetPath(),
-                      fn.GetFullName(), wildcard,
-                      wxFD_OPEN | wxFD_FILE_MUST_EXIST );
-
-    if( dlg.ShowModal() == wxID_CANCEL )
-        return;
-
-    wxString editor = dlg.GetPath();
-
-    Pgm().SetEditorName( editor );
+    // Ask for the current editor and instruct GetEditorName() to not show 
+    // unless we pass false as argument.
+    wxString editorname = Pgm().GetEditorName( false );
+
+    // Ask the user to select a new editor, but suggest the current one as the default.
+    editorname = Pgm().AskUserForPreferredEditor( editorname );
+
+    // If we have a new editor name request it to be copied to m_editor_name and saved
+    // to the preferences file. If the user cancelled the dialog then the previous
+    // value will be retained.
+    if( !editorname.IsEmpty() )
+        Pgm().SetEditorName( editorname );
 }
 
 

=== modified file 'common/pgm_base.cpp'
--- common/pgm_base.cpp	2016-03-03 17:51:38 +0000
+++ common/pgm_base.cpp	2016-03-17 19:34:05 +0000
@@ -315,14 +315,13 @@
 }
 
 
-const wxString& PGM_BASE::GetEditorName()
+const wxString& PGM_BASE::GetEditorName( bool aCanShowFileChooser )
 {
     wxString editorname = m_editor_name;
 
     if( !editorname )
     {
-        // Get the preferred editor name from environment variable first.
-        if(!wxGetEnv( wxT( "EDITOR" ), &editorname ))
+        if( !wxGetEnv( wxT( "EDITOR" ), &editorname ) )
         {
             // If there is no EDITOR variable set, try the desktop default
 #ifdef __WXMAC__
@@ -333,30 +332,47 @@
         }
     }
 
-    if( !editorname )       // We must get a preferred editor name
+    // If we still don't have an editor name show a dialog asking the user to select one
+    if( !editorname && aCanShowFileChooser )
     {
         DisplayInfoMessage( NULL,
                             _( "No default editor found, you must choose it" ) );
 
-        wxString mask( wxT( "*" ) );
-
-#ifdef __WINDOWS__
-        mask += wxT( ".exe" );
-#endif
-        editorname = EDA_FILE_SELECTOR( _( "Preferred Editor:" ), wxEmptyString,
-                                        wxEmptyString, wxEmptyString, mask,
-                                        NULL, wxFD_OPEN, true );
+        editorname = AskUserForPreferredEditor();
     }
 
+    // If we finally have a new editor name request it to be copied to m_editor_name and
+    // saved to the preferences file.
     if( !editorname.IsEmpty() )
-    {
-        m_editor_name = editorname;
-        m_common_settings->Write( wxT( "Editor" ), m_editor_name );
-    }
+        SetEditorName( editorname );
 
+    // m_editor_name already has the same value that editorname, or empty if no editor was
+    // found/chosen.
     return m_editor_name;
 }
 
+const wxString PGM_BASE::AskUserForPreferredEditor( const wxString& aDefaultEditor )
+{
+    // Create a mask representing the executable files in the current platform
+#ifdef __WINDOWS__
+    wxString mask( _( "Executable file (*.exe)|*.exe" ) );
+#else
+    wxString mask( _( "Executable file (*)|*" ) );
+#endif
+
+    // Extract the path, name and extension from the default editor (even if the editor's
+    // name was empty, this method will succeed and return empty strings).
+    wxString path, name, ext;
+    wxFileName::SplitPath( aDefaultEditor, &path, &name, &ext );
+
+    // Show the modal editor and return the file chosen (may be empty if the user cancels
+    // the dialog).
+    return EDA_FILE_SELECTOR( _( "Select Preferred Editor" ), path,
+                              name, ext, mask,
+                              NULL, wxFD_OPEN | wxFD_FILE_MUST_EXIST,
+                              true );
+}
+
 
 bool PGM_BASE::initPgm()
 {
@@ -603,7 +619,7 @@
 
         for( ENV_VAR_MAP_ITER it = m_local_env_vars.begin(); it != m_local_env_vars.end(); ++it )
         {
-            wxLogTrace( traceEnvVars, wxT( "Saving environment varaiable config entry %s as %s" ),
+            wxLogTrace( traceEnvVars, wxT( "Saving environment variable config entry %s as %s" ),
                         GetChars( it->first ),  GetChars( it->second.GetValue() ) );
             m_common_settings->Write( it->first, it->second.GetValue() );
         }

=== modified file 'include/pgm_base.h'
--- include/pgm_base.h	2015-03-29 21:22:53 +0000
+++ include/pgm_base.h	2016-03-17 18:49:11 +0000
@@ -133,8 +133,23 @@
 
     /**
      * Return the preferred editor name.
-     */
-    VTBL_ENTRY const wxString& GetEditorName();
+     * @param   aCanShowFileChooser If no editor is currently set and this argument is
+     *          'true' then this method will show a file chooser dialog asking for the
+     *          editor's executable.
+     * @return  Returns the full path of the editor, or an empty string if no editor has
+     *          been set.
+     */
+    VTBL_ENTRY const wxString& GetEditorName( bool aCanShowFileChooser = true );
+    
+    /**
+     * Shows a dialog that instructs the user to select a new preferred editor.
+     * @param   aDefaultEditor Default full path for the default editor this dialog should
+     *          show by default.
+     * @return  Returns the full path of the editor, or an empty string if no editor was
+     *          chosen.
+     */
+    VTBL_ENTRY const wxString AskUserForPreferredEditor(
+                                        const wxString& aDefaultEditor = wxEmptyString );
 
     VTBL_ENTRY bool IsKicadEnvVariableDefined() const               { return !m_kicad_env.IsEmpty(); }
 

