Function: c-narrow-to-comment-innards

c-narrow-to-comment-innards is a byte-compiled function defined in cc-cmds.el.gz.

Signature

(c-narrow-to-comment-innards RANGE)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-cmds.el.gz
(defun c-narrow-to-comment-innards (range)
  ;; Narrow to the "inside" of the comment (block) defined by range, as
  ;; follows:
  ;;
  ;; A c-style block comment has its opening "/*" and its closing "*/" (if
  ;; present) removed.  A c++-style line comment retains its opening "//" but
  ;; has any final NL removed.  If POINT is currently outwith these innards,
  ;; move it to the appropriate boundary.
  ;;
  ;; This narrowing simplifies the sentence movement functions, since it
  ;; eliminates awkward things at the boundaries of the comment (block).
  ;;
  ;; This function might do hidden buffer changes.
  (let* ((lit-type (c-literal-type range))
	 (beg (if (eq lit-type 'c) (+ (car range) 2) (car range)))
	 (end (if (eq lit-type 'c)
		  (if (and (eq (char-before (cdr range)) ?/)
			   (eq (char-before (1- (cdr range))) ?*))
		      (- (cdr range) 2)
		    (point-max))
		(if (eq (cdr range) (point-max))
		    (point-max)
		  (- (cdr range) 1)))))
    (if (> (point) end)
	(goto-char end))		; This would be done automatically by ...
    (if (< (point) beg)
	(goto-char beg))	;  ... narrow-to-region but is not documented.
    (narrow-to-region beg end)))