Function: web-mode-toggle-comments

web-mode-toggle-comments is an interactive and natively compiled function defined in web-mode.el.

Signature

(web-mode-toggle-comments)

Documentation

Toggle comments visibility.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
;;---- COMMENT ------------------------------------------------------------------

(defun web-mode-toggle-comments ()
  "Toggle comments visibility."
  (interactive)
  (with-silent-modifications
   (save-excursion
     (if web-mode-comments-invisible
         (remove-overlays))
     (setq web-mode-comments-invisible (null web-mode-comments-invisible))
     (let ((continue t)
           (pos (point-min))
           (visibility web-mode-comments-invisible)
           end)
       (while continue
         (setq pos (next-single-property-change pos 'font-lock-face))
         (if (null pos)
             (setq continue nil)
             (when (eq (get-text-property pos 'font-lock-face) 'web-mode-comment-face)
               (setq end (next-single-property-change pos 'font-lock-face))
               (put-text-property pos end 'invisible visibility)
               (when visibility
                 (make-overlay pos end))
               (goto-char pos)
               )
             )
         )
       ) ;let
     )))