help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parens matching not matching all matching parens


From: Arjan Bos
Subject: Re: parens matching not matching all matching parens
Date: Fri, 17 Sep 2004 20:36:32 +0200
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.3) Gecko/20040910

Stefan Monnier wrote:

(define-generic-mode 'rtf-generic-mode
  nil
  nil
  (list "\\\\\\([a-z]+\\(-?[0-9]+\\)? ?\\)")
  (list "\\.[rR][tT][fF]")
  nil)


Try

(defvar rtf-font-lock-keywords
  '("\\\\\\([a-z]+\\(-?[0-9]+\\)? ?\\)"))

(defvar rtf-mode-syntax-table
  (let ((st (make-syntax-table)))
    (modify-syntax-entry ?\( "." st)
    (modify-syntax-entry ?\) "." st)
    (modify-syntax-entry ?\[ "." st)
    (modify-syntax-entry ?\] "." st)
    st))

;;;###autoload
(add-to-list 'auto-mode-alist '("\\.[rR][tT][fF]\\'" . rtf-mode))

(define-derived-mode rtf-mode text-mode "RTF"
  "Major mode for Rich Text Format."
  (set (make-local-variable 'font-lock-defaults)
       '(rtf-font-lock-keywords)))


-- Stefan
Stefan,

As always, your info is great, thanks! But I solved it by browsing generic-x.el and applying the needed changes.

btw, did you notice that indenting the syntax-table elisp above has problems with the parentheses and brackets?

Arjan

--
--
If you really want to contact me, then replace the "I see you" text by its three letter accronym, hetnet.

Fabricate Diem PVNC, Motto of the Night Watch -- Terry Pratchett


reply via email to

[Prev in Thread] Current Thread [Next in Thread]