Words    Words    Words

The Dream Café Weblog

Help us Dr. Internet — Emacs Edition

April 11th, 2009 by kit · 40 Comments

UPDATE: FIxed!!! Thanks for everyone’s help. See comments if you’re curious about the whole meandering process to success.

Hey everyone, Kit here. Today with the help of my geeky friend, Diana, we overhauled both of Steve’s machines, including his broken Linux box which he uses to write on and check his email.

The good news is that his Windows box (used for gaming and manuscript editing) is working wonderfully and got a nice upgrade (we’re going to get more memory for it too, soon). The Linux box has also been improved, and Steve can check and respond to his email again.

But we’ve hit a wrinkle and a pretty serious one. Steve writes his books in emacs on the Linux box, using a special mode which was written for him. We’ve successfully reinstalled the script and all its bells and whistles seem to be working.

BUT we can’t seem to get the program to stay in paragraph-indent-text-mode, it defaults to a programmer-style indent. We also can’t seem to adjust the tab widths lower. I’ve tried editing the .emacs file but I am kind of stabbing away in the dark, as I am a vi man and pretty ignorant about .emacs.

After the break is the current .emacs file, which seems to work to load Steve’s script and turn on soft word wrap. As I said, no tweaks I’ve made to invoke paragraph-indent or change tabs seems to work.

We’ve been at this pretty much non-stop since sometime this afternoon, so I am going to get some sleep. I will check any responses here, and respond as needed, in a couple hours.
Kit

p.s. We’re using Ubuntu and Emacs22

(setq auto-mode-alist (cons ‘(”\\.mss$” . sprint-mode) auto-mode-alist))
(setq auto-mode-alist (cons ‘(”\\.MSS$” . sprint-mode) auto-mode-alist))
(load-library “sprint”)
;; If we’re graced with a window system…
(cond (window-system
;; Frame setup
(setq default-frame-alist
‘((top . 200) (left . 400)
(width . 81) (height . 33)
(cursor-color . “yellow”)
(cursor-type . “box”)
(foreground-color . “white”)
(background-color . “blue”)
(font . “10×20″)))
(setq initial-frame-alist ‘((top . 50) (left . 100)))
))
(longlines-mode)   ;; soft word wrap like the rest of the world

Tags: Steve · Writing

40 responses so far ↓

  • 1 dreamingkat // Apr 11, 2009 at 6:28 am

    I know I mentioned it in chat, and I assume you tried it, it didn’t work, and then removed the line, but for completeness, I’m adding this comment. I suspect that the special mode is a minor mode and works on top of the major mode for text.

    to load the major load for text by default for new buffers, add the following line (yes, that’s only one single quote):

    (setq default-major-mode ‘text-mode)

  • 2 Star Straf // Apr 11, 2009 at 7:03 am

    I posted a link here on my Livejournal cause I know I know some emac geeks

  • 3 glenn // Apr 11, 2009 at 9:27 am

    I’m an emacs guy & happy to help if I can. But your .emacs file is loading a library (sprint.el) I can’t find through google (!). Is this a custom library you or someone you know wrote? If you could send the sprint.el file to me in email (geewiz at sonic.net) I would be happy to see if I can replicate & fix the problem. It would also help to know the exact emacs version (you said 22, but running ‘emacs -version’ will give a little more info). (Oh – and if the sprint.el file isn’t in your home directory, there’s your problem :).

  • 4 kit // Apr 11, 2009 at 9:38 am

    Yeah sprint.el was written by somebody just for Steve ages ago. sprint.el is loading fine, and seems to run out of the /usr/share/emacs/site-lisp directory. Even though it is running OK (the problem we’re having is with paragraph indentation and size of tabs) , I can still send it to you if you think it’ll be useful for troubleshooting.

    emacs –version returned:
    GNU Emacs 22.2.1

    Thanks!

  • 5 Terry Weissman // Apr 11, 2009 at 10:30 am

    I also am an Emacs guy, and would love an opportunity to give back to Steve after years of reading his books. Please send me sprint.el too, at terry at weissman dot org. The more eyes the better, right?

  • 6 Nathan // Apr 11, 2009 at 11:09 am

    If the file has been in /usr, it should be on the old boot disk that I replaced for Steve a couple of years ago, and asked him to hold on to and store in a safe place. This would be Ubuntu 4.x or 5.x I think.

  • 7 Andy (friend of Star) Arenson // Apr 11, 2009 at 12:32 pm

    I had a possibly-similar problem recently where emacs on my Gentoo box just started failing to indent the way it used to. Not too long after I ended up switching from Gentoo to RHEL and emacs began working as it used to, so I don’t know what caused the problem, but I think it’s possible that there’s a version of emacs out there that ended up with a weird default indenting, so my suggestion, for what it’s worth, is to make sure you’re running the latest version of emacs.

  • 8 kit // Apr 11, 2009 at 3:48 pm

    Terry & Glen: Sent. check your email.

    Nathan@6: We have sprint.el up and running ok, the issue seems to be with paragraph-indent-text-mode and the size of tabs. Do you think there are any other files on the boot disc that would help?

    Andy@7: We’re using the latest emacs package available on ubuntu, as far as I know, as we just installed it fresh from the package libraries.

    To anyone: Is there anywhere else on ubuntu where the settings in .emacs might be getting overruled? I already poked around a little in the site-lisp and /etc/emacs directories without much luck.

    Kit

  • 9 George // Apr 11, 2009 at 4:17 pm

    Did you try using the customization feature of emacs? Type ctrl-h v and emacs will prompt you for a variable name. Type in tab-width. You will get a description of the variable and its current value (probably 8). There will be a “customize” link on the documentation page. Click that. On the customization screen, change the value to what you want, and click on “Save for Future Sessions”. That will add a line to the bottom of the .emacs file that should fix you right up.
    I think part of the problem might be that tab-width is automatically buffer-local, so you need to set it correctly to make it a default.

    .emacs should override any other settings on the machine; that’s what it is for. But it is hard to tell what kinds of things are interacting without seeing the code in sprint.el.

  • 10 glenn // Apr 11, 2009 at 5:35 pm

    OK, think I got it; the tab stops are probably right but being ignored because emacs is using indent-relative (which seems designed to line up tabular stuff) when you want tab-to-tab-stop. This can be overriden like this:

    (define-key text-mode-map (kbd “TAB”) ‘tab-to-tab-stop)

  • 11 skzb // Apr 11, 2009 at 6:24 pm

    First of all, thanks to everyone who is taking an interest.

    Kit: Am I misremembering, or did we have it working right at one point, but that putting the code into the .emacs file is where it seemed to fail?

  • 12 skzb // Apr 11, 2009 at 6:30 pm

    Yikes! We have a bigger problem. It seems the line-wrapping we’re doing is NOT right. We used the following:

    (longlines-mode)
    in the .emacs file.

    I just tried to reformat the most recent paragraph, and it reformatted everything–made the whole file one long paragraph. I think my editor would not care for that. I’m fairly sure the readers wouldn’t like it.

    Are there other ways to do what, in the last version of emacs, was selecting the option “line-wrap in text mode”?

  • 13 George // Apr 11, 2009 at 6:35 pm

    If it wrapped everything, then it isn’t in paragraph-indent-text-mode. It thinks paragraphs are separated by blank lines.

  • 14 skzb // Apr 11, 2009 at 6:41 pm

    I think that’s it, George! I’ll check it with Kit when he’s up, and made sure we can get it happening in the .emacs file, but initial tests indicate you’ve nailed it.

  • 15 kit // Apr 11, 2009 at 9:08 pm

    As Steve said, big thanks to everyone who has weighed in so far.

    Ok we have made progress.

    1) Glenn’s suggestion @ 10 means that indents behave properly from the beginning.
    2) George’s suggestion @ 9 seems to temporarily fix the width of tabs.

    However, the .emacs file still is not automatically turning on paragraph-indent-text-mode, and when we turn it on manually in the program, it resets the tab widths from 5 (as set with George’s help above) to 8, and even resets all the tabs in Steve’s documents.

    This is still progress — Steve wrote a sentence today, after days of downtime — but we’d like to figure out how to automatically turn on paragraph-indent-text-mode and also permanently set the tab widths to 5, even after paragraph-indent-text-mode is turned on.

    Here is the current .emacs file:

    (setq auto-mode-alist (cons ‘(”\\.mss$” . sprint-mode) auto-mode-alist))
    (setq auto-mode-alist (cons ‘(”\\.MSS$” . sprint-mode) auto-mode-alist))
    (load-library “sprint”)
    ;; If we’re graced with a window system…
    (cond (window-system
    ;; Frame setup
    (setq default-frame-alist
    ‘((top . 200) (left . 400)
    (width . 81) (height . 33)
    (cursor-color . “yellow”)
    (cursor-type . “box”)
    (foreground-color . “white”)
    (background-color . “blue”)
    (font . “10×20″)))
    (setq initial-frame-alist ‘((top . 50) (left . 100)))
    ))
    (longlines-mode) ;; soft word wrap like the rest of the world
    (define-key text-mode-map (kbd “TAB”) ‘tab-to-tab-stop)
    (paragraph-indent-text-mode)

    Any further suggestions?

  • 16 dreamingkat // Apr 11, 2009 at 9:52 pm

    the last line isn’t doing anything. paragraph-indent-text-mode appears to be a major mode, and it looks like your calling the sprint library as a major mode too. AFAIK, you can only have one major mode active at a time (but lots of minor modes).

    There is a minor mode that claims to be equivalent: paragraph-indent-minor-mode
    Google results suggest attempting to turn it on with (varying degrees of success):
    (add-hook ‘text-mode-hook ‘paragraph-indent-minor-mode)

  • 17 Bawrence // Apr 11, 2009 at 10:04 pm

    Has to be said: You wouldn’t have these issues in Word, WordPro, or WordPerfect, WordStar… and you’d have one less box to troubleshoot.

  • 18 kit // Apr 11, 2009 at 11:01 pm

    I have discovered we’re now getting an error message at startup.

    Wrong argument: Incorrect-integer-or-marker-p, “TAB”

    dreamingkat@16: Putting that line into .emacs did not seem to help. Does it need to be somewhere in particular in the file?

    Bawrence@17: No, it really doesn’t. First off, one of your favorite authors has been using a certain method to write, successfully and productively, for years now. Do you really think that is something to casually muck about with?

    Secondly, Word and their ilk require just as much customization and troubleshooting to be useful to a writer — I say this as both a writer who has struggled with it on his own, and as someone who has attempted, head-bangingly, to troubleshoot Steve’s Word issues. Word is, in fact, what he uses to edit his manuscripts (the ones he writes in emacs) prior to sending them to his editors.

  • 19 kit // Apr 11, 2009 at 11:03 pm

    Oops that error is:

    Wrong type argument: integer-or-marker-p, “TAB”

  • 20 TechSlave // Apr 12, 2009 at 12:34 am

    Not to digress, as I can offer little help except emotional support due to a failure to learn emacs, but the writer’s tools and habits (especially of long establishment) are difficult to change without impacting everything of the writing process.

    Good luck with the emacs, ladies and gents. Though you’ve likely tried it, it’s all I have to throw out, as far as GoogleFU goes (not certain it’s not in that sprint library):
    (setq default-tab-width 5)

    Hope it all flows smooth soon.

  • 21 kit // Apr 12, 2009 at 3:10 am

    Still having trouble. We’re going to get in touch with the author of sprint.el on Monday or Tuesday and see where that gets us. We’ve got Steve able to write, he’s 95% of perfect, so that’s real good progress. Thanks for everyone who tossed their .02 in.

  • 22 kit // Apr 12, 2009 at 3:19 am

    Well we fixed it.. a bunch of the suggestions made earlier were totally sound. But it turns out, somewhere, some smart quotes had snuck into the .emacs files and fouled it up. Our friend Nathan Elliot, and his fresh set of eyes, spotted the problem.

    Again thanks everyone.

  • 23 Interesting Emacs Links - 2009 Week 15 « A Curious Programmer // Apr 12, 2009 at 3:56 am

    [...] is a nice example of someone asking the internet for help with an emacs issue. In the end it looks like it was solved in the real world by someone [...]

  • 24 Bawrence // Apr 12, 2009 at 9:30 am

    So fighting with 2 WP apps is somehow better than fighting one? Seems kludgy to me, but whatever works.

  • 25 Brad // Apr 12, 2009 at 2:39 pm

    It’s all about right tool for the right job.

    The tools for the early stage of writing are different from the last stages of layout. In this case, emacs and word are extremely different. The former you can fully shape to your needs. The latter you shape yourself to it’s requirements. When you’re a craftsman, you want your tools to work for you.

    So, yes, two is better than one in this case.

  • 26 Bawrence // Apr 12, 2009 at 4:40 pm

    As I said, whatever works. As a craftsman, I choose the right tool, I don’t hammer a screw halfway in before switching to a screwdriver.

  • 27 Miramon // Apr 12, 2009 at 6:12 pm

    I’ve used emacs for over 20 years. That was before GNU even existed. I used emacs for pretty much all text-editing purposes until I found FrameMaker in the early 90s (I thought FM was superior for technical documents), and continued to use emacs for programming until quite recently (when I stopped programming professionally).

    However, I haven’t used emacs for ordinary writing for quite some time. I have to admit I use Word now, since it is well-nigh universal, and since OpenOffice is not quite as good, and since no one uses FrameMaker any more, despite its superiority.

    I wonder if skzb or others can suggest what features of emacs make it good for him/them for general writing and composition, as opposed to editing, programming, and such tasks?

  • 28 skzb // Apr 12, 2009 at 7:27 pm

    If I couldn’t get emacs working, I DID have a fallback position–I still have a typewriter. Failing that, there is always pen and paper. If for some reason I couldn”t use that, I might use WORD.

  • 29 Miramon // Apr 12, 2009 at 8:27 pm

    > …couldn”t use that…

    Word would have fixed that for you :)

    I kid, I kid.

    If it wasn’t for having frequently to share formatted quasi-typeset documents with other typical office-dwellers I’d choose something different myself.

  • 30 TechSlave // Apr 13, 2009 at 2:12 am

    I’ve come up with two good reasons not to use the same program to write a story as to proof and edit it. Perhaps I am right, or perhaps I will be zero for zero.

    Reason One, being the first:
    The nature of the process involved should dictate the tool to be used. When writing from scratch, putting my own words and thoughts to a page, I am filled with a near unspeakable intimidation by the sight of the blank white space. To combat this, my template document for writing comes with a fragment of text as a header. I change it intermittently, though someday I’ll get around to making it a self-generating random line from another document in the same folder of work.
    Thusly, a clean slate is not desirous. Additionally, I want something which has no feeback. I never, ever, EVER want a word autocompleted. My grammar shall not be fixed. My capitalization suntouched, etc, ad infinitum, a list of all the things which I have to customize OUT of Word or OpenOffice.org or any similar minded word processor. In windows, I write in Notepad or Wordpad. In Linux, I throw things together on gedit. But my needs differ from a true author’s, and I demand simplicity.

    To counter, when I work on editing or reviewing writing for manuals, technical information, website FAQ/Help text, I need an entirely different environment. One where there is plenty of space to roam, circle in red, throw editing marks down like gauntlets, and even entirely re-format sections to meet either the standards for the document, the writing style guide, or other conventions. Not to mention something easy on the eyes because I will be reading and re-reading the same sections. Eye strain and the confines of collaborative change-tracking become the problem, rather than the simple and interruption-free flow of idea to the page.

    Reason Two, being the second:
    Somewhere, somehow, Mr. Brust was in the throes of creation. Perhaps Vlad was in the midst of a witty dialogue with Morrolan. Perhaps we were, at last, to pull back the veil of silence about the joyous reunion, amidst appropriate importunate settings of course, between Aliera and Mario. Or perhaps a genuine klava recipe was preparing to emerge from experimentation after a long night.
    And then it struck.
    As the writer typed, eyes closed, minute upon minute on the muted PC, the unthinkable was occurring…
    That unwanted child, that silver-headed stepchild, that paragon of pattering misfortune, known here as Clippy, rose and took !@#$%^&ING screen focus from the actual document and it was all gone. Gone. Gone! Lost beyond the hopes of crash recovery. All input routed to null.
    Once such experience could sour a person on MS’s office products for a long, long time.

    SKZB @ 28:
    I recommend falling back to cuneiform before Word. But I might be biased. I write with my eyes closed sometimes, touch-typing (as mentioned above) and one mis-finger of the ALT or CTRL key can lead not only to lost work – but settings on MS Word that could boggle the mind.

  • 31 skzb // Apr 13, 2009 at 9:57 am

    Good points, Techslave. My main requirement for writing (as opposed to editing) is that it be transparent; I do NOT want to be thinking about the editor, or how to get it do things, or faced with the need to highlight sections to be italicized, or anything except the words themselves. Emacs, as DDB set it up for me, does that.

    It is not impossible I could, eventually, become equally comfortable in some other environment, but I begrudge the years it would take to reach that point. I’d rather be writing.

  • 32 TechSlave // Apr 13, 2009 at 2:44 pm

    skzb @ 31:
    You have expressed it far more succinctly than I. If the tool you have is comfortable and fits all your needs, without distraction..it is perfect. Zen and the art of feature creep, as developers would say.

  • 33 Chris // Apr 13, 2009 at 8:04 pm

    Hmm, I’d love to see this emacs mode of yours, Steve. Wanna share?

  • 34 skzb // Apr 13, 2009 at 9:13 pm

    Drop Kit an email; he has a copy and will send it to you.

    Bear in mind that much of it is stuff that is from the dark ages, when I did my editing in a word processor called Borland Sprint.

  • 35 Chris // Apr 14, 2009 at 7:18 am

    Thanks, Steve. I am not worried about the dark ages-ness of it. I am just a geek.

  • 36 Mycroft W // Apr 16, 2009 at 4:36 pm

    vile? (okay, now you know which side of the holy war I’m on).

    Very glad you got your writing program up and running. As far as Werd goes, if I wanted to not know what my precious would look like at the end (oh, and not have auto-linecounts, auto-go-to-line and auto-word (real, and paid) counts), or not have a clue why it looks the (wrong) way it does, I’d think about Werd.

    After trying vigor.

  • 37 Chris B. // Apr 16, 2009 at 10:34 pm

    I’m often curious whenever this comes up: is this hate Werd-flavored or Macroshaft-flavored? And is it recent, or steeped in long tradition? Werd, while utter crap in ‘87, was quite mature by ‘03, and is an utterly different experience than any previous version as of ‘07.

    If the hate flows for MS in general, instead of the particular product, folks should give a try to OpenOffice. OpenOffice 3 is extremely mature and capable, totally compatible with Werd and pretty much every other word processor, and its whole existence is a slap in the face for the folks at Redmond. If your MS-hate runs potent and fresh, you’re all but obligated to try out OO3. Open-source, free, the absolute shining example of the principles of socialist cooperation creating great works to spit in the face of the capitalist (and imperialist) power of MS. :)

    And it runs on everything, from Windows to nearly all major flavors of Linux.

  • 38 Mycroft W // Apr 17, 2009 at 11:53 am

    Primarily it’s a Microsoft bias – the Microsoft way is “we’ll make it easy for you to do it the way we think right – and bloody difficult to do it any other way.” They train you, rather than you training it, which means more vendor lockin. Which is fun when the vendor changes everything around (see Office95 and, I’ve heard, 2007).

    Also known as WYSIAYG. I come from a vi/LaTeX and WordStar/WordPerfect world, where if something is formatted weirdly, I can look at the guts underneath to find out why, and stop it. That’s “too hard” for Word users, so MS doesn’t let you do it (without an awful lot more work than F11, if at all).

    It’s a geek thing – I like things to work the way I want them to work, and am willing to put the time into configuring it so that it does; as long as it bloody works tomorrow, and next month, and next year or whenever some patch decides to reset all the default settings.

    Never mind that emacs, bloatware though it is, running on suitably configured (i.e. I don’t need all this crap, don’t install it) ubuntu, will smoke on machines that struggle to bring up MS OS-of-the-month, never mind throwing Word on top of it.

  • 39 Chris // Apr 18, 2009 at 8:56 am

    I write with FrameMaker. Probably overkill just to use it just as a word processor but it works the way I want.

  • 40 Owlmirror // Aug 1, 2009 at 8:13 pm

    But it turns out, somewhere, some smart quotes had snuck into the .emacs files and fouled it up.

    More like smartass quotes.

    testing lone double-quote (”)
    testing lone double-quote with words (sk”zb)
    testing lone double-quote with space (sk “zb)
    testing lone single quote (’)
    testing lone single quote with numbers (’09)
    testing lone single quote with space ( ‘09)
    testing double–dashes
    testing single-dash


    testing lone double-quote (")
    testing lone double-quote with words (sk"zb)
    testing lone double-quote with space (sk "zb)
    testing lone single quote (')
    testing lone single quote with numbers ('09)
    testing lone single quote with space ( '09)
    testing double--dashes
    testing single-dash

    OK, that solves that problem. Use the <code> tag if you don’t want your quotes (and double-dashes) to be smartass.

    Hm. Looking back at the original post… was this the problem?

    (font . “10×20″)))

    The close double quote on the right (″) is a completely different type of double quote than the one on the left ( “). So it’s a double smartass quote.

Leave a Comment

Return to Home