lunes, 23 de abril de 2012

elisp of the day: undefine a defun

Elisp is a pretty archaic lisp. I'm not refering to the problems everyone talk about (dynamic scope, One namespace to rule them all,...) but the aspect of being very rudimentary in its construction.

That's why there have been several attempts to substitute elisp for something else (let's rewrite emacs in erlang!). For me, it's doing pretty well, and now that we have lexical scope there, I think I can live with prefixed-and-very-long-method-names.

A positive thing of elisp being archaic is that the system is wide open to users, and most things are just obvious (once you were given the proper explanation, heh).

One place that doesn't work like that is when redefining a defun to defmethod. setfing the symbol-function to nil does not work. (It makes the old defun inaccessible, but doesn't free the symbol)

That's why fmakunbound exists. fmakunbound 'symbol,  and after that you'll be able to defmethod on that symbol.

For now, I haven't found any other real use case for that, but I can imagine unloading a package by removing all methods it previously defined.  That's not much in the culture of emacs though (never seen any plugin that does that) 

sábado, 31 de marzo de 2012

Singulars



Video molt interessant per passar-lo als vostres pares (o fills), per explicar-los de que va la historia 'del internes'. Privacitat, entorn, poder, efecte bombolla. La qualitat divulgativa es bonissima. Jutgeu vosaltres la dels continguts.

sábado, 17 de marzo de 2012

shell and vim superpowers


It seems that the commandline is making a comeback, maybe with some hype. At least, I keep seeing more and more articles with titles like 'vim advanced features', courses like 'programando a toda leche con vim' (that are not cheap at all), or extensive articles like use unix as an ide or the zen of the vi wu wei (I like these 2), and other articles with this similar topic. It's amazing how people are reinventing the same wheel every other decade.

But out of these new tutorials that (mostly) bring nothing new to the scene, once in a while you find some useful tips or tools that people build that add orthogonal functionality (if that concept exists), and allow faster access to things, or better interface to them (note the orthogonality of the word 'thing').

You know, there's no problem that another level of indirection can't solve. So here you are. a couple of projects that allow you to refer to files, directories, and git stuff by numbers. fasd and git-number . The first one based on autojump.

Unfortunately, the web is so volatile that I can't find many of the top 10 vim articles from past decade, but I have seen isomorphic articles to this one by thousands. during the last 10 years.

So welcome guys, let's invent the future now! :)

domingo, 4 de marzo de 2012

more macros

Some links to useful/cool/smart lisp macros are appearing in that reddit post . There are a few really nice examples: from 'simple' templating systems to output html from Lisp, to more or less sophisticated macros-that-generate-macros, and even execute comments using reader macros. And the amazing factor-like stack concatenative language inside emacs (||| lisp-val: (list 1 2 3 4) { 1 + } map { 2 > } filter )

Here is a page where you can find most 'standard' macros from On lisp, ready to use for emacs lisp. I've used some of them for my new emacs project I'm doing with davazp.

There are also some nice macros in the third part of lisp for the web articles.

And here's a nice example of how awesome can 25 lines of lisp be. Not sure it's the best macro example, but got a smile in my face the first time I saw it.

miércoles, 29 de febrero de 2012

functional javascript

I already wrote one post some time ago about some javascript that enabled more confortable functional style programming.

Now I come with a few more (that mostly bring bundled functional capabilities in a single package)

Here's a library that brings map,filter,reduce,currying, and some inline string->function->evaluate automatisms.

And a more DIY text with quite a few nice tricks.

jueves, 9 de febrero de 2012

Kiss the cuke

I don't care if you're cuking it right or wrong.

But you can use cukes whatever language you use.
So, there's no excuse, if you like BDD, not to use it.

w3m-redirect automatically

You could take this post as a second iteration on this older post.

There are many urls that are fairly navigable on w3m (emacs-w3m that is). The less html-y the site is, the more confortable it is.

So here's a way to redirect gist links to the raw plaintext counterparts. I just wrote it in 5 minutes, and it's quite inestable, but for the moment, it Works On My Machine. I'll try to make it more general and robust in next few days (as always, with advice from davazp)



Btw, it doesn't work if there is more than 1 file in the gist.