Keybind to save a tiddler in edit mode without exiting the edit mode

451 views
Skip to first unread message

peuhpeuh singe

unread,
Sep 15, 2017, 4:39:43 AM9/15/17
to TiddlyWiki
Hello twexpert,

 Short version : How can I define a keybind to save a tiddler from the edit mode without exiting the edit mode ?

Longer version: (not sure it is relevant but who know....)

* Background:

I am currenlty using tiddlywiki to write small pieces of scripts that are sourced by my programming env directly from the html files.

For example in R in write a small function: tw.source(nameOfTiddler,pathToTiddlyWikiFile) that simply imports the code written in the given tiddler into my R env. 

* Question:

One practical problem I have is that I need to save the tiddler to move the modification from the draft version of the tiddler to the actual tiddler (which is a good thing). But the only way I found to do it quickly is to <Ctr-Enter> to save and exit the tiddler but I then have to reopen it to edit other changes, which is really inconvenient when I make a incremental code modification... I would like to be able to save a tiddler from the edit mode with exiting the edit mode using a simple keybind but not know how to do it.

Thks all for doing this incredible tool, that I use increasingly !

TonyM

unread,
Sep 15, 2017, 8:09:50 PM9/15/17
to TiddlyWiki
I would like this a lot as well.

Ideally alt-s or ctrl-s like many other documents. even if it just saved to memory and not disk or server.

I am currently doing a training course with my laptop, I am more worried about an accidental delete or back space inside a large tiddler of notes.

Regards
Tony

Thomas Elmiger

unread,
Sep 16, 2017, 12:26:39 PM9/16/17
to tiddl...@googlegroups.com
Hi all,

Great idea! Sometimes other people have to remind me of what I have been missing. You did it this time :–)
I do not have a solution for you, but I have some hints:

I just added a new button to my plugin EditButtons that saves the tiddler without closing it. In fact it saves and closes the tiddler, but reopens it right after that in edit mode.
If you want to see this kind of primitive solution, you can look into the button code in $:/core/ui/Buttons/save-open on https://tid.li/tw5/plugins.html#%24%3A%2Fplugins%2Ftelmiger%2FEditButtons

(I also tried to adapt the Navigator widget’s tm-save-tiddler message in a new JS-widget. I wanted to create a new tm-save-open-tiddler message, but failed.)

I also found out where keyboard controls are defined: $:/core/ui/EditTemplate so you would have to integrate the new command there …

@Tony as I am afraid of losing content too, I integrated an autosave option in my EditorCounter plugin. It saves the (draft) tiddler after every 200 characters entered/removed (you can change the number in the settings). Works perfectly for me with TiddlyFox (saves to disk). Maybe you want to try it out: https://tid.li/tw5/plugins.html

Stay safe!
Thomas

Mark S.

unread,
Sep 16, 2017, 3:23:59 PM9/16/17
to TiddlyWiki
Since you're importing, I'm guessing you're using node.js ??

Instead of importing the actual tiddler, could you import the draft tiddler?

Mark

@TiddlyTweeter

unread,
Sep 16, 2017, 5:09:29 PM9/16/17
to TiddlyWiki
Ciao Thomas

I very much like Save (without closing) and the Save And Close. That combination works like much of my desktop software---that when you "save" the file stays open. And when you exit you also save and the open file is no longer visible. With the 3 new Buttons you created, in addition to the core ones, it pretty much give users all they could need on variations on saving.

Buonanotte
Josiah

TonyM

unread,
Sep 16, 2017, 8:39:32 PM9/16/17
to TiddlyWiki
Thanks Thomas,

The save while editing is great. Can you tell me what classes my CSS needs to use to colour the buttons. I find using green, orange and red very helpful.

eg;

.tc-tiddler-controls button svg.tc-image-new-here-button { fill: #5eb987; }
I believe it should be possible to configure a keyboard shortcut to your save (and keep open) button.

I think we would be in Utopia if we could save and restore the cursor position in the edit window.

I will look at your EditorCounter for its features.

However I already have improved my productivity.


Regards
Tony

Thomas Elmiger

unread,
Sep 17, 2017, 4:50:07 AM9/17/17
to TiddlyWiki
Hi Tony

Thanks for your feedback! It motivated me to do some further optimisation including classes. Please take a look at https://tid.li/tw5/plugins.html#%24%3A%2Fplugins%2Ftelmiger%2FEditButtons version 0.1.5

I hope the new CSS answers your question :–)

@all should the default be with colours or just greytones?

All the best,
Thomas


Am Sonntag, 17. September 2017 02:39:32 UTC+2 schrieb TonyM:
 
I think we would be in Utopia if we could save and restore the cursor position in the edit window.

I think so too. At least this is not something I could do. (Utopia is an interesting book/story by the way.)

@TiddlyTweeter

unread,
Sep 18, 2017, 3:59:06 AM9/18/17
to TiddlyWiki
Ciao Thomas

Great stuff. Having tools like this---all the variant ways of saving/not saving---so easily usable brings new thoughts :-).

I have one SUGGESTION for the DOCUMENTATION ... Provide a note on how to change the icon ... Why?

For instance, in my own case, I may well, for one TW, ONLY have ...


... but changed to show only as a PLAIN "Tick" & "X". Simple "Tick" in that context replacing "Save" (your "Tick" + "box") and Simple "X" meaning "Save & Close." That corresponds to how a lot of software works.

I think its helpful for users to understand how to change the icon for such situations.

Tchüss
Josiah
Auto Generated Inline Image 1

TonyM

unread,
Sep 18, 2017, 8:17:36 PM9/18/17
to TiddlyWiki
Thomas et al

I attended a training course last night with my laptop and tiddlywiki, using this save open was invaluable since the class was fast paced, practical and needed me to capture command lines and bash commands. I think this tool and others bundled into a tiddlywki for in class makes a lot of sense. I may start a thread on this.

Thanks all

Tony

peuhpeuh singe

unread,
Sep 19, 2017, 5:28:41 AM9/19/17
to TiddlyWiki
@Thomas Elmiger: Thanks for sharing this nice work. I have suggestion concerning the issue that the tiddler is saved and reopened and that by consequence the cursor position is lost.
Do you think it would be reasonable, instead of close-and-save and open, to copy the  content of "Draft of 'TiddlerName'" to "TiddlerName" ? I guess this would avoid to close the current edit ?

Thanks,
P.


Le vendredi 15 septembre 2017 10:39:43 UTC+2, peuhpeuh singe a écrit :
Hello twexpert,

 Short version : How can I define a keybind to save a tiddler from sthe edit mode without exiting the edit mode ?

Thomas Elmiger

unread,
Sep 19, 2017, 2:22:52 PM9/19/17
to TiddlyWiki
Hi Peuhpeuh

If I understand your suggestion right, you would like to update the original tiddler’s text field only – and leave tags, fields and title unsaved. Correct?

That sounds doable. I will think it through and maybe test a bit. It might in fact work for everything except the title … because changing this ID is the tricky part in the whole draft process.

Cheers, Thomas

Thomas Elmiger

unread,
Sep 20, 2017, 6:22:11 PM9/20/17
to TiddlyWiki
Here is a new solution that works for me – including a keyboard shortcut.

https://tid.li/tw5/hacks.html#%24%3A%2Fhacks%2Ftelmiger%2FSaveTextOnly%2Freadme

Would anyone like to test it?

Good night
-t

@TiddlyTweeter

unread,
Sep 20, 2017, 7:31:16 PM9/20/17
to TiddlyWiki
Ciao Thomas,

This one is a bit esoteric for me. I'm not quite sure what its for so I can't really test it as I can't yet grasp what I'd be testing :-). Maybe I should say "PASS"? But I'd love to help, but I think on this I'm really the Lame Pony.

J, x

Birthe C

unread,
Sep 20, 2017, 8:02:33 PM9/20/17
to TiddlyWiki
Using the keyboard shortcut for saving, tiddler stays in edit mode and you can keep writing at exactly the same point. Nice when writing longer text. (eh tiddlers and long text......]


Birthe
Reply all
Reply to author
Forward
0 new messages