xemacs and folding fun
October 11, 2005 – 5:43 pmI don’t know why this proved difficult, but code folding in xemacs/emacs was not as simple to setup as I had imagined. I started off by searching for an xemacs folding package with emerge. After this came up empty, I started scouring the web for emacs related information.
I came across numerous sites with folding information but could not find a specific file except for an old library from 2001.
Thinking the folding.el couldn’t possibly be stored on my filesystem I checked:
[code]
?> locate folding.el
/usr/lib/xemacs/xemacs-packages/lisp/text-modes/folding.el
/usr/lib/xemacs/xemacs-packages/lisp/text-modes/folding.elc
[/code]
Well what do you know, there it is! Now I just have to figure out how
to configure it.
I decided to always load the library since I use it extensively at
work (well, everyone else where I work uses vi folding).
This is what my emacs customization file ends up looking like
(.xemacs/custom.el):
[code]
;; always load folding
(if (load "folding" 'nomessage 'noerror)
(folding-mode-add-find-file-hook))
;; perform custom folding for these major modes
(folding-add-to-marks-list 'php-mode "// {{{ " "// }}}" nil t)
(folding-add-to-marks-list 'javascript-mode "// {{{ " "// }}}" nil t)
[/code]
Further setup instructions can be found right in the lisp code. The
most helpful being:
[code]
;; To install Folding mode, put this file (folding.el) on your
;; Emacs `load-path' (or extend the load path to include the
;; directory containing this file) and optionally byte compile it.
;;
;; The best way to install folding is the autoload installation,
;; so that folding is loaded into your emacs only when you turn on
;; `folding-mode'. This statement speeds up loading your .emacs
;;
;; (autoload 'folding-mode "folding" "Folding mode" t)
;; (autoload 'turn-off-folding-mode "folding" "Folding mode" t)
;; (autoload 'turn-on-folding-mode "folding" "Folding mode" t)
;;
;; But if you always use folding, then perhaps you want more traditional
;; installation. Here Folding mode starts automatically when you
;; load a folded file.
;;
;; ;; (setq folding-default-keys-function
;; ;; 'folding-bind-backward-compatible-keys)
;;
;; (if (load "folding" 'nomessage 'noerror)
;; (folding-mode-add-find-file-hook))
;
[/code]
And that’s it!
Some additional information on using folding can be found at
http://www.chrislott.org/geek/emacs/n2n_folding_mode.php or by typing
“C – h m” in xemacs.
Sorry, comments for this entry are closed at this time.