Function: cperl-commentify

cperl-commentify is a byte-compiled function defined in cperl-mode.el.gz.

Signature

(cperl-commentify BEGIN END STRING)

Documentation

Mark text from BEGIN to END as generic string or comment.

Mark as generic string if STRING, as generic comment otherwise. A single character is marked as punctuation and directly fontified. Do nothing if BEGIN and END are equal. If cperl-use-syntax-text-property is nil, just fontify.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cperl-mode.el.gz
(defun cperl-commentify (begin end string)
  "Mark text from BEGIN to END as generic string or comment.
Mark as generic string if STRING, as generic comment otherwise.
A single character is marked as punctuation and directly
fontified.  Do nothing if BEGIN and END are equal.  If
`cperl-use-syntax-text-property' is nil, just fontify."
  (if (and cperl-use-syntax-table-text-property
           (> end begin))
      (progn
        (setq string (if string cperl-st-sfence cperl-st-cfence))
        (if (> begin (- end 2))
	    ;; one-char string/comment?!
	    (cperl-modify-syntax-type begin cperl-st-punct)
          (cperl-modify-syntax-type begin string)
          (cperl-modify-syntax-type (1- end) string))
        (if (and (eq string cperl-st-sfence) (> (- end 2) begin))
	    (put-text-property (1+ begin) (1- end)
			       'syntax-table cperl-string-syntax-table))
        (cperl-protect-defun-start begin end))
    ;; Fontify
    (when cperl-pod-here-fontify
      (put-text-property begin end 'face (if string 'font-lock-string-face
                                           'font-lock-comment-face)))))