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…
My Emacs Productivity Tricks/Hacks
101–110 of 210 posts
Re: My Emacs Productivity Tricks/Hacks
#102The 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…
s/^/"/
s/\n/“, /
(Change all beginning of line to double pling. Change all new lines to double pling, comma, space)I don’t even store this as a procedure, I just ctr-f and do it from whatever text editor I’m in (I’m not an Emacs user)
The nice thing about search and replacing your way out of problems is that it works on coworkers machines.
I’m not saying it’s better than a stored procedure or a macro but once you’re into it, it’s easy to regex your way out of all sorts of adhoc problems :)
Re: My Emacs Productivity Tricks/Hacks
#103I use Emacs every day. But only for org-mode which is fantastic. Besides that I really really tried hard to love Emacs as my go-to editor. However I found no alternative for decent CSV file support (like https://github.com/chrisbra/csv.vim simply great!) Inspecting large XML files with syntax highlighting and folding. VIM is also not the fastest here but at least 10 times faster (emacs SGML mode is a joke for xml fil…
Re: My Emacs Productivity Tricks/Hacks
#104Earlier quoted context omitted.
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…
Works well for a few dozen entries...less so for a few hundred or a few thousand :)
Re: My Emacs Productivity Tricks/Hacks
#105Whenever 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…
Re: My Emacs Productivity Tricks/Hacks
#106Earlier 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.
And now since I'm sucked into the cult of the helm-o-verse I find I am binding many fewer keys. Just start typing 'M-x ar' and now it's the second item. Add another 'r' brings it to the fore. Less (for me) to remember. I note this mainly because it took me quite a long time to grok helm. Keep working with it!
Re: My Emacs Productivity Tricks/Hacks
#107The 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…
Re: My Emacs Productivity Tricks/Hacks
#108I use Emacs every day. But only for org-mode which is fantastic. Besides that I really really tried hard to love Emacs as my go-to editor. However I found no alternative for decent CSV file support (like https://github.com/chrisbra/csv.vim simply great!) Inspecting large XML files with syntax highlighting and folding. VIM is also not the fastest here but at least 10 times faster (emacs SGML mode is a joke for xml fil…
One of the reasons I switched from vi to Emacs in the very distant past was for this specific reason. (Vim did exist, but it wasn't installed on the old Unix machines I was working on).
Re: My Emacs Productivity Tricks/Hacks
#109Helm-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.
Re: My Emacs Productivity Tricks/Hacks
#110Earlier quoted context omitted.
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.
hm, I just select the text and do xclip -o | awk '{ print "\"" $0 "\"," }' find it simpler than 10 lines of lisp but what do I know :p
It's great for running sort, awk, sed, etc.