summaryrefslogtreecommitdiff
path: root/lisp/progmodes/hideshow.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2009-08-09 02:43:50 +0000
committerChong Yidong <cyd@stupidchicken.com>2009-08-09 02:43:50 +0000
commit1c292fc7de79735fdea7f6df03a6b2ce7100b285 (patch)
treee56ff349ee31dc3d025f5a177c50f6e71d3aa0dc /lisp/progmodes/hideshow.el
parent2db0ae07bce8513db2975836d6e20bfdee9c5f1c (diff)
downloademacs-1c292fc7de79735fdea7f6df03a6b2ce7100b285.tar.gz
* progmodes/hideshow.el (hs-special-modes-alist): Don't use
hs-c-like-adjust-block-beginning. (hs-hide-block-at-point): Stop hiding at the beginning of hs-block-end-regexp (Bug#700).
Diffstat (limited to 'lisp/progmodes/hideshow.el')
-rw-r--r--lisp/progmodes/hideshow.el36
1 files changed, 19 insertions, 17 deletions
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index 7e4da68ec38..bf2792dada0 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -267,10 +267,10 @@ This has effect only if `search-invisible' is set to `open'."
;;;###autoload
(defvar hs-special-modes-alist
- '((c-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning)
- (c++-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning)
+ '((c-mode "{" "}" "/[*/]" nil nil)
+ (c++-mode "{" "}" "/[*/]" nil nil)
(bibtex-mode ("@\\S(*\\(\\s(\\)" 1))
- (java-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning))
+ (java-mode "{" "}" "/[*/]" nil nil))
"*Alist for initializing the hideshow variables for different modes.
Each element has the form
(MODE START END COMMENT-START FORWARD-SEXP-FUNC ADJUST-BEG-FUNC).
@@ -567,20 +567,21 @@ and then further adjusted to be at the end of the line."
(let* ((mdata (match-data t))
(header-beg (match-beginning 0))
(header-end (match-end 0))
- (p
- ;; `p' is the point at the end of the block beginning,
- ;; which may need to be adjusted
- (save-excursion
- (if hs-adjust-block-beginning
- (goto-char (funcall hs-adjust-block-beginning
- header-end))
- (goto-char header-beg))))
- (q
- ;; `q' is the point at the end of the block
- (progn (hs-forward-sexp mdata 1)
- (point)))
- ov)
- (when (and (< p (point)) (> (count-lines p q) 1))
+ p q ov)
+ ;; `p' is the point at the end of the block beginning, which
+ ;; may need to be adjusted
+ (save-excursion
+ (if hs-adjust-block-beginning
+ (goto-char (funcall hs-adjust-block-beginning
+ header-end))
+ (goto-char header-end))
+ (setq p (line-end-position)))
+ ;; `q' is the point at the end of the block
+ (hs-forward-sexp mdata 1)
+ (setq q (if (looking-back hs-block-end-regexp)
+ (match-beginning 0)
+ (point)))
+ (when (and (< p q) (> (count-lines p q) 1))
(cond ((and hs-allow-nesting (setq ov (hs-overlay-at p)))
(delete-overlay ov))
((not hs-allow-nesting)
@@ -751,6 +752,7 @@ and `case-fold-search' are both t."
(end-of-line)
(hs-overlay-at (point))))
+;; This function is not used anymore (Bug#700).
(defun hs-c-like-adjust-block-beginning (initial)
"Adjust INITIAL, the buffer position after `hs-block-start-regexp'.
Actually, point is never moved; a new position is returned that is