One of the things that always drives me crazy about Emacs is indentation. It's hard to get it to do what I want it to do in cases where there is no mode that matches what I'm coding. I have a ton of files written using vimoutliner, and I don't feel like switching them to Emacs' own format. It's a simple outline format. Four space wide tabs are used for nesting.
I could never figure out how to get Emacs to just "do the right thing" with these .otl files. I finally figured out the right magical incantation, thanks to some hints from Jesse Montrose. Updated:
;; Add support for Vim outline files.Viola! Editing .otl files just became possible!
(defun otl-setup ()
(setq outline-regexp "\t+")
(setq indent-tabs-mode t) ;; Use real tabs.
(setq tab-width 4))
(setq auto-mode-alist
(cons '("\\.otl$" . outline-mode)
auto-mode-alist))
(add-hook 'outline-mode-hook
'otl-setup)


6 comments:
Ooo! I get even get Emacs' own outliner mode to work with .otl files!
(defun otl-setup ()
(setq outline-regexp "\t+")
(setq indent-tabs-mode t) ;; Use real tabs.
(setq tab-width 4))
(setq auto-mode-alist
(cons '("\\.otl$" . outline-mode)
auto-mode-alist))
(add-hook 'outline-mode-hook
'otl-setup)
Why even use vimoutliner? I just switched to emacs' org-mode and found it a world of improvement over vimoutliner. check it out www.orgmode.org
> Why even use vimoutliner?
Since I am normally a die-hard Vim user, I already have a ton of files in vimoutliner mode. I don't want to have to convert these to Emacs' outline-mode.
Jesse also suggested AllOut: http://www.emacswiki.org/emacs-ja/AllOut
It looks like a very sophisticated outline tool.
So caffeine is a gateway drug to Emacs. Good to know... ;)
Grumble, grumble. It messes up sometimes. I hit tab to indent, and it indents like 7 spaces instead of one tab, which totally breaks the format. I don't know what the deal is.
Post a Comment