Emacs part12
■ このスレッドは過去ログ倉庫に格納されています
0888871
NGNGregexp だけだと多分無理な気がするんで、こんなんでどうすかね?
matcher を関数にするときって、成功したらその最後の位置まで point を動かしとか
ないといけないんですね。初めて知った。じゃないと無限ル・・・
(defun 883-font-lock-matcher (bound)
(let (beg end)
(save-match-data
(and (search-forward "'''" bound t)
(setq beg (match-end 0)))
(and (search-forward "'''" bound t)
(setq end (match-beginning 0))))
(when (and beg end)
(set-match-data
(list (save-excursion (goto-char beg) (point-marker))
(save-excursion (goto-char end) (point-marker))))
t)))
(let ((buf-name "*font-lock-test*"))
(and (get-buffer buf-name)
(kill-buffer buf-name))
(setq test-font-lock-keywords '((883-font-lock-matcher . font-lock-string-face)))
(with-current-buffer (get-buffer-create buf-name)
(set (make-local-variable 'font-lock-defaults)
'(test-font-lock-keywords))
(turn-on-font-lock)))
■ このスレッドは過去ログ倉庫に格納されています