Showing posts with label emacs23. Show all posts
Showing posts with label emacs23. Show all posts

sauron: keeping an eye on what's going on






I'm a fairly busy person, and need to keep track of a lot of things. That
includes following a bunch of internal IRC channels, attending meetings, meeting
deadlines and so on. But I don't want to stare at my org-mode calendar, or
flip through ERC buffers all the time.



Instead, I'd like to have one little emacs frame (window) that gathers these
('events'), and transfers me to wherever the event came from when I click it - some
IRC-channel in ERC, my org-calendar etc. and other inputs. Note, using
Bitlbee, you can include Facebook-contacts, GoogleTalk-buddies and
Twitter-tweets, … in ERC - so, you can track just about anything.



In addition, with so many inputs, I'd also like the possibility to filter out unwanted
events, and generate various light/sound effects and fireworks, proportional
to the priority of the event.



For all this, I wrote a little emacs-tool called Sauron that does just
that. M-x sauron-start pops up a frame that receives events, and M-x sauron-stop hides it and stops listening. It works with ERC, org, and
listens for D-Bus messages; so it's pretty easy to get events from all over
the place.



It's a bit of a balancing act to get all the important information while not
being swamped in noise, but Sauron allows you to fine-tune it to whatever
works the best for you. I've tried to have sane defaults though, so things
should mostly work without too much configuration - but if you need the power,
it's there. I also added some convenience functions to make it easy to get
sounds and other special effects.






So - it's brand new, it is of seems-to-work-for-me-quality, and I'd like to
invite others to try it out, hack it, give feedback, add new back-ends and so
on – what better Christmas present to ask for!



There's documentation, examples etc. to be found in Sauron's github repository.




package management revisited

Ages ago we discussed ELPA, the emacs packaging system. It allows you to

browse through an online repository of emacs packages and install, uninstall

and upgrade them, all from within the emacs comfort zone (menu:

Options/Manage Emacs Packages).

Emacs 24.1 (a pretest is available) will include a version of ELPA --

package.el; the version included with emacs 24 supports multiple

archives. The official archive is the one provided by GNU, then there is

the current one for ELPA, but there's now a third one available: Marmalade.

Marmelade ('Spreadable Elisp') offers a very easy way for developers to

make their packages available to emacs users, and an even easier way for

users to test out interesting packages.

To use all available package repositories (GNU, ELPA and Marmalade), add

the following snippet to your .emacs:

(setq package-archives '(("ELPA" . "http://tromey.com/elpa/") 
("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")))

This works out-of-the-box for Emacs 24; for Emacs 23, you'll need the newer

package.el, which you can get from the emacs 24 repo (if necessary, remove

the old package.el first).

Currently, there are 870 packages listed in the three repositories – a lot of

toys to play with! In fact, it is already getting quite hard to find what

you're looking for; a bit more structured way (maybe using categories) would

be useful. Also, a bit more information than the one-line description would

be very useful.

Nevertheless, it's a great addition to emacs, which will make it much easier

to play with packages – without even having to read the installation

instructions.

interview with Eric Ludlam (CEDET)






One of the notable new features of emacs 23.2 was the inclusion of CEDET. CEDET adds IDE-type functionality to emacs, and one only needs to read
the responses to the 100th post to see the great interest in that.



The man behind CEDET is Eric Ludlam (EML), a long-time Emacs user and
developer. He kindly answered the many questions we had for him. Thanks, Eric!




djcb: Eric, could you tell us a little bit about yourself? And about
that fantastic hobby of yours, building href="http://en.wikipedia.org/wiki/Siege_engine">siege engines?



EML: I manage a software engineering team at the MathWorks. The MathWorks
are the creators of Matlab. In my spare time I maintain CEDET, the Matlab
support for Emacs, and build replicas of ancient siege engines.



I've been building catapults of various types for use at the World Championship Punkin' Chunk since 1998. My team started with a traction
trebuchet, then a HCW Trebuchet, then moved to Human Powered Centripetal, and
finally to the torsion division with MistaBallista. As far as I know, Mista
Ballista is the worlds largest farthest throwing currently functional
ballista.



Most recently, I got to help demolish a building where I work by shooting
stuff at it, which was a lot of fun.




djcb: How did you get involved with Emacs? Do you spend a lot of time
with it?



EML: I've been hacking Emacs since version 18.54 on Ultrix because the alternative
was vi. My first post (and thus contribution to Emacs) was to
gnu.emacs.sources on June 6, 1992. I've used Emacs to work on C/C++ code for
many years which inspired all the various parts of CEDET, but these days I
don't get much coding time.



My work with Emacs and CEDET is seasonal currently. The summers are usually
busy with family activities, and my falls are busy getting the catapult
ready, so CEDET work usually happens in the winter.




djcb: Can you tell us a bit about the background of CEDET?


EML: I started with some really basic editors and eventually with LSE (Language
Sensitive Editor) on VMS. LSE was pretty cool. When I switched OSes to
Ultrix and was forced to use Emacs, and discovered you could script it, I was
hooked. My first big Emacs hack was etalk, an implementation of Unix talk in
Emacs.



In one of the Emacs related newsgroups, a spoof story floated around about how
Emacs became sentient, and started writing code for Richard [Stallman] instead
of the other way around. Since then I've always wanted to get Emacs to start
writing my code for me. I wrote cparse.el, a regexp nightmare that could
parse almost any C file into a sequence of highly detailed tags. The tags
could be used to then generate code, and I had a cool comment writing utility,
automatic prototype generation, and some navigation features. On the whole it
failed for many reasons.



The concept, however, continued. CParse became the basic idea behind what is
now the Semantic package in CEDET, though none of the old stuff remains beyond
some echos in some SRecode utilities.



My end goal is to provide round-trip code management in Emacs. Emacs needs to
be able to read your code, allow you to perform transformations in the code in
an abstract way, and then write new code for you. Everything in CEDET is
building toward that goal. It is taking a long time, and you can see it
starting to take shape. Semantic can parse the code, COGRE can manipulate UML
diagrams representing your code, and you can export diagrams into code through
SRecode. Unfortunately this isn't a round-trip solution as the generated code
currently should not replace existing hand-written code.




Can you tell us a bit about the CEDET-project?


EML: I maintain CEDET and field questions on the mailing list. There are
several contributors who either own some tool in the "contrib" area, fix bugs,
answer questions or apply patches for new features. There has always been
someone to pick up the slack when I'm busy elsewhere, and I've greatly
appreciated that.



The easiest (and most common) way to contribute code to CEDET is to provide
support for some new language, or to create a language agnostic tool using the
CEDET APIs. As with Emacs, you need to be able to assign copyright to the FSF
to contribute to CEDET's core, but new language support or utilities can have
a home in the contrib area as well.




djcb: CEDET is part of Emacs since 23.2. Can you tell us a bit about how that
happened?



EML: I've been providing assignments for the parts of CEDET since 1996 or so.
For Emacs 23.1, CEDET was at a stable and useful enough state that Chong
Yidong was willing to do the work to integrate it into Emacs. My ability to
get a legal release for CEDET in time for Emacs 23.1 failed, so it went into
23.2 instead. It is my understanding that CEDET's smart completion engine
reached a performance and reliability point that made it desirable to have in
Emacs.



Emacs currently includes the parts of CEDET needed to make EDE, the project
management system, Semantic and it's user tools, and SRecode all work from a
user perspective. Emacs lacks the Semantic development environment, needed
for writing new language support, and COGRE, the UML diagram editing tool.




djcb: Are there plans to include those parts as well?


Yes. It is important for users with a stock Emacs to develop new languages
using the missing Semantic development tools. I don't know if COGRE will ever
go in, though I expect that this will be done via the new package management
system [elpa].




djcb: Did you ever try IDEs such as href="http://en.wikipedia.org/wiki/Eclipse_(software)">Eclipse? How do you
think CEDET stacks up against such programs?



EML: I have used Visual Studio more than Eclipse, and certainly watched demos
on how these and other tools work.



These tools win over CEDET's features in that they usually integrate directly
with the compiler, VM or whatever, and have very good completion engines and
UIs that you can interact with.



CEDET wins in that you don't need a compiler, or even code that can compile
for it to work and start providing useful completions. It can infer an awful
lot from a project.



CEDET's language support structure is thus simple in comparison, and CEDET
supports many more languages as a side effect. It also wins because it is in
Emacs, and I've done my best to try and match the "Emacs Way". For an Emacs
user, this is intuitive, but can appear quirky to outsiders.




djcb: What about other development tools for in emacs?


EML: There are a lot of language specific solutions like GCCSense, slime, JDEE, and
others out there. These projects are great in that they take a language, and
push it to the edge of what you can do, and the users generally love that
stuff. When someone wants to do the same thing, like when CSDE started for
C#, and it tried to copy JDEE, it was just that, a copy that didn't quite make
it.



It is my hope that CEDET will become the target of choice for users who want
to make their language support in Emacs the best. They will save a lot of
time doing so as well. The same infrastructure for integrating in external
tools can be used to get improved results out of CEDET, but CEDET will handle
converting that into a representation that would then allow any tool built on
CEDET to work. This is the same model that worked well for comint.el, and
gud.el.



Yasnippet is a bit different in the way it "competes" with SRecode. My first
implementation of SRecode tried recycling tempo templates, but I couldn't get
it to work. In fact all the template systems I investigated fell short of
what I was trying to do, so I had to roll my own, and ended up using a variant
of the Google template format.



The key difference is that the goal was for SRecode to provide a series of
base templates for code generation. A tool writer would then write some tool
to generate code. A user would then use the tool, and say "This is great, how
do I change where the { goes?"



The answer is to override the template with that detail in it without
interfering with the system templates. That only works if the templates are
sufficiently granular that the changed template can be simple. Template reuse
needs to be high so that if your company formats your methods as:





int mymethod() { implementme() };





instead of





int mymethod() {
}





that one template change will allow this to happen for all code generated from
every tool.



Thus, the audience for yasnippet and SRecode is quite different. Of course
you could do yasnippet like things with SRecode if someone took the time to
improve the field-editing feature in SRecode, but that has not been my focus.




djcb: Do you follow the overall Emacs development process? Are there
things you would like to see changed/improved?



EML: I watch the emacs-devel mailing list, mainly to see if anything
related to CEDET goes by that I can help with, or what the latest cool
feature might be. My first contribution of Speedbar to Emacs in Emacs 20
helped drive some features related to overlines, boxes, and other face
attributes that appeared in Emacs 21.



In the future, once CEDET and Emacs cross merge techniques are hashed out, I
would expect some key parts that need performance improvements might move into
C. Another part of CEDET that I'd love to see become bound closer to Emacs is
mode-local.el. It tries to simulate mode-local variables and mode-local
functions. This is critical in a complex system like CEDET that needs to
provide a language support author with fine grained control. There are good
reasons not to make what is currently implemented "the Emacs way", but it
would be nice to resolve those and enable mode authors a with a more powerful
way to customize the user experience.




djcb: Do you have specific plans for CEDET in the future?


EML: Here is the short list:




  • Improve Emacs/CEDET cross merging


  • Offload tag storage to an external process - needed for scalability


  • Design/define a "CEDET mode" as a way of simplifying the confusing array of
    distinct tools and modes that make up CEDET now.


  • Finish the smart-context menu project


  • Resolve the "code replacement" problem of parsing a block of code,
    transforming it, and re-creating that code in place reliably.





djcb: In addition to all these 'generic' improvements, are there
specific areas where new contributors could make a difference?



EML: Supporting new "stuff" in CEDET is one big win. Stuff can be:




  • New project types under EDE to ease transition from something like Visual
    Studio to Emacs.


  • Language support, such as parsers, or mode overrides. Finding ways to take
    existing cool tools, like JDE's beanshell, or slime's inferior lisp process
    and allowing it to do work for CEDET is another big win.


  • Templates for code generation in new languages.




Tool writing would also be good. JDEE's author Paul Kinnucan converted many
bits of JDEE to CEDET and co-designed many of CEDET's parts along the way,
such as semanticdb, and that was a huge help. ECB's current maintainer Klaus
has also had a big impact on the way concepts are abstracted to a tool that
depends on CEDET.



Naturally, joining the mailing list and fixing reported bugs and improving
the doc is also a huge help, but not as exciting as writing new code. :)




djcb: Finally, many people want to start using CEDET, but it seems they
have a bit of trouble to get started. Do you have any recommendations for
them?



EML: Start with the cedet.info file which has many of the common setup
configurations in it. If you run into something not explained well or at
all, be sure to join the mailing list and be specific about how that doc
failed. Very few questions on the mailing list refer to the doc, so the doc
is rarely improved in a way that can help others.



Another good starting point is Alex Ott's article A Gentle Introduction to CEDET, which is very helpful.




Thanks a lot for your time, Eric! Wishing you a lot of success with
CEDET and all your other projects!



emacs 23 has been released!








Emacs 23(.1) has been released! After only just over two years since the
previous version, emacs 23 has been released on July 29 2009. Time to
celebrate! And a big thanks all the talented hackers that made it possible!



Emacs 23 brings many new features. Some of those have been discussed before
in emacs-fu, and of course you can get the full list from the NEWS-file
(C-h n). This is just a list of some of the highlights, in particular the
end-user-visible ones. Let's go through them - of course I cannot mention all
of them, so feel free to add your favorite one in the comments.






fonts & anti-aliasing






Finally, emacs 23 brings support for anti-aliased fonts to X (Mac/Windows
users have had this for a while). If you're running emacs on X, this one
change is enough to never want to go back to an older version of Emacs
again.



The new font system mentioned in some posts before: setting fonts and emacs 23.







support for D-Bus and Zeroconf






You can now call other services on the desktop using the DBUS IPC system
(popular on X); using d-bus: an example shows how to communicate with the
Tomboy note taker program from emacs. As more and more desktop services
are accessible using D-BUS, this offers great opportunities for better
integrating emacs with the rest of the desktop. For example, one could
imagine that emacs could communicate with a network manager when it needs a
connection. Or it could show a desktop notification when an appointment is
near. And all without adding hard dependencies or calling external
binaries.



Using Zeroconf is also quite easy; for example, to get a list of all
zeroconf-support printers, you could do something silly like:






(require 'zeroconf)
(zeroconf-init)
(dolist (srv (zeroconf-list-services "_printer._tcp"))
(insert (format "\nprinter: %s" (nth 2 srv))))







to insert a list of the available printers in your current buffer. As with
D-Bus, it's really an enabler for a lot of cool things.








support for 'headless' emacs-daemon







If you have a lot of support packages, emacs startup can be a bit slow.
However, emacs 23 brings emacs --daemon, which enables you to start emacs
in the background (for example when you log in). You can instantly pop up
new emacs windows (frames) with emacsclient. Of course, you could already
have an emacs 'server' in older versions, but being able to start it in the
background makes this a much nicer solution.



The Emacs-daemon was discussed in emacs-fu in emacs –daemon and windows and daemons (for MS-Windows). Popping up new emacs windows is so fast that
you can use emacs for any editing job, for example as an editor for an email program, or for quick rememember notes.



You can even combine X and console clients in one session now.







Emacs now support Xembed






This enables you to embed emacs in other programs (on X) using
XEmbed. Haven't played with that yet. There is some more information in

EmacsWiki/Xembed.







Support for frame opacity






You can now make you emacs frames transparent. Discussed before in
transparent emacs. Not sure how useful this is, but it surely looks nice :)







Internationalization






Emacs's character set is a superset of Unicode, with about four times

the space available. That should be enough for the foreseeable
future… There are also many new character sets available, as well as new
language environments, such as Chinese-GB18030, Khmer, Bengali, Punjabi,
Gujarati, Oriya, Telugu, Sinhala, and TaiViet.



Note that, internally, emacs uses UTF-8 now.







New defaults







  • Screen motion now goes by screen lines by default, that is when you
    move the cursor up or down, it follows the line as you see them. Nice.



  • Transient mark mode (visible selection) is now on by default, so no need
    for (transient-mark-mode t) in your .emacs anymore. However, you
    still need to put (delete-selection-mode t) if you like replace the
    current selection with your typing.




  • Also shift-select mode is enabled by default, so you can select with
    shift + the arrow keys.








New modes and packages, and updated ones








using the systems 'trash' when deleting files


A short tip today.



When you delete files and directories in Emacs 23 (say, with dired), instead
of losing the files until the end of times (or at least until the
singularity), you can move them to the 'trashcan', by whatever name that rose
comes in your system, 'Trash' or 'Recycle Bin'…



To enable this, put the following in your .emacs:

(setq delete-by-moving-to-trash t)


There is one problem - a bug? I am using Ubuntu 9.04, which follows the
Freedesktop Trash Spec; it moves delete file in ~/.local/share/Trash,
together with some metadata, so it can restore the file to their original
location. However, emacs follows some older convention, ie. to move the file
to ~/.Trash, and without any metadata.




You can partially fix this by making ~/.Trash a symlink to
~/.local/share/Trash/files/, but of course that does not get you the
metadata.

transparent emacs

It may not be so useful, but emacs23 allows you to manipulate the transparency of your emacs frames (windows). If you use Windows or X with a compositing window manager on X, you can make your windows transparent. Examples of compositing window managers are Compiz/Beryl and even the good-old Metacity (gconftool-2 -s '/apps/metacity/general/compositing_manager' --type bool true).

The following code for your .emacs makes it easy to set transparency from within emacs:

(defun djcb-opacity-modify (&optional dec)
"modify the transparency of the emacs frame; if DEC is t,
decrease the transparency, otherwise increase it in 10%-steps"

(let* ((alpha-or-nil (frame-parameter nil 'alpha)) ; nil before setting
(oldalpha (if alpha-or-nil alpha-or-nil 100))
(newalpha (if dec (- oldalpha 10) (+ oldalpha 10))))
(when (and (>= newalpha frame-alpha-lower-limit) (<= newalpha 100))
(modify-frame-parameters nil (list (cons 'alpha newalpha))))))

;; C-8 will increase opacity (== decrease transparency)
;; C-9 will decrease opacity (== increase transparency
;; C-0 will returns the state to normal
(global-set-key (kbd "C-8") '(lambda()(interactive)(djcb-opacity-modify)))
(global-set-key (kbd "C-9") '(lambda()(interactive)(djcb-opacity-modify t)))
(global-set-key (kbd "C-0") '(lambda()(interactive)
(modify-frame-parameters nil `((alpha . 100)))))

Now, you can make make emacs more transparent (less opaque) by pressing C-9, while C-8 has the opposite effect. C-0 brings us back to normality.

Admittedly, window transparency is a classical solution-looking-for-a-problem. But let that not stop us from using it -- now we can watch full-screen movies while still using emacs. That, my friends, is progress.

emacs --daemon

Emacs23 has gone in pre-test. As I mentioned before, there are a lot of improvements, and there's little reason not to migrate to this new version. YMMV, of course. As always, you can see all the news with C-h n (Ctrl-H and then n) -- but obviously you need emacs 23 to see the news for emacs 23.

There's even an easter egg, as Giorgos Keramidas notes: M-x butterfly, inspired by xkcd...

A more useful new feature that I'll discuss here, is emacs --daemon. Since many versions, you can set up emacs as an emacs-server. The idea is that you start one emacs instance (the 'server'), and you can then use emacsclient to quickly pop up a new emacs-frame (window). This new frame is not a new emacs instance, it's just a new frame (window) for the already-running emacs. The nice thing is that emacsclient is very quick - it doesn't need to parse all the startup packages or your 5000-line .emacs. You could activate it by putting (server-start) in your .emacs, or calling M-x server-start. I've been happily using that for years with mutt.

Those were happy years. Still, things could be better. Emacs-client/server had its limitations: first, an emacs could have graphical or console (tty) clients, but not both at the same time. Second, you always needed to start emacs in the foreground before you could use emacslient.

Both of these limitations have gone now -- hurray! You simply start emacs as:

 $ emacs --daemon
and it starts running in the background. After that, you can start emacs client frames (windows) using:
 $ emacsclient -c
. This will give you a graphical version when running X, or a terminal (console) version otherwise. If you want a terminal version even in windows-mode, use:
 $ emacsclient -t
. If you don't want the controlling terminal to wait for the emacsclient to finish, you can add the -n argument, so:
 $ emacsclient -c -n
and you can even specify an alternate editor if emacs is not yet running, so:

$ emacsclient -c -a nano # if all else fails...

Of course, you can also start emacs itself as the 'alternate'.

Now, my new way to run emacs is a follows:


  1. I start emacs in the background (as daemon) when logging into X; this can be done automatically by adding to make emacs --daemon to your list of startup-programs. In GNOME, this can be set through the Preferences/Sessions/Startup Programs-menu. I am sure other environments have something similar. Alternatively, you could put emacs --daemon & in ~/.xinitrc.
  2. I fire up emacs frames (windows) with emacsclient -c (or emacsclient -t to run it in a console);
  3. That's it!

If you want to terminate emacs outside emacs, you'll have to kill it by hand (AFAIK) -- something like
 $ pkill -TERM -u $USER emacs
Make sure you have no unsaved data, and no other emacsen running...

You also might want to set some influential environment variables in your .~/.bashrc, ~/.zshenv, ..., so other programs will automatically use an emacsclient when available; e.g.,


EDITOR="emacsclient -c"
VISUAL="emacsclient -c"

With emacs --daemon there's no longer any need to use vi for quick-editing some file. In other words: alias vi="emacsclient -c"...

using d-bus: an example


In the previous entry, I mentioned Emacs version 23. This time, let's see what we can do with one of its new features: D-Bus-support. As you might know, D-Bus is an IPC system used on Linux/Unix to communicate between applications; it's a kind-of successor to systems like Bonobo (Gnome) and KParts (KDE). With support for D-Bus in Emacs, it's easy to control other applications. More and more programs are providing D-Bus interfaces.

As a semi-useful example of that, let's look at using D-Bus to control the Tomboy Note Taker application. Tomboy takes a novel approach (at least for me) at note taking -- your notes are connected like a wiki. Tomboy was originally designed and written by Alex Graveley, who has a talent for coming up with interesting ideas, and then turning them into software. Anyhow, I only use Tomboy as example of the use of D-Bus from emacs; there are many other interesting programs controllable through D-Bus.

Note, I won't discuss the details of D-Bus itself here; there's a lot of good material available already. Specifically, for some more background on using D-Bus with emacs, I can recommend the documentation (info-page) that comes with Emacs-23.

Back to Tomboy. First, let's make it easy to call Tomboy. It obviously assumes you have Tomboy installed, but it does not have to be running. First, a helper function that uses the new dbus-call-method-function, sets the service, path and interface names for Tomboy; this way, we don't have to specify them for each call:

(require 'dbus)
(defun djcb-call-tomboy (method &rest args)
"call the tomboy method METHOD with ARGS over dbus"
(apply 'dbus-call-method
:session ; use the session (not system) bus
"org.gnome.Tomboy" ; service name
"/org/gnome/Tomboy/RemoteControl" ; path name
"org.gnome.Tomboy.RemoteControl" ; interface name
method args))

Then, djcb-tomboy-create-note-region creates a new note from the region (selection) use CreateNamedNote and SetNoteContents; it even does some rudimentary error checking:

(defun djcb-tomboy-create-note-region (b e name)
"Create a new note with in the Tomboy notetaker from region"
(interactive "r\nsName for new Tomboy note:")
(let ((note-uri (djcb-call-tomboy "CreateNamedNote" name)))
(if (and note-uri (> (length note-uri) 0))
(djcb-call-tomboy "SetNoteContents" note-uri
(concat name "\n" (buffer-substring b e)))
(message "hmmm... it did not work. maybe try a different name"))))

With djcb-tomboy-insert-note-contents we can insert the contents of some tomboy note into the current buffer, using FindNote/GetNoteContents There's auto-completion available for the name of the note, using ListAllNotes:
(defun djcb-tomboy-insert-note-contents (name)
"Insert Tomboy note with NAME"
(interactive
(list (let ((lst))
(dolist (uri (djcb-call-tomboy "ListAllNotes"))
(add-to-list 'lst (djcb-call-tomboy "GetNoteTitle" uri)))
(completing-read "Name of Tomboy Note:" lst))))
(let ((note-uri (djcb-call-tomboy "FindNote" name)))
(when note-uri
(insert (djcb-call-tomboy "GetNoteContents" note-uri)))))

So, easy enough to do, even for an Elisp novice like myself. Again, this is more to show the use of dbus from emacs than about Tomboy itself -- but it is somewhat useful. I'm actually not using Tomboy so much anymore - org-mode better fits my emacs-centric workflow. But Tomboy has some very interesting plugins which might be nice for org-mode as well.

As I said before, Tomboy is only an example here -- there are many other D-Bus services available ('dbus-list-activatable-names') And D-Bus services are introspectable - you can search through them, and retrieve information about the interfaces they provide, as well as the methods and signatures. Again, the Emacs D-Bus infopages are quite useful.

emacs 23

As per January 2009, the current stable version of GNU/Emacs is 22. However, there is a development version 23 available from CVS. The development version should become the next stable version in the not-too-distant future. I've been using emacs 23 for more than one year now, and have found it very reliable.

I'll be discussing some of the Emacs 23 specific tricks in some future entries, here I will discuss a small number of visible ones. This does not even scratch the surface of what is new - it's just a little taster.

One of the biggest, user-visible changes in Emacs 23 is the support for anti-aliased fonts on X11. This means that the fonts will look much smoother -- and as noted, users feel more effective when using pretty technology. In this case, some pictures are probably in order; the two screenshots show emacs-22 versus emacs-23, using default settings. The difference is striking, to say the least.







Emacs also supports variable-width fonts, so you could use any TrueType (and some other) font. However, I prefer to use a fixed-width font; a nice one is the Inconsolata font (ttf-inconsolata in Ubuntu/Debian, inconsolata-fonts in Fedora).

Another interesting new feature is DBUS-support; D-Bus is an IPC system used on Linux/Unix to communicate between applications. Using D-Bus, Emacs now even has support for querying the network for ZeroConf-devices when you are using Avahi; for example, insert a list of all printers in the local network into the current buffer, you could do something like:

(require 'zeroconf)
(zeroconf-init)
(dolist (srv (zeroconf-list-services "_printer._tcp"))
(insert (format "\nprinter: %s" (nth 2 srv))))

Of course, this is not so useful. But being able to use Zeroconf (and D-Bus) easily from within emacs enables all kinds of interesting hacks... to be continued.

A maybe-useful graphical gimmick is that you can now change the 'opacity' (non-transparency) of your emacs frame (window) if you're on MS-Windows, or on some X with compositing enabled (Compiz, metacity-with-compositing, ...).

(modify-frame-parameters (selected-frame) 
`((alpha . 90)))

will make your frame (window) 90% opaque (ie., 10% transparant).

If you're very conservative, you should of course wait for the official release of the new emacs. If you are a bit more adventurous, I can definitely recommend it. I have not come across any bugs. Of course, your mileage may vary.

The easiest way to get emacs 23 is to get some prebuilt packages;


  • For Windows, Ian Eure's MacOS-packages (haven't tested those);
  • For Debian, you can get emacs-snapshot-packages from orebokech, which are update weekly;
  • For Ubuntu, there are emacs-snapshot-packages from Ubuntu-Elisp

I guess there must be similar packages for Fedora/Suse/... but I could only find some older packages from EmacsCvsAndFedora. That says more about my searching skill than anything else, I guess... You can however also compile the new emacs yourself; it's not too difficult and there are some instructions in EmacsWiki, but note that the page is partly outdated.

Final note: if you have to have some emacs-23 specific code in your .emacs, but you also need emacs-22, you can use some like:

(when (>= emacs-major-version 23)
;; do something only in emacs 23
)

Followers

Popular Posts