Hi, when debugging app-xemacs/gentoo-syntax (ebuild-mode-keywords.el) I've noticed the following problem with font-lock mode. To reproduce: 1. xemacs -q # 21.5.28-r4 2. M-x font-lock-mode RET 3. Evaluate the following expression in the *scratch* buffer (this is the first example from the documentation of "font-lock-add-keywords", only with 'c-mode replaced by nil): (font-lock-add-keywords nil '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend) ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face))) This returns the following form: (t ("\\<\\(FIXME\\):" (1 font-lock-warning-face prepend)) ("\\<\\(and\\|or\\|not\\)\\>" (0 font-lock-keyword-face)) ("^(\\(def\\(\\(un\\|advice\\|alias\\|macro\\*?\\|setf\\|subst\\*?\\|-edebug-spec\\|method\\|generic\\|ine-\\(?:compiler-macro\\|function\\|function-when-void\\|modify-macro\\|setf-method\\|compatible-function-alias\\|obsolete-function-alias\\|ccl-program\\|device-method\\*?\\|prefix-command\\|skeleton\\)\\)\\|\\(class\\|struct\\|type\\)\\)\\>\\|def\\([^ \n()]+\\)\\)\\>[ '(]*\\([^ \n()]+\\)?" (0 font-lock-keyword-face)) (1 (font-lock-keyword-face)) (6 (cond ((match-beginning 3) 'font-lock-function-name-face) ((match-beginning 4) 'font-lock-type-face) (t 'font-lock-variable-name-face)) nil t)) ... and produces an error: (6) (general/warning) Error in unknown: Invalid function: 1 Backtrace follows: 1(1439) # bind (highlights matcher keyword nkeywords iter old-progress progress bufname keywords case-fold-search loudly loudvar end start) font-lock-fontify-keywords-region(701 1439 nil) # (unwind-protect ...) # bind (modified buffer-undo-list inhibit-read-only old-syntax-table buffer-file-name buffer-file-truename loudly end beg) font-lock-default-fontify-region(701 1439 nil) # bind (loudly end beg) font-lock-fontify-region(701 1439) # bind (val end beg) #<compiled-function (beg end val) "...(5)" [end beg font-lock-fontify-region] 3>(701 1439 t) map-range-table(#<compiled-function (beg end val) "...(5)" [end beg font-lock-fontify-region] 3> #<range-table [701 1439) t 0x3ac48>) # (unwind-protect ...) # (unwind-protect ...) # (unwind-protect ...) # bind (dummy buffer) #<compiled-function (buffer dummy) "...(47)" [font-lock-pending-buffer-table font-lock-range-table buffer remhash buffer-live-p clear-range-table map-extents #<compiled-function (ex dummy-maparg) "...(32)" [font-lock-range-table ex end beg extent-start-position extent-end-position 0 1 put-range-table t] 5> nil font-lock-pending t put-text-property map-range-table #<compiled-function (beg end val) "...(5)" [end beg font-lock-fontify-region] 3>] 9>(#<buffer "*scratch*"> t) # (unwind-protect ...) maphash(#<compiled-function (buffer dummy) "...(47)" [font-lock-pending-buffer-table font-lock-range-table buffer remhash buffer-live-p clear-range-table map-extents #<compiled-function (ex dummy-maparg) "...(32)" [font-lock-range-table ex end beg extent-start-position extent-end-position 0 1 put-range-table t] 5> nil font-lock-pending t put-text-property map-range-table #<compiled-function (beg end val) "...(5)" [end beg font-lock-fontify-region] 3>] 9> #<hash-table size 0/29 weakness key 0x3ac0a>) # (unwind-protect ...) # bind (match-data) font-lock-fontify-pending-extents() #<compiled-function nil "...(10)" [font-lock-pending-buffer-table hash-table-count 0 font-lock-fontify-pending-extents] 2>() # (unwind-protect ...) call-with-condition-handler(#<compiled-function (__call_trapping_errors_arg__) "...(17)" [__call_trapping_errors_arg__ errstr error-message-string lwarn general warning "Error in %s: %s\n\nBacktrace follows:\n\n%s" "unknown" backtrace-in-condition-handler-eliminating-handler] 8> #<compiled-function nil "...(10)" [font-lock-pending-buffer-table hash-table-count 0 font-lock-fontify-pending-extents] 2>) # (condition-case ... . ((error))) font-lock-pre-idle-hook() # (unwind-protect ...) # (catch #<INTERNAL OBJECT (XEmacs bug?) (opaque, size=0) 0x98e8020> ...) # (unwind-protect ...) # (unwind-protect ...) # bind (inhibit-quit) # (unwind-protect ...) # (unwind-protect ...) # bind (inhibit-quit) (next-event "[internal]") # (condition-case ... . error) # (catch top-level ...)
To clarify, the error message is not from evaluation of font-lock-add-keywords, but occurs during the following fontification of the buffer.
I can't reproduce this with latest xemacs ebuild - xemacs-21.5.34-r4.ebuild.