@techee requested changes on this pull request.

I think it principle the patch is fine, I just don't like that there are now 2 more or less identical implementations, one used for swapping header/sources, the other for setting filetypes.

I think the implementations could be unified as follows:

  1. implement try_find_header_source() which would be basically the current try_swap_header_source() that returns full_name inside the inner if.
  2. implement find_header_source() which which would be basically on_swap_header_source() returning the filename (if found) by the try_find_header_source() calls.
  3. move these 2 functions to rpjorg-utils.
  4. implement on_swap_header_source() as
gchar *full_name = find_header_source(doc);
open_file(full_name);
g_free(full_name);
  1. implement on_doc_filetype_set() as
gchar *full_name = find_header_source(doc);
GeanyFiletype * source_filetype = filetypes_detect_from_file(full_name);
GeanyDocument * doc = document_find_by_filename(utf8_file_name);
document_set_filetype(doc, source_filetype);
g_free(full_name);

(Maybe I missed some details but in principle this should be it.)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.