Function: hide-ifdefs

hide-ifdefs is an interactive and byte-compiled function defined in hideif.el.gz.

Signature

(hide-ifdefs &optional START END NOMSG)

Documentation

Hide the contents of some #ifdefs.

Assume that defined symbols have been added to hide-ifdef-env. The text hidden is the text that would not be included by the C preprocessor if it were given the file with those symbols defined. With prefix argument, also hide the #ifdefs themselves.

Hiding will only be performed within the marked region if there is one.

Turn off hiding by calling show-ifdefs.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/hideif.el.gz
(defun hide-ifdefs (&optional start end nomsg)
  "Hide the contents of some #ifdefs.
Assume that defined symbols have been added to `hide-ifdef-env'.
The text hidden is the text that would not be included by the C
preprocessor if it were given the file with those symbols defined.
With prefix argument, also hide the #ifdefs themselves.

Hiding will only be performed within the marked region if there is one.

Turn off hiding by calling `show-ifdefs'."

  (interactive
   (if (use-region-p)
       (list (region-beginning) (region-end))
     (list (point-min) (point-max))))

  (setq current-prefix-arg (or hide-ifdef-lines current-prefix-arg))
  (save-restriction
    (let* ((hide-ifdef-lines current-prefix-arg)
           (outer-hide-ifdef-verbose hide-ifdef-verbose)
           (hide-ifdef-verbose (and outer-hide-ifdef-verbose
                                    (not (or nomsg (use-region-p)))))
           (hide-start-time (current-time)))
      (and hide-ifdef-verbose
           (message "Hiding..."))
      (setq hif-outside-read-only buffer-read-only)
      (unless hide-ifdef-mode (hide-ifdef-mode 1)) ; Turn on hide-ifdef-mode
      (if hide-ifdef-hiding
          (show-ifdefs))                    ; Otherwise, deep confusion.
      (setq hide-ifdef-hiding t)
      (narrow-to-region (or start (point-min)) (or end (point-max)))
      (hide-ifdef-guts)
      (setq buffer-read-only
            (or hide-ifdef-read-only hif-outside-read-only))
      (and hide-ifdef-verbose
           (message "Hiding done, %.1f seconds elapsed"
		    (float-time (time-subtract nil hide-start-time)))))))