Emacs 24.5.1 update issue on Windows 7

After updating Emacs to 24.5.1 (from 23.2) on my Windows 7 machine, I found that Emacs wouldn’t startup properly and would just display a white/blank screen and appear to hang. When running it from the command line, I was seeing a couple of lines of errors indicating a problem with GTK on startup:

GLib-GObject-CRITICAL **: gtype.c:2720: You forgot to call g_type_init()
GLib-CRITICAL **: g_once_init_leave: assertion `result != 0′ failed

This reminded me that I had installed GTK+ 3.0 recently prior to my update and thought perhaps this was some interaction with the new GTK installation. Rather than uninstall GTK, I opted to remove the path to the GTK bin from my Windows 7 PATH environment variable. Once I did that and then tried to run Emacs, it worked properly. Not sure what the weird interaction was about — perhaps the wrong GTK DLL was being loaded up?

Share

Emacs, Cygwin, cvs, etc. on Windows 7

When using Emacs 24.3.1 on Windows 7, I found that cygwin-mount.el would not work (it gave a bogus error of being unable to locate mount.exe) or using version control (cvs) within Emacs would fail with “Permission Denied”. Turns out the problem was Windows UAC (User Access Control). By changing the properties on runemacs.exe to “Run as administrator”, I was able to fix this issue.

Share

PuTTY, Linux Terminal, Xterm, Emacs, 256 Colors

The title says it all. This is some documentation to track how to get colors right when using PuTTY from Windows to SSH into a Linux server and then use Emacs in text-mode and edit php or other programming language files in syntax highlighted color.

In PuTTY, first make the following change (away from the default) — On the left-hand side configuration Category tree, select the Data sub-node from the Connection node. In there change, the “Terminal-type string” to “xterm-256color

Once you connect and login to the Linux server, do “echo $TERM” and you should see “xterm-256color” as a result. This allows the terminal emulation to support an xterm-type terminal with 256 colors. Once logged in, if you run “tput colors“, you should see “256” as the result of running this command.

Then run EmacsEmacs will run in text-mode. Within Emacs, run the command ‘list-colors-display‘. This should display 256 colors.

After this, you need to load up the appropriate major mode for the language you are going to be working on to get proper syntax coloring for that language (if you don’t use a suitable mode, you might get some syntax color, but not all the syntax coloring that will be supported in a full-fledged mode that is designed to support the language of your choice).

Share

Creating and Using Keyboard Macros (Record Macro, Play Macro) to Record and Playback Keystrokes in Emacs

  • Use C-x ( to start the macro (start recording keystrokes)
  • …Perform whatever keyboard actions…
  • Use C-x ) to stop the macro (stop recording keystrokes)
  • Playback the recorded macro anytime using C-x e

You can also assign different hot-keys for convenience:

(global-set-key [f1] 'start-kbd-macro)
(global-set-key [f2] 'end-kbd-macro)
(global-set-key [f3] 'call-last-kbd-macro)

Check out the KeyboardMacros Emacs Wiki page for more in-depth info on Emacs Keyboard Macros.

Share

Changing Emacs Font Settings

Use this simple method to choose fonts, font styles and font colors under Emacs for Windows: Click the first mouse button with the Shift key pressed. Doing so brings up the Windows font chooser dialog. The dialog only brings up fixed-width fonts — perfect for programming. Choose and set the font settings you want. The change only affects the current session.

Share