Community
    • Login

    Merge local with external changes when file is modified by another program

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 5 Posters 328 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Thomas ZitoT
      Thomas Zito
      last edited by

      I have a file that I am working on in two programs. Notepad++, PL/SQL Developer.

      In Notepad++ I’m close to the bottom of the file, and in PLSQL Developer I’m somewhere at the top

      After making a change in an external program and saving the file, notepad++ asks me
      9682084e-51e6-4cd8-a767-9b669c5e177f-image.png

      So I save some changes in an external program.
      When I go back to Notepad++, it asks me if i want to reload the file. I can choose not to, but I would prefer to be asked to merge my changes and approve or deny…

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Thomas Zito
        last edited by

        @Thomas-Zito

        You want something here that has more “smarts” than Notepad++ can provide.
        I doubt that the ComparePlus plugin could handle something like this currently, but maybe it could be made to.
        Maybe that is even an ambitious “ask”.

        1 Reply Last reply Reply Quote 2
        • Mark OlsonM
          Mark Olson
          last edited by

          @Alan-Kilborn

          You want something here that has more “smarts” than Notepad++ can provide.

          AFAICT the only thing that NPP needs to enable something like what @Thomas-Zito asked for is a NPPN notification that fires only when a file is reloaded from disk, probably named NPPN_FILEBEFORERELOAD (in spite of the awkward similarity in name to the existing NPPN_FILEBEFORELOAD).

          If such a notification existed, a programmer could implement @Thomas-Zito’s desired functionality by responding to NPPN_FILEBEFORERELOAD with the following:

          1. Load the file to be reloaded (call it fileToReload from disk, and put its contents in a new temp buffer (call it fileOnDisk)
          2. Use ComparePlus to compare the fileOnDisk with fileToReload
          3. Probably cancel the compare and empty and close fileOnDisk in response to fileToReload being saved.

          The overhead of a new NPPN is pretty low, both in terms of new code and performance overhead, so I imagine that Don Ho might be receptive to this idea. I’m not going to submit a new issue myself, but others are more than welcome to.

          CoisesC 1 Reply Last reply Reply Quote 3
          • Alan KilbornA
            Alan Kilborn
            last edited by

            @Thomas-Zito If you want to put in a feature request along the lines of what Mark said, see some instructions on how to do it HERE.

            1 Reply Last reply Reply Quote 2
            • CoisesC
              Coises @Mark Olson
              last edited by

              @Mark-Olson said in Merge local with external changes when file is modified by another program:

              @Alan-Kilborn

              You want something here that has more “smarts” than Notepad++ can provide.

              AFAICT the only thing that NPP needs to enable something like what @Thomas-Zito asked for is a NPPN notification that fires only when a file is reloaded from disk, probably named NPPN_FILEBEFORERELOAD (in spite of the awkward similarity in name to the existing NPPN_FILEBEFORELOAD).

              If such a notification existed, a programmer could implement @Thomas-Zito’s desired functionality by responding to NPPN_FILEBEFORERELOAD with the following:

              1. Load the file to be reloaded (call it fileToReload from disk, and put its contents in a new temp buffer (call it fileOnDisk)
              2. Use ComparePlus to compare the fileOnDisk with fileToReload
              3. Probably cancel the compare and empty and close fileOnDisk in response to fileToReload being saved.

              The overhead of a new NPPN is pretty low, both in terms of new code and performance overhead, so I imagine that Don Ho might be receptive to this idea. I’m not going to submit a new issue myself, but others are more than welcome to.

              I think the hard part of this is step 2. That amounts to “add funtionality to ComparePlus — or create a separate, dedicated plugin — that can compare the current, edited version of a file to the version on disk and provide an interface through which the user can resolve conflicts.”

              Having done that, you really don’t need to modify Notepad++: you just need to answer “No” to that pop-up and then invoke the plugin. The NPPN message could allow the plugin to intercept this condition, but as far I know, no current NPPN message processes a return value; unless this one were different, or an NPPM message were added that would be allowed within the NPPN processing, there would be no way to tell Notepad++ to skip the dialog. (If the dialog came first, there would be no reload to trigger the NPPN message if the user selected “No,” and if the user selected “Yes” there would, again, have to be some way to tell Notepad++ not to do the reload from disk after all, because the plugin would process it instead.)

              So my suggestion — since aside from one extra step by the user (invoking a plugin command) this could be accomplished without modifying Notepad++ — is that the first step should be to find someone willing and able to write that plugin command. When and if that actually happens, consider asking for a change in Notepad++ to make it a little bit easier to use.

              PeterJonesP 1 Reply Last reply Reply Quote 1
              • CoisesC
                Coises
                last edited by Coises

                Something else should be noted which may have escaped the original poster.

                None of the ideas discussed thus far retain a copy of the original file, before either Notepad++ or the external program changed it. That means you won’t be choosing to merge changes from two sources; you’ll be comparing your edits to the file as edited in the external program, with no way to distinguish edits in the external program from text that was already in the file before you started editing in either program.

                This might not be what was imagined.

                1 Reply Last reply Reply Quote 2
                • PeterJonesP
                  PeterJones @Coises
                  last edited by

                  @Coises said in Merge local with external changes when file is modified by another program:

                  I think the hard part of this is step 2. That amounts to “add funtionality to ComparePlus — or create a separate, dedicated plugin — that can compare the current, edited version of a file to the version on disk and provide an interface through which the user can resolve conflicts.”

                  Doesn’t the existing action Diff since Last Save essentially do that already? It compares the value in Notepad++ to the value on disk, and allows you to resolve conflicts; how is that not what you just described?

                  CoisesC Mark OlsonM 2 Replies Last reply Reply Quote 4
                  • CoisesC
                    Coises @PeterJones
                    last edited by

                    @PeterJones said in Merge local with external changes when file is modified by another program:

                    Doesn’t the existing action Diff since Last Save essentially do that already? It compares the value in Notepad++ to the value on disk, and allows you to resolve conflicts; how is that not what you just described?

                    I don’t use ComparePlus and don’t really know much at all about it. Without really thinking about it, I assumed (and we all know what comes of that) that if ComparePlus could already do such a thing, a solution using that capability would have been proposed.

                    1 Reply Last reply Reply Quote 0
                    • Mark OlsonM
                      Mark Olson @PeterJones
                      last edited by

                      @PeterJones said in Merge local with external changes when file is modified by another program:

                      Doesn’t the existing action Diff since Last Save essentially do that already?

                      I can confirm that this is in fact exactly what Diff since Last Save in ComparePlus does, making it totally unnecessary to create an NPPN_FILEBEFORERELOAD notification or do anything I suggested in my above post.

                      1 Reply Last reply Reply Quote 2
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors