Live data from Hacker News

The single most useful Emacs feature

stackoverflow.com

101–110 of 112 posts

Re: The single most useful Emacs feature

#101
post #74
post #46

Earlier quoted context omitted.

You can also use the M-x comment-region and M-x uncomment region to comment stuff. If you use it a lot, just bind them to a convenient key stroke.

Don't forget M-; is comment-dwim which usually does... what you mean (uncomments the region if it looks commented, comments it otherwise)

This was my contribution to the SO thread! Super handy feature. I also use the - highlight block - then 'C shift -' to undo in region

Re: The single most useful Emacs feature

#102
post #5

hi-lock-mode! Hi-lock lets you specify regexes to highlight anywhere in a file; it's like domain-specific font-lock. It's astoundingly useful in code review. For instance, given a giant blob of J2EE web handler code, I can eyeball one handler, recognize the annotation mapping the method to URL syntax, and then punch in a hi-lock regex to light up similar annotations everywhere in the file, then glance through the who…

That actually sounds like a useful browser-wide extension (rather than just building it into a code-review tool).

Re: The single most useful Emacs feature

#103
post #58

Earlier quoted context omitted.

Have you tried ack? http://betterthangrep.com/ There are some ack-modes for emacs, too, eg. https://github.com/nschum/full-ack

I haven't, but I don't have a problem with grep, so much as I find there's exactly enough friction with Emacs grep integration to prevent me from ever taking advantage of it.

Presumably the friction involves the fact that you have to tell Emacs the command to run before entering the search you want to do, making sure that you type exactly the find | [e]grep command you want. Then, grep, egrep, perl, and emacs all use different regular expression syntax, so you're never really sure what to type, and you are bound to have to try a few times. (Quiz: how do you search for a literal paren?)

Ack solves this by using Perl regular expressions and a built-in include/exclude list, which is annoying because you'll have to tell Emacs to tell Ack which one to use.

eproject-grep abstracts away having to type any commands or enter an include/exclude list (since the whole point of eproject is to maintain that information), but you'll still have to guess whether it's going to use grep or egrep and type the regular expression right.

multi-occur will use Emacs regular expressions, but only on open buffers.

So I guess the solution is to use eproject to open the correct buffers, and then use multi-occur on them. I will implement that and see if I like it. Perhaps you might too.

Re: The single most useful Emacs feature

#104
post #62

Earlier quoted context omitted.

Out of curiosity, do you use usually emacs for J2EE code? I am an emacs user, but have been doing some J2EE stuff for the last few months, and have been getting really annoyed by the IDE's lately, and I was wondering if it was a wise choice to go with emacs for Java too.

For Java work, I use Emacs and command line tools.

Indeed. Java is only different from the rest of the world if you use Eclipse and think its defaults are sane. For everyone else, you write some sort of build script that builds your project, and that's as easy to run from Emacs as it is from anywhere else.

Re: The single most useful Emacs feature

#106

For newcomers, C-g is a delight (it certainly was for me). Especially with the arcane reputation of Emacs, it was awfully reassuring to know how to get out of whatever unfamiliar function I'd fat-fingered myself into.

Well, it won't get you out of recursive edits. I remember visiting a coworker's machine before telling him about those, and the modeline was something like [[[[[[[[[[(CPerl)]]]]]]]]]].

ESC ESC ESC is a much better "get me out of here!" command to remember.

Re: The single most useful Emacs feature

#107

This is not really a feature , as such, but it is a classic work-around for one emacs' many silly defaults: ; Ask for y/n on all queries that normally ask for yes/no. (fset 'yes-or-no-p 'y-or-n-p)

I do this, but defalias is a better choice for implementing it than fset.

Re: The single most useful Emacs feature

#108
post #100

Earlier quoted context omitted.

The register 0-9 store the last ten deletes (yanks?) in Vim. This serves the same purpose as the kill ring.

Oh yes. The only thing I wish vi had was a key that let you traverse these so you don't have to remember exactly how many yanks ago you yanked something.

Yeah, that confuses me on a regular basis, too.

Re: The single most useful Emacs feature

#109
post #56

The kill ring. I would marry the kill ring and have its babies. Why have other editors not adopted this? Have they?

I wish the Windows Clipboard would implement a version of the kill ring. I really, really hate not having previous cuts and copies available. As a rather clumsy work-around I keep an emacs scratch file open on my task bar and copy stuff I might need more than once to it.

Look up Clipboard Manager by Jan Zeman. It runs in the Windows sidebar.

Re: The single most useful Emacs feature

#110

For newcomers, C-g is a delight (it certainly was for me). Especially with the arcane reputation of Emacs, it was awfully reassuring to know how to get out of whatever unfamiliar function I'd fat-fingered myself into.

Well, it won't get you out of recursive edits. I remember visiting a coworker's machine before telling him about those, and the modeline was something like [[[[[[[[[[(CPerl)]]]]]]]]]]. ESC ESC ESC is a much better "get me out of here!" command to remember.

I haven't managed to get into such a position; I may not be as clever as your coworker.
Post reply on HN