emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/progmodes/ps-mode.el


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/ps-mode.el
Date: Sat, 10 Nov 2001 14:36:51 -0500

Index: emacs/lisp/progmodes/ps-mode.el
diff -u emacs/lisp/progmodes/ps-mode.el:1.8 emacs/lisp/progmodes/ps-mode.el:1.9
--- emacs/lisp/progmodes/ps-mode.el:1.8 Fri Oct 26 05:14:10 2001
+++ emacs/lisp/progmodes/ps-mode.el     Sat Nov 10 14:36:51 2001
@@ -5,7 +5,7 @@
 ;; Author:     Peter Kleiweg <address@hidden>
 ;; Maintainer: Peter Kleiweg <address@hidden>
 ;; Created:    20 Aug 1997
-;; Version:    1.1f, 25 Oct 2001
+;; Version:    1.1g, 9 Nov 2001
 ;; Keywords:   PostScript, languages
 
 ;; This file is part of GNU Emacs.
@@ -30,7 +30,7 @@
 
 ;;; Code:
 
-(defconst ps-mode-version "1.1f, 25 Oct 2001")
+(defconst ps-mode-version "1.1g, 9 Nov 2001")
 (defconst ps-mode-maintainer-address "Peter Kleiweg <address@hidden>")
 
 (require 'easymenu)
@@ -256,10 +256,13 @@
    ps-mode-font-lock-keywords-1
    (list
     '("//\\w+" . font-lock-type-face)
-    '("^\\(/\\w+\\)\\>[[ \t]*\\(%.*\\)?\r?$"
+    `(,(concat
+       "^\\(/\\w+\\)\\>"
+       "\\([[ \t]*\\(%.*\\)?\r?$"      ; Nothing but `[' or comment after the 
name.
+       "\\|[ \t]*\\({\\|<<\\)"         ; `{' or `<<' following the name.
+       "\\|[ \t]+[0-9]+[ \t]+dict\\>"  ; `[0-9]+ dict' following the name.
+       "\\|.*\\<def\\>\\)")            ; `def' somewhere on the same line.
       . (1 font-lock-function-name-face))
-    '("^\\(/\\w+\\)\\>\\([ \t]*{\\|[ \t]*<<\\|.*\\<def\\>\\|[ \t]+[0-9]+[ 
\t]+dict\\>\\)"
-      . (1 font-lock-function-name-face))
     '("/\\w+" . font-lock-variable-name-face)
     (cons ps-mode-operators 'font-lock-keyword-face)))
   "High level highliting for PostScript mode.")
@@ -523,7 +526,10 @@
          ps-mode-font-lock-keywords-1
          ps-mode-font-lock-keywords-2
          ps-mode-font-lock-keywords-3)
-        t)))
+        t))
+  (set (make-local-variable 'comment-start) "%")
+  ;; NOTE: `\' has a special meaning in strings only
+  (set (make-local-variable 'comment-start-skip) "%+[ \t]*"))
 
 (defun ps-mode-show-version ()
   "Show current version of PostScript mode."
@@ -573,15 +579,13 @@
       ;; Search next bracket, stepping over escaped brackets.
       (if (not (looking-at "\\([^()\\\n]\\|\\\\.\\)*\\([()]\\)"))
           (setq level -1)
-        (if (string= "(" (match-string 2))
-           (setq level (1+ level))
-          (setq level (1- level)))
-        (goto-char (setq pos (match-end 0)))))
+       (setq level (+ level (if (string= "(" (match-string 2)) 1 -1)))
+       (goto-char (setq pos (match-end 0)))))
     (if (not (= level 0))
         nil
       ;; Found string with nested brackets, now set match data nr 2.
-      (goto-char first)
-      (re-search-forward "\\(%\\)\\|\\((.*\\)" pos))))
+      (set-match-data (list first pos nil nil first pos))
+      pos)))
 
 ;; This function should search for a string or comment
 ;; If comment, return as match data nr 1



reply via email to

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