1

I edit some files that are mostly C code but include a few special extension tokens. The tokens that give c-mode a problem are @' and @".

I essentially want c-mode to ignore these two bigrams. The current behavior is that the quote (single or double) is interpreted as the beginning of a quoted string.

I reckon this is childs play for anyone well versed in elisp syntax tables but I am not hence my appeal for your help.

Scott Weldon
  • 2,695
  • 1
  • 17
  • 31

1 Answers1

1

You have to put a syntax-table property on the ' and " characters, e.g.:

(defun c-propertize-@ ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "@\\(\"\\|'\\)" nil t)
      (put-text-property (match-beginning 1)
                         (match-end 1)
                         'syntax-table
                         '(1))))) ;;= punctuation

Take a look at syntax-propertize-function, if you also want to edit these tokens.

politza
  • 3,316
  • 14
  • 16