aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-07-06 14:16:52 +0000
committerChong Yidong2009-07-06 14:16:52 +0000
commitd44d05e807ff0a0d98ed3d46b8325dfba407e644 (patch)
treec08e2a0aa95f9eeb95696b11ddebe48d6d1ef68a
parent3e2fa3535424f158e2e1146d2d2c2d9f61e35799 (diff)
downloademacs-d44d05e807ff0a0d98ed3d46b8325dfba407e644.tar.gz
emacs-d44d05e807ff0a0d98ed3d46b8325dfba407e644.zip
* progmodes/hideshow.el (hs-hide-block-at-point): Don't move point
to the end of the line when locating the block (Bug#700).
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/progmodes/hideshow.el21
2 files changed, 15 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 14e667f086e..08bf352b55e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12009-07-06 Chong Yidong <cyd@stupidchicken.com>
2
3 * progmodes/hideshow.el (hs-hide-block-at-point): Don't move point
4 to the end of the line when locating the block (Bug#700).
5
12009-07-06 Michael Albinus <michael.albinus@gmx.de> 62009-07-06 Michael Albinus <michael.albinus@gmx.de>
2 7
3 * net/tramp.el (tramp-handle-write-region): Flush file properties 8 * net/tramp.el (tramp-handle-write-region): Flush file properties
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index dc2451bc6f1..7e4da68ec38 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -565,29 +565,28 @@ and then further adjusted to be at the end of the line."
565 (hs-hide-comment-region (car comment-reg) (cadr comment-reg) end) 565 (hs-hide-comment-region (car comment-reg) (cadr comment-reg) end)
566 (when (looking-at hs-block-start-regexp) 566 (when (looking-at hs-block-start-regexp)
567 (let* ((mdata (match-data t)) 567 (let* ((mdata (match-data t))
568 (pure-p (match-end 0)) 568 (header-beg (match-beginning 0))
569 (header-end (match-end 0))
569 (p 570 (p
570 ;; `p' is the point at the end of the block beginning, 571 ;; `p' is the point at the end of the block beginning,
571 ;; which may need to be adjusted 572 ;; which may need to be adjusted
572 (save-excursion 573 (save-excursion
573 (goto-char (funcall (or hs-adjust-block-beginning 574 (if hs-adjust-block-beginning
574 'identity) 575 (goto-char (funcall hs-adjust-block-beginning
575 pure-p)) 576 header-end))
576 ;; whatever the adjustment, we move to eol 577 (goto-char header-beg))))
577 (line-end-position)))
578 (q 578 (q
579 ;; `q' is the point at the end of the block 579 ;; `q' is the point at the end of the block
580 (progn (hs-forward-sexp mdata 1) 580 (progn (hs-forward-sexp mdata 1)
581 (end-of-line) 581 (point)))
582 (point))) 582 ov)
583 ov)
584 (when (and (< p (point)) (> (count-lines p q) 1)) 583 (when (and (< p (point)) (> (count-lines p q) 1))
585 (cond ((and hs-allow-nesting (setq ov (hs-overlay-at p))) 584 (cond ((and hs-allow-nesting (setq ov (hs-overlay-at p)))
586 (delete-overlay ov)) 585 (delete-overlay ov))
587 ((not hs-allow-nesting) 586 ((not hs-allow-nesting)
588 (hs-discard-overlays p q))) 587 (hs-discard-overlays p q)))
589 (hs-make-overlay p q 'code (- pure-p p))) 588 (hs-make-overlay p q 'code (- header-end p)))
590 (goto-char (if end q (min p pure-p))))))) 589 (goto-char (if end q (min p header-end)))))))
591 590
592(defun hs-inside-comment-p () 591(defun hs-inside-comment-p ()
593 "Return non-nil if point is inside a comment, otherwise nil. 592 "Return non-nil if point is inside a comment, otherwise nil.