Function: org-fontify-inline-src-blocks-1

org-fontify-inline-src-blocks-1 is a byte-compiled function defined in org-src.el.gz.

Signature

(org-fontify-inline-src-blocks-1 LIMIT)

Documentation

Fontify inline src_LANG blocks, from point up to LIMIT.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-src.el.gz
(defun org-fontify-inline-src-blocks-1 (limit)
  "Fontify inline src_LANG blocks, from `point' up to LIMIT."
  (let ((case-fold-search t))
    ;; The regexp below is copied from `org-element-inline-src-block-parser'.
    (while (re-search-forward "\\_<src_\\([^ \t\n[{]+\\)[{[]?" limit t)
      (let ((beg (match-beginning 0))
            (lang-beg (match-beginning 1))
            (lang-end (match-end 1))
            pt)
        (add-face-text-property beg lang-end 'org-inline-src-block)
        (add-face-text-property beg lang-beg 'shadow)
        (add-face-text-property lang-beg lang-end 'org-meta-line)
        (setq pt (goto-char lang-end))
        ;; `org-element--parse-paired-brackets' doesn't take a limit, so to
        ;; prevent it searching the entire rest of the buffer we temporarily
        ;; narrow the active region.
        (save-restriction
          (narrow-to-region beg
                            (min limit (or (save-excursion
                                             (and (search-forward"\n" limit t 2)
                                                  (point)))
                                           (point-max))))
          (when (ignore-errors (org-element--parse-paired-brackets ?\[))
            (add-face-text-property pt (point) 'org-inline-src-block)
            (setq pt (point)))
          (when (ignore-errors (org-element--parse-paired-brackets ?\{))
            (remove-text-properties pt (point) '(face nil))
            (add-face-text-property pt (1+ pt) '(org-inline-src-block shadow))
            (unless (= (1+ pt) (1- (point)))
              (if org-src-fontify-natively
                  (org-src-font-lock-fontify-block
                   (buffer-substring-no-properties lang-beg lang-end)
                   (1+ pt) (1- (point)))
                (font-lock-append-text-property
                 (1+ pt) (1- (point)) 'face 'org-inline-src-block)))
            (add-face-text-property (1- (point)) (point) '(org-inline-src-block shadow))
            (setq pt (point)))))
      t)))