emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112466: * lisp/progmodes/octave.el (


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112466: * lisp/progmodes/octave.el (octave-texinfo-font-lock-keywords): Remove.
Date: Sun, 05 May 2013 22:29:42 -0400
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112466
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sun 2013-05-05 22:29:42 -0400
message:
  * lisp/progmodes/octave.el (octave-texinfo-font-lock-keywords): Remove.
  (octave-font-lock-texinfo-comment): Use texinfo-font-lock-keywords with
  some tweaks, instead.
modified:
  lisp/ChangeLog
  lisp/progmodes/octave.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-05-05 15:29:51 +0000
+++ b/lisp/ChangeLog    2013-05-06 02:29:42 +0000
@@ -1,3 +1,9 @@
+2013-05-06  Stefan Monnier  <address@hidden>
+
+       * progmodes/octave.el (octave-texinfo-font-lock-keywords): Remove.
+       (octave-font-lock-texinfo-comment): Use texinfo-font-lock-keywords with
+       some tweaks, instead.
+
 2013-05-05  Leo Liu  <address@hidden>
 
        * progmodes/octave.el (octave-font-lock-keywords)

=== modified file 'lisp/progmodes/octave.el'
--- a/lisp/progmodes/octave.el  2013-05-05 15:29:51 +0000
+++ b/lisp/progmodes/octave.el  2013-05-06 02:29:42 +0000
@@ -998,49 +998,40 @@
                            nil 'delimited nil nil beg end)
         (message "Function names match")))))
 
-;; Adapted from texinfo-font-lock-keywords
-(defvar octave-texinfo-font-lock-keywords
-  `(("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face prepend) ;commands
-    ("^\\*\\([^\n:]*\\)" 1 font-lock-function-name-face prepend) ;menu items
-    ("@\\(emph\\|i\\|sc\\){\\([^}]+\\)" 2 'italic prepend)
-    ("@\\(strong\\|b\\){\\([^}]+\\)" 2 'bold prepend)
-    ("@\\(kbd\\|key\\|url\\|uref\\){\\([^}]+\\)"
-     2 font-lock-string-face prepend)
-    ("@\\(file\\|email\\){\\([^}]+\\)" 2 font-lock-string-face prepend)
-    ("@\\(samp\\|code\\|var\\|math\\|env\\|command\\|option\\){\\([^}]+\\)"
-     2 font-lock-variable-name-face prepend)
-    ("@\\(cite\\|x?ref\\|pxref\\|dfn\\|inforef\\){\\([^}]+\\)"
-     2 font-lock-constant-face prepend)
-    ("@\\(anchor\\){\\([^}]+\\)" 2 font-lock-type-face prepend)
-    ("@\\(dmn\\|acronym\\|value\\){\\([^}]+\\)"
-     2 font-lock-builtin-face prepend)
-    ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-keyword-face prepend))
-  "Additional keywords to highlight in texinfo comment block.")
-
 (defface octave-function-comment-block
   '((t (:inherit font-lock-doc-face)))
   "Face used to highlight function comment block."
   :group 'octave)
 
+(eval-when-compile (require 'texinfo))
+
 (defun octave-font-lock-texinfo-comment ()
-  (font-lock-add-keywords
-   nil
-   `((,(lambda (limit)
-         (while (and (search-forward "-*- texinfo -*-" limit t)
-                     (octave-in-comment-p))
-           (let ((beg (nth 8 (syntax-ppss)))
-                 (end (progn
-                        (octave-skip-comment-forward (point-max))
-                        (point))))
-             (put-text-property beg end 'font-lock-multiline t)
-             (font-lock-prepend-text-property
-              beg end 'face 'octave-function-comment-block)
-             (dolist (kw octave-texinfo-font-lock-keywords)
-               (goto-char beg)
-               (while (re-search-forward (car kw) end 'move)
-                 (font-lock-apply-highlight (cdr kw))))))
-         nil)))
-   'append))
+  (let ((kws
+         (eval-when-compile
+           (delq nil (mapcar
+                      (lambda (kw)
+                        (if (numberp (nth 1 kw))
+                            `(,(nth 0 kw) ,(nth 1 kw) ,(nth 2 kw) prepend)
+                          (message "Ignoring Texinfo highlight: %S" kw)))
+                      texinfo-font-lock-keywords)))))
+    (font-lock-add-keywords
+     nil
+     `((,(lambda (limit)
+           (while (and (search-forward "-*- texinfo -*-" limit t)
+                       (octave-in-comment-p))
+             (let ((beg (nth 8 (syntax-ppss)))
+                   (end (progn
+                          (octave-skip-comment-forward (point-max))
+                          (point))))
+               (put-text-property beg end 'font-lock-multiline t)
+               (font-lock-prepend-text-property
+                beg end 'face 'octave-function-comment-block)
+               (dolist (kw kws)
+                 (goto-char beg)
+                 (while (re-search-forward (car kw) end 'move)
+                   (font-lock-apply-highlight (cdr kw))))))
+           nil)))
+     'append)))
 
 
 ;;; Indentation


reply via email to

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