It seems that HideShow mode is not compatible with LaTeX. Is there any way to achieve a similar effect: hide some blocks that I highlight?

1 Answer 1


HideShow has a non-interactive function that hides a region (hs-hide-comment-region). I've written a wrapper function to call this function on the current region, if it is active. You can have the region reappear with any of the HideShow "show" commands (e.g. hs-show-block while your point is on the hidden region). This command checks if HideShow is enabled in the current buffer, which is necessary to make sure that the hidden region is displayed properly and that the show commands will work properly.

This command should work in any buffer where hs-minor-mode is enabled, including ones where the major mode is LaTeX-mode.

(defun drg-hs-hide-region (beginning end)
  (interactive "r")
  (if hs-minor-mode
      (when (use-region-p)
        (hs-hide-comment-region beginning end)
    (message "hs-minor-mode must be enabled for this function to be run.")))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.