comparison lisp/progmodes/hideshow.el @ 81555:a0461babeddf

(hs-hide-comment-region): Use line-end-position. (hs-hide-block-at-point, hs-show-block): Likewise.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Fri, 22 Jun 2007 08:14:00 +0000
parents ed157fbce08b
children 8ee965d8fb17
comparison
equal deleted inserted replaced
81554:ed157fbce08b 81555:a0461babeddf
506 (funcall hs-forward-sexp-func arg))) 506 (funcall hs-forward-sexp-func arg)))
507 507
508 (defun hs-hide-comment-region (beg end &optional repos-end) 508 (defun hs-hide-comment-region (beg end &optional repos-end)
509 "Hide a region from BEG to END, marking it as a comment. 509 "Hide a region from BEG to END, marking it as a comment.
510 Optional arg REPOS-END means reposition at end." 510 Optional arg REPOS-END means reposition at end."
511 (let ((beg-eol (progn (goto-char beg) (end-of-line) (point))) 511 (let ((beg-eol (progn (goto-char beg) (line-end-position)))
512 (end-eol (progn (goto-char end) (end-of-line) (point)))) 512 (end-eol (progn (goto-char end) (line-end-position))))
513 (hs-discard-overlays beg-eol end-eol) 513 (hs-discard-overlays beg-eol end-eol)
514 (hs-make-overlay beg-eol end-eol 'comment beg end)) 514 (hs-make-overlay beg-eol end-eol 'comment beg end))
515 (goto-char (if repos-end end beg))) 515 (goto-char (if repos-end end beg)))
516 516
517 (defun hs-hide-block-at-point (&optional end comment-reg) 517 (defun hs-hide-block-at-point (&optional end comment-reg)
534 (save-excursion 534 (save-excursion
535 (goto-char (funcall (or hs-adjust-block-beginning 535 (goto-char (funcall (or hs-adjust-block-beginning
536 'identity) 536 'identity)
537 pure-p)) 537 pure-p))
538 ;; whatever the adjustment, we move to eol 538 ;; whatever the adjustment, we move to eol
539 (end-of-line) 539 (line-end-position)))
540 (point)))
541 (q 540 (q
542 ;; `q' is the point at the end of the block 541 ;; `q' is the point at the end of the block
543 (progn (hs-forward-sexp mdata 1) 542 (progn (hs-forward-sexp mdata 1)
544 (end-of-line) 543 (end-of-line)
545 (point))) 544 (point)))
804 See documentation for functions `hs-hide-block' and `run-hooks'." 803 See documentation for functions `hs-hide-block' and `run-hooks'."
805 (interactive "P") 804 (interactive "P")
806 (hs-life-goes-on 805 (hs-life-goes-on
807 (or 806 (or
808 ;; first see if we have something at the end of the line 807 ;; first see if we have something at the end of the line
809 (let ((ov (hs-overlay-at (save-excursion (end-of-line) (point)))) 808 (let ((ov (hs-overlay-at (line-end-position)))
810 (here (point))) 809 (here (point)))
811 (when ov 810 (when ov
812 (goto-char 811 (goto-char
813 (cond (end (overlay-end ov)) 812 (cond (end (overlay-end ov))
814 ((eq 'comment (overlay-get ov 'hs)) here) 813 ((eq 'comment (overlay-get ov 'hs)) here)