Lennart Borgman writes: > Jeremy Hankins wrote: >> I personally consider viper to be more of an implementation of vi in >> elisp; it generally works quite well with other emacs modes without >> interfering with their use. There are a few exceptions, though -- I'd >> love to get viper to work better with folding.el, for example. > > What version of Emacs do you use? What are the problems with folding.el? It's the debian unstable emacs-snapshot package 20061003-1, so 22. I'm using folding.el v3.35, which is current, I believe. I've hacked folding.el a bit -- mainly to set up an option to not narrow when folding-shift-in is called. I've attached a patch against folding.el, if you're interested, and I'm using this advice for viper-search: ;; This advises viper-search so that it behaves well with folding-mode. (defadvice viper-search (around jjh/folding-viper-search activate) (let ((executing-kbd-macro t)) ad-do-it) (let* ((start (match-beginning 0)) (end (match-end 0)) (match (buffer-substring start end))) (when folding-mode (folding-shift-in)) (search-forward match end t nil) (goto-char start)) (or executing-kbd-macro (memq viper-intermediate-command '(viper-repeat viper-digit-argument viper-command-argument)) (viper-flash-search-pattern)) ad-return-value) It's a bit ugly, because it sets executing-kbd-macro so that it can override the way viper-flash-search-pattern is called. Unfortunately this disables the message about the search wrapping the buffer, but without it folding marks are flashed instead of the search match. If anyone has a better suggestion I'd be interested -- I'm pretty new to elisp. Ideal would be a hook in viper-search, I guess. What I'd really like, though, is for ex-style line addressing to work properly, but I don't really see how that's possible without significant modifications to viper. From what I can see it looks like viper handles generating addresses for lines in a variety of places, and they'd all have to be tracked down to make it behave with folding-mode.