Live data from Hacker News

My Emacs Productivity Tricks/Hacks

mycpu.org

191–200 of 210 posts

Re: My Emacs Productivity Tricks/Hacks

#191
post #5

org f-ing mode edit: actual package is called "org-mode"

org-mode for notetaking/journaling/organizing and writing documentation with org-babel for interactive (literate) programming and making diagrams (gnuplot, matplotlib, graphviz, mscgen, plantuml). Can’t say this for many tools but using org-mode has been life changing for me.

I'm writing a novel with org-mode and it's the most transparent writing tool I've ever used, and so flexible too.

Re: My Emacs Productivity Tricks/Hacks

#192
post #148

Earlier quoted context omitted.

http://eclipse-games.sourceforge.net/

That's nothing. You can do, in Emacs: - Run Nethack - Chat over IRC. Double combo with Bitlbee - Chat over Slack/$whatever proto is designed in Elisp - Write Interactive Fiction - Emulate Interactive fiction with a Z machine in Elisp - Write and read emails/news with GNUs - Listen to music with EMMS - M-x doctor because is too complex and you need to talk to someone - Comment on HN with eww - Do literate programming…

I particularly like calc mode. Top notch programmable rpn calculator with basic CAS support. Good for most algebraic transformations plus derivatives and integrals. It also supports graphing!

Also you missed that you can run WebKit inside of emacs. Also you embed X apps in emacs and use it as a window manager.

Re: My Emacs Productivity Tricks/Hacks

#193
post #122

Earlier quoted context omitted.

csv-mode does exactly what you want.

Filter rows based on a value? Deleting a Row? Easily navigating from the nth element in a CSV header to the nth element in data row 1000?

Sure, just use SES and import the CSV. It’s no excel, but it does what you’re talking about.

Re: My Emacs Productivity Tricks/Hacks

#194
post #192
post #148

Earlier quoted context omitted.

That's nothing. You can do, in Emacs: - Run Nethack - Chat over IRC. Double combo with Bitlbee - Chat over Slack/$whatever proto is designed in Elisp - Write Interactive Fiction - Emulate Interactive fiction with a Z machine in Elisp - Write and read emails/news with GNUs - Listen to music with EMMS - M-x doctor because is too complex and you need to talk to someone - Comment on HN with eww - Do literate programming…

I particularly like calc mode. Top notch programmable rpn calculator with basic CAS support. Good for most algebraic transformations plus derivatives and integrals. It also supports graphing! Also you missed that you can run WebKit inside of emacs. Also you embed X apps in emacs and use it as a window manager.

> embed X apps in emacs

Not in the console mode, you can't.

Re: My Emacs Productivity Tricks/Hacks

#195

This is mostly a listing of packages and very known ones at that. One of the best features I like is undoing regions. That is, if you know the approximate location of the text that you want to undo, you just select a region that contains that location and call undo. It can be used as a quick git alternative. Say you modify the buffer all over the place. If you want to undo some text that you've modified an hour ago b…

> you just select a region that contains that location and call undo. What the fuck, how did I not know this. I am now glad that I read this thread. So much time lost undoing a bunch of changes, killing the piece I want to restore, redoing the changes and then yanking.

Hahaha! Nice! Exactly the reaction I was hoping to see. I'm really glad that that helped you.

Re: My Emacs Productivity Tricks/Hacks

#196
post #149

Earlier quoted context omitted.

The man-or-boy test for IDEs was proposed long ago by Martin Fowler. If the editor can do the ‘extract method’ refactoring, then it's an IDE that properly understands the structure of the code. More generally and forgivably, I'd say the IDE must know that two variables of the same name may be different variables, and to know which instances are which vars. Funny enough, this benefit of IDEs might rarely be felt with…

Are there any languages other than C#, Java and maybe Dart that have these features? As soon as you add any kind of metaprogramming or macros to the mix, IDEs start to break, because they can't refactor code that doesn't exist yet. That's an issue for IDEs for C, C++, Rust, D and probably few other languages.

> Are there any languages other than C#, Java and maybe Dart that have these features?

If you're talking about ‘extract method’, any regular imperative language in the C style should have that―possibly as ‘extract function’. I mean also Python, JS, Ruby and the like. The hard part here is to figure out which vars go into the method/function and which of them must be accepted as parameters or returned from the function―that's where the understanding of code structure comes in.

Sure, fiddling with metaprogramming will break IDE's understanding of the code, e.g. in Python, but you can do that carefully and isolate the effects so that the rest of code is still ‘clean’. That's also why Java integrates any and all features into the type and OOP system (afaik), so the code can always be described statically. I guess Haskell is an extreme example of that, but not sure how IDE-friendly it is.

Re: My Emacs Productivity Tricks/Hacks

#197
post #89

Whenever I hear about or see the .vimrc and .emacs files people create, maintain and constantly modify to me this just looks like the perfect example of a sunk cost fallacy. IDEs are usually dismissed by many such people since you can (allegedly) do the same in vim/emacs but to me this seemed crazy as I'd see people spend hours configuring plugins, writing Lisp and whatever to save them on some task they'd get for fr…

> example of a sunk cost fallacy

For some people, it's the other way around. Emacs makes it simple to automate things. And there's no such thing as "excessive automation." Proprietary IDEs are like Steve Yegge once said: "are cookie-cutter solutions." To me, it's not even about productivity; it's about minimizing frustration. Repetitive and mundane tasks (no matter how small they seem to be) can and should be automated.

Practical examples of how using Emacs makes my life easier:

- I conduct Web searches right from my IDE. I can search on Wikipedia, Google, Github, YouTube, WolframAlpha, etc. I can select any piece of text/code and perform a search. One day I even realized that I could also enforce the programming language on Github. It took me about ten minutes to extend the existing functionality of the Emacs package called `engine,` now whenever I'm writing, for example, Clojure code, and I need to search for a selected piece of code on Github it automatically appends `Language=Clojure` to the search parameters.

- We have a convention to have suffixes in our git branches that denote the ticket number associated. So I used to go to Jira, find my ticket, then think about the branch name, then type it, sometimes I would mistype the ticket number. One day I sat down, spend about twenty minutes, wrote a little piece of emacs-lisp. For a given Jira ticket number, it fetches its summary and then, based on that summary, generates a "git-friendly" branch name. It's not like it would take me too long doing it the old way. But now it literally takes less than a second, and it is way less frustrating.

- I use Org-mode, which by itself is a hands-down the best todo-list/organizer/note-taking/journaling app. We also use Slack at work. Very often, I would copy Slack conversation and paste it to my main org-mode file, so the relevant information (associated with a unit of work) is close-by. I used to do it manually. The other day I sat down and wrote a script that retrieves that info from Slack by using its API and automatically generates an Org-mode heading.

I can provide countless examples of seemingly small things like that, but those who are now settled with using their favorite IDE probably won't be impressed or moved.

Don't get me wrong - IntelliJ is a superb product. I myself used WebStorm, PyCharm, RubyMine, and Ultimate for a number of years. About seven years to be more precise. I learned their IDE to the pieces. I have discovered undocumented/poorly documented features. I used to hang big print-out posters with the major keybindings on my walls. I participated in developing plugins. But still moved to Emacs, because there is simply no software product in existence with the extensibility capabilities that can match.

Please, don't underestimate the ingenuity of tinkerers. Best artists, watch-makers, and carpenters are known to create their own tools or pick up designs of someone else's and improve upon them. In their hands, the instrument that they have might be a thousand times more powerful and capable, compared to one that was created by an army of specialists.

Re: My Emacs Productivity Tricks/Hacks

#198

This is mostly a listing of packages and very known ones at that. One of the best features I like is undoing regions. That is, if you know the approximate location of the text that you want to undo, you just select a region that contains that location and call undo. It can be used as a quick git alternative. Say you modify the buffer all over the place. If you want to undo some text that you've modified an hour ago b…

Indirect buffers is another awesome feature of Emacs, that AFAIK no other editor is capable to do. You can basically clone a buffer of the current file and work in two (or more) buffers like they all belong to completely different files.

It's handy when you're writing a function that uses things declared somewhere else in the same file. Instead of jumping back and forth you just clone the buffer and you can collapse and narrow things independently.

Re: My Emacs Productivity Tricks/Hacks

#199
post #60

Earlier quoted context omitted.

All decent IDEs have a file search command.

I like Emacs a lot, but it' definitely lacking most of the advanced IDE features, and the Emacs features that a decent IDE (read: Intellij) implement are usually "good enough" for me. People who've been using only Emacs for the last 20 years are in no position to comment on IDEs

Emacs's greatness lies somewhere else. Its extensibility is unmatched. IMO there's no other software product ever been created that can be extended like Emacs.

I'm sure if given enough resources and motivation, it's possible to build superb support for the modern programming languages. For example, you wouldn't claim that Intellij/VSCode/Sublime/Atom has better support for Erlang, for OCaml, for Lisp, for LaTeX, would you?

Emacs evolves slowly. Things take time. And yes, there are always IDEs that do things [slightly] better. At a given moment. Remember, though Emacs outlived many trendy IDEs. Relatively not too long ago IDEs like C++ Builder and Delphi Builder, Eclipse, NetBeans were quite popular. And they did have some remarkable features that Emacs didn't. Do you see any HN posts about those anymore?

Now check, for example, Github Language Stats¹ and find there emacs-lisp. Isn't it surprising to see it somewhere in the middle of the list? Isn't it surprising that it made into that list at all? Remember that it is not a general-purpose language; it is not used in the enterprise; it is not used in the game industry; not suitable for writing mobile apps or web pages. And it also a pretty concise language, it's a Lisp. But there's a lot of it on GitHub alone. Who are these people? Who writes all that code? And how the heck they keep doing it - none of them ever have gotten paid for it, aside from some tiny voluntary contributions and hugely successful Kickstarter campaign for Magit.

If a programming language stays relevant for long enough, people eventually will build emacs packages for it, and they'll keep improving them. But for a proprietary IDE, if it doesn't have a feature you like - you have no other option but to submit a request and wait. Sometimes you have to wait indefinitely.

> People who've been using only Emacs for the last 20 years are in no position to comment on IDEs

I moved to Emacs after almost 20 years of using IDEs. If I am still programming 20 years from now, I'm sure it will be in Emacs.

____

* ¹ https://madnight.github.io/githut

Re: My Emacs Productivity Tricks/Hacks

#200
post #60
post #2

Helm-projectile rant is well deserved. I'm often ashamed looking at my colleagues trying to find some file with a mouse in their big fat IDEs.

All decent IDEs have a file search command.

> All decent IDEs have a file search command.

Yes, all decent IDEs have file search command. But Emacs got SEARCH:

- You can search for all files that contain given string and then open the search results and modify occurrences using multiple cursors and then save it, and it will propagate changes in multiple files;

- You can recursively search for file names, then (for example) mark those that are bigger than 15Mbs, or files that were edited last time in March, and then tell Emacs to show git-log of changes, but only related to those files;

- You can search for a pattern, but also tell it to display it with a context (for example 4 lines before and after the occurrence);

- You can recursively search for a filename pattern, and then among those that you find, you can rename those that match a regexp;

- You can git-grep for a file that was deleted in the repo;

- You can find all the compilation/linting errors and warnings in the code for a given project;

And guess what? All that works the same way for remote machines. You can use the search on a remote computer and open files, just like it was a local machine. Heck, you can even search and open files inside Docker containers.

You think I'm done here? I haven't even talked about searching for stuff using Org-mode.

Seriously, whenever there's an argument about IDEs vs. Emacs - Emacs just beats the shit out of any. "But it doesn't support re-factoring... bleh-bleh." Like everyone who seriously uses Emacs really doing it because they hate refactoring or something. Emacs has better tools and a myriad of ways to deal with code.

Post reply on HN