# HG changeset patch # User Chong Yidong # Date 1249785830 0 # Node ID 0cec7dac5f5073e65cf5b3fb0b4f145b6aded0f4 # Parent 8642d488076f6c37db4c2184709f0031681acc3e * 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). diff -r 8642d488076f -r 0cec7dac5f50 lisp/ChangeLog --- a/lisp/ChangeLog Sun Aug 09 00:17:01 2009 +0000 +++ b/lisp/ChangeLog Sun Aug 09 02:43:50 2009 +0000 @@ -1,3 +1,10 @@ +2009-08-09 Chong Yidong + + * 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). + 2009-08-09 Dmitry Dzhus * progmodes/gdb-mi.el (gdb-gud-context-call): Does not need to be diff -r 8642d488076f -r 0cec7dac5f50 lisp/progmodes/hideshow.el --- a/lisp/progmodes/hideshow.el Sun Aug 09 00:17:01 2009 +0000 +++ b/lisp/progmodes/hideshow.el Sun Aug 09 02:43:50 2009 +0000 @@ -267,10 +267,10 @@ ;;;###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 @@ (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 @@ (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