Recent

Author Topic: Feature request/suggestion about file saving  (Read 3245 times)

440bx

  • Hero Member
  • *****
  • Posts: 4566
Re: Feature request/suggestion about file saving
« Reply #30 on: August 01, 2024, 01:31:51 am »
There's AutoSave plugin in OPM.
https://github.com/lainz/LazAutoSave
What I need is not just automatic saving.  What I need is automatic saving when Lazarus loses focus, that's when I want automatic saving to be triggered.  I don't care to have automatic saving in any other situation.

Does that package you linked to save files when Lazarus loses focus ?
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

lainz

  • Hero Member
  • *****
  • Posts: 4593
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Feature request/suggestion about file saving
« Reply #31 on: August 01, 2024, 01:49:35 am »
There's AutoSave plugin in OPM.
https://github.com/lainz/LazAutoSave
What I need is not just automatic saving.  What I need is automatic saving when Lazarus loses focus, that's when I want automatic saving to be triggered.  I don't care to have automatic saving in any other situation.

Does that package you linked to save files when Lazarus loses focus ?

It saves always, not just when you switch tabs.

But try to adapt it to your needs.

Regards.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10310
  • Debugger - SynEdit - and more
    • wiki
Re: Feature request/suggestion about file saving
« Reply #32 on: August 01, 2024, 01:50:09 am »
I'm going to take this on just for fun... :)

Yep, just fun and games :)

1) That assumes there are
- no optional param / param with default value
- overloads
- () are mandatory for functions

2) "if b is a record" => does not exclude the other cases, if we consider operator overloads (as then a record + some_other_type would be possible)

3) Yes a semicolon could make that correct, if the following "c" is a function (since the result does not need to be consumed, it would be a statement)

4) Yes the "extra space" wasn't serious / so is the missing comment-start

So for the given
   if true then A := b c

consider
b and c are functions
b is overloaded (or has a default param)
b returns a structure
there is an overloaded + for that structure type

Ok, yes: not the average case....


However, on the more serious note, if trying to narrow it down... I uphold an unspecific error ("semicolon missing" is not unspecific) is better that the wrong specific.

Some of your suggestion on finding the error assume that the error is in the next token. But if "b" was already wrong, then any specific error found will sent the user on the wrong path. And for a user, especially a not-so-expert it does not matter what rules the compiler used to determine the error, if he mistyped the b.
E.g.
   A := no b;  /
- meant to be "not b"
- "no" may be a defined identifier
No error, whatsoever would help the user here. And any attempt to get a specific error will make it worse.

Well ChatGpt actually includes this
"The no operator is not valid in Pascal. Pascal uses not for logical negation." and even an example on the correct usage of "not".

440bx

  • Hero Member
  • *****
  • Posts: 4566
Re: Feature request/suggestion about file saving
« Reply #33 on: August 01, 2024, 02:14:13 am »
The driving force behind emitting an error messages is for the message to provide a remedy that makes the statement correct.  That said, if the statement has multiple problems, such as a missing operator between two identifiers and a semicolon missing separating the last identifier from the next statement, then the compiler would be wise to emit a single error message and once that error is corrected then concern itself with any errors that may have followed that one.

Personally, I think Borland made the right choice when they decided to stop compilation upon finding an error.  Error recovery is fraught with problems stemming from possible ambiguities caused by syntactic errors.  For the most part, FPC seems to behave the same way.

My personal choice is: give me the fastest possible compiler that emits a _single_ precise, accurate error message. 

The deficiencies, in the form of omissions, you pointed out in the possibilities I mentioned are completely valid but, the compiler can take those omissions into account and, in most cases, resolve to a precise error message. 

IOW, the compiler knows (or, at the very least, should know), if a function has optional parameters, if an operator has been overloaded or whatever else may apply and take those things into consideration when determining what action makes the syntactically incorrect statement, correct.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Joanna

  • Hero Member
  • *****
  • Posts: 1101
Re: Feature request/suggestion about file saving
« Reply #34 on: August 01, 2024, 04:09:38 am »
On the topic of errors, what is with those runtime error messages that give an error number that you have to look up or have memorized instead of saying what the error is? Wouldn’t it be just as easy to say what it is in text ?

Also some error messages don’t really take you to where the error is and you still need to put in breakpoints and trace to where the error happens manually... I wish there could be better runtime error messages.
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

DomingoGP

  • Jr. Member
  • **
  • Posts: 70
Re: Feature request/suggestion about file saving
« Reply #35 on: August 01, 2024, 12:29:21 pm »
Now, with the package from Domingo (thank you again Domingo), ...
 

You are welcome!.  :D

I have tried on windows 7 with Notepad++ and the behavior is de same.

The attached zip contains a hacked version for Windows that here (windows7 64 bits) works as desired with Notepad++, i hope it also works well with multiedit for You.

As a curiosity, using TEDNotepad (http://jsimlo.sk/notepad/) the first version worked fine.

Best Regards
Domingo.

440bx

  • Hero Member
  • *****
  • Posts: 4566
Re: Feature request/suggestion about file saving
« Reply #36 on: August 01, 2024, 12:37:31 pm »
The attached zip contains a hacked version for Windows that here (windows7 64 bits) works as desired with Notepad++, i hope it also works well with multiedit for You.
I'll try it very soon (I want to finish some things I'm currently doing before recompiling the IDE/installing a new package.)

And thanks again!
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018