100th post


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






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






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.



cleaning up the mode-line

Emacs' version on a status-bar is called the mode-line, and contains all
kind of information – the current buffer name, the cursor position and a
lot of other things, depending on what major and minor modes are active.




Customizing the mode-line is, unfortunately, rather hard. One day, I'll
write something about that… but for now at least we may be able to improve
things a little bit, by reducing mode line pollution. Mode line pollution?
Well, many parts of emacs like to announce their presence and state in the
mode line. With the limited space available there, this can become a bit of
an issue, the (Lisp Interaction company Yas abbrev) takes quite some
space:








But there are some ways to limit the space taken by modes and
minor-modes. Note, these snippets should go in your .emacs, and you need to restart emacs to make them active.



First, the minor modes (note, you can see the currently activated
ones with C-h m); install the handy diminish.el (or get it using the emacs-goodies-el package when using Debian/Ubuntu) and add something like the following:


(when (require 'diminish nil 'noerror)
(eval-after-load "company"
'(diminish 'company-mode "Cmp"))
(eval-after-load "abbrev"
'(diminish 'abbrev-mode "Ab"))
(eval-after-load "yasnippet"
'(diminish 'yas/minor-mode "Y")))



And the major-modes, for example for Emacs Lisp mode:


(add-hook 'emacs-lisp-mode-hook 
(lambda()
(setq mode-name "el"))) 

This looks a bit shorter:






You can of course set these names to whatever is obvious to you.

Followers

Popular Posts