comparison lisp/progmodes/hideshow.el @ 18867:b6e4c4c2a3ef

(hs-special-modes-alist): Use a regexp generated by regexp-opt. (hs-life-goes-on): Nullify inhibit-point-motion-hooks as we have to move inside intangible overlays. Enable edebug.
author Richard M. Stallman <rms@gnu.org>
date Sat, 19 Jul 1997 05:34:45 +0000
parents 5ec58687160a
children 520a7d40d75c
comparison
equal deleted inserted replaced
18866:04d56f77da0d 18867:b6e4c4c2a3ef
157 157
158 ;;;#autoload 158 ;;;#autoload
159 (defvar hs-special-modes-alist 159 (defvar hs-special-modes-alist
160 '((c-mode "{" "}" nil nil hs-c-like-adjust-block-beginning) 160 '((c-mode "{" "}" nil nil hs-c-like-adjust-block-beginning)
161 (c++-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning) 161 (c++-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning)
162 (java-mode "\\(\\(\\([ \t]*\\(\\(public\\|private\\|protected\\|abstract\\|static\\|\\final\\)[ \t\n]+\\)+\\(synchronized[ \t\n]*\\)?[a-zA-Z0-9_:]+[ \t\n]*\\(\\[[ \t\n]*\\][ \t\n]*\\)?\\([a-zA-Z0-9_:]+[ \t\n]*\\)([^)]*)\\([ \n\t]+throws[ \t\n][^{]+\\)?\\)\\|\\([ \t]*static[^{]*\\)\\)[ \t\n]*{\\)" "}" "/[*/]" java-hs-forward-sexp hs-c-like-adjust-block-beginning)) 162 (java-mode "\\(\\(\\([ \t]*\\(\\(abstract\\|final\\|p\\(r\\(ivate\\|otected\\)\\|ublic\\)\\|static\\)[ \t\n]+\\)+\\(synchronized[ \t\n]*\\)?[a-zA-Z0-9_:]+[ \t\n]*\\(\\[[ \t\n]*\\][ \t\n]*\\)?\\([a-zA-Z0-9_:]+[ \t\n]*\\)([^)]*)\\([ \n\t]+throws[ \t\n][^{]+\\)?\\)\\|\\([ \t]*static[^{]*\\)\\)[ \t\n]*{\\)" java-hs-forward-sexp hs-c-like-adjust-block-beginning))
163 ; I tested the java regexp using the following: 163 ; I tested the java regexp using the following:
164 ;(defvar hsj-public) 164 ;(defvar hsj-public)
165 ;(defvar hsj-syncronised) 165 ;(defvar hsj-syncronised)
166 ;(defvar hsj-type) 166 ;(defvar hsj-type)
167 ;(defvar hsj-fname) 167 ;(defvar hsj-fname)
168 ;(defvar hsj-par) 168 ;(defvar hsj-par)
169 ;(defvar hsj-throws) 169 ;(defvar hsj-throws)
170 ;(defvar hsj-static) 170 ;(defvar hsj-static)
171 171
172 ;(setq hsj-public "[ \t]*\\(\\(public\\|private\\|protected\\|abstract\\|static\\|\\final\\)[ \t\n]+\\)+") 172 ;(setq hsj-public
173 ; (concat "[ \t]*\\("
174 ; (regexp-opt '("public" "private" "protected" "abstract"
175 ; "static" "final") 1)
176 ; "[ \t\n]+\\)+"))
177
173 ;(setq hsj-syncronised "\\(synchronized[ \t\n]*\\)?") 178 ;(setq hsj-syncronised "\\(synchronized[ \t\n]*\\)?")
174 ;(setq hsj-type "[a-zA-Z0-9_:]+[ \t\n]*\\(\\[[ \t\n]*\\][ \t\n]*\\)?") 179 ;(setq hsj-type "[a-zA-Z0-9_:]+[ \t\n]*\\(\\[[ \t\n]*\\][ \t\n]*\\)?")
175 ;(setq hsj-fname "\\([a-zA-Z0-9_:]+[ \t\n]*\\)") 180 ;(setq hsj-fname "\\([a-zA-Z0-9_:]+[ \t\n]*\\)")
176 ;(setq hsj-par "([^)]*)") 181 ;(setq hsj-par "([^)]*)")
177 ;(setq hsj-throws "\\([ \n\t]+throws[ \t\n][^{]+\\)?") 182 ;(setq hsj-throws "\\([ \n\t]+throws[ \t\n][^{]+\\)?")
551 (goto-char (or done here)) 556 (goto-char (or done here))
552 done)) 557 done))
553 558
554 (defmacro hs-life-goes-on (&rest body) 559 (defmacro hs-life-goes-on (&rest body)
555 "Executes optional BODY iff variable `hs-minor-mode' is non-nil." 560 "Executes optional BODY iff variable `hs-minor-mode' is non-nil."
556 (list 'if 'hs-minor-mode (cons 'progn body))) 561 (` (let ((inhibit-point-motion-hooks t))
562 (when hs-minor-mode
563 (,@ body)))))
564
565 (put 'hs-life-goes-on 'edebug-form-spec '(&rest form))
557 566
558 (defun hs-already-hidden-p () 567 (defun hs-already-hidden-p ()
559 "Return non-nil if point is in an already-hidden block, otherwise nil." 568 "Return non-nil if point is in an already-hidden block, otherwise nil."
560 (save-excursion 569 (save-excursion
561 (let ((c-reg (hs-inside-comment-p))) 570 (let ((c-reg (hs-inside-comment-p)))