Function: fortran-make-syntax-propertize-function

fortran-make-syntax-propertize-function is a byte-compiled function defined in fortran.el.gz.

Signature

(fortran-make-syntax-propertize-function LINE-LENGTH)

Documentation

Return a value for syntax-propertize-function in Fortran mode.

This varies according to the value of LINE-LENGTH. This is used to fontify fixed-format Fortran comments.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/fortran.el.gz
;; Comments are real pain in Fortran because there is no way to
;; represent the standard comment syntax in an Emacs syntax table.
;; (We can do so for F90-style).  Therefore an unmatched quote in a
;; standard comment will throw fontification off on the wrong track.
;; So we do syntactic fontification with regexps.
(defun fortran-make-syntax-propertize-function (line-length)
  "Return a value for `syntax-propertize-function' in Fortran mode.
This varies according to the value of LINE-LENGTH.
This is used to fontify fixed-format Fortran comments."
  ;; This results in a non-byte-compiled function.  We could pass it through
  ;; `byte-compile', but simple benchmarks indicate that it's probably not
  ;; worth the trouble (about 0.5% of slow down).
  (eval                         ;I hate `eval', but it's hard to avoid it here.
   `(syntax-propertize-rules
     ("^[CcDd\\*]" (0 "<"))
     ;; We mark all chars after line-length as "comment-start", rather than
     ;; just the first one.  This is so that a closing ' that's past the
     ;; line-length will indeed be ignored (and will result in a string that
     ;; leaks into subsequent lines).
     (,(format "^[^CcDd\\*\t\n].\\{%d\\}\\(.+\\)" (1- line-length))
      (1 "<")))
   t))