Procrastiblog

November 25, 2007

Gnome Sessions

Filed under: Linux, Tech — Chris @ 8:56 pm

I tentatively clicked “Remember current running applications” in Gnome Session Preferences (aka gnome-session-properties) and lived to regret it. What this does is it restarts any currently running application when you login. This is useful for, e.g., your online backup daemon, but kind of annoying for, e.g., five Emacs windows, Last.fm, some random Nautilus directory window, etc.

Now, first I tried checking and unchecking “Automatically remember running applications when logging out”, as the window layout makes it seem as if these two settings are related. They are not. Then, I was tempted to fix this by futzing with the “Startup Programs” or “Current Session” lists. This is Not Right.

The Right Thing is to close all your programs (or just the offending ones) and then click again on “Remember current running applications”. That is to say: the only way to change the “remembered” snapshot is to take another snapshot*.

Note: Session Preferences has a Help button, but the Gnome manual page on it doesn’t mention “Remember currently running programs” or “Automatically remember running applications when logging out”. This is annoying.

* Presumably there is a text file tucked away somewhere that controls this (maybe ~/.gnome2/session?), but I haven’t the patience to find out.

Advertisements

Style Guidelines for People

Filed under: LaTeX — Chris @ 8:03 pm

In the midst of some unrelated Googling, I came across Luca de Alfaro’s style guidelines for student co-authors. This is good stuff. I particularly like “one sentence per line” b/w “fill-sentence macro”. It’s an elegant solution to a frequently annoying deficiency of diff, which is unfortunately the baseline for anyone collaborating via CVS or SVN. I tweaked his macro to get nice indentation in AucTeX:

(defun fill-sentence ()
  (interactive)
  (save-excursion
    (or (eq (point) (point-max)) (forward-char))
    (forward-sentence -1)
    (indent-relative)
    (let ((beg (point)))
      (forward-sentence)
      (if (equal "LaTeX" (substring mode-name (string-match "LaTeX" mode-name)))
          (LaTeX-fill-region-as-paragraph beg (point))
        (fill-region-as-paragraph beg (point))))))
(global-set-key "\ej" 'fill-sentence)

[UPDATE 1/20/08] Fixed an off-by-one error when the cursor is on the first character of the sentence by adding (forward-char).
[UPDATE 9/19/08] Fixed an error when the cursor is at the end of the buffer by changing (forward-char) to (or (eq (point) (point-max)) (forward-char))

BSG Is Back (Then Gone Again)!

Filed under: Battlestar Galactica, Not Tech, TV — Chris @ 4:50 pm

BSG: Razor is basically a very solid, two-part flashback episode in TV movie form. Admiral Cane is resurrected* for some Hot Lesbian Action and to dictate a torture memo** (“Pain, degradation, fear, shame… Be as creative as you feel the need to be”). Eighties vintage Cylons are resurrected for no apparent reason. New characters are introduced and then killed off with ruthless efficiency. There was a bit of the old, vague mytho-babble (“All of this has already happened… and will happen again”) pointing towards the next season, which makes me terribly worried the show will end badly, in grand X-Files and/or Twin Peaks style.

It doesn’t look like Razor is scheduled to re-air, if you missed it, but it will be out on DVD next week (in an annoyingly expanded version). Season 4 is scheduled to begin in March (or April?). Till then, work…

* Not in the “she’s a Cylon” sense.

** Isn’t it fun how “torture memo” is now a cultural reference?

LaTeX Letters

Filed under: LaTeX, Tech — Chris @ 4:42 pm

I was trying to write a letter in LaTeX the other day:

\documentclass{letter}

\address{Nowheresville}

\signature{Me}

\begin{document}
\begin{letter}

\opening{To Whom It May Concern:}

Hello, there.

\closing{Sincerely,}

\end{letter}
\end{document}

This led to the following two errors, which shed little light on the situation:

! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type H  for immediate help.
 ...

l.10 \opening{To Whom It May Concern:}

and (on a different example)

! Incomplete \iffalse; all text was ignored after line 66.

                \fi
l.16 \end{letter}

Runaway text?
\@mlabel{}{\unhbox \voidb@x \ignorespaces \global \let

The problem, as it was gently explained to me, is I had omitted the second mandatory argument of \begin{letter}, which is the address of the recipient. The following is correct:

\documentclass{letter}

\address{Nowheresville}

\signature{Me}

\begin{document}
\begin{letter}{Foo Corp.}

\opening{To Whom It May Concern:}

Hello, there.

\closing{Sincerely,}

\end{letter}
\end{document}

[UPDATE] I just realized that the reason I got so confused about this is that I was working off a previous business letter that was formatted like:

\begin{document}
\begin{letter}
{
Foo Corp. \\
... \\
ATTN: Warranty Dept.}
...

I’m not sure if I intended it to be the case (probably not), but LaTeX picked up the braces around the address as the argument to letter. When I used this as the template for a personal letter and deleted the address, all hell broke loose.

Blog at WordPress.com.