emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/hideshow.el


From: Thien-Thi Nguyen
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/hideshow.el
Date: Thu, 23 Dec 2004 21:09:40 -0500

Index: emacs/lisp/progmodes/hideshow.el
diff -c emacs/lisp/progmodes/hideshow.el:1.48 
emacs/lisp/progmodes/hideshow.el:1.49
*** emacs/lisp/progmodes/hideshow.el:1.48       Thu Dec 23 18:20:32 2004
--- emacs/lisp/progmodes/hideshow.el    Fri Dec 24 01:57:47 2004
***************
*** 408,415 ****
    (let ((ovs (overlays-in from to)))
      (while ovs
        (let ((ov (car ovs)))
!       (when (overlay-get ov 'hs)
!         (delete-overlay ov)))
        (setq ovs (cdr ovs)))))
  
  (defun hs-isearch-show (ov)
--- 408,415 ----
    (let ((ovs (overlays-in from to)))
      (while ovs
        (let ((ov (car ovs)))
!         (when (overlay-get ov 'hs)
!           (delete-overlay ov)))
        (setq ovs (cdr ovs)))))
  
  (defun hs-isearch-show (ov)
***************
*** 429,444 ****
  This function is meant to be used as the `isearch-open-invisible-temporary'
  property of an overlay."
    (setq hs-headline
!       (if hide-p
!           nil
!         (or hs-headline
!             (let ((start (overlay-start ov)))
!               (buffer-substring
!                (save-excursion (goto-char start)
!                                (beginning-of-line)
!                                (skip-chars-forward " \t")
!                                (point))
!                start)))))
    (force-mode-line-update)
    (overlay-put ov 'invisible (and hide-p 'hs)))
  
--- 429,444 ----
  This function is meant to be used as the `isearch-open-invisible-temporary'
  property of an overlay."
    (setq hs-headline
!         (if hide-p
!             nil
!           (or hs-headline
!               (let ((start (overlay-start ov)))
!                 (buffer-substring
!                  (save-excursion (goto-char start)
!                                  (beginning-of-line)
!                                  (skip-chars-forward " \t")
!                                  (point))
!                  start)))))
    (force-mode-line-update)
    (overlay-put ov 'invisible (and hide-p 'hs)))
  
***************
*** 460,469 ****
                    ;; deprecated backward compatibility -- `block'<=>`code'
                    (and (eq 'block hs-isearch-open)
                         (eq 'code  flag)))
!         (overlay-put overlay 'isearch-open-invisible 'hs-isearch-show)
!         (overlay-put overlay
!                      'isearch-open-invisible-temporary
!                      'hs-isearch-show-temporary))
          overlay))))
  
  (defun hs-forward-sexp (match-data arg)
--- 460,469 ----
                    ;; deprecated backward compatibility -- `block'<=>`code'
                    (and (eq 'block hs-isearch-open)
                         (eq 'code  flag)))
!           (overlay-put overlay 'isearch-open-invisible 'hs-isearch-show)
!           (overlay-put overlay
!                        'isearch-open-invisible-temporary
!                        'hs-isearch-show-temporary))
          overlay))))
  
  (defun hs-forward-sexp (match-data arg)
***************
*** 519,528 ****
  
  (defun hs-safety-is-job-n ()
    "Warn if `buffer-invisibility-spec' does not contain symbol `hs'."
!     (unless (and (listp buffer-invisibility-spec)
!                  (assq 'hs buffer-invisibility-spec))
!       (message "Warning: `buffer-invisibility-spec' does not contain hs!!")
!       (sit-for 2)))
  
  (defun hs-inside-comment-p ()
    "Return non-nil if point is inside a comment, otherwise nil.
--- 519,528 ----
  
  (defun hs-safety-is-job-n ()
    "Warn if `buffer-invisibility-spec' does not contain symbol `hs'."
!   (unless (and (listp buffer-invisibility-spec)
!                (assq 'hs buffer-invisibility-spec))
!     (message "Warning: `buffer-invisibility-spec' does not contain hs!!")
!     (sit-for 2)))
  
  (defun hs-inside-comment-p ()
    "Return non-nil if point is inside a comment, otherwise nil.
***************
*** 566,572 ****
              (while (and (< (point) q)
                          (> (point) p)
                          (not (looking-at hs-c-start-regexp)))
!               (setq p (point));; use this to avoid an infinite cycle
                (forward-comment 1)
                (skip-chars-forward " \t\n\f"))
              (when (or (not (looking-at hs-c-start-regexp))
--- 566,572 ----
              (while (and (< (point) q)
                          (> (point) p)
                          (not (looking-at hs-c-start-regexp)))
!               (setq p (point)) ;; use this to avoid an infinite cycle
                (forward-comment 1)
                (skip-chars-forward " \t\n\f"))
              (when (or (not (looking-at hs-c-start-regexp))
***************
*** 646,652 ****
          (hs-hide-level-recursive (1- arg) minp maxp)
        (goto-char (match-beginning hs-block-start-mdata-select))
        (hs-hide-block-at-point t)))
!     (hs-safety-is-job-n)
    (goto-char maxp))
  
  (defmacro hs-life-goes-on (&rest body)
--- 646,652 ----
          (hs-hide-level-recursive (1- arg) minp maxp)
        (goto-char (match-beginning hs-block-start-mdata-select))
        (hs-hide-block-at-point t)))
!   (hs-safety-is-job-n)
    (goto-char maxp))
  
  (defmacro hs-life-goes-on (&rest body)
***************
*** 676,683 ****
      (let ((overlays (overlays-at (point)))
            (found nil))
        (while (and (not found) (overlayp (car overlays)))
!            (setq found (overlay-get (car overlays) 'hs)
!                  overlays (cdr overlays)))
        found)))
  
  (defun hs-c-like-adjust-block-beginning (initial)
--- 676,683 ----
      (let ((overlays (overlays-at (point)))
            (found nil))
        (while (and (not found) (overlayp (car overlays)))
!         (setq found (overlay-get (car overlays) 'hs)
!               overlays (cdr overlays)))
        found)))
  
  (defun hs-c-like-adjust-block-beginning (initial)
***************
*** 725,731 ****
                     (funcall hs-hide-all-non-comment-function)
                   (hs-hide-block-at-point t)))
             ;; found a comment, probably
!            (let ((c-reg (hs-inside-comment-p)))         ; blech!
               (when (and c-reg (car c-reg))
                 (if (> (count-lines (car c-reg) (nth 1 c-reg)) 1)
                     (hs-hide-block-at-point t c-reg)
--- 725,731 ----
                     (funcall hs-hide-all-non-comment-function)
                   (hs-hide-block-at-point t)))
             ;; found a comment, probably
!            (let ((c-reg (hs-inside-comment-p))) ; blech!
               (when (and c-reg (car c-reg))
                 (if (> (count-lines (car c-reg) (nth 1 c-reg)) 1)
                     (hs-hide-block-at-point t c-reg)
***************
*** 774,790 ****
      ;; first see if we have something at the end of the line
      (catch 'eol-begins-hidden-region-p
        (let ((here (point))
!           (ovs (save-excursion (end-of-line) (overlays-at (point)))))
!       (while ovs
!         (let ((ov (car ovs)))
!           (when (overlay-get ov 'hs)
!             (goto-char
!              (cond (end (overlay-end ov))
!                    ((eq 'comment (overlay-get ov 'hs)) here)
!                    (t (+ (overlay-start ov) (overlay-get ov 'hs-ofs)))))
!             (delete-overlay ov)
!             (throw 'eol-begins-hidden-region-p t)))
!         (setq ovs (cdr ovs)))
          nil))
      ;; not immediately obvious, look for a suitable block
      (let ((c-reg (hs-inside-comment-p))
--- 774,790 ----
      ;; first see if we have something at the end of the line
      (catch 'eol-begins-hidden-region-p
        (let ((here (point))
!             (ovs (save-excursion (end-of-line) (overlays-at (point)))))
!         (while ovs
!           (let ((ov (car ovs)))
!             (when (overlay-get ov 'hs)
!               (goto-char
!                (cond (end (overlay-end ov))
!                      ((eq 'comment (overlay-get ov 'hs)) here)
!                      (t (+ (overlay-start ov) (overlay-get ov 'hs-ofs)))))
!               (delete-overlay ov)
!               (throw 'eol-begins-hidden-region-p t)))
!           (setq ovs (cdr ovs)))
          nil))
      ;; not immediately obvious, look for a suitable block
      (let ((c-reg (hs-inside-comment-p))
***************
*** 871,879 ****
  
    (interactive "P")
    (setq hs-headline nil
!       hs-minor-mode (if (null arg)
!                         (not hs-minor-mode)
!                       (> (prefix-numeric-value arg) 0)))
    (if hs-minor-mode
        (progn
          (hs-grok-mode-type)
--- 871,879 ----
  
    (interactive "P")
    (setq hs-headline nil
!         hs-minor-mode (if (null arg)
!                           (not hs-minor-mode)
!                         (> (prefix-numeric-value arg) 0)))
    (if hs-minor-mode
        (progn
          (hs-grok-mode-type)
***************
*** 923,934 ****
  
  ;; make some variables permanently buffer-local
  (let ((vars '(hs-minor-mode
!             hs-c-start-regexp
!             hs-block-start-regexp
!             hs-block-start-mdata-select
!             hs-block-end-regexp
!             hs-forward-sexp-func
!             hs-adjust-block-beginning)))
    (while vars
      (let ((var (car vars)))
        (make-variable-buffer-local var)
--- 923,934 ----
  
  ;; make some variables permanently buffer-local
  (let ((vars '(hs-minor-mode
!               hs-c-start-regexp
!               hs-block-start-regexp
!               hs-block-start-mdata-select
!               hs-block-end-regexp
!               hs-forward-sexp-func
!               hs-adjust-block-beginning)))
    (while vars
      (let ((var (car vars)))
        (make-variable-buffer-local var)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]