May 29th, 2007 by Ryan McGeary · 1 Comment
Ever wonder how people keep such organized ChangeLog files in the root of their source trees? I’m sure some are just anal enough to manually manage them. I know I’ve done so on smaller projects, but I find it too much of a hassle for anything larger.
So, what do people use on larger projects? Believe it or not, there are actually GNU conventions for styling these files, and emacs includes an
add-log package to help adhere to these conventions.
C-x 4 a) automatically adds a new entry to the closest change log file found up the parent directory hierarchy. If none exists, a new change log file is created in your current directory, and the formatting is organized for you:
C-x v a) finds the change log file and add entries from the recent version control logs. Apparently, this only works with RCS or CVS. For subversion, you can try
vc-comment-to-change-log (Emacs 21) or
log-edit-comment-to-change-log (Emacs 22), but this might require some customization to suit you.
To change the email address listed in your change log entries, edit the
user-mail-address variable. To change the default change log file name, edit the
(setq user-mail-address "email@example.com") ;; default: user@host
(setq change-log-default-name "CHANGELOG") ;; default: ChangeLog
Some might say that keeping a ChangeLog file is defeated by public subversion repositories. I tend to agree for most circumstances, but there are some cases where a local, easily readable ChangeLog file is a good idea. Besides, it’s the cool thing to do.
The emacs manual has more information on change logs.
Tags:quick · tips
May 22nd, 2007 by Rob Christie · No Comments
compilation-mode has a nice feature so that you can skip over your info and warning level messages and jump right to those nasty errors. Set the variable
2 so that
M-p will jump to the next or previous error respectively. The other possible settings for this variable are:
2 — skip anything less than error
1 — skip anything less than warning, or
0 — don’t skip any messages.
Note that all messages not positively identified as warning or info are considered errors.
Tags:java · quick · tips
May 17th, 2007 by Rob Christie · 7 Comments
If you interact with a Subversion version controlled repository and you use emacs, then you are probably already using this package. However, I use this package every day, and if someone was just starting to use emacs, this would be on my short list of packages that must be installed.
psvn mode is similar to pcl-cvs for the Concurrent Version System (CVS). It is a frontend to the subversion client (svn).
M-x svn-status will prompt you for the location of your working directory (or subdirectory). Once it is entered a new buffer, *svn-status* , will open up with a status of all files within that directory and any subdirectories. It essentially runs
svn status -v. This view of your working copy of the repository shows the status of the files. You have the option of hiding unchanged files with the command
_. You can mark multiple files to be committed, and then commit them with the command
c which will in turn bring up an edit window where you can write the comment associated with your commit. Additionally, there are commands for diffing files, editing properties, and just about every other interaction you have with subversion. Be sure to check the following options:
svn-status-verbose – Setting this to nil will make
M-x svn-status run without the -v option at the command line.
svn-status-hide-unmodified – Setting this automatically performs the toggle that you can do with
_ when in the *svn-status* buffer, so that you only see files with a status that has changed in your working directory.
The package and its commands become an extension of the way you work with your files within emacs. It’s one of my favorites because it doesn’t get in the way of your normal process.
Tags:faves · newbie · reviews
May 10th, 2007 by Ryan McGeary · 2 Comments
This might be old news to some, but it was new to me.
XKeymacs is a keyboard utility to realize emacs-like usability on all windows applications. With XKeymacs you can use emacs keybindings with any windows application. You can create a keyboard macro and assign any shortcut key too. You also get bash-like command completion in your DOS shell.
This may very well void the need for Emacs Keybindings in MS Word.
I only played with it briefly as I’m no longer Windows-bound, but my initial impressions were good. Here is a more comprehensive review of XKeymacs.
Once you install it, the bindings are global – they work in Windows Explorer, Microsoft Word, Excel, in text-boxes and combo-boxes – everywhere. As for applications that provide their own readline bindings (such as Gnu Emacs on Windows), you must setup key-binding exceptions…
Tags:misc · reviews · windows
May 4th, 2007 by Rob Christie · No Comments
I just ran across this article. The Church of Emacs is a good read… no it’s not from alt.religion.emacs. The article is more of a history of emacs with some great references as well.
Tags:misc · news
April 30th, 2007 by Ryan McGeary · 8 Comments
I despise the fact that we live in a world with different end-of-line file formats. Windows/DOS uses CRLF, Unix uses LF, and Mac’s used to use CR. Thankfully, Mac’s started to adopt the Unix format when OS X was released — if only Windows could do the same.
What I despise even more is that some editors seem to be incapable of determining the difference between a DOS and Unix file. There’s nothing worse than finding a once, perfect Unix file corrupted by a small section of lines with CRLFs while the rest of the file keeps only LFs. Most of the time, the blame can be placed on one’s editor configuration, but I also blame some editor defaults for not at least maintaining the format that the file was opened in. To be fair, most power-editors like emacs, vim, TextMate, etc behave “correctly” by default and keep the format that the file was opened in, but many others (unnamed) do not.
There’s not a whole lot we can do to avoid these problems without hounding our peers, but there are ways to fix these problems after they’re found.
Let’s fix the nastier problem first. When you find a file corrupted with half LFs and half CRLFs, strip out the ^M (CR) characters with a quick search and replace. Run
query-replace) and substitute
C-q C-m with nothing.
quoted-insert and is useful for inserting control characters (e.g. ^M, entered as
C-m). Afterwards hit the exclamation point (
!) to tell query-replace to replace all matches with no questions.
Other times, you will run into DOS formatted files and will just want to convert them to Unix format for consistency sake. To do this, open the buffer and run
C-x <RET> f then enter
undecided-unix when prompted for the new coding system. This runs
set-buffer-file-coding-system and the result is very similar to running
dos2unix myfile.txt at the command line.
Tags:osx · quick · tips · unix · windows
April 24th, 2007 by Rob Christie · 17 Comments
This is the start of a series on our favorite emacs packages. Some of these packages are part of emacs core, some aren’t (but we could argue should be). I use
iswitchb-mode at least a hundred times a day.
iswitchb is one of the features of emacs that I rave about whenever I try to explain why I am still using a 30-year old editor. From the package commentary:
As you type in a substring, the list of buffers currently matching the substring is displayed as you type. The list is ordered so that the most recent buffers visited come at the start of the list. The buffer at the start of the list will be the one visited when you press return. By typing more of the substring, the list is narrowed down so that gradually the buffer you want will be at the top of the list. Alternatively, you can use C-s and C-r to rotate buffer names in the list until the one you want is at the top of the list. Completion is also available so that you can see what is common to all of the matching buffers as you type.
The key stroke
C-x b brings up the iswitchb mini-buffer, and with a few key strokes the file you want is open. My normal mode of operation is to load the project I am working on into the emacs file name cache, and then use iswitchb to switch between the files. In order to use iswitchb in this manner you will need iswitchb-fc, and a means for populating the file name cache.
Some of the nice features of iswitchb include filtering out buffers that you don’t want to see, and limiting how many files are shown in the minibuffer by customizing the
iswitchb-max-to-show variable. Additionally, you can kill a buffer from within
iswitchb by typing
C-k. The following is a snippet from my .emacs:
;; iswitchb ignores
(add-to-list 'iswitchb-buffer-ignore "^ ")
(add-to-list 'iswitchb-buffer-ignore "*Messages*")
(add-to-list 'iswitchb-buffer-ignore "*ECB")
(add-to-list 'iswitchb-buffer-ignore "*Buffer")
(add-to-list 'iswitchb-buffer-ignore "*Completions")
(add-to-list 'iswitchb-buffer-ignore "*ftp ")
(add-to-list 'iswitchb-buffer-ignore "*bsh")
(add-to-list 'iswitchb-buffer-ignore "*jde-log")
(add-to-list 'iswitchb-buffer-ignore "^[tT][aA][gG][sS]$")
There are other packages out there that do the same thing and even more. Even though I love
iswitchb, I have been meaning to try icicles and/or the ido package since they seem to provide the same functionality on steroids. If you are an advocate of one of these other packages, I hope to hear from you. If you are not using any of these packages on an hourly basis then start today. The package is indispensable.
Tags:faves · misc · reviews
April 17th, 2007 by Rob Christie · 7 Comments
I ran across this package on gnu.emacs.sources recently. If you enable
light-symbol-mode in a buffer and pause on a symbol, then Emacs will highlight all other occurrences of the symbol in the buffer. When you move point the highlighting goes away.
Tags:misc · quick
April 9th, 2007 by Ryan McGeary · 22 Comments
There are several ways to customize the display of the cursor. I happen to prefer highlighting the current line as a visual cue to keep my eye focused on where I’m working.
Before a few days ago, I had not realized there were so many packages to accomplish this, but let’s review a few. [Read more →]
Tags:misc · reviews
April 5th, 2007 by Rob Christie · 22 Comments
When you first start using emacs, there is normally someone who says something like keyboard macros in emacs rock. At that moment in time, they show you some quick little example, it looks neat but it probably doesn’t register with the true magnitude that it should. This series shows examples of macros “in the wild”. I hope it helps reinforce the value of the keyboard macro. [Read more →]
Tags:kb-macros · tips