jEdit Community - Resources for users of the jEdit Text Editor
New options for auto-save or toggle-button
Submitted by Scribus on Wednesday, 22 September, 2010 - 13:14
Yesterday, I suddenly registered how used my -key looks, compared to the rest of my keyboard. I investigated for the reason, and found me pressing -s in jEdit very often to save my modified buffer.

In that moment it struck me that an autosave-feature would be nice, which could be described as following:

The file is saved. You start typing. While you continue to type, your file remains unsaved. As soon as you stop to type, the clock starts ticking for a optional amount of seconds until your buffer gets saved automatically.

With "saved" I mean really saved, like with -s, and not the fallback-file with the filename enclosed in "#"-characters.

Such a feature would save me many keypresses and make it much more comfortable to point my mouse to a terminal and execute the modified program.

- Is such a feature already possible with the build-in macro language, or does someone has to create a plugin to make this wish come true?

Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Other Way
by Robert Schwenn on Wed, 22/09/2010 - 17:30
If You could start Your program (is it a script?) via macro from within jEdit, You could save the script before executing it via buffer.save() - have a look at the macro \Misc\Run_Script.bsh. Also, You wouldn't need the mouse because You could assign a keyboard shortcut to the macro.
 
That is a good alternative to
by Scribus on Wed, 22/09/2010 - 17:57
That is a good alternative to the terminal, thanks for your suggestion! Although, I think its not as flexible as the terminal, since one can resize the terminal with a keypress to the maximum height, use "less -S" to comfortably scroll the output, or start the program (in my case a perl script) with "ddd" to look into the data while its running. A xterm can easily get positioned beneath jEdit with the widescreen monitors we use nowadays, but where wold jEdit launch the program? Can it be launched inside the system console?

Maybe I can script a beanshell macro which autosaves the buffer whenever I stop typing. All I need would be the possibility to send the macro into sleep and also to catch all keydown or keyup events so to know if there was typing when the macro wakes up from the sleep, then eventually save the buffer and send it to sleep again.

 
hints
by Robert Schwenn on Wed, 22/09/2010 - 22:08
1. Capabilities of jEdit
Run_Script.bsh uses runInSystemShell() to run the command in the SystemShell of Console Plugin. If You'd use runCommandToBuffer() instead, the output of the command went to a new jEdit buffer! You could also use Runtime.getRuntime().exec() to run a command outside console.

2. If You really want to hack for Your special autosave function:
I think, the only thing macros are not intended for is to run permanently. You should ask for help at the jEdit-devel mailing list( https://lists.sourceforge.net/lists/listinfo/jedit-devel ), where the developers will see it...
User login
Browse archives
« March 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82338
Context Free Art (*.cfdg)   0.31   46042
JBuilder scheme   .001   18487
BBEdit scheme   1.0   18107
ColdFusion scheme   1.0   18015
R Edit Mode - extensive version   0.1   17461
Advanced HTML edit mode   1.0   16194
Matlab Edit Mode   1.0   16056
jEdit XP icons   1.0   15220
XP icons for jEdit   1.1   14281