Archive

Posts Tagged ‘emacs’

Rails and Emacs: Rsense and Auto-Complete

2011/07/17 Comments off

If you’re developing Rails with Emacs and using Rinari here are two more extensions you might like:

http://cx4a.org/software/auto-complete/

and

http://cx4a.org/software/rsense/

Installation. Just  as described. Code completion for ruby-on-rails with emacs!

And the package is written in Java(!), Very cool!

I am impressed!

Advertisements

Emacs: murrine_style_draw_box: assertion `height >= -1′ failed

2010/11/02 Comments off

This nasty bug has been around for over a year: Calling Emacs on Ubuntu from the console outputs

murrine_style_draw_box: assertion `height >= -1′ failed

after every action within Emacs.

The solution is simple, but has not been integrated in the Ubuntu repository yet.

Here it is:

In the file

/usr/share/themes/Ambiance/gtk-2.0/gtkrc

change

GtkRange::trough-under-steppers = 0

to

GtkRange::trough-under-steppers = 1

For details see Bug #538541Bug #550532 and Resolving “murrine_style_draw_box: assertion `height >= -1′”

Categories: IT, linux, Uncategorized Tags: , , ,

Using a different minor-mode-prefix with Rinari (Emacs Rails)

2010/04/27 Comments off

Rinari is a Ruby on Rails Minor Mode for GNU/Emacs.

Problem: Most key mappings / keyboard shortcuts rely on the hard coded strings “;” and “‘” (I.e. “C-; f c” -> rinari-find-controller). These prefixes are difficult to access on a German keyboard because they require the shift modifier.

Solution: The following code adds a comma to the list of rinari-prefix strings. Add it to your GNU/Emacs configuration file (i.e. ~/.emacs):

(add-to-list 'load-path "~/your-path-to-rinari-source-code/rinari")
;; This patch must appear before the line "(require 'rinari)"!
(defvar rinari-minor-mode-prefixes
(list ";" "'" ",") ;; CHANGE Added comma to prefix list
     "List of characters, each of which will be bound (with C-c) as a rinari-minor-mode keymap prefix.")

(require 'rinari)

Result: We can now access the command “rinari-find-controller” with the key sequence “C-c , f c”.

Side note: I’m all ears for more Emacs-Lispy solutions to this problem. 😉

Using basic Emacs keybindings in Gnome-Terminal

2010/01/15 4 comments

Summary: Use basic Emacs keyboard shortcuts (ie navigation) in Gnome-Terminal while using the Bash shell. This post is only interesting for people familiar with Emacs.

This is so simple that I almost afraid to post it…

…One of those things that has been bothering you for years(!), but was never urgent enough to invest time figuring out how to fix…

Problem:

You’re used to Emacs shortcuts. Bash (and many other shells) support Emacs keybindings out of the box. But your default terminal comes with a stupid menu bar. So you press M-d (Emacs’ “kill-word”; for non-Emacs users: this corresponds to the key sequence Alt-d) and end up calling the “File” menu entry of the Gnome-Terminal (File is called “Datei” in German, which is my LOCAL). If you your LOCAL settings are English, you will have the same problem with the Emacs shortcut M-f (in Emacs this is “word-forward”): The Gnome-Terminal will grap the key sequence and open the “File” menu.

Solution:

  1. Open your Gnome-Terminal
  2. Edit -> Keyboard shortcuts -> DISABLE ALL MENU ACCESS KEYS (If you have German settings the menu entry is called: “Bearbeiten -> Tastenkombinationen -> Alle Menükürzel aktivieren”. Disable the checkbox..)

That’s it.

Emacsclient usage on a GNU/Linux system

2009/10/23 3 comments

Short instructions on how to setup Emacs using the Emacs Server/Emacs Client system on a GNU/Linux machine.

This post is intended for people familiar with GNU/Emacs.

Requirements:

GNU/Emacs 23 or greater (for Ubuntu get the Emacs PPA: https://launchpad.net/~ubuntu-elisp/+archive/ppa)

Files to edit:

~/.emacs
~/.bashrc

System settings using Gnome:

System -> Einstellungen -> Startprogramme

For the impatient:

Add this to your ~/.bashrc:

export ALTERNATE_EDITOR=emacs EDITOR=emacsclient VISUAL=emacsclient
## you can always use the command "emacs" instead of "emacsclient -c"
alias emacs='emacsclient -c'

Add this to your ~/.emacs:

(server-start)

Add this to your system startup options:

/path/to/your/emacs --daemon

ie:

/usr/bin/emacs --daemon

Gnome panel starter:

/usr/bin/emacsclient -c'

Detailed instructions

Starting Emacs from scratch will always load your init file (default: ~/.emacs). Loading this file can take a few seconds if your init file has grown over the years and if you load many external libraries.

To decrease the load time for situations like this the GNU/Emacs folks have developed the GNU/Emacs daemon and the GNU/Emacs server-client concept.

This concept allows you to attach to an already running session. No matter if you are currently using X or  a TTY session!

Just try it (without changing any settings):

  1. Start GNU/Emacs from a shell under X:
    $ emacs
    
  2. Now start the Emacs server from within Emacs:
    M-x server-start
    
  3. Open a file from within Emacs (it does not have to exist):
    C-x C-f ~/deleteme.txt
    
  4. Because we started the Emacs server, we can now start the Emacs client with close-to-zero load time:
  5. Starting the Emacs client from a new shell:
    $ emacsclient deleteme-from-shell.txt
    

    This will open the file “deleteme-from-shell.txt” in your running Emacs session. Cool, isn’t it?

    IMPORTANT: To close the attached Emacs client without killing the Emacs server you have to use “C-x #” instead of “C-x C-c”!

  6. Starting the Emacs client from a new shell AND opening a new Emacs frame:Same as step 5, but use “-c”:
    $ emacsclient -c deleteme-from-shell.txt
    

    Again: Close the client using “C-x #”! This will close the frame (=window) while keeping the server running.

  7. Starting the Emacs client from a new shell AND opening it within the current shell:Same as step 5, but use “-t”:
    $ emacsclient -t deleteme-from-shell.txt
    

    This will also work for a true TTY session. An example of a true TTY session can be achieved by switching to TTY-0 (Ctrl+Alt+F1; to return to your graphical display: Ctrl+Alt+F7). Try it:

    Ctrl+Alt+F1

    Login with username and password, then type

    $ emacsclient -t deleteme-from-shell.txt
    

    We are still attached to the same session! Cool!

    Switch back to your graphical display: Ctrl+Alt+F7

  8. The only drawback so far is that we had to start the Emacs server manually from within an Emacs session using “M-x server-start”. Otherwise “emacsclient” will complain that it has no server to attach to. So let’s include this feature in our Emacs init file (~/.emacs). Add this to your init file:
    (server-start)
    
  9. The previous step still requires us to start Emacs before we can invoke emacsclient. Let’s tell our default shell (ie Bash) to use “emacsclient” as default. If that doesn’t work, our shell should use “emacs”. Add the following the your ~/.bashrc:
    export ALTERNATE_EDITOR=emacs EDITOR=emacsclient VISUAL=emacsclient
    
  10. I prefer to to only use a single command, “emacs”, and “the computer” should figure out
    IF an Emacs server is running (then I’ll use “emacsclient” to attach to a running Emacs server)

    OR if I have to start a new Emacs session (which, in turn, starts an Emacs server).

    ## you can always use the command "emacs" instead of "emacsclient -c"
    alias emacs='emacsclient -c'
    
  11. Sugar: To be sure to have an Emacs server running, we can add the Emacs daemon to our system startup options. How to add scripts to your startup options differs strongly between different Linux systems. Here’s how I did it (using Gnome):”System” -> “Einstellungen” -> “Startprogramme”(in English this should correspond to something like “System” -> “Settings” -> “Start programs”)I added a new entry with the following content:
    /path/to/your/emacs --daemon
    

    ie:

    /usr/bin/emacs --daemon
    
  12. Further sugar: To use a Gnome panel starter, just add this program parameter to the starter properties:
    /usr/bin/emacsclient -c
    

From 8.04 LTS to Jaunty Jackalone (Ubuntu 9.04): Software

2009/04/28 4 comments

The upgrade from the Ubuntu 8.04 LTS version to 9.04 (codename “Jaunty Jackalone” = JJ) was very smooth. It did NOT screw up the X-Server, SMB, Cups, NFS, SSH, USB, etc.  For me it was about a 3GB download.

The first thing I noticed was that a nasty gdm-login-screen-resolution bug was fixed by upgrading from 8.04 to 8.10.

Since each upgrade changes the default version of ones most used/favorite software, I will list those products I was concerned about most:

Sun Java (http://java.sun.com/)

  • OK: JJ comes with the current Java JRE and SDK version (1.6_13)

Eclipse (http://www.eclipse.org/)

  • Out-of-date: JJ comes with version 3.2 (2 years old). The current version is 3.4 (Ganymede). But since you can run Eclipse directly without compiling, this is no big deal.

GNU Emacs (http://www.gnu.org/software/emacs/)

  • GNU Emacs snapshot (=bleeding edge/developer version): OK: installing emacs-snapshot-gtk gives a current developer version  (build from 2009-04-05)
  • Emacs stable: Out-of-date: The current Emacs version is 22.3. JJ has Emacs version 22.2, although Emacs 22.3 was released 2008/09.

AUCTeX (http://www.gnu.org/software/auctex/)

  • Out-of-date: JJ comes with AUCTeX version 11.84. Version 11.85 was released 2008/02. I’ll have to install this manually.

R (http://www.r-project.org/)

  • OK: JJ has 2.9.0. The current version is 2.9.0.

TexLive (http://www.tug.org/texlive/)

  • Out-of-date: JJ comes with texlive-2007… Just download the current texlive-2008 from the texlive homepage and install it beside the Ubuntu texlive version.

Skype-Plugin for Pidgin’s Instant Messenger

  • I’ve already written a blog on some of the nice Pidgin features. After upgrading to JJ and seeing that Pidgin is used for internal messaging within Ubuntu, I am even more convinced that this is currently THE multi-protocol multi-plattform instant messenger to go with. Get the skype-plugin from http://eion.robbmob.com/ and install the Debian/Ubuntu skype4pidgin.deb file by executing “sudo dpkg -i skype4pidgin.deb”

GTKtalog (http://www.nongnu.org/gtktalog/)

  • Not present in JJ’s repositories. I’m very sad about this, because to my knowledge this is the only software for managing a CD/DVD collection which does not require a database. Although its user interface (Tck/Tk) is not-so-stylish-up-to-date, it has many features which I have grown accostumed to and which are lacking even in current high-end Disk-Manager programs.