Live data from Hacker News

My Emacs Productivity Tricks/Hacks

mycpu.org

71–80 of 210 posts

Re: My Emacs Productivity Tricks/Hacks

#71
post #55
post #50

Earlier quoted context omitted.

What's a hydra? (in this context)

A cluster of Emacs keybindings that share a common prefix, implemented using the hydra library: https://github.com/abo-abo/hydra

So it's sort of like a mode switch? You give the prefix, and then you can give it a whole series of commands, based on a crib sheet that it shows you, that have that common prefix - without having to retype the prefix - before passing a different key to drop out of the mode again?

That does sound potentially handy, if I have it right.

Re: My Emacs Productivity Tricks/Hacks

#72

I used to think that Emacs is some weird editor with absurd keybindings, until I learned lisp and understood what makes it so special. Now Emacs (Spacemacs[0]) is my main driver. [0] https://www.spacemacs.org

How did learning lisp help you understand the power of Emacs? Just starting down the Spacemacs road myself (from Sublime Text), and curious to hear more about your experience!

Re: My Emacs Productivity Tricks/Hacks

#73

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…

Love this. Adding to my `.emacs` now :)

Re: My Emacs Productivity Tricks/Hacks

#74

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…

Doesn't sound crazy at all to me! I do this all the time using multiline editing in Sublime Text. It's the one part of a more modern IDE I have a hard time giving up (transitioning to Spacemacs currently). Will have to try out this script and see if it helps bridge the gap!

If emacs keyboard macros haven't bridged the gap for you, try https://github.com/magnars/multiple-cursors.el

Keyboard macros: https://www.emacswiki.org/emacs/KeyboardMacros

Re: My Emacs Productivity Tricks/Hacks

#75

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…

Yes, indeed. You can also do that, and other small variations on it depending on the context, with a macro.

You go to the end of "josh", press F3, add a comma and a space and you delete the rest of the line, until "sam" is now the next symbol after your cursor. Then you go to the end of the line (C-e) and press F4. Your macro is now recorded. To call it, press F4 repeatedly until everything is on one line.

As a bonus, you can actually name your macro, assign a keybinding to it, and can also save it as Lisp code.

Re: My Emacs Productivity Tricks/Hacks

#76
post #74

Earlier quoted context omitted.

Doesn't sound crazy at all to me! I do this all the time using multiline editing in Sublime Text. It's the one part of a more modern IDE I have a hard time giving up (transitioning to Spacemacs currently). Will have to try out this script and see if it helps bridge the gap!

If emacs keyboard macros haven't bridged the gap for you, try https://github.com/magnars/multiple-cursors.el Keyboard macros: https://www.emacswiki.org/emacs/KeyboardMacros

I’ve been using this for a few things, and while it’s a little more unwieldy than Sublime’s it works fine for most of my uses so I’d definitely recommend giving it a go.

Re: My Emacs Productivity Tricks/Hacks

#77
post #74

Earlier quoted context omitted.

Doesn't sound crazy at all to me! I do this all the time using multiline editing in Sublime Text. It's the one part of a more modern IDE I have a hard time giving up (transitioning to Spacemacs currently). Will have to try out this script and see if it helps bridge the gap!

If emacs keyboard macros haven't bridged the gap for you, try https://github.com/magnars/multiple-cursors.el Keyboard macros: https://www.emacswiki.org/emacs/KeyboardMacros

Perfect - I'll try this out. Thanks for helping me out despite my newby-ness!

Re: My Emacs Productivity Tricks/Hacks

#78

I used to think that Emacs is some weird editor with absurd keybindings, until I learned lisp and understood what makes it so special. Now Emacs (Spacemacs[0]) is my main driver. [0] https://www.spacemacs.org

I think there are weird things about spacemacs. It’s probably somewhat good for someone who doesn’t know any emacs because a lot of the emacs defaults are bad. And for someone who wants vim bindings it’s good because it has a lot more than evil mode does. On the other hand I feel like a lot of the layers are developed by people who spend too much time tinkering with editor features trying to make the most complicated thing in the process. And this means they’re not bothered by needing to tweak configs all the time, and they are frequently restarting emacs so they don’t notice things like the terrible performance it can give people who use emacs in the more normal way of opening emacs on Monday morning and not killing many buffers all week.

The complexity can leave you with weird bugs. For example if you use regular emacs (X forwarding over a network) on X displays with different dpis, your text will look the same (physical) size on both. If you use spacemacs it can be wrong on one because of some hack someone added somewhere in that tower of complexity. There are plenty of other oddities in there.

Also as soon as one advances to wanting slightly more customisation, it can be really hard to do it with spacemacs. Whereas with regular emacs it’s quite easy to go from basically zero to some.

Re: My Emacs Productivity Tricks/Hacks

#79

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…

I am developing a headache now, after trying this out, because I'm remembering all the times I have done this by hand. Or even writing an awk script, etc.

Re: My Emacs Productivity Tricks/Hacks

#80
emacs as a binary editor: useful. Any other uses: counter-productive. I've (painfully) watched some amazingly gifted researchers/engineers using it, and saw them waste about 50% of their attention trying to use it. Emacs is not an editor, it is an OS with non-obvious semantics.
Post reply on HN