Live data from Hacker News

My Emacs Productivity Tricks/Hacks

mycpu.org

151–160 of 210 posts

Re: My Emacs Productivity Tricks/Hacks

#151
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.

Is there anything like vs-chromium's code search in emacs? After finding vs-chromium I lean on it so hard that when I tried to switch to emacs, helm-projectile was good but wasn't good enough.

Plus I'm on windows and there was enough friction where things kind of worked but didn't (usually environmental things like it couldn't find ag or awk, process lifetime, window drawing, etc.).

Re: My Emacs Productivity Tricks/Hacks

#152

Earlier quoted context omitted.

Once you bind it to a key, though, it's a lot quicker. There is something to be said for emacs as a unified computing environment when compared to the UNIX way of doing things. Instead of wrangling different parts of the filesystem and tying them together with aliases and shell scripts, you can just version-control the productivity software (i.e. your emacs config) you write in the course of using emacs.

A lot quicker to do something specific. What if your problem involves text, but is always changing? Then you need general tools and a way to compose them together. Just like general Unix command and Awk which automatically loop through files. I would go crazy if I had to write actual code to do that kind of work 50 times a week.

A difference between emacs functions and awk one-liners is that the former are highly composable. Over the course of weeks you can build whole libraries of custom text-manipulation functionality for your particular domain, all integrated seamlessly into your editor. The thought of calling out to tools like awk for this is really galling. Could just be me, though.

Re: My Emacs Productivity Tricks/Hacks

#153
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…

Editor wars, won.

Re: My Emacs Productivity Tricks/Hacks

#154
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.

Is there anything like vs-chromium's code search in emacs? After finding vs-chromium I lean on it so hard that when I tried to switch to emacs, helm-projectile was good but wasn't good enough. Plus I'm on windows and there was enough friction where things kind of worked but didn't (usually environmental things like it couldn't find ag or awk, process lifetime, window drawing, etc.).

Not sure how vs-chromium's search is, but I use helm-projectile-rg for searching, and it's pretty nice (and super fast)

Re: My Emacs Productivity Tricks/Hacks

#155
One of my favorites is creating a seperate backup dir where all backup "~" files are created and versioned and rotated in and out etc at specific intervals, so I no longer get the random files in the dir I'm working in but can still go find backups if I mess something up.

Re: My Emacs Productivity Tricks/Hacks

#156
One of my favorites is creating a separate backup dir where all backup "~" files are created and versioned and rotated in and out etc at specific intervals, so I no longer get the random files in the dir I'm working in but can still go find backups if I mess something up.

  (setq
   backup-by-copying t      
   backup-directory-alist
    '((".*" . "~/.emacs.d/bu/"))
   delete-old-versions t
   kept-new-versions 6
   kept-old-versions 2
   version-control t)

Re: My Emacs Productivity Tricks/Hacks

#157

One of my favorites is creating a separate backup dir where all backup "~" files are created and versioned and rotated in and out etc at specific intervals, so I no longer get the random files in the dir I'm working in but can still go find backups if I mess something up. (setq backup-by-copying t backup-directory-alist '((".*" . "~/.emacs.d/bu/")) delete-old-versions t kept-new-versions 6 kept-old-versions 2 version…

I already use this in my shrc files:

    alias ls='ls --hide="lost+found" --hide="#*" --hide="*~" --hide="*.pyc" --hide="*.egg-info" --hide="__pycache__" --color=auto'
But I'll be adding your item into my config for the rotated versioning, I wasn't aware that emacs does that but I assume it'll save me anything from few hours to a few weeks yearly. Thanks!

Re: My Emacs Productivity Tricks/Hacks

#158

The one thing I consistently do in emacs that shocks my coworkers -- is running this (custom) function, that I call "arrayify": (defun arrayify (start end quote) "Turn strings on newlines into a QUOTEd, comma-separated one-liner." (interactive "r\nMQuote: ") (let ((insertion (mapconcat (lambda (x) (format "%s%s%s" quote x quote)) (split-string (buffer-substring start end)) ", "))) (delete-region start end) (insert in…

In vim: :' !awk '{printf("\"\%s\", ",$0)}' or to do the whole file: :%!awk '{printf("\"\%s\", ",$0)}' What I find nice about this approach is that I can use my knowledge of awk in other non-vim contexts. Similarly I can use my knowledge of other text processing commands to do things in vim, like reformat text into columns (:%!column -t) for example. Of course you could use vim commands to do the same thing: 0 GI" $ G…

The way I'd do it in vim is to record a macro of doing it interactively by hand once, then play back that macro. I have space bound to @q to make playing back the macro in the q register easy (using the q register because q is also how you start and stop recording a macro.)

    noremap  @q
These days I do this from evil-mode:

    (define-key evil-normal-state-map " " "@q")

Re: My Emacs Productivity Tricks/Hacks

#159
I'm extremely surprised to not see Spacemacs mentioned in the article or the comments. Spacemacs is, IMHO, the most sane and useful default configuration of Emacs. It is friendly to people switching from vim and includes all the packages listed in the article by default (as well as many more).

It has been my go-to editor for many years now; I highly recommend it.

Re: My Emacs Productivity Tricks/Hacks

#160

As a long time emacs user, I'm sad to say but I've become pretty content with Visual Code and I don't think I'm going back. Ofcourse, took a lot of time customizing Code retaining all my emacs keybindings, etc.

What was it that made you move, and what is it that will make you stay?
Post reply on HN