jueves, 26 de abril de 2018

It's like copy-paste, but reversed

So browsing this reddit thread I felt again like when I discovered the "undo in selection".

So you can mark a point in an emacs buffer as the destination of all your future inserts, copys and pastes.  And of course, this comes by default, because why not :).


domingo, 1 de abril de 2018

Dnstuff

Cloudflare announcing their 1.1.1.1 dns, and me reading this text about what and why of dns.

EDIT: more stuff on dns appearing in hn

miércoles, 28 de marzo de 2018

nice, no-bullshit, senior docs

So I've been reviewing some old documents and blogs and found some new ones.

Things that just make sense, that are full of common sense, and ask for common sense.

- Antirez's youtube channel. Very mamma mia.
- Norvig's lisp style book
- Joel on software. Worth every word
- Patterns and antipatterns of APL.
- The Art of Unix Programming. ESR.
- Patterns of software. Dick Gabriel's one, not the GoF's one.
- Some HN thread with good links about system dynamics.
- Christopher Alexander a city is not a tree 

miércoles, 21 de marzo de 2018

TIL: no more git clone

I knew about suffix aliases but usually don't need them because my launchers already use xdo-open. But I came out with this, and feel that it has a twist:
alias -s git="git clone"
It makes github links more copypasteable.

domingo, 18 de marzo de 2018

fixing indentation of lua (busted) in emacs. A nasty hack

In general, indentation is not an issue in emacs.

But there are some exceptions.  For example, in Lua, one of the de facto testing libraries is busted, which tries to mimick rspec in many aspects.

A typical busted test looks like this:
Lua mode tends to indent code in a very lisp-y way (which I personally like) by aligning parameters to the same function using as a "starting point" the offset of the first parameter.  In this case, there's also an opened function that gets indented in addition to that base column.
This is unacceptable in most codebases, so I had to write some hack for those particular cases.

As the indentation code for lua-mode is quite complex and this is an exception to the general rule, I wrote this very ugly hack, that seems to solve my problem at hand.
As with all defadvice uses, it looks like a hack because it is a big ugly hack, but at least it lets me deal with it, and move on with my tasks without manually reindenting stuff.



Another +1 for emacs hackability :)

domingo, 25 de febrero de 2018

SF emacs meetup

This week I attended an emacs meetup in SF just by pure chance. I was browsing /r/emacs and there was a comment about the meetup. I found about it just the day before the event.

Being the first time I'm in San Francisco, and the fact that I'll be around just for a couple of weeks (for my new job), it makes it even more surprising that  I was able to go.

We were about 15 people, most from the bay area, and I think myself I was the only foreigner. The meetup topic was "a few of our favourite emacs modes", which unlocked the possibility to talk about helm-dash (not that it's my favourite mode, but is the one I wrote (and I also find it quite helpful)).

So I volunteered and gave a really quick intro to helm-dash.

Others talked about evil, magit, pynt, multiple-cursors (that was nuts!), git-timemachine, use-package, and probably some more that I already forgot.

My discoveries were:

- evil can easily create new text objects.
- learn to use multiple cursors (although I prefer vim's substitutions, mc work better for multiline "macros", and give you more visual feedback than emacs macros)
- pynt and emacs-ipython-notebook . If I ever do python again, I should remember that.
- use-package has more options that one usually thinks. RTFM
- ggtags is worth looking at if your language is not supported by etags/ctags.
- hydra red/blue modes.


Lots of fun during a couple of hours talking about tooling and worfklows with random techies.See you next time I'm around.

sábado, 27 de enero de 2018

2 ways to anchor a regex in elisp

This one I just learnt reading a PR in the melpa repo.


Usually we use ^ and $ to match the beginning and end of the line when dealing with regular expressions.

But, the same way we have \A and \z in ruby , in elisp manual: elisp regex backslash explains there is \` and \'  (that would be written \\` and \\' inside your regex string) to anchor the regex match to the beginning and end of the string or buffer. While $ matches end of the line, so "hello$" will match "hello\ngoodbye", while "hello\\'" will not.