Recent

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

440bx

  • Hero Member
  • *****
  • Posts: 5302
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 v4.0rc3) on Windows 7 SP1 64bit.

lainz

  • Hero Member
  • *****
  • Posts: 4713
  • 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: 11164
  • 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: 5302
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 v4.0rc3) on Windows 7 SP1 64bit.

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1422
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: 85
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: 5302
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 v4.0rc3) on Windows 7 SP1 64bit.

munair

  • Hero Member
  • *****
  • Posts: 855
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Feature request/suggestion about file saving
« Reply #37 on: May 10, 2025, 10:32:26 am »
As far as the facilities that Lazarus provides, such as function definition hints and code navigation, I completely agree that those are great but, the problem I face is they stop working as the code gets more complex.  Codetools doesn't seem to handle the way I structure code.  In the project I'm working on currently I cannot get function definition hints, jumping to function definitions/implementation does not work, code completion does not work, hints (if and when they appear, which is unusual) are sometimes yellow and sometimes grey, they grey ones are a pain because it's not possible to scroll them causing them to rarely show the information that is of interest.

One of the few issues I currently have with Codetools is that it reports "TStringBuilder not found" while typing, despite the project compiling without errors. It also seems unable to locate TStringBuilder's definition unit/line. But going by my own experience, the Lazarus IDE is quite capable of handling larger projects. No need for me to turn to external editors. The only thing buggy is the debugger when I try to get a variable's value, especially with record or class references. So I use writeln() frequently and hit ctrl+alt+o after execution end to check the output. That works very well.
« Last Edit: May 10, 2025, 10:36:06 am by munair »
It's only logical.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11164
  • Debugger - SynEdit - and more
    • wiki
Re: Feature request/suggestion about file saving
« Reply #38 on: May 10, 2025, 12:19:57 pm »
One of the few issues I currently have with Codetools is that it reports "TStringBuilder not found" while typing, despite the project compiling without errors. It also seems unable to locate TStringBuilder's definition unit/line. But going by my own experience, the Lazarus IDE is quite capable of handling larger projects. No need for me to turn to external editors. The only thing buggy is the debugger when I try to get a variable's value, especially with record or class references. So I use writeln() frequently and hit ctrl+alt+o after execution end to check the output. That works very well.
Please see https://forum.lazarus.freepascal.org/index.php/topic,71099.0.html

440bx

  • Hero Member
  • *****
  • Posts: 5302
Re: Feature request/suggestion about file saving
« Reply #39 on: May 10, 2025, 03:30:00 pm »
But going by my own experience, the Lazarus IDE is quite capable of handling larger projects.
In general, I agree with that but, my personal experience so far is, codetools eventually stops working and, in a project that's over 100K lines, figuring out why is not easy. 

That said, so far, in v4.0rc3 it seems to be doing better than in previous versions (or maybe it's just that it likes the project I'm currently working on better than other projects of mine.)

No need for me to turn to external editors.
I consider most editors available on PCs to be unusable.  This is probably because decades ago I had access to a dedicated Wang word processor.  That Wang machine was a lean, mean, text editing machine.  It puts each and every one of today's text editors (with the exception of Multi-Edit) to shame.

I use the Lazarus editor for minor editing while debugging.  I've tried to configure it to work more like M.E but, it that doesn't go very far (to my great chagrin.)

That autosave from Domingo is a wonderful thing.  One less thing for me to worry about when programming. 

Just in case someone else is interested in that package, I recommend version 1 because version 2 causes a console to flash on the screen and also causes having to alt-tab twice (instead of once) to switch from Lazarus to another app back and forth. v1 is great stuff. :)  Can't thank Domingo enough for it.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11164
  • Debugger - SynEdit - and more
    • wiki
Re: Feature request/suggestion about file saving
« Reply #40 on: May 10, 2025, 03:47:37 pm »
I've tried to configure it to work more like M.E but, it that doesn't go very far (to my great chagrin.)

If you feel like it, open a thread and describe the missing features... I am always interested in what other editors do different.

That said, I am not always able (e.g. time) or even willing (e.g. prioritize) to implement all the stuff (and I still have a list of items to be done).

Of course if it's obvious stuff, like
- speed: Well that's already known. (Not that SynEdit is that terrible slow, but certain parts are, and any part can always be improved)
- bugs...
- codetools (for the purpose of my interest not part of the editor, despite being needed, and despite no shortage of interesting ideas)


Some of my personal todo:
- Major and minor keyboard modes like Emacs.
- Control commands via "edit at bottom" (also like Emacs, but could be vi like too)
- Some yet to be determined much more flexible bookmark system.
- [EDIT/ADDED] configurable editor commands
  e.g. cursor-left-next-____ => user can create any amount of such commands by selecting which "stoppoints" to stop at: word-start, word-end, at snake _ in word, after snake, before CamelCase, before symbol with/without lead space, after symbol, ...

But none of them is in the works, not now, likely not soon... :(
« Last Edit: May 10, 2025, 04:13:41 pm by Martin_fr »

440bx

  • Hero Member
  • *****
  • Posts: 5302
Re: Feature request/suggestion about file saving
« Reply #41 on: May 10, 2025, 05:29:17 pm »
If you feel like it, open a thread and describe the missing features... I am always interested in what other editors do different.
I probably won't open a thread because what's missing feels like it's caused by a different editing philosophy instead of simply missing features.

One example that hopefully will make the statement above a bit clearer.   In M.E, the user doesn't need to press keys to copy a block of text into a buffer.  In M.E, you simply select text, usually using the arrow key(s), page-up, page-down, etc.  Once the text is selected, it's ready to be manipulated.  No need to copy it to a buffer.

A common editing task is to copy some text.  In most editors, it goes 1. select the text, 2. copy the text into a buffer, 3. paste the text in the target spot.  In M.E, it goes, 1. select the text, 2. copy the text in the target spot.

In that simple and common operation, no keystrokes were needed to copy the text into a buffer.  The selected text is persistent and typing does not overwrite/replace the text (Lazarus can do that part too.)

As you are aware, telling Lazarus to make the text persistent changes some of its cursor movement behavior.  That's already a deal breaker.  The fact that text is selected shouldn't change anything at all as far as caret movement goes.

What makes M.E so good (and desirable to me) is that it takes _very few_ keystrokes to get the job done and, the reason for that is rooted, not so much in its feature set but, in an editing philosophy that cannot be fully duplicated in "normal editors".

Since you mentioned bookmarks and, the setting and recovery of bookmarks is more "feature" than philosophy.  In Lazarus, it's not really straightforward to see which bookmarks have been set and which are still available (seems like the only way is by opening menus.) Contrast that with setting and recovery of bookmarks in M.E, please refer to the attachment.  When setting a bookmark (ctrl-s), a little popup shows up showing me which bookmarks are already used and suggesting what the next bookmark should be.  I can accept that or press a number and that's it (no need to press an ok button or return or anything else.  When recovering a bookmark (ctrl-g) I get the little popup showing which bookmarks are set, therefore ready to be recovered by just pressing the number.

In the case of bookmarks, Lazarus' method is reasonably succinct (it doesn't take a bunch of keys to set/recover them) but, seeing which bookmarks are available is, as previously stated, not straightforward and that subtracts from the feature's usefulness.  I really need to mention that the bookmark improvement you made recently (exact recovery of bookmark state), greatly enhanced the usefulness of bookmarks in Lazarus.  Thank you for that. :)

There are dozens of small details like that, that in every day use, make a considerable difference.

One problem the Lazarus editor faces, which I doubt can be fully overcome is that, it shares key combinations with a whole lot of other functions.  That removes those key combinations for the editor's use, that's a handicap and as I mentioned in another thread, I don't see a good solution for that.  A partial solution would be to make key combinations context sensitive but, that may not be easy to do (depends on how things are already coded/implemented.)


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

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11164
  • Debugger - SynEdit - and more
    • wiki
Re: Feature request/suggestion about file saving
« Reply #42 on: May 10, 2025, 06:19:31 pm »
A common editing task is to copy some text.  In most editors, it goes 1. select the text, 2. copy the text into a buffer, 3. paste the text in the target spot.  In M.E, it goes, 1. select the text, 2. copy the text in the target spot.
Sounds like the old Turbo Pascal block.

Using a persistent block, and then
Ctrl K B  set block begin
Ctrl K K  set block end
and some other place Ctrl K C  insert a copy of that block


Quote
As you are aware, telling Lazarus to make the text persistent changes some of its cursor movement behavior.  That's already a deal breaker.  The fact that text is selected shouldn't change anything at all as far as caret movement goes.
Agreed to be a bug.

The behaviour come (probably) from changing the selection. And by accident applies to having a selection.


Quote
  In Lazarus, it's not really straightforward to see which bookmarks have been set and which are still available (seems like the only way is by opening menus.)
Yes, you can however use a key-combo to get this as popup menu. That allows you to look which are free.

Quote
Contrast that with setting and recovery of bookmarks in M.E, please refer to the attachment.  When setting a bookmark (ctrl-s), a little popup shows up showing me which bookmarks are already used and suggesting what the next bookmark should be.  I can accept that or press a number and that's it (no need to press an ok button or return or anything else.
We have "Set a free bookmark". But it wont ask, it just does. You then see in the gutter which one it was.

This "Set a free bookmark" is also in the popupmenu that you can pop up via keycombo.

Quote
In the case of bookmarks, Lazarus' method is reasonably succinct (it doesn't take a bunch of keys to set/recover them) but, seeing which bookmarks are available is, as previously stated, not straightforward and that subtracts from the feature's usefulness.
What is imho missing is a tool-window that stays open, and keeps the info visible.

There is a package "stacked bookmarks" or similar, but its a different concept.

Quote
One problem the Lazarus editor faces, which I doubt can be fully overcome is that, it shares key combinations with a whole lot of other functions.  That removes those key combinations for the editor's use, that's a handicap and as I mentioned in another thread, I don't see a good solution for that.  A partial solution would be to make key combinations context sensitive but, that may not be easy to do (depends on how things are already coded/implemented.)

Some keycombos are context sensitive already.

Either
- Depend on which window is focused (but Anchordock sometimes breaks that)
- What the editor currently does (e.g. syncro edit)

Of course you got stuff that the OS does, like Alt-T opens the tools menu.... (not sure if the editor keymap would overrule that).

As for other stuff, like keys that control the debugger, well yes: currently that is: if you want to use them for debugging, then you can't have them for editing.

That would be the "major mode".

A major mode, is a separet keymap, that can either be toggled according to the "mode" of the IDE (modes would need to be defined).
Minor modes are also keymaps, that can be user toggled within each major mode.

I have to look at the emacs docs again (its long since I last used it) to remind myself of the exact distinction.

But the goal is, different keymaps for different tasks.

440bx

  • Hero Member
  • *****
  • Posts: 5302
Re: Feature request/suggestion about file saving
« Reply #43 on: May 10, 2025, 06:47:15 pm »
Just for the record,

The little popups in the snapshot I posted don't stay open.  The moment the bookmark is set or recovered they go away (as they should, otherwise they would obscure text which is undesirable.)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

dsiders

  • Hero Member
  • *****
  • Posts: 1403
Re: Feature request/suggestion about file saving
« Reply #44 on: May 10, 2025, 07:16:58 pm »
Since you mentioned bookmarks and, the setting and recovery of bookmarks is more "feature" than philosophy.  In Lazarus, it's not really straightforward to see which bookmarks have been set and which are still available (seems like the only way is by opening menus.) Contrast that with setting and recovery of bookmarks in M.E, please refer to the attachment.  When setting a bookmark (ctrl-s), a little popup shows up showing me which bookmarks are already used and suggesting what the next bookmark should be.  I can accept that or press a number and that's it (no need to press an ok button or return or anything else.  When recovering a bookmark (ctrl-g) I get the little popup showing which bookmarks are set, therefore ready to be recovered by just pressing the number.

In the case of bookmarks, Lazarus' method is reasonably succinct (it doesn't take a bunch of keys to set/recover them) but, seeing which bookmarks are available is, as previously stated, not straightforward and that subtracts from the feature's usefulness.  I really need to mention that the bookmark improvement you made recently (exact recovery of bookmark state), greatly enhanced the usefulness of bookmarks in Lazarus.  Thank you for that. :)

Are you aware of Ctrl+Shift+B to set or toggle a bookmark and Ctrl+B to select an existing bookmark? I see no difference (other than button versus menu item layout) when compared to your images.
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

 

TinyPortal © 2005-2018