read

If you are an Emacs fan, you may have notice a lot of cool changes from Emacs21 to Emacs22. One of those changes is related to defuns. A defun is simply a function definition. But, what is actually a ‘function definition’? Until Emacs21, a function definition is the code that defines the function (easy, is not it?). There are a lot of functions in Emacs that are based on defuns: beginning-of-defun, mark-defun, narrow-to-defun, etc.

One of those functions that is very useful is narrow-to-defun (C-x n d): it hides all source code except the current function. Then, you can do all kind of changes that will affect only the shown code. If you try it with a C example, you will notice all code except the function you are positioned is hidden. Unfortunately, as you can check, the function definition is not part of the defun, so it is also hidden. Besides being upset, as you can not see the definition, there are other problems, like Emacs indenting wrong.

But with Emacs22, this has changed, so now a defun includes both the code of a function and its definition. If you try again the previous example in Emacs22, you will notice that now the function is shown fine, and it even indents fine.

The problem is that some Emacs packages are not aware of this change. One of that package is gtk-doc: it creates a skeleton of the Gtk function you are writting. Unfortunately, this package, which works fine until Emacs21, does not work fine in Emacs22, because of the change of defun.

The fix is very easy, and I attach the package already fixed. You need to load Emacs22, and compile it (gtk-doc.el) with compile it with byte-compile-file funtion, which creates a gtk-doc.elc, and then replace the current file with the newer. If you want to have a look at the change done, I attach also a patch with the fix.

Blog Logo

Juan A. Suárez


Published

Image

Words from the Inside

Uninteresting things from an uninteresting developer

Back to Overview