From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jeremy Hankins Newsgroups: gmane.emacs.help Subject: Re: Hard to switch from vi Date: Mon, 09 Oct 2006 13:49:52 -0400 Organization: None Message-ID: <8764et2xbz.fsf@wasp.nowan.org> References: <20061009001242.GB6779@marita.homelinux.net> <4529F5D8.7060200@student.lu.se> <87ejth3gfp.fsf@wasp.nowan.org> <452A60EB.4040307@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1160416599 10369 80.91.229.2 (9 Oct 2006 17:56:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 Oct 2006 17:56:39 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 09 19:56:36 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GWzKJ-0007U3-JQ for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Oct 2006 19:54:08 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GWzKJ-0006Q9-62 for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Oct 2006 13:54:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GWzK7-0006Ov-4K for help-gnu-emacs@gnu.org; Mon, 09 Oct 2006 13:53:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GWzK6-0006Oj-CG for help-gnu-emacs@gnu.org; Mon, 09 Oct 2006 13:53:54 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GWzK6-0006Og-8S for help-gnu-emacs@gnu.org; Mon, 09 Oct 2006 13:53:54 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GWzRh-0003KT-4X for help-gnu-emacs@gnu.org; Mon, 09 Oct 2006 14:01:45 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GWzIQ-0006tG-M8 for help-gnu-emacs@gnu.org; Mon, 09 Oct 2006 19:52:10 +0200 Original-Received: from vtelinet-66-220-245-132.vermontel.net ([66.220.245.132]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 09 Oct 2006 19:52:10 +0200 Original-Received: from nowan by vtelinet-66-220-245-132.vermontel.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 09 Oct 2006 19:52:10 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 145 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: vtelinet-66-220-245-132.vermontel.net Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEULMAUzSyRZaUF5hl2S mHCysorm2a/HwZqMSkpRAAAACXBIWXMAAABkAAAAZAAPlsXdAAAARnRFWHRSYXcgcHJvZmlsZSB0 eXBlIGFwcDEyAAphcHAxMgogICAgICAxNQo0NDc1NjM2Yjc5MDAwMTAwMDQwMDAwMDAzNjAwMDAK kIvs3wAAAXpJREFUOMu9lLFOAkEQhr89TyvBPUAKG1AJLSYYW0RN7NQYH8HoC+hj6Atg4gsYjY2N iZJYYmONnhhbw61EK/DWYiGBPa7UrSb3ZWb+f2Zy7gHjn8tfAJF488YB0Wi/HasxYNpX4s6bj4Dw BEQ6F8mYPgUKOamGgdDwCiAY7ZF4KOEBTsWS67+U8IHZiI82ug6iYoNMRTYAZCQjXwuACZCWQScA SBE+WT4cTKeEb4EQgN6FWLZ6JE2sjtQoEOdmvBvKUtU1H4p5W+6MibaVDUyllIpZbT6yc61iwCAj Uuon7nyMKFrSBi0T1XcizenP0Ab9UwqJydBxcrW0RyL6txvx8WXlegRC44IjFSCz/Yp+SwbpqnJB L9VhcnUKgMR1eRHxcbnrAuU6MH+zdVcWzfc1QKfXlQt0AO977iyjb7PVgXYX+PECJIVs96JYGlLV u9KHtXYzTPqdPTks995ZCPb9x2fSR6NXsjIDKrWZFMpybtahP//llzH6fgGtSm7N1PqS6gAAABp6 VFh0SlBFRy1Db2xvcnNwYWNlAAB42jMCAAAzADMRFn5jAAAAJXpUWHRKUEVHLVNhbXBsaW5nLWZh Y3RvcnMAAHjaM6ww1DGEYAARbwLnIJ7wIwAAAABJRU5ErkJggg== User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:rXhniwl9pAmn2Ce5pWpU2cTcFjI= X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:37931 Archived-At: --=-=-= 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=patch Content-Description: Patch against folding.el --- folding.el-orig 2006-09-29 16:58:26.000000000 -0400 +++ folding.el 2006-10-04 08:55:59.000000000 -0400 @@ -2004,7 +2004,9 @@ (folding-point-folded-p goal)) (folding-shift-in t)) (goto-char goal))) - (folding-narrow-to-region (point-min) (point-max) t))) + (folding-narrow-to-region + (and folding-narrow-by-default (point-min)) + (point-max) t))) (if (or folding-stack (folding-point-folded-p (point))) (folding-open-buffer)))))))) @@ -2114,6 +2116,10 @@ ;;; ........................................................ &v-Config ... +(defvar folding-narrow-by-default t + "If t (default) things like isearch will enter folds. If nil the +folds will be opened, but not entered.") + ;; Q: should this inherit mouse-yank-at-point's value? maybe not. (defvar folding-mouse-yank-at-point t "If non-nil, mouse activities are done at point instead of 'mouse cursor'. @@ -3604,22 +3610,26 @@ many folds as necessary are entered to make the surrounding text visible. This is useful after some commands eg., search commands." (interactive) - (let ((goal (point))) - (if (folding-skip-ellipsis-backward) - (while (prog2 (beginning-of-line) - (folding-shift-in t) - (goto-char goal))) - (let ((data (folding-show-current-entry noerror t))) - (and data - (progn - (setq folding-stack - (if folding-stack - (cons (cons (point-min-marker) (point-max-marker)) - folding-stack) - '(folded))) - (folding-set-mode-line) - (folding-narrow-to-region (car data) (nth 1 data)) - (nth 2 data))))))) + (labels + ((open-fold nil + (let ((data (folding-show-current-entry noerror t))) + (and data + (progn + (when folding-narrow-by-default + (setq folding-stack + (if folding-stack + (cons (cons (point-min-marker) (point-max-marker)) + folding-stack) + '(folded))) + (folding-set-mode-line)) + (folding-narrow-to-region (car data) (nth 1 data))))))) + (let ((goal (point))) + (while (folding-skip-ellipsis-backward) + (beginning-of-line) + (open-fold) + (goto-char goal)) + (when (not folding-narrow-by-default) + (widen))))) ;;}}} ;;{{{ folding-shift-out @@ -3764,9 +3774,11 @@ (re-search-forward "[\n\C-m]" nil 0 (1- line))) (let ((goal (point))) (while (prog2 (beginning-of-line) - (folding-shift-in t) - (goto-char goal)))) - (folding-narrow-to-region (point-min) (point-max) t)) + (folding-shift-in t) + (goto-char goal)))) + (folding-narrow-to-region + (and folding-narrow-by-default (point-min)) + (point-max) t)) ;;}}} --=-=-= -- Jeremy Hankins PGP fingerprint: 748F 4D16 538E 75D6 8333 9E10 D212 B5ED 37D0 0A03 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --=-=-=--