Menu

New feature: Rename file

Peder Y
2008-06-04
2012-11-13
  • Peder Y

    Peder Y - 2008-06-04

    Upon right-clicking a tab page it would be nice to be able to rename it in one go.

     
    • Fool4UAnyway

      Fool4UAnyway - 2008-06-04

      Perhaps someone had the same idea before you and posted it as well.

      This has been discussed before.

       
    • jmg

      jmg - 2008-06-06

      Save-Me-As is what you are after ?  (in 4.9.2)

       
    • xusoo

      xusoo - 2008-06-06

      jmg,
      I don't think Save-Me-As is the one we're talking about here. 'Rename' means changing the original file with new name, 'Save-Me-As' is just saving a new copy with new name. Actually 'Rename' is very popular in lots of editor, like UltraEdit, editplus.

      XS

       
    • Haibara

      Haibara - 2008-06-08

      I always thought Windows did its best to lock a file that was 'in use' (in this case, being edited by Notepad++), so that you couldn't do things like rename an  'in use' file... bringing about the need to make a copy of the file, rename _that_, and then delete the 'original' once it's been released.

      If that's the case, then it wouldn't be easy for such a feature to be implemented in Notepad++, at least with the standard DOS/Windows disk calls.  (Of course, I could be wrong.)

       
      • jmg

        jmg - 2008-06-08

        It depends on the details. With NP++, windows allows a rename of the file outside the
        NP++ menus, and NP+ keeps the copy in memory, and will alert if the settings are right.
        Most Files I edit, are generated ones, so save-as is fine for me (as I'm not worried about removing a copy that will be soon replaced anyway).
        That said, some editors DO have a rename choice, and so there is a case to add that,
        for those who really miss it.

         
      • xusoo

        xusoo - 2008-06-08

        Haibara,
        the implementation is difficult, i agree and totally understand.
        the requirement is odd from any technical aspects, i don't think so. Most commercial editors have the function actually, and most people believe the NPP can win the commercial ones.

        XS

         
    • Peder Y

      Peder Y - 2008-06-10

      Well, since NP++ handles the locks anyway, it should be a minor thing to change. Release locks, rename the file, add locks again. Or, even easier, "Save me as" + delete the original file. Must be less than five lines of code.

      "Save me as" does not do the job because I still have to go back and delete the original file manually.

      Nice to know people agree.

      - Peder -

       
    • Haibara

      Haibara - 2008-06-10

      Actually, I think it's the OS that handles the 'locking,' not the application.  It just prevents other things from attempting to modify the file while something else is already 'using' it (to avoid problems).  In theory, NPP would have to actually close/release the document before it could rename it.

      (I'm no expert on the DOS/Windows filesystem's way of doing things, of course, and I'm perfectly willing to admit I'm probably wrong... someone who knows more about it, please speak up.  :D )

       
    • Harry

      Harry - 2008-06-10

      Windows indeed locks a file if an application requests it to do so. Notepad++ will only lock the file when reading it/writing it, afterwards it'll be freed for any other application (otherwise, the entire Modification-Autodetection would be obsolete :P).

      please define the whole Rename option. Should it actually delete the existing file? Should it change the name of the tab, but not save it? How much does it differ from the Save As option as to me it looks quite similar, I know its not exactly the same though.

      Its probably more than 5 lines of code but not much, it probably going to look an awful lot like Save as :)

       
    • Peder Y

      Peder Y - 2008-06-19

      Well, the program already has the option "Save me as...". This option will save a copy of the current file as something new, close the old file, and keep the new file in the open tab. Rename would be more or less exactly similar. I gather the program has released any locks that might have been attached to the original file that was just closed. Once the normal "save me as" steps have been completed, simply delete the original file and the current file will have been renamed.

       
      • Fool4UAnyway

        Fool4UAnyway - 2008-06-19

        Well, that's not 100% true. Of course, renaming the file could be achieved this way. But when you use a tool that also monitors the original file, like FileHamster does, you will lose any revisions made after the Save As feature is used.

        FileHamster won't know you renamed the file and will not monitor the new file with the changed name (unless you have a watch at the directory instead of single files).

        If you delete the original file, FileHamster will ask you if you want to remove the revisions (which I guess you don't).

        If you have a watch set at the complete directory, new revisions will be stored for the new file, but you will have two separate revision histories instead of one.

        One might as well argue that Save As isn't necessary, because one can close the file, rename it, and open the renamed file again in Notepad++.

         
        • Harry

          Harry - 2008-06-19

          So in this case, better to save the doc, then use win32 apis to move the file (as in explorer) and adjust the name of the document. Its save as, but no copy left.
          If Don agrees, such a feature could be added methinks.

           
MongoDB Logo MongoDB