]> git.eshelyaron.com Git - emacs.git/commitdiff
Make hs-special-modes-alist also work for modes derived from those modes
authorTobias Zawada <i_inbox@tn-home.de>
Fri, 21 Aug 2020 12:42:20 +0000 (14:42 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 21 Aug 2020 12:42:20 +0000 (14:42 +0200)
* lisp/progmodes/hideshow.el (hs-grok-mode-type): Also set up
hideshow variables based on hs-special-modes-alist in derived
modes (bug#39354).

etc/NEWS
lisp/progmodes/hideshow.el

index 53391f91f733f5ac424a1d4ab7a6fddcb6107a87..8e3c2201e879bca48d1d404d159813889e515342 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -820,6 +820,10 @@ window after starting).  This variable defaults to nil.
 
 ** Miscellaneous
 
+---
+*** 'hs-special-modes-alist' is now also heeded for modes derived from
+the modes in that list.
+
 +++
 *** New global mode 'global-goto-address-mode'
 This will enable 'goto-address-mode' in all buffers.
index 625e08e4d797387c4516b2df21f2e1c89c073f05..c5b9cfc2e7b8bdc85a104ddcf2f0150f6cd3a6c8 100644 (file)
 ;;---------------------------------------------------------------------------
 ;; user-configurable variables
 
+(require 'cl-lib)
+
 (defgroup hideshow nil
   "Minor mode for hiding and showing program and comment blocks."
   :prefix "hs-"
@@ -652,7 +654,9 @@ Otherwise, guess start, end and `comment-start' regexps; `forward-sexp'
 function; and adjust-block-beginning function."
   (if (and (bound-and-true-p comment-start)
            (bound-and-true-p comment-end))
-      (let* ((lookup (assoc major-mode hs-special-modes-alist))
+      (let* ((lookup (cl-assoc-if (lambda (mode)
+                                   (derived-mode-p major-mode mode))
+                                 hs-special-modes-alist))
              (start-elem (or (nth 1 lookup) "\\s(")))
         (if (listp start-elem)
             ;; handle (START-REGEXP MDATA-SELECT)