jueves, 17 de octubre de 2013

Yet Another Find File In Project in Emacs

Every other day in reddit /r/emacs there's someone asking for this find-in-project feature that has sublime/textmate/vim(ctrl-p) users so addicted.  Is there anything similar for emacs?

The answer is (as usual), yes, more than one, probably more than needed.

People are suggesting projectile, prelude, helm or fiplr.  The point is that if the only feature you want is to search on a git repo, and you don't want any of the other sugar that projectile/prelude provide (you already know stock emacs), you can write your own in 5 minutes. So I did. Long time ago, when there weren't so many search packages, and I just wanted a fraction of available plugins offered.

It was also a nice exercise when I was learning elisp.

Here it is:


Sorry again to planet emacs readers. The gist isn't showing properly there.... :/

miércoles, 16 de octubre de 2013

TIL: 2013-10-16

  • C-x 8 is the prefix to insert 'strange' characters in emacs.
Not really easy to use as most of the chars take 2 keypresses more, but anyway, I don't have to enter ç or ñ that often.

The credits for this tip go to Toni.

viernes, 4 de octubre de 2013

TIL: 2013-10-4

In which branches is a given commit? (useful after using git pickaxe)

git branch -a --contains [treeish]

martes, 1 de octubre de 2013

Absolute vs relative times in applications

[m] ok
[m] and do you thing relative time is more useful then absolute one?
[m] or vice versa?
[m] the other one will be on tooltip
[rgrau] day/time for me is the most valuable   
[rgrau] batch processes are at 4:00
[k] I think relative time is more useful if it refreshes automatically
[rgrau] not 8 hours ago
[k] like, each 10 seconds
[m] it refreshes automatically
[k] then yes
[rgrau] but you loose track
[rgrau] because you have to synch every time  
[m] for me relative is for quick check
[m] absolute for serious things
[rgrau] at any scale, I know where am I
[rgrau] (tm)
[m] :D
[m] pfff
[m] because it is not 'ago'
[rgrau] absolute time is the way
[rgrau] if it's shorter 
[rgrau] (tm)
[rgrau] in the app logs, if you have to compare , there's absolute date
[rgrau] and absolute dates do not rely in the global state of the world
[rgrau] it's immutable
[rgrau] so better
[rgrau] (and I mean it (tm))
What's your take?

viernes, 27 de septiembre de 2013

Switching gmail accounts in Conkeror

Here I come with another hack for conkeror.

I've been using gnus on and off during the last year, but I keep comming to gmail web interface quite often.

The page mode for gmail is quite nice but there's one thing you can't do using the keyboard (AFAIK). That is changing accounts.

So I wrote a couple of functions to switch along N different gmail accounts you might be logged in.  In the end, I simplified the functions to a single one that just swaps between the zeroeth account and the first one. here we go.

miércoles, 18 de septiembre de 2013

Pretend you never pushed that file in git

Years ago, when I was starting to use git, I commited (and pushed) a file I didn't want. It was a huge TAGS file, which made the repo unusable.

 At that time I found a way to remove it, but today I stumbled upon a github page which explains it way better.

Enjoy

martes, 17 de septiembre de 2013

url-retrieve can't find localhost

Today I found a surprising bug in emacs url package. In fact, I'm not sure where the bug is.

The bug appears when trying to url-retrieve an url on localhost, like:
 
 
(url-retrieve "http://localhost:7070/api/services" 
  (lambda (s) (switch-to-buffer (current-buffer))))

The funny thing is that changing localhost to 127.0.0.1 works. Even adding a line "127.0.0.1 foobar" in my /etc/hosts also fixed it.

No clue why is that,but anyway,  it seems to be fixed in some development branch so I'm going to recompile my 24.3.50.1 to the latest one and see what happens.