--- 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)) ;;}}}