35 ms·
Ask HN: What's the weirdest/best thing you've done with Emacs?
I'm slowly becoming addicted to Emacs, and I'm curious about what everyone else is doing. What are some of your favorite hacks and changes you've implemented over the years?
- riaandewit 5y agoAt this one job I had, the org basically ran on stored procedures. Like thousands of them. So I whipped up a couple of functions and keybindings so if the cursor was on the name of a stored proc, I could surf to it. And then back and so on. Basically, it was a stored proc browser!
- cpach 5y agoThis is not my hack, but I thought it was worth linking to. Running a bakery on Emacs and PostgreSQL: https://bofh.org.uk/2019/02/25/baking-with-emacs/ https://bofh.org.uk/2019/02/25/baking-with-emacs/
- convolvatron 5y agoback in the early days of internet go, I wrote a client for the ascii protocol that used '*' and 'o' for stones, and used it for a few years on an actual vt100. not super weird, but it really took a lot less work than any of the alternatives and worked great.
- foobarbaz33 5y agoMaybe not so amazing, or even Emacs specific. But I use a text file to store my browser bookmarks. I type a brief description above each url. I can add search tags. description blah blah blah tags: programming performance http://some_url_foobar I view the file with Emacs mode goto-address-mode. So all the hyperlinks are clickable with the mouse or a keybind. I can run M-x occur. To search and get a nice list of matches by tag or description text. I think it's superior to any bookmark feature built into a browser. Simply using a text-based format, and a few built-in Emacs features.
- deleted 5y ago[deleted]
- duckgoesmooo 5y agoHi thanks for your sharing your usage! I'm very interested in doing this. I tried to use a sqlite database (using dbrowser gui) to handle my resources for my researching. But I'm not a programmer so I struggled to learn SQL. Couple questions: How do you handle mistyping the wrong tag? Is there something you use that could lint mistakes? Is there a way to show all the tags that's available or you've used? Like grepping to show all the unique tags, but in emacs. How do you handle stale links (links you no longer visit)? Delete them, move them, mark them stale or something? If you wanted to see everything related to say tag1, tag2, keyword1, and keyword2, is there some way to like "grab" all those links and view them in a separate buffer? I guess it's more like filtering and reactively changing the list to show you what you want.
- foobarbaz33 5y ago> Is there a way to show all the tags that's available or you've used? No. But I could implement that in a few minutes. I could search for "tags:" headers, add the trailing text items to a list, then call function delete-dups. Or I could use a pre-defined list of tags and have a function that lets me select from that. But this starts moving away from the "just a text file" thing, and I'd have to start creating my own custom mode. That's nice but then I'm also forcing rules, structure, and even custom user interface that's beyond "just a text file". Minimal structure and rules is a feature too, it's easier to add new bookmarks. > How do you handle stale links I haven't had a stale link yet. If I ever notice one, I'll delete or correct. Or maybe add a flag STALE: in front of the URL if i want to keep it for historical purposes. > see everything related to say tag1, tag2, keyword1, and keyword2, is there some way to like "grab" all those links and view them in a separate buffer? Sort of. I use grep-like line based searching. It searching lines only, not "records". So it treats each line as it's own thing. But it gets the job done. I use the swiper package. With it's out-of-order matching mode. So my search query might be: food meat It would find lines that contained both search items in any order. I only bother with "and" style search not "or". It is flawed. If food and meat are on separate lines, it would not find the match. A more advanced search feature that understands the file format could solve that. Or a better suited database file structure. But not worth it for me. 99% of the time I'm searching 1 keyword only.
- zck 5y agoThe weirdest thing I have done in Emacs is using it to generate WAVE files, with a visual interface. The music loops, so you can keep playing with it. I've given talks about the package at !!Con 2021 and EmacsConf 2020. Info about this at https://zck.org/bangbangcon2021 https://zck.org/bangbangcon2021. Video at https://www.youtube.com/watch?v=BeTDIrJeriI https://www.youtube.com/watch?v=BeTDIrJeriI. Bonus: the presentation itself is done from within Emacs, in another library I wrote.
- snickersnee11 5y agoAwesome! It's actually would be nice to have something like a library of MIDI snippets that you can record and store under org-mode bullets, sort them by tags (mood, tempo, genre) and then quickly copy them into a DAW. It would give another dimension to musicians, not only they can store verbally formulated ideas about their music in form of notes, but actually have a library of materials they can use.
- second--shift 5y agoI've taught a stripped down emacs/org-mode to my partner to manage a hand-crafted meatspace recipe book. Their only "computing" otherwise is done on a smartphone (no laptop or desktop usage at all). They use org-mode to give structure to the document and then export to HTML with and embedded .css I made with appropriate styles added. This .html page gets printed from Chrome and cut up / added to the recipe book. My partner couldn't be less interested in tech/computing, but is using emacs as a tool to create a handmade art project. I dunno about weirdest, but this is my example of how emacs can be anything to all peoples.
- Buttons840 5y agoThis isn't a hack, but the way org-columns combines a collapsible tree view with spreadsheet like functionality is neat. I use it for project estimations where breaking things down further and further results in a tree, and the estimate sums of lower items in the tree are combined for the higher items. I don't know if this can be done in a spreadsheet.
- zibzab 5y agoPlay nethack while pretending to work. Our test suite could take hours to complete but could occasionally fail and had to be restarted. Emacs multiwindow with a shell in a small window and a game in another one was what kept me sane that year.
- hollerith 5y agoI use an Emacs construct called an idle timer to maintain a file of (the start and end of) every interval 7 minutes long or longer during which I did not interact with Emacs, which enables me to figure out when I started or stopped some activity. A typical use of the file is figuring out retroactively when I got out of bed even though I didn't make any record of the event at the time the event happened: specifically, I look in the file, see a interval of emacs-idleness 7 hours long, which information I combine with my memory that I used Emacs within minutes of getting out of bed. The file would be even more useful if it pertained to all my interactions with the OS, not just interactions with Emacs, but that would prove much harder to implement particularly because I would need to implement anew every time I switch OSes. (I was using a different OS when I wrote the Emacs code described above than I am using now.) The code has provided me much value relative to its implementation cost (time spent).
- rodeph 5y agoSounds handy. Are you interested in sharing the source?
- hollerith 5y agohttps://github.com/hruvulum/hruvulum.github.io/blob/master/idleness.el https://github.com/hruvulum/hruvulum.github.io/blob/master/i... (Is there a more graceful way to publish a single file?)
- Asdrubalini 5y agoGitHub Gist is exactly made for this! https://gist.github.com/ https://gist.github.com/
- natrys 5y agoYou might be interested in a generic time tracking daemon like arbtt[1]. It takes a snapshot of your activities across all programs in much more granular and configurable interval. It stores the data in binary format which is more space efficient but ships with tools that can spit out data for further scripting. Independent of data collection, arbtt also has a DSL that lets you tag your samples programmatically. Which means you can use logic such as conditionals and regex on data such as active program name, window title etc to mark a sample productive or distracted etc. The weird thing I do with Emacs here is run a function every N minutes and figure out productive work ratio in that interval with help of other scripts. Then it compares the ratio to a target threshold and performs actions based on if it meets the goal or not. Usually I warn myself if I am not being productive, but when I am feeling particularly intolerant of procrastination I lock myself out of my own laptop for a few minutes, to clear up my head. [1] https://arbtt.nomeata.de/ https://arbtt.nomeata.de/
- matttproud 5y agoHand-authored a SVG file, using the REPL to compute math, for what would become a tattoo. (In retrospect, I’d have designed the image with greater tolerances for ink dispersion in skin over time.)
- mdparker89 5y agoThe best thing in the last year was that I made a mode for my job. All of my work repos are under the same folder so the mode gets activated for any file under that folder. It's small right now but has functionality like creating a new migration and switching to the new file. I also have yas-snippets for SQL tied to the mode. Using which-key helps me not have to remember all of the commands.
- accidentalrebel 5y agoI made a basic game engine for Emacs. https://github.com/accidentalrebel/emacs-game-engine https://github.com/accidentalrebel/emacs-game-engine Has easy to use coordibate system for placing characters on screen, shape drawing, keyboard and mouse output, and audio. Maybe not tbe greatest, but it is was the most fun I had.
- kleer001 5y agoIn the full scope of what it can do it's not very weird, but I'd say it's the best I've done so far... is write a book! It's in draft 2 at the moment, having been printed out and manually edited over the last couple months. The path there was enlightening. From multiple crashes per attempt to lines and lines of customization. From unexpected crashes and automagical recovery. I've come to love this little word processor cum operating system. I only wish I had found it decades ago when I had more time to pour into a hobby.
- metroholografix 5y agoI control my browser through Emacs, since it's a lot faster/saner especially when I have close to 1000 tabs. https://github.com/atomontage/osa-chrome https://github.com/atomontage/osa-chrome (macOS, has some extra features) https://github.com/anticomputer/chrome.el https://github.com/anticomputer/chrome.el (OS agnostic)
- olivertaylor 5y agoNeat project!
- mattplm 5y agoI don't think it's really weird but using it as an http rest client for testing apis with restclient.el Postman frustrated me because it was taking up all the memory on my computer to do really simple calls. I remembered the "emacs rocks" episode on restclient and gave it a shot. Such a nice package. Really unfortunate that the maintainer doesn't update the melpa package.
- shakow 5y ago> Really unfortunate that the maintainer doesn't update the melpa package. Last MELPA update is 05/11; did I miss something?
- tvaughan 5y agohttps://github.com/pashky/restclient.el/issues/127 https://github.com/pashky/restclient.el/issues/127 Not OP, but I suspect this is what s/he meant
- mattplm 5y agoMelpa package still misses restclient-jq.el AFAICT, the receipe for the package is not correct. Seemed to work at some point since someone merged a PR about that.
- schmudde 5y agoI use emacs restclient as well. It's not just good - it keeps you in the flow. No context switching to a different environment, just a quick cut 'n paste of the path and data you're working on.
- Macphisto 5y agoTons of weird/fun stuff. Emacs is generally my primary tool. - I work in Incident Response and use emacs and orgmode as a second brain for case notes. I log commands in orgmode and try to build my notes to make sure the investigation is a repeatable. - For a good while I was using emacs/gnus as my email client. It wasn't without its warts but compared to Outlook it was glorious. - I needed something to distract me during chemotherapy sessions so I wrote an NTFS MFT parser in emacs-lisp. It was a super dumb project but I'd been ages since I'd read through Carrier's file system forensics and it was good exercise. - For a time I was using emacs and the emacs lisp request library to track bitcoin payments made in suspected extortion cases. It was fun to map until the transfers hit bitcoin tumblers then it my laptop basically lit on fire.
- AnimalMuppet 5y agoNot what I've done, but the single craziest thing I've ever seen emacs do was a mode that you could put the editor into where you could edit the Lisp atoms of the running emacs program. Using the emacs editor commands to do so. That melts my brain.
- S4M 5y agoI use it to connect to my chess server! I play on freechess.org and xboard is my client for it, but I launch it from an emacs shell that becomes my console to interact with freechess. I also added some elisp commands so private chats have their own buffers.
- progfolio 5y agoCurrently working on a speedrun split timer written in elisp: https://github.com/progfolio/speedo https://github.com/progfolio/speedo I've also written a real-time game pad input visualizer (heavily inspired by Chris Wellon's work here: https://nullprogram.com/blog/2016/11/05/ https://nullprogram.com/blog/2016/11/05/) I did this for a couple of reasons. I couldn't find a decent split timer that was: - available on Linux - not Electron/browser based (These worked well enough, but at the cost of high CPU usage, which caused hiccups when recording gameplay) I was easily able to set up the timer so that I can feed inputs to anti-micro, which are forwarded to Emacs. This allows me to control everything from the game pad. I also have a feature that allows me to record a mistake during a run. I have commands which can then pull out mistakes for a given range across multiple runs to analyze where I need to practice most. Still a work in progress, but it's been fun to work on.
- em-bee 5y agoin the mid 90s i taught my then 75 year old grandmother on her first computer how to write LaTeX documents in emacs. i created boilerplate templates for her various document types (letters, reports, etc) and she knew how to start emacs from the commandline, load those templates and save them into new documents. and of course preview and print too, but i don't remember if she did that from emacs or from the terminal
- em-bee 5y agolong before there were convenient tools like xpra to move a window from one X terminal to another i was able to connect emacs to multiple X terminals at once, and in that way switch between computers and keep using the same instance of emacs via gui. given that emacs works just as well in a terminal, that is not a huge advantage, but it is noteworthy that emacs has this capability and had it for a long time. something any gui program could have in theory
- ctietze 5y agoThe weirdest thing was when I ran Dwarf Fortress Adventurer Mode in text-output in Emacs and fiddled with custom key-bindings. (I still think there's potential, esp. for macros :)) The best thing is very boring, but it's the best because I use it all day, every day, and it brings me joy: bringing all my text things to Emacs. Writing, project/task organizing, and email. Never thought I'd end up there.
- rodweb 5y agoI started using it.
- jetti 5y agoIt isn't really a hack but the best thing I've done is use org mode for organizing work. I make a file for each sprint and each ticket in that sprint gets its own file which is hyperlinked in the sprint file. I can open the sprint file then navigate to each ticket which will have a link to the Jira ticket and then may directly link to certain lines of code that may be a central focus of the ticket. Another thing I did with org mode was create a release document of all commits that are going into a release as well as the link to that commit in github, then exported to PDF and sent to the team. We had to cherry pick a bunch of commits for a release and in order to make it clear what was going out I organized it by newest to oldest and had the commit hash as a hyperlink.