12.09.09

Firefox, Emacs, and Mac OS X

Posted in How To, Intermediate, Mac at 10:47 am by Techie

On Linux and Windows, I use an extension called It’s All
Text
to add an “edit” button to text areas. Hitting this will
launch the contents of the text area in my editor of choice — emacs.
(You can pick any editor you like.)

However, on Mac, it’s not really straightforward, due to the way they
handle applications. The comments in this
post
pointed me in the right direction for how to set this up.

The default proportional font in aquamacs bugs me, so I fix that by
launching it with a textarea and going to Options -> Appearance
-> Font For Text-Mode and setting it to Andale Mono. I also turn
off Soft Word Wrap and Auto Word Wrap In Text Modes under options,
because I’m used to emacs’s old unfriendly behavior.

06.11.07

Customizing Emacs

Posted in How To, Intermediate, Linux, Mac, Windows at 11:24 am by Techie

What’s your favorite editor? Oh, I’m sorry, the correct answer should be emacs. Actually, you should use whatever editor you feel most comfortable with; I’ve just found the ability to record keyboard macros in emacs to be indispensable, all the more so since I’ve been using it for almost ten years. Be I writing on Linux, Windows, or Mac OS X, my preferred text editor is still emacs.

However, once I get on a new machine, I need to customize .emacs, which is the startup configuration file. There are a series of changes that I find quite useful, and often find myself looking up again and again. Without further ado, here are the customizations:

;; Emacs usually has a slash screen on startup.  Let's get rid of that and start with a blank buffer.
(setq inhibit-startup-message t)

;; I like to see what is selected in the buffer.  This turns on visual feedback on selections.
(setq transient-mark-mode t)

;; Activate font-lock mode (syntax coloring).
(global-font-lock-mode t)

;; Line numbers are good.  Getting column numbering as well is better.
(column-number-mode t)

;; Scrollbars go on the right.  Who puts these on the left?
(set-scroll-bar-mode 'right)

;; Enable mouse wheel scrolling.
(if (load "mwheel" t)
    (mwheel-install))

;; Always end files in anewline.
(setq require-final-newline 't)
;; ...or ask to end in newline if needed
; (setq require-final-newline 'query)

;; Match parentheses.  Useful to be sure you've closed everything up.
(show-paren-mode t)

; Display settings
; default size and color options for all frames.
(setq default-frame-alist
 '(
; frame width and height
    (width             . 80)
    (height            . 40)
  ;;;; foreground, background, and cursor colors
  ;;;    (foreground-color  . "grey8")
  ;;;    (background-color  . "grey92")
  ;;;    (cursor-color      . "red3")
  )
)
; places top left corner of initial frame at location (25,25) on screen
(setq initial-frame-alist
 '(
    (top               . 25)
    (left              . 25)
  )
)

; Temporary files cluttering up the space are annoying.  Here's how we
; can deal with them -- create a directory in your home directory, and
; save to there instead!  No more random ~ files.
(defvar user-temporary-file-directory
  "~/.emacs-autosaves/")
(make-directory user-temporary-file-directory t)
(setq backup-by-copying t)
(setq backup-directory-alist
      `(("." . ,user-temporary-file-directory)
        (tramp-file-name-regexp nil)))
(setq auto-save-list-file-prefix
      (concat user-temporary-file-directory ".auto-saves-"))
(setq auto-save-file-name-transforms
      `((".*" ,user-temporary-file-directory t)))

I additionally have some macros that aren’t generally useful. There’s a million things to tweak in the customization, and if you’re fancy, you can even write your own hacks — better brush up on that lisp! Here are a few more resources of interest:

12.12.06

How To: Authorize more than five computers with iTunes

Posted in Intermediate, Mac, Windows at 4:50 pm by Techie

I’m not sure of the legality of this one, but Lifehacker pointed to an article about authorizing iTunes on more than five computers. The basic idea is that the authorization for a computer is stored on your local machine. This is a good thing, because otherwise you would need to be constantly connected to the Internet to play your music — not exactly ideal if you have a laptop. What you do is copy this folder, de-authorize your computer, then restore the folder. Voila — re-authorized, without connecting to the music store!

For Mac, the above link points to an Applescript that handles this for you: iTude.zip

LifeHacker notes that for Windows, the directory is stored in C:\Documents and Settings\All Users\Application Data\Apple Computer\iTunes\SC Info. Copy this folder, de-authorize your machine, then restore it, and your music should play.

A caveat to this is that any music bought thereafter will not work, because the authorization key will change on each new song purchased. However, if you just need a quick additional computer for your music and aren’t buying new music, then this will do the trick. Let’s see how long before Apple patches this!

Bad Behavior has blocked 280 access attempts in the last 7 days.