Canales externos

narrowing buffer contents

Emacs-fu - Dom, 22/08/2010 - 12:10

'Narrowing' is yet another of those many useful emacs features that took me years to appreciate, mostly because I never really tried it. I may not be the only one, so here's a short introduction.

Narrowing is the concept of hiding the buffer contents except for what you are currently working on. This is useful when you don't want to be distracted, but also because it allows you to execute commands only on the narrowed part. You can narrow different things:

what's shownnamebinding region (selection)narrow-to-regionC-x n n current pagenarrow-to-pageC-x n p functionnarrow-to-defunC-x n d everythingwidenC-x n w

I never used narrowing for the current page, but apparently it's used by e.g. Info-Mode to show only one page.

That last one is pretty important to remember; it's not totally obvious how to get back to 'normal' mode where you can see everything. For this very reason ('where the #>*$@ did my text go'), always-helpful emacs by defaults disables narrow-to-region (but, for some reason, not the other ones). To enable it, put the following in your .emacs:

(put 'narrow-to-region 'disabled nil)

Also note that the mode-line will show 'Narrow' when you're in narrow mode, lest you forget.

When you're using org-mode there is an additional one you might want to memorize:

what's shownnamebinding subtreeorg-narrow-to-subtreeC-x n s

I'm using that last one quite often; I have org-files where I keep meeting notes etc., and when in a certain meeting, I only want to see the notes for that specific meeting.

One bug? feature? of narrowing is that line-numbering is relative to the narrowed area rather than the full buffer. I'd prefer to have the real line numbers.

some handy key bindings

Emacs-fu - Vie, 30/07/2010 - 19:23

Emacs offers many handy key bindings; every now and then I come across a new one, which has been hiding there somewhere for a decade or more… Here are some of my favorites – I'm listing those that are (a) often useful, (b) might not be known by everyone already (c) don't require any external packages or setup.

  • M-27 x gives you xxxxxxxxxxxxxxxxxxxxxxxxxxx; and, believe it or not, works also with different characters and numbers;
  • M-m jumps to the first non-whitespace character on the current line;
  • M-^ joins two lines into one – like vi(m)'s :join, except that point must be on the second line, not the first;
  • M-/ auto-completes based on words in all your buffers; there are more powerful alternatives, but this one does not require any setup;
  • C-h k followed by some key or key combination tells you what it does, C-h m describes the currently active modes, with their key bindings;
  • C-h f documents the current function, C-h v does the same for variables. C-h a gives you information about commands - for example to get date-related commands, press C-h a date. This will, however, also get you commands related to update; instead, you can use C-h a \bdate (because C-h a accepts regular expressions);
  • C-x C-o will delete all the empty lines around your current cursor position, except for one;
  • M-q re-aligns the current paragraph; I use it all the time when writing e-mails etc. (you might want to check out filladapt for a version that gives you a bit more smartness with indentations, lists etc.);
  • C-x 8 RET in a recent emacs version gives you an auto-completable list of special characters to insert. So if I need, say, the Yen-character, I type C-x 8 RET ye TAB and I get YEN SIGN, which RET will then insert: ¥. Note that the completion only works on the start of the character name, so if you'd want to include the α-character, you'd need to know that its UCS-name is GREEK SMALL LETTER ALPHA… (you can try *alpha or TAB the empty string, and search in the results buffer, but that's rather slow);
  • C-h l shows your last 300 key presses ('lossage'). Interesting to see, and it might be useful when defining keyboard macros.

What are your favorites? Please share them in the comments.

navigating through files and buffers with the lusty explorer

Emacs-fu - Mié, 21/07/2010 - 15:29

I think quite a few people are using ido-mode to navigate through files an and buffers; we discussed it here already a long time ago. I am a happy ido-user myself – it took me some time to fully get full accustomed to the key bindings, but now it feels very natural. Definitely an improvement of my emacs user experience.

However, I am always looking for new things – and one of those is a sort-of ido-mode substitute. It's called the Lusty Explorer and it's the emacs implementation of an existing vim-plugin. It's quite similar to ido-mode; the difference is mainly that it shows all the files or buffers at the same time, in the way that shells (say, bash or zsh) do auto-completion.

The best way to show how it works is using an screencast (note, this is of a slightly older version). Lusty Explorer uses fuzzy matching; that means that I can type /etc/fo, and all items in /etc/ with names f.*o match.

To install lusty-explorer, simply copy lusty-explorer.el to your load-path, and put something like the following in your .emacs:0

(when (require 'lusty-explorer nil 'noerror) ;; overrride the normal file-opening, buffer switching (global-set-key (kbd "C-x C-f") 'lusty-file-explorer) (global-set-key (kbd "C-x b") 'lusty-buffer-explorer))

Side-note, the (when (require 'lusty-explorer nil 'noerror) ...) is there just make sure that no error is raised when lusty-explorer is not found, and the rest is ignored in that case. I use this construct for all packages that are not necessarily available everywhere I use my .emacs; thus, they will simply be ignored and not cause startup errors.

I've been using Lusty Explorer for about a week now, and I am quite happy with it. I still need some time (and maybe some more customization) to get used to the way it works - for example, I found the way ido-mode handles backspace a bit smarter. Also, ido-mode can be customized to a much greater extent. That might merely be a factor of the relative age of the packages – and I haven't really felt the need to customize Lusty Explorer too much. For now, I think I'm going to keep on using it. It's worth a try at least!

keyboard macros

Emacs-fu - Vie, 16/07/2010 - 18:34

Keyboard macros are a truly classic emacs feature. Still, I only started to use them years after I got sucked into emacs – not so uncommon for emacs features… There may be more people like me, so let's raise the awareness a bit.

Keyboard macros allow you to record a number of keystrokes, and replay those at some later point. This can be a great time-saver when you need to do repetitive things. In many cases, they are an easy alternative to writing some elisp to get a job done. Note, keyboard macros are should not be confused with elisp-macros, which are something else altogether.

an example

So, when would we want to use a keyboard macro? Let's take some tedious task -- for example, we have a list of a few hundred names:

Newton, Isaac Einstein, Albert Maxwell, James Turing, Alan ...

and we want to turn that into:

Isaac Newton James Maxwell Alan Turing ...

so, roughly, put the last name after the first name, and remove the comma.

We can solve this in different ways; we could simple change each line by hand. That's a fine solution if there are only a few lines, but it gets boring rather quickly.

Another way is to use regular expressions (see Building regular expressions); in this case, it's fairly easy to come up with one (assuming you know regular expressions). But let's see how we can solve it with a keyboard macro.

Schematically, we can solve this with the following:

actionkey go to beginning of a lineC-a kill (cut) the first wordM-d delete the next two charactersDEL DEL go to the end of the lineC-e insert a spaceSPC yank (paste)C-y go to the next lineC-n

This may look like some magical incantation, but it comes quite natural when you are actually doing the editing.

An important thing to remember when working with keyboard macros is that you do your commands in such a way that they can be repeated for each line. Suppose you would select Newton with shift-select, i.e., C-SPC at the beginning of the line and pressing the right arrow key 6 times – that works for Newton, but not for Einstein. Instead, we need to use M-d ('kill-word') instead.

defining a macro

Now that we have solved the problem for a single line, let's make a keyboard macro.

We move the cursor to the first line, and start the definition by pressing C-x (, or alternatively, F3. Then, we press the commands C-a, M-d, DEL DEL, C-e, SPC, C-y, C-n (as in the list above). To finish the definition, press C-x ), (or F4).

Hurray, we have our macro. Now, let's use it.

using the macro

Now, to execute the last defined macro, you press C-x e. We could repeat that for our whole list, but fortunately there's an easier way to repeat a macro n times, using a prefix argument. For example, to repeat the macro 123 times, you first press C-u 123 and then C-x e.

There's a slightly shorter way to do this: instead of C-u 123 we can write M-123, and for C-x e we can use F4 (kmacro=end-or-call-macro).

You can even repeat the macro until the end of the buffer is reached with C-u 0 C-x e; this only makes sense if the macros ever reaches the end of the buffer of course. (Remember that you can always terminate with C-g, keyboard-quit)

You can also apply your keyboard macro to all lines in the selected area (region) with M-x apply-macro-to-region-lines (or C-x C-k r). Important to remember: this will actually move the cursor (point) to the start of each line, and then execute the macro. If you want your macro like that, the go-to-the-next-line should not be part of your macro, or you will be skipping lines.

saving macros for later use

If you want to use multiple macros, you can name them. You can do this with M-x name-last-kbd-macro. If you name your macro, say, foo (inventive as we are), you can then execute it after that as M-x foo, which will be available until you exit emacs.

If you want to have the macro for future emacs sessions as well, you can use insert-kbd-macro, which will give you an elisp version of your macro. For our example, this will look like:

(fset 'foo [?\C-a ?\M-d delete delete ?\C-e ? ?\C-y ?\C-n])

Not very readable, but we can put this in .emacs, and we can use it the next time we start emacs as well. We can also add a key binding for this, for example:

(global-set-key (kbd "C-c f") 'foo)

This will bind foo to C-c f.

final notes

Keyboard macros can be useful and easy, but they are fundamentally connected to key presses – so, if you remap your keys to something different, your macros may not work anymore. Also, the macros are pretty much write-only in the way we use them here. You can edit them in the macro editor though, with M-x edit-kbd-macro M-x foo; we'll then get something like:

;; Keyboard Macro Editor. Press C-c C-c to finish; press C-x k RET to cancel. ;; Original keys: C-a M-d 2*<delete> C-e SPC C-y C-n Command: foo Key: none Macro: C-a ;; move-beginning-of-line M-d ;; kill-word 2*<delete> ;; delete-char C-e ;; move-end-of-line SPC ;; self-insert-command C-y ;; yank C-n ;; next-line

Keyboard macros can be quite a useful trick in your arsenal. And I have not even gone into more advanced tricks like macros with variations or the macro ring. Please refer to the section Keyboard macros in the emacs manual (C-h r) for all the details.

And, finally, don't let the text-based example limit your imagination – you can turn just about any repetitive sequence of tasks into a macro.

Org-mode: propiedades y columnas

El blog de Blackhats - Mar, 06/07/2010 - 02:49

En este articulo nos adentraremos un poco mas en org-mode, basicamente en que se pueden aplicar propiedades a distintas areas, que luego veremos que utilidad tiene. Para entender este post es necesario entender como trabajar con tablas en org-mode y como crear listas en org-mode (relacionadas o no con las tareas o TODO).

Es posible asignar propiedades a columnas o elementos de una lista, estas propiedades tendran un valor (por eso son pares) por ejemplo:

* Coleccion de CD
** Clasica
*** Variacion Goldberg
:PROPERTIES:
:Titulo: Variacion Goldberg
:Compositor: J.S. Bach
:Artista: Glen Gould
:Publicante: Deutsche Grammophon
:NDisks: 1
:END:

Se puede definir una lista de posibles valores para una propiedad en particular, para ello se le debe anadir el sufijo _ALL al nombre de la propiedad. Esto tendra una consecuencia especial a nivel de herencia, que si se marca una entrada, se aplicara para el arbol entero. Ademas definiendo una lista de posibles valores permitira evitar errores a la hora de escribir, por ejemplo:

* Coleccion de CD
:PROPERTIES:
:NDisks_ALL: 1 2 3 4
:Publisher_ALL: “Deutsche Grammophon” Philips EMI
:END:

Para definir posibles valores para propiedades de forma global podemos hacerlo de la siguiente manera (o mediante la variable global org-global-properties):

#+PROPERTY: NDisks_ALL 1 2 3 4

Los siguientes keybindings son usados para trabajar con propiedades:

  • M-TAB : Pulsado despues de : inicial en una linea, autocompleta claves.
  • C-c C-x p : Asigna un valor a una propiedad. Si fuese necesario la propiedad drawer sera creada.
  • M-x org-insert-property-drawer : Inserta una propiedad drawer en la entrada actual.
  • C-c C-c : Ejecuta comandos de la propiedad
  • C-c C-c s : Da un valor para la propiedad actual. Ambos, tanto la propiedad como el valor pueden ser autocompletados.
  • S-<– : Cambia la propiedad al valor anterior.
  • S—> : Cambia la propiedad al siguiente valor.
  • C-c C-c d : Elimina una propiedad de la entrada actual.
  • C-c C-c D : Elimina de forma global una propiedad de todas las entradas del fichero actual.
  • C-c C-c c : Computa la propiedad actual.

Propiedades especiales

Las propiedades especiales permiten acceder de forma alternativa a estas funcionalidades, por ejemplo:

TODO : Tarea TODO de la entrada.
TAGS : TAGS definidos directamente en una linea de cabecera.
ALLTAGS : Todos los TAGS, incluidos los heredados.
CATEGORY : La categoria de la entrada.
PRIORITY : La prioridad de la entrada.
DEADLINE : El limite de tiempo.
SCHEDULED : El tiempo o timestamp de esta entrada.
CLOSED : Cuando fue realmente cerrada esta entrada.
TIMESTAMP : La primera fecha de una entrada.
TIMESTAMP_IA : La primera fecha de inactividad de una entrada.
CLOCKSUM : La suma de los intervalos de tiempo de un subarbol. org-clock-sum debe ser lanzado la primera vez para computar dichos valores.
ITEM : El contenido de una entrada.

Busqueda de propiedades

Al crear estos arboles y listas especiales con una seleccion basada en propiedades podemos usar los siguientes keystrokes:

  • C-c \ ó C-c / m : Crea un arbol donde guardar todas las entradas que coincidan. Con el prefijo C-u ignora las lineas de cabecera que no son TODO.
  • C-c a m : Crea una lista global de propiedades/tags que coinciden con los ficheros de la agenda.
  • C-c a M : Crea una lista global de tags que coinciden con los ficheros de la agenda, pero fuerza solo a entradas TODO y todos sus subelementos (ver variable org-tags-match-list-sublevels).
  • C-c / p : Crea un arbol basado en el valor de la propiedad. Primero muestra el nombre de la propiedad y luego su valor.

Herencia de propiedades

Como bien dijimos anteriormente, si un padre tiene una propiedad determinada, su hijo la puede heredar. Por defecto esto esta deshabilitado, debido a que puede retardar bastante las busquedas, asi que si se quiere habilitar tendremos que configurar la variable org-use-property-inheritance. Ademas org tiene algunas propiedades hardcodeadas por defecto a nivel hereditario, que son:

COLUMNS : Define el formato de la vista de la columna.
CATEGORY : Para la vista de la agenda, la propiedad se aplica al subarbol entero.
ARCHIVE : Para archivacion, dicha propiedad debe definir la localizacion del archivo para el subarbol entero.
LOGGING : Para logueo, debe definir las opciones del logueo para cada entrada del subarbol.

Vista de columnas

Mediante la vista de columnas podremos tener un modo comodo para ver y editar propiedades de una columna, donde cada nodo sera convertido en una fila tabulable. Por lo que podemos usar:
  • TAB : para desplazarnos entre columnas de esta fila de propiedades.
  • S-TAB S-TAB : para ver el contenido o compactarla de nuevo.

Podemos definir el formato de una columna para un solo fichero de la siguiente forma:

#+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO

Para especificar que dicho formato solo se aplique a un arbol especifico deberiamos hacer algo asi:

** Alto del nodo para vista de columnas
:PROPERTIES:
:COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
:END:

Los atributos que podemos conceder a las columnas se definen con la siguiente sintaxis:

%[ancho]propiedad[(titulo)][{tipo_sumario}]

Todos los elementos son opcionales a excepcion del simbolo % y el nombre de la propiedad:

ancho un valor entero que indicara el ancho de la columna en caracteres.
propiedad la propiedad a ser editada en esta columna.
(titulo) La cabecera del texto para la columna.
{tipo_sumario} Si se especifica, el valor de las columnas para el padre seran computadas para los hijos:
{+} Suma los miembros en esta columna
{+;%.lf} Como ‘+’ pero usando formato para long float
{$} Divisas
{:} Suma los tiempos HH:MM:SS
{X} Estado del checkbox, [X] si todas los hijos son [X]
{X/} Estado del checkbox, [n/m]
{X%} Estado del checkbox [n%]
{min} El numero mas pequeno de la columna
{max} El mayor numero de la columna
{mean} Significado artimetico de los valores
{:min} El valor de tiempo mas pequeno de la columna
{:max} El mayor valor de tiempo de la columna
{:mean} Significado aritmetico de los valores de tiempo.
{@min} Edad minima (en dias/horas/minutos/segundos)
{@max} Edad maxima (en dias/horas/minutos/segundos)
{@mean} Significado artimento de los valores (en dias/horas/minutos/segundos)

El siguiente ejemplo muestra que cada elemento tendra 25 caracteres de ancho como linea de cabecera, los siguientes especificardores tendran las columnas Dueno, Estado y Aprobados:

:COLUMNS: %25ITEM %9Aprobados(Aprobados?){X} %Duenos %11Estado %10Tiempo_Estimado{:} %CLOCKSUM
:Duenos_ALL: Juan Pedro Luis Alberto Javi
:Estado_ALL: “En progreso” “No comenzado todavia” “Finalizado” “”
:Aprobados_ALL: “[ ]” “[X]“

Podremos acceder a la vista de columnas usando los siguientes keystrokes:

Para activar/desactivar:

  • C-c C-x C-c : Activa la vista de columna. Si el cursor se encuentra antes de la primera linea de cabecera del fichero, se aplicara entonces para todo el fichero. El formato sera tomado de la variable org-columns-default-format.
  • r ó g: Recrea la vista de columna.
  • q : Sale de la vista de columna.

Para editar valores:

  • <izq> : Se desplaza hacia el campo de la izquierda en la vista de columnas.
  • <der> : Se desplaza hacia el campo de la derecha en la vista de columnas.
  • <arriba> : Se desplaza hacia el campo de la izquierd en la vista de columnas.
  • <abajo> : Se desplaza hacia el campo de la izquierda en la vista de columnas.
  • S-<– ó p : Modifica el valor al anterior para dicho campo.
  • S—> ó n : Modifica el valor al siguiente para dicho campo.
  • 1..9,0 : Selecciona el Nth valor, 0 seleccionara el decimo valor.
  • e : Edita la propiedad actual.
  • C-c C-c : Hace toggle de un checkbox.
  • v : Ve el valor completo de la propiedad actual (util cuando la columna es mas pequena que el valor).
  • a : Edita la lista de valores permitidos para dicha propiedad. Si el valor no existe, lo anadira a la lista.

Para modificar la estructura de la tabla:

  • < : Estrecha la columna.
  • > : Amplia la columna.
  • S-M—> : Inserta una nueva columna a la derecha de la columna actual.
  • S-M-<– : Elimina la columna actual.

La vista de columnas es tan solo un overlay sobre un buffer, por lo que este no puede ser exportado o impreso directamente, para ello debemos usar bloques dinamicos de vistas de columnas, tal que asi:

* La vista de columna
#+BEGIN: columnview :hlines 1 :id “label”
#+END:

El bloque dinamico tiene los siguientes parametros:

:id Es el identificador, que puede ser local, global, file:ruta-al-fichero o directamente el ID.
:hlines Cuando es t, inserta una linea horizontal despues de cada linea. Cuando es un numero N, inserta una linea horizontal antes de cada linea de cabecera con un nivel inferior o igual a N.
:vlines Cuando es t, fuerza los grupos de columnas para tener lineas verticales.
:maxlevel Cuando tiene un valor N, no captura las entradas por debajo del nivel N.
:skip-empty-rows Cuando es t, ignora las filas donde no hay indicada una linea en blanco para un ITEM.

Los siguientes comandos permiten insertar o actualizar un bloque dinamico:

  • C-c C-x i : Inserta un bloque dinamico capturando una vista de columna.
  • C-c C-c ó C-c C-x C-u : Actualiza el bloque dinamico actual. El cursor debe estar al principio de la linea de dicho bloque #+BEGIN.
  • C-u C-c C-x C-u : Actualiza todos los bloques dinamicos. Util para bloques con tablas de reloj.

Es posible anadir formulas a la columna de una vista de una tabla en caso de querer hacer plotting sobre la tabla, por lo que incluir #+TBBLFM: despues de la tabla, recalculara la tabla automaticamente despues de una actualizacion.

Para mas informacion sobre la captura y proceso de valores de propiedades en una tabla es interesante ver el script org-collector.el, que provee una API para coleccionar propiedades de una entrada para un ambito concreto.

Org-mode : Graficas / trazas (plot)

El blog de Blackhats - Sáb, 03/07/2010 - 02:21

En el articulo anterior referente a spreadsheet u hojas de calculo, explicamos como es posible realizar hojas de calculo mediante org-mode de GNU/emacs. Como bien muchos saben, estas las hojas de calculo son datos tabulados en los que se pueden incluir referencias y demas, por lo que este software generalmente incluye lo que se llama plotting o traza de estos datos, o lo que es lo mismo realizar graficas haciendo uso de estos datos. GNU/emacs no es para menos, y tambien permite realizar lo mismo. He preferido separarlo en dos articulos (aunque este segundo me ha quedado algo corto), ya que en muchos casos no estamos para nada interesados en esta funcionalidad, pero si creo que es un aditivo a la funcionalidad anterior y esta estrechamente relacionada.

Plot

Se puede producir graficos en 2D y 3D mediante gnuplot, lo cual requiere de tener gnuplot y gnuplot-mode instalado. Se debe agregar a la primera linea de la tabla algo tal que asi (por ejemplo):

#+PLOT: title:”foobar” ind:1 deps:(3) type:2d with:histograms set:”yrang [0:]“.

Existen otras funciones para plot tal que:

set: especifica cualquier opcion de gnuplot a ser modificada.
title: espeficia el titulo del ploteado.
ind: especifica que columna de la tabla usara el eje de las x.
deps: especifica las columnas a ser ploteadas.
type: especifica el tipo de ploteado, 2d, 3d o grid.
with: Especifica cada opcion a ser insertada (lines, points, boxes, impulses, etc).
file: especifica un fichero de salida para el ploteado.
labels: lista de etiquetas a ser usadas para las deps.
line: especifica una linea entera a ser insertada en el script de gnuplot.
map: Cuando dibuja en 3D o tipo, activa los mapas para ir mas alla de 3d slope.
timefmt: Especifica el formato de timestams.
script: control total especificando un fichero de script. Especificado por $datafile.

Los resultados son excepcionales, podeis probarlos, podeis encontrar mas informacion dedicada al tema en: http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html tambien podeis encontrar informacion interesante sobre gnuplot en su web oficial.

Org-mode : spreadsheet (hojas de calculo)

El blog de Blackhats - Sáb, 03/07/2010 - 02:01

Y aqui estamos con un nuevo articulo sobre org-mode, como no, org-mode permite la creacion y uso de hojas de calculo (en ingles spreadsheet). Parece increible como un software que a simple vista parece tan simple, pueda llegar a tener tanta potencia, todo esto no seria posible sin el magnifico grupo de desarrolladores de org-mode y en general a la comunidad tan activa de GNU/emacs, sin mas dilacion comenzamos explicando el uso de referencias.

Antes de comenzar, debe conocer un minimo el uso de tablas en org-mode, ya que las hojas de calculo se emplean mediante dicho uso, por lo que es necesario leer el articulo sobre Org-mode: tablas para poder aplicar luego hojas de calculo sobre el.

Referencias

Se puede referenciar un campo para computarlo con otros. Se puede referenciar dado su nombre, sus coordenadas absolutas o coordenadas relativas. Para saber las corrdenadas de un campo debemos presionar C-c ? que mostrar las coordenadas de dicho campo o bien C-c } que hara toggle de las coordenadas del grid.

La notacion que usa org es @fila$columna, si es relativa debemos anadir + o - delante del numero. Tambien se puede especificar ‘I‘ para referirse a la primera linea, ‘II‘ a la segunda linea, ‘-I‘ a la (n)anterior linea o bien ‘III+2‘ para referirse al segundo dato de la tercera linea de la tabla. 0 se referira a la columna y fila actual.

Existen referencias especiales como ‘$LR5‘ que pueden ser usadas para referirse al 5o campo de la ultma fila de la tabla.

@2$3 -> 2a fila, 3a columna
C2 -> igual que la anterior columna
$5 -> 5a columna en la fila actual
E& -> igual que la anterior
@2 -> columna actual, 2a fila
@-1$-3 -> una fila mas arriba, tres columnas mas a la derecha
@-I$2 -> encima de la fila actual, columna 2

Rangos

$1..$3 -> Los primeros 3 campos de la fila actual
$P..$Q -> rango usando nombres de columnas P y Q
@2$1..@4$3 -> 6 campos entre estos dos campos, dando rutas relativas
A2..C4 -> 6 campos entre estos dos campos, dando rutas absolutas
@-1$-2..@-1 -> 3 numeros de la columna a la derecha, 2 arriba de la fila actual.

Referencias con nombre

Se puede asignar un nombre a una referencia mediante la variable org-table-formula-constants, o localmente mediante el fichero de configuracion:

#+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6

Es posible usar referencias remotas mediante:

remote(NAME-OR-ID,REF)

Donde nombre es el nombre de la tabla dado por #+TBLNAME: NAME o su ID. REF es la direccion absoluta o rango de referencias valido en la tabla.

Las formulas pueden ser usadas como expresiones algebraicas mediante el paquete calc de emacs (importante saber que usa convencion no estandar donde / tiene menos precedencia que *) mediante la funcion calc-eval se puede realizar esta evaluacion.

Mediante org-calc-default-modes se usara el modo standard de calc (precision 12, unidades angulares graduales, fracciones y los modos simbolicos deshabilitados).

p20 -> cambia la precision interna a 20 digitos
n3 s3 e4 f4 -> normal, cientifica, ingeniero o formato fijo
D R -> gradianes o radiales (angulo)
F S -> fraccion y simbolicos
N -> interpreta todos los campos como numeros, y usa 0 para los campos que no tengan numeros.
T -> fuerza la intepretacion del texto
E -> mantiene campos vacios en rangos

Ademas se puede usar printf como especificador de formato para reformatear el resultado final:

$1+$2 : suma el primero y el segundo campo
$1+$2;%.2f : suma los dos primeros campos usando 2 decimales
exp($2)+exp($1) : funciones matematicas
$0;%.1f : reformatea la celda actual a un decimal
($3-32)*5/9 : Conversion de grados Farenheit a Celsius
$c/$1/$cm : Conversion de Hz a cm
tan($1);Dp3s1 : computa en grados, precision 3, mostrando SCI 1
sin($1);Dp3%.le : usa el especificador printf para mostrar
vmean($2..$7) : computa un rango de columnas, usando un vector de funciones
vmean($2..$7);EN : igual, pero usa los campos vacios como 0
taylor($3,x=7,2) : serie de taylor de $3, en x=7, segundo grado.

Tambien se pueden contener expresiones logicas tales como:

if($1<20,teen,string(“”)) : teen, si la edad de $1 es menor que 20, en cualquier otro caso vacio.

Si lo que queremos es usar mas potencia podemos escribir formulas para la manipulacion de cadenas y el control de estrucutras tales como:

Intercambia los primeros dos caracteres de la columna 1:
‘(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))

Suma columnas 1 y 2, equivalnete a calc $1 y $2:
‘(+ $1 $2);N

Calcula la suma de las columnas 1 a 4:
‘(apply ‘+ ‘($1..$4));N

Para asignar una formula a un campo en particular, debe ir precedido por “:=“. Las formulas son guardadas en el formato especial con #+TBLFM: directamente debajo de la tabla. Ademas debemos usar el comando C-u C-c = si queremos insertar una nueva formula en el campo actual.

Es frecuente usar la misma formula para todos los campos de una columna, esto es posible mediante TAB, INTRO o C-c C-c para pasar guardar la formula en la columna usada. Una vez se sale a la siguiente fila tan solo debemos pulsar C-c =, e insertara la nueva formula en la columna actual, reemplazandola por el resultado, tambien es posible usar prefijos para aplicarlo en muchas celdas consecutivas de la columna actual.

Para editar y depurar (o debuggear) existe:

  • C-c = ó C-u C-c = : Edita una formula asociada con el campo/columna actual en el minibuffer.
  • C-u C-u C-c = : reinserta una formula activa en el campo actual. Ademas la ventaja de usar el minibuffer es que se puede emplear el comando C-c ?
  • C-c ? : Resalta el campo referenciado por la posicion del cursor en una formula.
  • C-c } : Muestra (toggle) los numeros de una fila y columna para una tabla, usando overlays. Con C-c C-c se puede formar la alineacion de la tabla cada vez.
  • C-c { : Hace toggle del debugger de formula.
  • C-c ‘ : Edita todas las formulas de la tabla actual en un buffer especial.
  • C-c C-c ó C-x C-s : Sale del editor de formulas
  • C-c C-q : Sale del editor de formula sin instalar los cambios.
  • C-c C-r : Hace toggle del editor de formulas para todas las referencias entre standard (B3, etc) e internas (@3$2, etc).
  • TAB : Hace impresion ‘bonita’, idnetando las formulas lisp, etc.
  • M-TAB : Completa los simbolos lisp.
  • S-up/down/left/right (tecla super + flechas) : Desplaza el punto de referencia.
  • M-S-up/down : Mueve la linea de test para formulas en columnas en el bufer de org.
  • M-up/down : Desplaza la ventana
  • C-c } : Muestra las coordenadas del grid de la tabla.

Cuando se evalua una forma que contiene errores se mostrara la cadena ‘#ERROR‘ para conocer que ocurrio en la substitucion de variables y calculos se puede emplear C-u C-u C-c = INTRO.

Para actualizar la tabla se pueden emplear los siguientes comandos:

  • C-c * : Recalcula la fila actual
  • C-u C-c * ó C-u C-c C-c : recalcula la tabla entera
  • C-u C-u C-c * ó C-u C-u C-c C-c : Itera la tabla para recalcularla hasta que los cambios ocurran.

Existen otras funciones avanzadas con tablas como:

  • C-# : rota la marca de calculos en la primera columa para los estados, ‘#‘, ‘*‘, ‘!‘, ‘$‘. Tambien se puede aplicar sobre regiones.

Las tablas especiales que comiencen con C-u C-c * solo afectara a filas marcadas por ‘#‘ y ‘*‘. Las marcas tienen los siguientes significados:

! : Define nombres para las columnas, por lo que es posible usar $nombre en lugar de $6.
^ : Define nombres para las filas, por lo que cualquier formula en la tabla que use $m1, tomara el valor de la misma.
_ : Define nombres en los campos de la fila inferior.
$ : Campos en esta fila pueden definir parametros para formulas. Por ej. si un campo de una fila contiene $, y dentro contiene max=50, las formulas en esta tabla se podran referir a $max usando como valor 50. Los parametros trabajaran como constantes.
# : Campos en esta fila seran automaticamente recalculados mediante TAB, INTRO o S-TAB o mediante C-u C-c * para recalcularlo de forma global.
* : Selecciona esta linea para recalcular globalmente con C-u C-c *, pero no de forma automatica (para evitar carga cuando se edita demasiado).
: Lineas desmarcadas estan excentas de calculos con C-u C-c *.
/ : No exporta esta linea.

Basicamente este es el uso de hojas de calculo con emacs, aunque en el siguiente articulo anadire una funcionalidad interesante que sabiendo esto puedan crearse graficos sobre dichos datos.

console apps in emacs with multi-term

Emacs-fu - Mié, 30/06/2010 - 21:05
multi-term

updated Whenever it makes sense, I try to use emacs for my computer-based activities; surely, programs like The Gimp or a graphical web browser cannot yet be replace by emacs, but I'm making progress. I like the ways emacs gives me to automate and speed-up my tasks; I get some return-on-time-investment.

2010 or not, I still spend quite a bit of time on the console. So why not do that from within emacs? There different ways to run shells within emacs.

The simplest one is shell (i.e,, M-x shell), which starts a simple shell, which does not support which does not support 'graphical' console applications, such as mutt, mc, htop.

Then there are term and ansi-term (M-x ansi-term) that do support such applications, which ansi-term supporting colors as well (it seems to have become the default for term in recent emacs versions).

Another one is the nifty EShell (included with emacs), which is not just a (simple) terminal, but also a full shell environment, and has integration with other things in emacs. It's nice, but has some of the limitations that shell has - you cannot run 'graphical' applications; also, I don't really need a shell, as I am quite happy with zsh (zed shell) already, which is more powerful, and I prefer a shell that works both inside and outside emacs.

For all these reasons, I am using MultiTerm, which has 'graphical' support that ansi-term has, but adds a nice extra, namely support for multiple terminals within emacs. I'm not fully up to date with the exact difference in the terminal support between the two, but I haven't had any problems so far.

You can install multi-term (put it in your load-path), and add the following to your .emacs:

(autoload 'multi-term "multi-term" nil t) (autoload 'multi-term-next "multi-term" nil t) (setq multi-term-program "/bin/bash") ;; use bash ;; (setq multi-term-program "/bin/zsh") ;; or use zsh... ;; only needed if you use autopair (add-hook 'term-mode-hook #'(lambda () (setq autopair-dont-activate t))) (global-set-key (kbd "C-c t") 'multi-term-next) (global-set-key (kbd "C-c T") 'multi-term) ;; create a new one

With this, C-c t will jump through your multi-term buffers (create a new one if it doesn not exist yet), while C-c T unconditionally creates a new terminal.

Org-mode : TAGS (etiquetas)

El blog de Blackhats - Lun, 21/06/2010 - 02:37

Despues de un tiempo inactivo (unos 6 meses); algunos de ellos por estar viajando y sin conexion a Internet y otras veces por otras razones personales por fin vuelvo para continuar con este blog sobre GNU/Emacs, asi que pido disculpas a todos por este retraso y tiempo inactivo.

Tambien quiero pedir disculpas debido a que los ultimos articulos necesitan ser revisados, ya que contienen frases que no son del todo entendibles o con algunos ejemplos poco claros, asi que intentare revisarlos lo antes posible.

Por otro lado decir que hemos migrado a nuevos servidores de OVH (antes estaban en 1&1) con mejores servicios, asi pues, hemos instalado nuevas versiones de software mas modernas mas seguras y con mas funcionalidades. Gracias a |[TDP]| ya que ha cargado con la parte pesada y se ha encargado de todo ello. Sin mas dilacion, pasamos a la parte tecnica y especifica de GNU/Emacs, en el cual hablare de los TAGS (o etiquetas) en org-mode.

Una forma de relacionar informacion cruzada es usar TAGS en las lineas de cabecera. Cada linea de cabecera contiene una lista de TAGS (que deben tener un formato alfanumerico o bien ‘-‘ o ‘_‘) por ejemplo:

* Reunion con el grupo Frances        :work:
** Sumario por Frank               :boss:notes:
*** TODO Preparar presentacion        :action:

Herencia

Para usar los TAGS definidos en un solo fichero podemos usar:

#+FILETAGS: :Peter:Boss:Secret:

Que ademas pueden usar herencia (o no) si se configuran las variables org-use-tag-inheritance y org-tags-exclude-from-inheritance.

Cuando una linea de cabecera coincide durante una busqueda de TAGS y la herencia esta activada (o habilitada), todos los subniveles del mismo nivel heredaran este mismo TAG, por lo que esto puede provocar muchos resultados en algunos casos, asi que si solo se quiere encontrar la primera coincidencia en un subarbol podemos configurar la variable org-tags-match-list-sublevels (aunque esto no se recomienda segun la web oficial de org-mode).

Creando TAGS

Generalmente los TAGS se escriben a mano despues de la linea de cabecera, aunque despues de pulsar ‘:‘ podemos usar M-TAB para autocompletion de TAGS, ademas existen algunos keystrokes interesantes relacionados:

C-c C-q ó C-c C-c : Crea TAGS para la linea de cabecera actual. Ademas despues de presionar INTRO el TAG sera alineado, pero con C-u INTRO todos los tags seran alineados respecto la variable org-tags-column.

Org soporta insercion basada en listas de TAGS, para ello debemos especificar de forma global org-tag-alist con una lista de TAGS o bien para un fichero especifico mediante:

#+TAGS: @work @home @tennisclub
#+TAGS: laptop car pc boat

En el caso de que la lista sea dinamica usando la variable org-tag-alist debemos dejar la lista de TAGS en blanco tal que asi:

#+TAGS:

Podemos especificar una lista de TAGS en la variable org-tag-persistent-alist, lo que usara automaticamente en cada fichero dicha lista de TAGS, a excepcion de si se anade esta linea:

#+STARTUP: noptag

Existe ademas un metodo de seleccion de TAGS ultrarapido llamado fast tag selection, que permite deseleccionar y seleccionar TAGS simplemente presionando una tecla, por lo que deberemos asignar teclas unicas a cada TAG. Tambien se pueden configurar de forma global configurando la variable org-tag-alist en nuestro .emacs:

(setq org-tag-alist ‘((“@work” . ?w) (“@home” . ?h) (“laptop” . ?l)))

Se puede configurar de manera local (solo relevante para un fichero) de la siguiente forma:

#+TAGS: @work(w) @home(h) @tennisclub(t) \n laptop(l) pc(p)

Especificando ‘\n‘ comenzara una nueva linea despues de un TAG especifico, que seria lo equivalente a:

#+TAGS: @work(w) @home(h) @tennisclub(t)
#+TAGS: laptop(l) pc(p)

Se pueden agrupar los TAGS mediante llaves, indicando asi que al menos uno de los 3 encerrado entre llaves debe ser seleccionado:

#+TAGS: { @work(w) @home(h) @tennisclub(t) } laptop(l) pc(p)

Para activar los cambios debemos pulsar C-c C-c.

Es posible crear TAGS de exclusion mutua configurando la variable org-tags-alist:

(setq org-tag-alist ‘((:startgroup . nil)
(“@work” . ?w) (“@home” . ?h)
(“@tennisclub” . ?t)
(:endgroup . nil)
(“laptop” . ?l) (“pc” . ?p)))

Presionando C-c C-c y cualquier tecla de las siguientes:

  • a-z ó - ó _ : podremos anadir o eliminar un TAG de la linea actual (ademas tendra en cuenta tags de exclusion mutua).
  • TAB : Autocompletara un TAG.
  • SPC : Elimina todos los TAGS de la linea actual.
  • INTRO : Acepta el nuevo TAG modificado.
  • C-g : Cancela el nuevo TAG.
  • q : Si q no esta asignado como un TAG, abortara como C-g.
  • ! : Deshabilita todos los TAGS de exclusion mutua.
  • C-c : Hace toggle para auto-salida del siguiente cambio. En modo experto el primer C-c mostrara la ventana de seleccion.

Es posible modificar la variable org-fast-tag-selection-single-key para evitar tener que presionar INTRO para TAGS demasiado usados y asi tener el mismo efecto.

Busqueda en tags

Es posible extraer cierta informacion a partir de los TAGS. Por ejemplo:

  • C-c \ ó C-c / m : Crea un arbol con todas las lineas de cabecera que coincidan con dicho TAG.
  • C-u C-c \ ó C-u C-c / : Con el prefijo esta vez ignorara aquellas lineas de cabecera que no sean un TODO.
  • C-c a m : Crea una lista global de la agenda de todos los TAGS que coincidan.
  • C-c a M : Crea una lista global de la agenda de todos los TAGS que conicidan, pero solo buscara aquellos que sean TODO y forzara la busqueda en subtareas (ver variable org-tags-match-list-sublevels).

Estos comandos se pueden usar para buscar empleando logica booleana como por ejemplo ‘+boss+urgent-project1‘ para encontrar todas las cabeceras de linea que tengan el TAG de ‘jefe’ y el de ‘urgente’ pero no para el ‘proyecto1′.

Recordad que este articulo es interesante combinarlo con los anteriores referentes a org-mode (tablas, hiperenlaces y tareas).

Al principio el uso de org-mode puede resultar algo complejo (sobretodo si no estamos habituados o no lo hemos estado al antiguo outline-mode) pero con un poco de practica, ignorando aquellos comandos que usemos con menos frecuencia y usando solo aquellos que mas nos interesen en cada momento, al final conseguiremos dominar este modo de manera mecanica.

automatic pairing of brackets and quotes

Emacs-fu - Jue, 17/06/2010 - 20:24

Some text-editors, notably TextMate for MacOS, have a nice feature where inserting a opening ( will automatically insert the closing ), and put the cursor in between them (and does same for [], {}, and various quote-marks).

Not surprisingly, there are some implementations for emacs as well; the best one I have found so far is called autopair, which was written by João Távora. It usually does things just right. Do things 'just right' is essential for such a tool; even small annoyances can disturb your flow. Autopair tries to do whatever makes the most sense for a given mode (programming language etc.), but it can be tuned as well.

After installation, you can automatically activate it for all modes with (in your .emacs):

(require 'autopair) (autopair-global-mode 1)

Now, evaluate this or restart emacs, and enjoy the autopairing-magic!

Except for autopairing, autopair also takes care of autocleaning; that is, if I press ( it turns that into () (the pairing part), and if I press Backspace then, it removes the whole () (the cleaning part). This makes things much less annoying if you type a pair by accident. Autopairing is the kind of thing that can get annoying quickly if it does not things exactly right – and autopair succeeds!

Another nice trick it offers is autowrapping – that is, I select a word, press ", and automatically it's turned into "word". To enable that, you need to add the following:

(setq autopair-autowrap t)

Note: you might want to see the notes below about delete-selection-mode and cua-mode.

Anyway, autopair with autowrap makes for a really smooth editing experience, I love it! There are two small issues for me though. First, when the cursor in front of some non-whitespace, I'd like autopairing not to happen, and second, somehow I can't seem to get "-autopairing to work in org-mode; of course, that could be my own fault. These things might be tunable; I haven't tried very hard yet.

delete-selection-mode

Important to mention here is that autopair is (by default) not fully compatible with delete-selection-mode. As you may know, that is the mode that causes emacs to replace the current selection with a character typed, similar to what most other programs do. I think many people have it enabled in their .emacs with something like:

(delete-selection-mode 1)

If you want to keep on using that together with autopair, add the following to your .emacs:

(put 'autopair-insert-opening 'delete-selection t) (put 'autopair-skip-close-maybe 'delete-selection t) (put 'autopair-insert-or-skip-quote 'delete-selection t) (put 'autopair-extra-insert-opening 'delete-selection t) (put 'autopair-extra-skip-close-maybe 'delete-selection t) (put 'autopair-backspace 'delete-selection 'supersede) (put 'autopair-newline 'delete-selection t)

But, not that that still won't give you the autowrap behavior mentioned above. For that, we can use cua-mode.

cua-mode

We discussed CUA-mode before, focusing on its nice rectangle-editing features. But CUA-mode can also be an alternative for delete-selection-mode, and it goes together more nicely with autopair; so, instead of delete-selection-mode and the put's, add the following to your .emacs:

(setq cua-enable-cua-keys nil) ;; don't add C-x,C-c,C-v (cua-mode t) ;; for rectangles, CUA is nice

See the linked CUA-mode article for the 'why' of that first line. With this change, autopair should be working smoothly, including autowrap.

further customization

As I have hinted at, autopair can be tuned for different modes, and can differentiate between it's behaviour in literal strings, code, comments etc. The default are usually sane, but if you're interested, have a look at the documentation, in particular autopair-extra-pairs and the More tricks-section in the documentation.

worldcup games in your org-mode agenda

Emacs-fu - Jue, 10/06/2010 - 19:57

A significant part of the world population will be watching the Football World Cup in South-Africa this month. For people who use org-mode to organize their lives, find the schedule of all the games in this message I sent to the org-mode mailing list.

In order to have the games show up in your agenda, make sure the file is in your org-agenda-files. If needed, you could add it with something like in your org-mode settings:

(add-to-list 'org-agenda-files "~/org/fifa-worldcup-2010.org")

One small issue with the schedule is that it use the South-African times, and there is no automatic way to adjust times for the local time zone. As a work-around, Juan Pechiar provided the following function which makes it easy to update all org-timestamps in a file:

(defun uphours (n) "update all timestamps n hours" (interactive "nAdd hours: ") (save-excursion (goto-char (point-min)) (while (re-search-forward "[[<]" nil t) (when (org-at-timestamp-p t) (org-timestamp-change n 'hour) ))))

Evaluate this function (in emacs, put your cursor after the last ")"), then press C-x C-e. After that, you can go to the file with the world cup schedule, and give an M-x uphours, provide the offset for your timezone, compare to South-African time (positive or negative).

Go: El nuevo lenguaje de programación de Google

La página de Vejeta - Mié, 26/05/2010 - 22:33
En google han dedicido que necesitamos otro "lenguaje de sistemas", y nos traen "Go". Go promueve la creación de sistemas y servidores como si fueran un conjunto de procesos que se comunican, llamados goroutines. Puedes arrancar miles de goroutines y olvidarte de los desbordamientos (stack overflows). Ha sido liberado con licencia BSD.
Categorías: Noticias generales

100th post

Emacs-fu - Jue, 20/05/2010 - 08:29
100

With that last post, emacs-fu reached the 100 posts milestone! Hurray! Thank you for all the support, it's been a great ride so far, and there's so much more to write about - if only there were 36 hours in a day.

Anyway, to celebrate, I'll be off for the coming weeks (Korea), and I'm not sure if I have much time to blog from there. So, let's take this opportunity for a small reader poll: what would you be interested to read about? More programming-related stuff, more org-mode, more about integration with other programs, more interviews, more …?

Please leave your ideas in the comments. I'd be interested to hear!

Update: I am back now; thanks for all the replies. It seems that many people are interested in CEDET. In fact, I am interested in it myself as well, but am not using it right now, so it will take a while. For the time being, Alex Ott's Gentle Introduction might be the best way to get started.

zenburn for org-mode-generated html

Emacs-fu - Jue, 20/05/2010 - 08:15

If you read this blog directly, instead of through some aggregator or feed-reader, you can now see the code blocks rendered in the nice zenburn color theme that I discussed before. I'm really enjoying it, so I added some style sheet definitions, so org-mode #+BEGIN_SRC / #+END_SRC blocks look as such in the web page (and just like they look on my screen), for instance:

(defun fibo (n) "calculate the Nth (N>=0) fibonacci number in a simple yet inefficient way" (cond ((= n 0) 0) ((= n 1) 1) (t (+ (fibo (- n 1)) (fibo (- n 2)))))) ;; now, gimme a list of fibo numbers 0..20 (mapcar 'fibo (number-sequence 0 20))

Note, I discussed the use of such code blocks earlier; it's one of many nice features of org-mode. Only quite recently I found that I can press C-c ' in such a code block to edit them in a mode-specific little buffer… something new and obvious to learn every day.

Anyhow, to get the nice zenburn-output in the generated HTML, you can use the following CSS (note, so far I have only done the code blocks):

/* zenburnesque code blocks in for html-exported org mode */ pre.src { background: #3f3f3f; color: #dcdccc; } .org-preprocessor { color: #8cd0d3; } .org-preprocessor { color: #8cd0d3; } .org-variable-name { color: #f0dfaf; } .org-string { color: #cc9393; } .org-type { color: #dfdfbf; font-weight: bold; } .org-function-name { color: #8cd0d3; font-weight: bold; } .org-keyword { color: #f0dfaf; font-weight: bold; } .org-comment { color: #7f9f7f; } .org-doc { color: #afd8af; } .org-comment-delimiter { color: #708070; } .org-constant { color: #dca3ac; font-weight:bold; } .org-builtin { color: #7f9f7f; }

You can save the above CSS-blob in a file (say, zenburn-code.css), and set the style sheet for the org-html export by putting a #+STYLE:-line in your org files:

#+STYLE: <link rel="stylesheet" type="text/css" href="zenburn-code.css" />

emacs 23.2

Emacs-fu - Vie, 14/05/2010 - 18:22

Recently, emacs version 23.2 was released. It's a quick update after 23.1 came out (July 29 of 2009); it seems Chong Yidong / Stefan Monnier (interview) are doing releases more often than before they took over emacs maintainership. A welcome change, I would say.

The amount of changes is obviously also a bit smaller than in 23.1, but there are still some interesting updates. Let's go through a couple of those here; I am not striving for completeness, and I won't really go into the biggest change (inclusion of the CEDET IDE-framework), as I haven't been using that enough to say anything about it. Instead, let's look at some of the other highlights; for the full list of changes, please refer to the NEWS-file. If you have some other cool new feature that deserves mentioning, please add a comment.

Some highlights
  • Maximum file size increased to 512Mb (this used to be 256 on 32-bit machines). This may be useful for big log files etc. It does take a while to load such big files, but after that it's not too slow, at least if you have enough RAM. For 'normal' files, you're unlikely to ever hit the limit; e.g. Tolstoy's War and Peace is only 3 MB…

    Note, you can set large-file-warning-threshold to set the maximum file size after which emacs will starting asking you for confirmation when trying to open (eh, visit) files.

  • By default, the mouse cursor turns invisible when typing, so there is no more need for mouse-avoidance-mode and similar tricks. However, if you insist on seeing the mouse cursor, you can add to your .emacs:
(setq make-pointer-invisible nil)
  • On X-based systems, emacs now listens for font changes (Xft), and can automatically use the GNOME mono-spaced font (as set in the GNOME Appearance preferences dialog). Note that this may not work for all fonts/settings (at least in my tests, setting the font to italic does not seem to reflect in emacs). Anyway, to enable this, put the following in your .emacs (or the moral equivalent):
(setq font-use-system-font t)
  • On Unix, Emacs 23.2 now follows the freedesktop trash specification for file deletion; thus, the hacks we hacks we mentioned before are no longer needed.
  • Some cool additions for Tramp, allowing emacs to access files in rsync and even imap://-locations. On systems supporting GVFS, emacs can now directly use e.g. obex://-uris (Bluetooth). I need to play a bit with these things! Tramp support has also been built into eshell.
  • There are already quite some ways to do auto-completion in emacs using the TAB-key, and emacs 23.2 makes this a bit easier to set up. You can add basic auto-completion with:
(setq tab-always-indent 'complete)
  • After setting that, the TAB-key will (after trying if there's anything to indent first) provide possible completions. It works pretty well for Emacs-Lisp (I did not test other languages), although the way it shows the completions (separate *Completions*-buffer) is a bit clumsier that what for instance yasnippet or company-mode do.
  • You can also do partial completions now, by appending initials to the completion style, i.e.:
;; there must be a more elegant way... (setq completion-styles (append completion-style '(initials)))
  • With this, you can complete on the initials of functions and variables in the minibuffer, say, typing C-h v tai and then pressing TAB will give you tab-always-indent.
  • As mentioned, the biggest change is the addition on the CEDET-framework, which contains things like smart completion, code browsing, UML diagram creation, project management – features somewhat similar to those in e.g. Eclipse. I don't know how well it works in practice, but I will give it a try. At least, inclusion in Emacs should make setting it up with all dependencies a bit easier, as there is now a guaranteed-to-work setup for Emacs 23.2 at least.

Summarizing, 23.2 provides us with some nice updates all around and brings CEDET to the masses. Chong Yidong / Stefan Monnier have done a very good job in making faster releases, while still keeping an eye on the quality. On the other hand, the previous version (23.1) is a very solid release, and if you don't need CEDET, there is no real need to hurry to 23.2.

Future releases

A lot is happening in the world of GNU/Emacs, with changes being proposed and implemented in many different places. There's Eli Zaretskii's way work on making emacs support bidirectional languages (for right-to-left writing systems such as Hebrew and Arabic; the /bi/directional part is that one should be able to mix left-to-right and right-to-left). There is Jan Djärv's work on adding UI-tabs to emacs (like e.g. Firefox has them). There is Ken Raeburn and Andy Wingo's work on adding Guile Scheme support to emacs - possibly replacing the current Emacs Lisp implementation in the future. These are just a few of the more prominent projects.

Nobody knows in which release these items will be available (if at all), but it's exciting to see all the directions people are taking emacs.

Distribuir contenido