Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to work around a known bug in Ubuntu 9.10, where using the scrollbar in emacs causes text to be highlighted, and the cursor to move. This page here shows that you can fix this by setting an environment variable before launching emacs:

$ GDK_NATIVE_WINDOWS=1 emacs

So a lazy fix would be to alias "emacs" in my .bashrc:

alias emacs="GDK_NATIVE_WINDOWS=1 emacs"

This, however, has the drawback of setting this environment variable for all subsequent commands run from that shell. Is there any way to set GDK_NATIVE_WINDOWS=1 for just emacs, whenever I run emacs?

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

Use the env command:

env GDK_NATIVE_WINDOWS=1 emacs

and you can alias this as before:

alias emacs="env GDK_NATIVE_WINDOWS=1 emacs"
share|improve this answer
add comment

What you need to do is to clear the variable once emacs started. I am not sure how you can do this, however I am pretty sure it can be done.

share|improve this answer
    
So something like: alias emacs = "tmp=${GDK_NATIVE_WINDOWS} GDK_NATIVE_WINDOWS=1 emacs& GDK_NATIVE_WINDOWS=${tmp}" ? –  SuperElectric Jan 29 '11 at 20:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.