Function: uncomment-region

uncomment-region is an interactive and byte-compiled function defined in newcomment.el.gz.

Signature

(uncomment-region BEG END &optional ARG)

Documentation

Uncomment each line in the BEG .. END region.

The numeric prefix ARG can specify a number of chars to remove from the comment delimiters.

View in manual

Key Bindings

Aliases

prolog-uncomment-region (obsolete since 28.1) tcl-uncomment-region (obsolete since 28.1)

Source Code

;; Defined in /usr/src/emacs/lisp/newcomment.el.gz
;;;###autoload
(defun uncomment-region (beg end &optional arg)
  "Uncomment each line in the BEG .. END region.
The numeric prefix ARG can specify a number of chars to remove from the
comment delimiters."
  (interactive "*r\nP")
  (comment-normalize-vars)
  (when (> beg end) (setq beg (prog1 end (setq end beg))))
  ;; Bind `comment-use-global-state' to nil.  While uncommenting a region
  ;; (which works a line at a time), a comment can appear to be
  ;; included in a multi-line string, but it is actually not.
  (let ((comment-use-global-state nil))
    (save-excursion
      (funcall uncomment-region-function beg end arg))))