Posts Tagged ‘ Emacs ’
The default text in the GLText screensaver in Ubuntu is “Host-Name, Kernel Version”. To change this, go to the screensaver folder in the terminal, and copy the gltext.desktop file to your home directory. Open gltext.desktop for editing (using emacs, for example), and change the line that reads:
Exec=gltext -root
to
Exec=gltext -root -front -text 'whatever text you like'
Might need to change permissions. I just ran chmod 777 and that did the trick.
This worked for me using Ubuntu 10.04 (Lucid Lynx).
I tend to do everything I possibly can on Linux, but once in a while, I need to figure it out on Windows (*cringe). For example, today I am going to install Emacs on Windows. I quite literally have no clue how to do this, but a quick Google search turned up this page, which describes it in painful detail.
Here I am, sitting indoors during a snowstorm, blundering my way through my raytracing script. Ah, Snell’s law and optics. What fun! Anyhow, I realized that it was the perfect opportunity to practice some LaTeX skills. I’ll be able to describe the theory of what I’m doing in my script. Not that it’s anything complicated, but it’s enough for me to be able to practice some TeX-style math notation. Sweet.
Here’s what I’ve got so far, using Emacs. Easy! No math yet though.
\documentclass[12pt]{article}
\title{Raytrace script – how it works}
\author{M. Weirathmueller}
\date{1 January 2010}
\begin{document}
\maketitle
\section{Indroduction}
This document is meant to accompany the my raytrace.py script, in an attempt to describe the theory behind what it’s doing.
The main idea is to read two sound speed profiles, and to compare depths computed by a multibeam echosounder for these profiles.
\section{theory}
\end{document}
(incidentally – I just discovered that WordPress source code posting supports LaTeX – fun!)
It was also the first time I’d ever compiled a LaTeX file from the command line. I know, I know, it’s no big deal. But it was new for me!
Created my PDF like this:
pdflatex raytrace.tex
Then looked at it in my PDF viewer like this:
gnome-open raytrace.pdf
gnome-open just opens the file with the default program for that extension. Also – I added an alias to my .bashrc file so that just typing “g file.pdf” works like “gnome-open file.pdf”.
Whenever I start emacs from the command line, I get the following error:
(emacs:16341): GLib-WARNING **: g_set_prgname() called multiple times
I can’t figure out what is causing it. I did some google searching, and get the impression that it might be a bug. But if it turns out that I’ve just messed something up, I’d like to know about it so I can fix it! It doesn’t seem to cause any problems, but it’s sort of annoying.
Fun times on Christmas vacation! What better time to get my Emacs environment working the way I want it? I’m going too try to keep it really simple this time. I’m going to get Rope, Pymacs, and Ropemacs to start with, and maybe these will be all I need for now.
First, I create a .emacs file in my home directory. I will fill it in as I go, and will include the final version when it’s complete. All that’s in it now is a line that says: (add-to-list 'load-path "~.emacs.d/"). Also create a directory called .emacs.d. I had both of these things before, but deleted them and am starting from scratch because I had issues that I couldn’t solve.
1. Rope: downloaded from Sourceforge repository (Rope version 0.9.2). From terminal, ran setup.py with build, then install options. (for help, run setup.py –help-commands)
2. Pymacs: downloaded from Pymacs archives (Pymacs version 23). From terminal, ran the setup.py file with the build and install options again. I just put my .emacs.d/ directory in my emacs load-path (above), and then put the pymacs.el file in there. The Pymacs website suggests byte compiling for speed, which isn’t too complicated: just open emacs, type M-x byte-compile-file RETpymacs.el RET.
3. Ropemacs: Last time I did this, I used the source repository on Bitbucket, but this time I just downloaded from the Sourceforge site (same as Rope, just scroll down). I installed the same way as for Rope and Pymacs using the setup.py script.
Final .emacs file:
(add-to-list 'load-path "~.emacs.d/") (autoload 'pymacs-apply "pymacs") (autoload 'pymacs-call "pymacs") (autoload 'pymacs-eval "pymacs" nil t) (autoload 'pymacs-exec "pymacs" nil t) (autoload 'pymacs-load "pymacs" nil t) (require 'pymacs) (pymacs-load "ropemacs" "rope-")
And that’s it for now…Hopefully this will work for me. Maybe I’ll add Yasnippets eventually, but I don’t think I really have a need for that yet.
I have been messing with some old Python files that I wrote ages ago (a couple of which were mentioned in a post a couple of days ago about ray tracing) – of course I was using Emacs. I’ve been getting this error since I configured Emacs for Python using the .emacs file in my home directory. Every time I open Emacs, I get a buffer telling me that it can’t load the Yasnippets_bundle.el file. I have no idea why. I went back to this website and tried to figure out where I’d gone wrong, but I think I’m going to have to just scrap my .emacs file (but save it, of course!) and start from scratch. There’s a whole slew of code in my .emacs file that I copied from someone else on the web. I certainly don’t understand it all, so it’s really no wonder that I can’t figure out why it’s not working!
Some websites that might help me out:
I guess I’m overlapping somewhat with an earlier post, but I figured it can’t hurt to have things listed twice…Anyway, I hadn’t listed the Emacs Python Wiki before, and I think it looks helpful.
Note: I had also forgotten to type Alt+x eval-buffer - I guess this must mean evaluating the buffer, but I don’t know why I need to run this. I should probably figure that out. I did try typing it as the Yasnippets instructions indicate, but it didn’t make the error message go away.
Good news: trying to solve the Yasnippets problem I had a chance to practice some Emacs and Bash commands – searching, moving around in a file, switching between buffers, etc…
Bad news: there is a Yasnippets problem.
Conclusion: Fixing my Emacs/Python issues is on my list.
Hey – I found this handy Emacs cheatsheet (PDF – (c) 1998 Free Software Foundation, Inc., designed by Stephen Gildea) – I remember having this pinned up to my cube wall in grad school. Unfortunately, I didn’t use it much. Maybe it’ll stick this time!
The issue is now resolved, but I thought I’d better make a note of it in case I accidentally do the same thing in 6 months… I created a .emacs file in my home directory that is used to configure emacs (in my case, for Python). I accidentally told it to “(require ‘yasnippet)” when I should have specified “(require ‘yasnippet_bundle)”, since that’s the one I’m using.
How do I actually take advantage of Emacs as a Python IDE? A quick google search turned up this: Enigma Curry blog post. This post is somewhat beyond me, and makes me a bit scared to try to configure my Emacs to to work with Python. But I now feel like doing anything else would be wimpy. I guess there’s also IDLE, which provides a GUI for Python development – and it’s a standard part of the Python system. But Emacs is cooler, right?
It turns out that if I want to customize Emacs for Python, I’m going to have to find and edit a file called .emacs. It says that this file should be in the $home_directory, along with a directory called .emacs.d. I found the .emacs.d directory, but not the .emacs file. I am missing something obvious, still unsure what I’m doing wrong.
Okay, I just created a .emacs file from one I found online – and I now have a working .emacs file. The one I’ve got right now has a black background and a different font. Now to make it do Python stuff. I’m following a tutorial that can be found here (Setup Perfect Python Environment – Sunshine and Rain of a Developer). I’m starting off by downloading several packages: python-mode.el , pymacs0.24 , auto-complete.el, yasnippet.el, rope and ropemacs.
Later the same night… I have finally got my very first emacs configuration file. Here it is (.emacs):
(add-to-list 'load-path "~/.emacs.d/") (add-to-list 'load-path "~/.emacs.d/plugins") (require 'auto-complete) (global-auto-complete-mode t) (require 'yasnippet-bundle) (load-library "init_python")
I had to do the whole thing twice too, because I messed up somewhere along the way, and nothing was working at all. But honestly, I don’t fully know what all this is going to do for me in the end. Hopefully make my life easier!
Oh, one more note – I had to install Pymacs along the way. At least, I had a problem, thought installing Pymacs would fix it, installed Pymacs, and it may or may not have fixed the original problem.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Aug | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||