emacs-diffs
[Top][All Lists]
Advanced

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

master a415179: Make hs-special-modes-alist also work for modes derived


From: Lars Ingebrigtsen
Subject: master a415179: Make hs-special-modes-alist also work for modes derived from those modes
Date: Fri, 21 Aug 2020 08:42:31 -0400 (EDT)

branch: master
commit a415179b56f022f50138f55d231070e3d1b00697
Author: Tobias Zawada <i_inbox@tn-home.de>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make hs-special-modes-alist also work for modes derived from those modes
    
    * 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                   | 4 ++++
 lisp/progmodes/hideshow.el | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 53391f9..8e3c220 100644
--- 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.
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index 625e08e..c5b9cfc 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -225,6 +225,8 @@
 ;;---------------------------------------------------------------------------
 ;; 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)



reply via email to

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