diff options
author | Thien-Thi Nguyen <ttn@gnuvola.org> | 1998-09-13 21:55:51 +0000 |
---|---|---|
committer | Thien-Thi Nguyen <ttn@gnuvola.org> | 1998-09-13 21:55:51 +0000 |
commit | 0fbb5ac47b532820496dd9215d7bbc8088466ec6 (patch) | |
tree | 8ec336de4ffc345d97c5977360e8ee5eb6d887a5 | |
parent | 5f4234dc1bb30bf0d247c5dd7e5cf1b24608d395 (diff) | |
download | emacs-0fbb5ac47b532820496dd9215d7bbc8088466ec6.tar.gz |
(hs-grok-mode-type) Handle nil `comment-start' and `comment-end'.
-rw-r--r-- | lisp/progmodes/hideshow.el | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index a94672ac7bc..d811e7d50b8 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -5,7 +5,7 @@ ;; Author: Thien-Thi Nguyen <ttn@netcom.com> ;; Dan Nicolaescu <done@ece.arizona.edu> ;; Keywords: C C++ java lisp tools editing comments blocks hiding outlines -;; Maintainer-Version: 4.20 +;; Maintainer-Version: 4.21 ;; Time-of-Day-Author-Most-Likely-to-be-Recalcitrant: early morning ;; This file is part of GNU Emacs. @@ -497,19 +497,21 @@ If `hs-special-modes-alist' has information associated with the current buffer's major mode, use that. Otherwise, guess start, end and comment-start regexps; forward-sexp function; and adjust-block-beginning function." - (when (and (boundp 'comment-start) - (boundp 'comment-end)) - (let ((lookup (assoc major-mode hs-special-modes-alist))) - (setq hs-block-start-regexp (or (nth 1 lookup) "\\s\(") - hs-block-end-regexp (or (nth 2 lookup) "\\s\)") - hs-c-start-regexp (or (nth 3 lookup) - (let ((c-start-regexp - (regexp-quote comment-start))) - (if (string-match " +$" c-start-regexp) - (substring c-start-regexp 0 (1- (match-end 0))) - c-start-regexp))) - hs-forward-sexp-func (or (nth 4 lookup) 'forward-sexp) - hs-adjust-block-beginning (nth 5 lookup))))) + (if (and (boundp 'comment-start) + (boundp 'comment-end) + comment-start comment-end) + (let ((lookup (assoc major-mode hs-special-modes-alist))) + (setq hs-block-start-regexp (or (nth 1 lookup) "\\s\(") + hs-block-end-regexp (or (nth 2 lookup) "\\s\)") + hs-c-start-regexp (or (nth 3 lookup) + (let ((c-start-regexp + (regexp-quote comment-start))) + (if (string-match " +$" c-start-regexp) + (substring c-start-regexp 0 (1- (match-end 0))) + c-start-regexp))) + hs-forward-sexp-func (or (nth 4 lookup) 'forward-sexp) + hs-adjust-block-beginning (nth 5 lookup))) + (error "% Mode doesn't support Hideshow Mode" mode-name))) (defun hs-find-block-beginning () "Reposition point at block-start. |