(I'm going to prepend this with the premise that stuff like TeX has probably been able to do all this stuff for ages, but this is looking to do things in a more automated fashion.)
Over the last couple of years I've been listening to more techy podcasts and it's been interesting learning a bit about some of the tools which people use to get things done. A lot of it is productivity software which I just can't use since I'm a fundamentally disorganised person, but there have been some interesting editors that have been promoted which has gotten me thinking about where that could go.
The first one, which I use a fair bit from time to time is Soulver. I don't use the iOS version since I very rarely care about calculating stuff with my phone, but I really like the OS X version. For those that haven't used it, it's essentially a calculation editor that benefits from not having the stupid virtual buttons that we've been carrying around with us in calculator apps ever since we were forced to actually use buttons. It automatically creates and uses variables as you go and keeps things like running totals at the bottom. It's fast, lightweight, easy to use and I like it a lot.
The second example I just grabbed recently after seeing a post about it on John Gruber's Daring Fireball blog and it's called Calca. This goes further in the 'regular editor' direction. It's a text editor (supports Markdown, which I guess gets brownie points from Gruber ;P) which also supports embedded calculations as well as things like Google lookups for values. It looks for a calculation symbol ('=>') and then tries to interpret the left side as part of an equation, taking into account any variables it's discovered (including multi-world variables, which is kinda neat).
Where I'm going with this is that a lot of what every day people use spreadsheets and other custom number crunching (or even programming) environments for isn't very complicated and it seems that smarter text editors could very well be a much better solution for them/us. Figure out what we want to do and with a limited amount of arcane command knowledge give us the result we need.
When I started thinking about this my first thought was that it'd be nice to have a text editor that I could run Python snippets in, but on further reflection that's the wrong direction. Rather than introducing power through complexity we should be trying to do more with a similar level of complexity to what we already have in text editing. Calculations seem to be good first step (it'd be interesting to see an approach that included graphing), but it strikes me that this could also be used with simple database usage in a similar fashion to the way that tools like Siri work with calendaring and reminders. This would be less about a single document though and more about learning from what we've already written and being able to contextually recall it for later use.
Maybe I'm crazy but it feels like there's more in this direction.