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 13:36:05 -0500

Index: emacs/lisp/progmodes/hideshow.el
diff -c emacs/lisp/progmodes/hideshow.el:1.47 
emacs/lisp/progmodes/hideshow.el:1.48
*** emacs/lisp/progmodes/hideshow.el:1.47       Sat Oct 18 01:04:28 2003
--- emacs/lisp/progmodes/hideshow.el    Thu Dec 23 18:20:32 2004
***************
*** 5,11 ****
  ;; Author: Thien-Thi Nguyen <address@hidden>
  ;;      Dan Nicolaescu <address@hidden>
  ;; Keywords: C C++ java lisp tools editing comments blocks hiding outlines
! ;; Maintainer-Version: 5.31
  ;; Time-of-Day-Author-Most-Likely-to-be-Recalcitrant: early morning
  
  ;; This file is part of GNU Emacs.
--- 5,11 ----
  ;; Author: Thien-Thi Nguyen <address@hidden>
  ;;      Dan Nicolaescu <address@hidden>
  ;; Keywords: C C++ java lisp tools editing comments blocks hiding outlines
! ;; Maintainer-Version: n/a (presently)
  ;; Time-of-Day-Author-Most-Likely-to-be-Recalcitrant: early morning
  
  ;; This file is part of GNU Emacs.
***************
*** 58,64 ****
  ;;
  ;; (load-library "hideshow")
  ;; (add-hook 'X-mode-hook               ; other modes similarly
! ;;           '(lambda () (hs-minor-mode 1)))
  ;;
  ;; where X = {emacs-lisp,c,c++,perl,...}.  You can also manually toggle
  ;; hideshow minor mode by typing `M-x hs-minor-mode'.  After hideshow is
--- 58,64 ----
  ;;
  ;; (load-library "hideshow")
  ;; (add-hook 'X-mode-hook               ; other modes similarly
! ;;           (lambda () (hs-minor-mode 1)))
  ;;
  ;; where X = {emacs-lisp,c,c++,perl,...}.  You can also manually toggle
  ;; hideshow minor mode by typing `M-x hs-minor-mode'.  After hideshow is
***************
*** 133,142 ****
  ;; variable `hs-special-modes-alist'.  Packages that use hideshow should
  ;; do something like:
  ;;
! ;;   (let ((my-mode-hs-info '(my-mode "{{" "}}" ...)))
! ;;     (if (not (member my-mode-hs-info hs-special-modes-alist))
! ;;         (setq hs-special-modes-alist
! ;;               (cons my-mode-hs-info hs-special-modes-alist))))
  ;;
  ;; If you have an entry that works particularly well, consider
  ;; submitting it for inclusion in hideshow.el.  See docstring for
--- 133,139 ----
  ;; variable `hs-special-modes-alist'.  Packages that use hideshow should
  ;; do something like:
  ;;
! ;;   (add-to-list 'hs-special-modes-alist '(my-mode "{{" "}}" ...))
  ;;
  ;; If you have an entry that works particularly well, consider
  ;; submitting it for inclusion in hideshow.el.  See docstring for
***************
*** 180,188 ****
  ;;     In the case of `vc-diff', here is a less invasive workaround:
  ;;
  ;;     (add-hook 'vc-before-checkin-hook
! ;;               '(lambda ()
! ;;                  (goto-char (point-min))
! ;;                  (hs-show-block)))
  ;;
  ;;     Unfortunately, these workarounds do not restore hideshow state.
  ;;     If someone figures out a better way, please let me know.
--- 177,185 ----
  ;;     In the case of `vc-diff', here is a less invasive workaround:
  ;;
  ;;     (add-hook 'vc-before-checkin-hook
! ;;               (lambda ()
! ;;                 (goto-char (point-min))
! ;;                 (hs-show-block)))
  ;;
  ;;     Unfortunately, these workarounds do not restore hideshow state.
  ;;     If someone figures out a better way, please let me know.
***************
*** 265,272 ****
    '((c-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning)
      (c++-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning)
      (bibtex-mode ("address@hidden(*\\(\\s(\\)" 1))
!     (java-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning)
!     )
    "*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).
--- 262,268 ----
    '((c-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning)
      (c++-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning)
      (bibtex-mode ("address@hidden(*\\(\\s(\\)" 1))
!     (java-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning))
    "*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).
***************
*** 543,552 ****
      (let ((q (point)))
        (when (or (looking-at hs-c-start-regexp)
                  (re-search-backward hs-c-start-regexp (point-min) t))
          (forward-comment (- (buffer-size)))
          (skip-chars-forward " \t\n\f")
          (let ((p (point))
!               (not-hidable nil))
            (beginning-of-line)
            (unless (looking-at (concat "[ \t]*" hs-c-start-regexp))
              ;; we are in this situation: (example)
--- 539,553 ----
      (let ((q (point)))
        (when (or (looking-at hs-c-start-regexp)
                  (re-search-backward hs-c-start-regexp (point-min) t))
+         ;; first get to the beginning of this comment...
+         (while (and (not (bobp))
+                     (= (point) (progn (forward-comment -1) (point))))
+           (forward-char -1))
+         ;; ...then extend backwards
          (forward-comment (- (buffer-size)))
          (skip-chars-forward " \t\n\f")
          (let ((p (point))
!               (hidable t))
            (beginning-of-line)
            (unless (looking-at (concat "[ \t]*" hs-c-start-regexp))
              ;; we are in this situation: (example)
***************
*** 571,583 ****
              (when (or (not (looking-at hs-c-start-regexp))
                        (> (point) q))
                ;; we cannot hide this comment block
!               (setq not-hidable t)))
            ;; goto the end of the comment
            (forward-comment (buffer-size))
            (skip-chars-backward " \t\n\f")
            (end-of-line)
            (when (>= (point) q)
!             (list (if not-hidable nil p) (point))))))))
  
  (defun hs-grok-mode-type ()
    "Set up hideshow variables for new buffers.
--- 572,584 ----
              (when (or (not (looking-at hs-c-start-regexp))
                        (> (point) q))
                ;; we cannot hide this comment block
!               (setq hidable nil)))
            ;; goto the end of the comment
            (forward-comment (buffer-size))
            (skip-chars-backward " \t\n\f")
            (end-of-line)
            (when (>= (point) q)
!             (list (and hidable p) (point))))))))
  
  (defun hs-grok-mode-type ()
    "Set up hideshow variables for new buffers.




reply via email to

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