Author Topic: beautify clears the file on screen AND ON DISK  (Read 95 times)

daniel gaudry

  • Junior Community Member
  • Posts: 7
  • Hero Points: 0
beautify clears the file on screen AND ON DISK
« on: September 17, 2022, 06:22:26 pm »
Hi,
I am an ada user.
When I edit the attached file in ada mode and try to beautify it:
tool
beautify
beautify default
The screen gets cleared and the file on disk is also cleared of content !!
I always have backups but ..
Any help will be useful
Regards




Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6396
  • Hero Points: 497
Re: beautify clears the file on screen AND ON DISK
« Reply #1 on: September 17, 2022, 08:45:11 pm »
Reproduced. You have exposed an extra problem beside the beautifier not working on this file. You have AutoSave on which is saving the file to the original file. The subtle bug here is that AutoSave doesn't add entries to your Backup History...(File>Backup History...). The decision was made A VERY LONG TIME AGO when backups were expensive to disable backups during autosave. Given the speed of machines today and the performance of backup history, AutoSave should support backup history.

daniel gaudry

  • Junior Community Member
  • Posts: 7
  • Hero Points: 0
Re: beautify clears the file on screen AND ON DISK
« Reply #2 on: September 18, 2022, 05:32:33 am »
hi,
Do not worry, my own 'beautifier', written in ada, kept current since 1988 is still ok (I can give it to you should you need it). It was only to keep you informed of a bug.
You are right today's computers are faster and your decision  on  AutoSave/Backup History could be modified.
Best Regards
Daniel

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6396
  • Hero Points: 497
Re: beautify clears the file on screen AND ON DISK
« Reply #3 on: September 18, 2022, 09:27:15 pm »
Thanks for the offer. We need all the options we currently support. It would be easier for us to continue to support what we have.

v27 beta 3 will have a fix for the problem where the beautifier results are blank (simple error handling problem). The beautifier was failing to parse your file because you've defined functions inside of begin/end as if the functions were statements. Our parser doesn't support this. As far as I know, this isn't valid for Ada.

AutoSave for v27 beta 3 will support adding Backup History when the "Same name" AutoSave option is used.

(v27 beta 3) There is a filter_command command which allows you to run a filter through the current buffer or selection if there is one. If you fix up your beautifier to accept input from stdin and write the output to stdout, this would work great. For example, if you use "more" for the command when prompted, you simply end up with the same contents you started with.

There is also a shell_command command but this command requires you specify the file name. This requires the buffer to be saved first for this to be helpful and it currently doesn't support using the selection. Also, this command just opens the results instead of replacing and contents of the current file.