Showing posts with label text. Show all posts
Showing posts with label text. Show all posts

Thursday, September 27, 2012

Making Emacs Act More Like a Text Editor

Emacs used to be a great programmer's editor. It still is, but non-text features keep creeping in making it less usable for editing and viewing text. For example, doc-view mode makes emacs render a PDF, DVI, or PS file. But PDF and PS are text formats, so I can't imagine why I'd want emacs to render them--other tools do that well.
To make emacs better-behaved, it seems the following in one's .emacs file is sufficient:

(add-to-list 'auto-mode-alist '("\\.pdf\\'" . fundamental-mode))
(add-to-list 'auto-mode-alist '("\\.ps\\'" . fundamental-mode))
Thanks to Stefan Monnier at https://groups.google.com/forum/?fromgroups=#!topic/gnu.emacs.help/TGVh05FGzK8
My .emacs file (really, my emacs-custom.el which is loaded from my .emacs) has been growing since Fall 1988, and I don't see that changing, especially as new puppies start monkeying with emacs' behavior. Of course, I do trim detritus from time-to-time.
Actually there might be some stuff in there from my time at William and Mary, 1984-1986. Zippy says "yow."

Tuesday, September 2, 2008

GNU Emacs: making the obvious difficult

Off and on it's really irritated me that someone on the GNU team decided to change the default behavior of tab in fundamental mode from insert ^i to indent-relative. I hate indent-relative. It makes lining things up in columns in text files difficult. So every few months I do a Google search, find other people making the same complaint, and see less than helpful suggestions. Tonight I got more frustrated than usual, and so spent more time than usual. It appears that the following shuts off indent-relative for the most part without messing up filename completion or indentation in various modes, e.g., java or html.
(setq default-major-mode 'text-mode)
(define-key text-mode-map "\t" "\C-q\C-i")
The above is pretty much alpha code at the moment. There's detritus in my .emacs that suggests that years ago I didn't like text mode for pnews or mail modes, but those are no longer issues. indent-relative is, IMHO, evidence of word processor-oriented thought processes, not text editor-oriented processes. As Linux grows to be more Windows like (e.g., bloated and buggy), there seems to be an undercurrent of making basic tools, e.g., emacs and wc, less Unix-like.