This is what the scratch (EDIT: read scratch as * scratch * without the spaces--is there any way to escape that properly on HN?) buffer is for in Emacs, and I find it extremely useful. Also, unlike using a different tool, it allows me to use all the Emacs-specific features I usually rely on. (For example, I can easily type special characters like r₁ × r₂ ≈ r₃ using the TeX mode.)
If you want more than one scratch buffer--which happens to me once in a while--you can just create a new buffer with any name, and it will also do. New buffers are in a different mode by default, but you can set it up to work exactly the same way as scratch if you want.
Just a fun alternative to this trick for the Emacs users around here :).
I just work in a call center right now, but live in my scratch buffer all day long. Being able to go from note taking to evaluating elisp for quick calculations and never having to switch tools is great. Plus the main piece of software for taking orders is a horrendous java application, with all kinds of weird buggy behavior, so the more I can do with firefox + emacs the better.
The only differences being, when you close vim, the scratch buffer does not yield a save prompt, and also, if you open a scratch buffer, then close it, and then reopen it again with :Scratch during the same vim session, any leftover contents from before (but during that same vim session, of course) will be restored, which is neat/convenient. :)
edit: misread your comment, thought you were comparing :new and :Scratch (linked above), not emacs' scratch. Not sure about that one, but again, the 'reopen scratch -> find leftover contents' functionality is a neat thing.
That is so cool :). I just slapped together a (really) simple chrome ext for opening up a new tab in "contenteditable" mode. It saves the contents into localStorage, thats it for now :) Here it is if anyones interested https://github.com/jwaterfaucett/textpad
I forked your code, added support so you can do (C-N) to open a new tab, click tab and start typing (the cursor will be at the end of the line), polished it up a bit (changed font to consolas, added a grey background with a tint of white text-shadow). I've sent a pull request.
I think I like it because of how weirdly constrained it is. Especially when you're writing something that will overwrite the handler itself, it's easy to get yourself stuck in a loop or a strange dead end.
Hmm... I only have an iPad simulator with me, but it works just pasting in what I wrote above. Maybe something in your data URI is getting munged?
Keyup is used here rather than keypress (which fires only once for each down-up event) since backspace won't fire keypress events, which is a nice thing to have in a live environment. But I can't think of any environment which would implement keypress and not keyup, or how one might work around not having key events at all.
I did, however, discover that if you alert in mobile Safari (in simulation and on my iPhone) on a backspace keydown, the keyup never gets through and it will happily erase everything before the cursor.
Thank you. I've tweaked it to my preferences. I've gotten in the habit of writing with a black on light grey monospaced font. Removing the web font dependency (and the transition, again matter of taste) made the page snappier.
Thank you! I loved it, but couldn't really disable the 'Currently' extension to make this my new tab. Now I'm using 'Web Shortcuts' extension with a GitHub page for the shortcut 'TODO'. Super fast and very useful! :)
I occasionally use a similar online tool, complementary to yours: http://notepad.cc. It stores each note online at its own URL, instead of per-computer at just the root URL. That lets you retrieve and edit notes across multiple computers. I mainly use notepad.cc if I’m using a someone else’s computer or a public computer and want to send some links or a note to myself.
FYI local storage is not reliable, so you may want to think about a fallback, or at least putting a disclaimer explaining that what you write will probably but nitndefinitely still be there when you come back.
Makes sense, and I like the simplicity of the design quite a bit. Maybe one way to augment it would be to add a button that throws the content into a gist/pastebin.something similar, so it could be more easily shared or preserved? Of course, it's a fine line between that and having social media buttons all over.
You can set it as the homepage (enableable in Settings). It adds an extra step after opening a new page (either clicking on the home icon or shift-cmd-h) but I prefer that to replacing the default Chrome page (with its Most visited and Recently closed menus).
I often do an exercise that I've started referring to as a "brain dump". Sometimes when I feel overwhelmed, for whatever reason, it helps to just simply start typing. I start by just saying whatever is most present on my mind, and each new thought starts on a new line. More often than not I end up drilling down to some kind of inner conflict buried pretty deep in my mind.
What's really amazing is when seemingly unrelated stressful moments in your life are revealed to be from the same source.
Apropos of nothing I believe this works because it frees up space in your brain. Sometimes, when I'm trying to get too much done at once, I'm stressed out by trying to keep to many things in the forefront of my thoughts at once. When I get stuck like that I create a scratch pad document with three 'zones'
stuff I'm working on right now
Stuff that I know needs to get done
Stuff that is now done.
Start by dumping everything I'm thinking of in 'Todo' and pick one and put it in Doing and while I'm in the middle of doing it when I think thoughts like "oh and this should really do x" I add that to the Todo pile and go back to doing. Each time I finish of the 'Doing' task I scan the todo list, move anything I need to into Done and pull one up for the Doing pane.
By externalizing the bookkeeping of all the things I'm trying to keep straight in my head I free up cycles to actually work on something.
The recently discussed http://mindmup.com works beautifully for me for this -- I just start lobbing the features and head noise into nodes and organize until some watershed where I realize I know what I need to do.
I picked up on it from this site: http://750words.com/ It's rather cathartic, although you're right that letting your mind wander within a recorded stream sometimes means you write down some quite scary stuff, it's probably the same part of the brain that says "you could jump, you know" whenever you look over a high ledge
I've found it is rare that I ever re-read my notes, no matter how much I might think I'll want to when I'm making them. This can be an idea or a long-term to-do list or the outline of a blog post, whatever. If I don't use it immediately after I'm done typing, it never gets read again.
As a result, I've started saving things less and less. However it's still useful to initially type them out. Helps me plan and form my thoughts and ideas. Currently this usually involves opening Textmate or Tumblr (and saving drafts) or email.
Hopefully this will be a solid replacement for all of the above. If I end up typing something I do want to use, then I'll copy and paste it elsewhere. The majority of the time I'll simply close the browser and not save it.
> Sometimes I just need to type garbage. Just to clear out my mind. Using editors to type such gibberish annoys me because it clutters my project workspace (I'm picky, I know).
This is a hack and a workaround. The bug is clearly using an editor restricted to editting files in a "Project Workspace". Yikes.
Everyone has their own workflow, and they're all insane (for myself, I have an emacsclient wrapper that when called without a file will create a unique name under ~/.emacsclient-scratch and edit that -- so I never lose anything I know I was typing at one point). Still... this just seems like a really bad solution. You get an "editor everywhere" but it's the default editor in your browser. Ick. It's cute though.
I don’t think that’s going to work, since the data URI is inherently local (and only works on Chrome), and you can’t use the Chrome file-system API or even localStorage when you're viewing a local file, unless chrome was opened with `--allow-file-access-from-files`
Interesting concept, but Facebook login + my (unique) real name (yes, there's only one of me in the whole world) + unencrypted PRIVATE journal with subconscious gibberish + possibly my email address = privacy hell.
I'd rather install this thing on my private webserver.
The analysis that 750 words does is very unique and interesting. You don't have to connect it with Facebook or your real name. You may create an anonymous account. Personal computer are very prone to failure. You will have to save your information somewhere on the cloud. They all shady. It is a compromise that you have to make based on your best judgement.
Look, I wouldn't enter personal data anywhere on the internet. If I write 750 words a day, I write about personal things that could be clearly related to me (by name or by my company name). I can't take that risk. Not because the guy behind 750words is not trustable. I don't know him. But because I have no idea whether or not his webserver is secure enough, whether or not he stores his FTP password somewhere in plaintext on his mobile or his laptop.
It doesn't have to be him who is the weakest link in that security chain.
What I don't get from your posting is the second part. Personal computers aren't prone to failure at all. I never had a single HDD crash. I backup my data on a second HDD just in case. It's incredibly unlikely that my data is going to be lost and that the cloud is the only solution for that.
So, there's clearly no compromise for me. Rule is: No cloud, no internet service for private data. And heck, I don't even use any analytics software or other software on my company website that I cannot self-host.
I see your problem and I agree with you. I think it's a complex issue. I am afraid of not backing up. My hard drive or local server might fail and I would like to keep a copy local and a copy offsite. All offsite vendors are somewhat shady. At the end of the day, if you use computers connected to Internet, you make yourself vulnerable of serious attacks. It is far from providing your data yourself but point is security in a relative term. So, it comes down to how sensitive is your data and how much you valve it.
I think the best part is how short and elegant it is.
I assume a lot of people won’t realize you can bookmark that URL since it looks so weird. Also, once you’re bookmarking, you can cheat and put more logic into the page. I made a slightly improved one with a dark background and larger font (hard to post the link on HN, so on a separate page):
You know what's the most amazing about this? The amount of community collaboration its driven. I saw this post when it was on the "new" page and had no comments. Coming back a couple hours later, I can see tons of people doing some tinkering on their own and sharing their finds back here.
I dunno, just something I noticed which I think is completely awesome and indicative of the benefits of open-source and open-knowledge.
Interestingly, NoScript addon for Firefox brings up the following message on attempting the URL:
Developers can enable them for testing purposes by toggling the "noscript.allowURLBarJS" preference."
I'm actually surprised this link got this much traction, I actually thought this was a thing that most developers were aware of. Shows you that you ought to reconsider when disseminating information that you as a learned developer think is "too basic" to bother writing about.
To be fair, I knew nothing about contentEditable until I sat down and tried to design my own RTE. It's actually very cool how little it takes to develop one that works, and FontAwesome makes it even easier. I would definitely consider it obscure.
As an aside, it's really interesting to look at the source for Ace. It doesn't use contentEditable, but certainly represents the sort of complexity we'd need without contentEditable available.
The contenteditable element is neat for quickly turning HTML elements into a notepad, but scripting custom functionality into it (creating a header after pressing enter twice, etc.) was a huge pain in my experience.
In the summer of 2011 an infinite textarea was posted to HN. You'd be in replace mode per default, and you could share it by URL. It would automatically save. I'd be delighted if someone knows its name.
i didn't know of contenteditable before, so 1000+1 thx. in my job i need to scribble above existing pages like crazy, so i mashed together this https://news.ycombinator.com/item?id=5140200 - a one liner / one unicode icon bookmarklet to liveedit any page.
It's cute, but I can't help observing that we're what, 70 years into the computer age, and there's still no ubiquitous, small, fast, clean text editor present by default on all personal computers. (DO NOT speak to me of Notepad.exe)
So discovering that 'by accident' web browsers can act as a simple (but huge, bloated and feature-starved) text editor seems like a big deal.
Personally I keep a simple, tiny, old freeware editor called Editpad 3.4, on every PC I use, accessed via desktop shortcut and 'right-click send-to'.
"all" is tricky, there isn't a standard command on all computers to list the contents of a file, let alone edit. But even my WRT54G has vi installed on it, and you can expect to find emacs and vim on almost any *nix.
First thing I do on a new Windows machine is install Notepad2.
I highly recommend it, it greatly improves on Notepad.exe while keeping the spirit (simple, lightweight no bullshit editing). It can be configured to replace Notepad.exe automatically.
It's about 10 years since I did any software development, and I only bother with surface tracking of web-languages progress. So a lot of this is news to me. Also maybe some of the posted 'improved versions' provide what I'd like with this 'contenteditable' thing. It'll take a while to try them all.
So far I don't see one crucial feature: the ability to load an existing file, and edit it. Am I stupidly missing something 'obvious'?
Being able to edit text and save, but not load existing documents and edit them makes this a useless novelty.
I did notice one suggestion to load a doc then use a short js command to switch to contenteditable. But that's not quite there.
Ideally, a browser could be made to work like this:
* Multiple ways to get it started: bookmark, desktop shortcut icon, url to public or private html page containing the config script. Once working like an editor it should stay that way, for multiple file load/saves and multiple tabs open.
* An 'open file' for any existing plaintext or html file, loaded from local filesystem (via file selector popup or bookmark) or the web (type known url or use bookmark).
* Ability to switch back and forth between three modes on the same document: raw plain ascii (no formatting), minimal formatting (B, I, U, bullets), and full html formated display.
* A document 'save as' as plain text (formatting stripped) or html, to the local filesystem, OR (best feature yet) anywhere with write enabled on a public or private web server.
* Nice if also handles encrypted load/save, so the doc is never in plaintext except on the local machine.
With that, the big name 'cloud' services can go take a leap. I could use my own server(s), or ones I happened to trust. There is flatly no way I would ever trust large enterprise cloud services.
Also, a tool like that which would allow editing on ANY machine with web access and local file r/w enabled for the browser, would be very useful for... things.
It always astonished me that browsers did not provide the capability to natively edit the html they displayed. Such an obvious need, and you'd think so simple to implement, that I'd concluded the absence of this ability had to be a deliberate industry-wide agreed policy of capability avoidance. Which means, for political reasons.
The File API is still kind of poorly supported, but you could add that depending on your browser (though you'd want to use an extension, since it'd be a bit more code).
As for live-editing HTML, that's usually been considered out of scope for a web browser, and been pushed to authoring or debugging programs. Chrome ships with their developer console integrated, but IIRC Firefox still relies on extensions.
I use workflowy too, but I'm not sure what you're talking about. `w <enter>` is going to send you to the first site with w in the name (which in my case is 'wikipedia.com' - I have to type 'wor' for workflowy.com to be selected).
The `<esc> @misc` part also doesn't make sense. That just does a search for tags, it doesn't put you in a mode to just write, which is what the OP's solution does.
Last but not least, a little pro-tip for ya, since you like the command line (or keyboard shortcuts as they are also called:) : Command-L puts the cursor in the location bar. So you can do <cmd>+L w <enter>. Also, shift back to a previous tab with cmd+shift+[ and +].
I'm simply describing my workflow -- Workflowy is easily my #1 "w", so that's why this works for me. Probably not very helpful -- I just thought I'd illustrate the "exact" same steps I take to achieve the same effect.
Same goes for "@misc". When I want to brain-dump some gibberish, as in the OP's use case, the @misc tag contains a big dump of stuff that I generally refine or delete later.
I don't know why I don't use ctrl+l -- i usually use ctrl+e or ctrl+k and then backspace (why do these do the same thing in chrome?). But yeah, thanks for the advice.