Function: bibtex-font-lock-url

bibtex-font-lock-url is a byte-compiled function defined in bibtex.el.gz.

Signature

(bibtex-font-lock-url BOUND &optional NO-BUTTON)

Documentation

Font-lock for URLs. BOUND limits the search.

If NO-BUTTON is non-nil do not generate buttons.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-font-lock-url (bound &optional no-button)
  "Font-lock for URLs.  BOUND limits the search.
If NO-BUTTON is non-nil do not generate buttons."
  (let ((case-fold-search t)
        (pnt (point))
        name bounds start end found)
    (bibtex-beginning-of-field)
    (while (and (not found)
                (<= (point) bound)
		(prog1 (re-search-forward bibtex-font-lock-url-regexp bound t)
		  (setq name (match-string-no-properties 1)))
		(setq bounds (bibtex-parse-field-text))
                (progn
                  (setq start (car bounds) end (nth 1 bounds))
                  ;; Always ignore field delimiters
                  (if (memq (char-before end) '(?\} ?\"))
                      (setq end (1- end)))
                  (if (memq (char-after start) '(?\{ ?\"))
                      (setq start (1+ start)))
                  (if (< start pnt) (setq start (min pnt end)))
                  (<= start bound)))
      (if (<= pnt start)
          (let ((lst bibtex-generate-url-list) url)
            (while (and (not found) (setq url (car (pop lst))))
              (goto-char start)
              (setq found (and (bibtex-string= name (car url))
                               (re-search-forward (cdr url) end t))))))
      (unless found (goto-char end)))
    (if (and found (not no-button))
        (bibtex-button (match-beginning 0) (match-end 0)
                       'bibtex-url (match-beginning 0)))
    found))