Use org-babel to execute the queries, from my “sql-queries.org” file.
Overwrite results into a /tmp file, also an org-mode file, with latest query results (call it anything — “query-result.org”).
Make psql spit out org-formatted tables for extra oomph.
Keep that results file open in another buffer (or frame on a big screen, if the table is wide).
Let Emacs auto-refresh the buffer, when it detects the file has changed.
Et voila! L’établi SQL du pauvre.Screenshot + sample code in the gist below (a `.org` file, as befits this topic :)
https://gist.github.com/adityaathalye/a6004acd34c683bcc806b2...
https://github.com/emarsden/pgmacs
(self-plug)
M-x sql-sqlite
Then C-c C-c on paragraph you want to send/execute
M-x sql-send- for the other commands
The mode is called sql-interactive-mode
That's it. machine my_db login my_usr password bla-bla-123
And then in the source block header, you can inject it into a variable :var pass=(auth-source-pick-first-password :host "my_db")
That's a built-in elisp function. Yes, you can call arbitrary functions to assign vars for org-mode source blocks. You can even assign shell command output, I often do things like: :var token=(shell-command-to-string "echo $MY_TOKEN")
What's crazy about this shit is that you can even pipe the content of the file back into itself: #+begin_src sh :pretty :var token=(shell-command-to-string (format "grep my_token %s" buffer-file-name))
echo $token
#+end_src
That's an absurd bananas degree of ingenious engineering that makes you question the sanity of programmers who deliberately abandon Emacs, even after experiencing such power. #+header: :dir /ssh:user@remote-host:/
#+begin_src sql
..
#+end_srcalthough also worth pointing out that Emacs often leads with the adjective self-documenting for a reason. Emacs has fantastic facilities built in to get information on virtually anything. Tutorials with C-h t, manuals with C-h r, apropos and describe- to search for any object etc. And pretty much any major extension like org has great documentation. Which btw I think is well worth reading or at least skimming to get an idea on how much you can do with it.
Oh, so it allows you to have source blocks in different languages where you can pass data between one another? I am highly skeptical it's possible in that fork at all.
doom emacs
>share calendar/todo
There is org-caldav that you can point to an org file and it syncs with a caldav server. This way you can have two-way sync from e.g. a phone's calendar to your org file.
1. Export a .ics file based on your agenda (support for this is built-in) to a shared folder to which your spouse has access (syncthing/dropbox/whatever). Your spouse would then use their calendar app to subscribe to the ics file. When you push changes to the ics file, they would automatically propagate on the calendar.
2. Use built-in org html export features to generate a simple page showing your schedule and either host it on your local network or put it in a shared directory as described above.
edit: sibling comment has a better suggestion (org-caldav)
Well integrated with vim keys, batteries-included conf. Maybe I'm just not ready for Doom Emacs yet, but this is what works for me.
That said, I'm still trying to wrap my head around how org-mode can work with my existing Obsidian vault. So far it's working pretty well, but I still feel like I'm missing some things to make it really all click together.
sondr3•4mo ago
[0]: https://gist.github.com/sondr3/ae4eda2816cfeda7b8597ce1c48d0..., best viewed as the raw file for all the details
adityaathalye•4mo ago
[0] Discussed here recently:
https://news.ycombinator.com/item?id=43157672dotancohen•4mo ago
adityaathalye•4mo ago
Y_Y•4mo ago
I don't recommend SP's section for MA421, regardless of the excellent teaching quality.
schonfinkel•4mo ago
https://www.orgroam.com/
tlavoie•4mo ago
She also had a rule about promptness of assignment delivery, meaning the start of class when she arrived. Fair enough!
On this one assignment, I had done all but the last question at home, and printed it off, with the hope that I could finish it at the lab and send it to a laser printer in another building. At the time, labs used shared, dot-matrix printers that were usually jammed. I got the last question done, sent it to the printer, then checked the queue. Apparently someone was printing a book, not going to get done before class.
I emailed her my .tex file, with the explanation that I'd hand in my incomplete printout in class, but would appreciate if she could mark the last section so I knew how I did. This was sent well before class, as the timestamp would show. The prof ended up printing, marking, and returning this version, and I received full marks!