emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/textmodes/conf-mode.el [emacs-unicod


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/conf-mode.el [emacs-unicode-2]
Date: Wed, 08 Dec 2004 02:13:17 -0500

Index: emacs/lisp/textmodes/conf-mode.el
diff -c emacs/lisp/textmodes/conf-mode.el:1.3.2.1 
emacs/lisp/textmodes/conf-mode.el:1.3.2.2
*** emacs/lisp/textmodes/conf-mode.el:1.3.2.1   Fri Nov 12 02:53:04 2004
--- emacs/lisp/textmodes/conf-mode.el   Wed Dec  8 05:02:27 2004
***************
*** 76,81 ****
--- 76,82 ----
      (define-key map "\C-c\C-c" 'conf-colon-mode)
      (define-key map "\C-c:" 'conf-colon-mode)
      (define-key map "\C-c\C-x" 'conf-xdefaults-mode)
+     (define-key map "\C-c\C-p" 'conf-ppd-mode)
      (define-key map "\C-c\C-q" 'conf-quote-normal)
      (define-key map "\C-c\"" 'conf-quote-normal)
      (define-key map "\C-c'" 'conf-quote-normal)
***************
*** 90,96 ****
      (modify-syntax-entry ?-  "_" table)
      (modify-syntax-entry ?.  "_" table)
      (modify-syntax-entry ?\' "\"" table)
- ;    (modify-syntax-entry ?:  "_" table)
      (modify-syntax-entry ?\; "<" table)
      (modify-syntax-entry ?\n ">" table)
      (modify-syntax-entry ?\r ">" table)
--- 91,96 ----
***************
*** 112,117 ****
--- 112,127 ----
      table)
    "Syntax table in use in Java prperties buffers.")
  
+ (defvar conf-ppd-mode-syntax-table
+   (let ((table (make-syntax-table conf-mode-syntax-table)))
+     (modify-syntax-entry ?*  ". 1" table)
+     (modify-syntax-entry ?%  ". 2" table)
+     ;; override
+     (modify-syntax-entry ?\' "." table)
+     (modify-syntax-entry ?\; "." table)
+     table)
+   "Syntax table in use in PPD conf-mode buffers.")
+ 
  (defvar conf-xdefaults-mode-syntax-table
    (let ((table (make-syntax-table conf-mode-syntax-table)))
      (modify-syntax-entry ?!  "<" table)
***************
*** 230,247 ****
        (forward-line))))
  
  
! (defun conf-quote-normal ()
!   "Set the syntax of \" and ' to punctuation.
  This only affects the current buffer.  Some conf files use quotes
  to delimit strings, while others allow quotes as simple parts of
  the assigned value.  In those files font locking will be wrong,
  and you can correct it with this command.  (Some files even do
  both, i.e. quotes delimit strings, except when they are
  unbalanced, but hey...)"
!   (interactive)
    (let ((table (copy-syntax-table (syntax-table))))
!     (modify-syntax-entry ?\" "." table)
!     (modify-syntax-entry ?\' "." table)
      (set-syntax-table table)
      (and (boundp 'font-lock-mode)
         font-lock-mode
--- 240,258 ----
        (forward-line))))
  
  
! (defun conf-quote-normal (arg)
!   "Set the syntax of ' and \" to punctuation.
! With prefix arg, only do it for ' if 1, or only for \" if 2.
  This only affects the current buffer.  Some conf files use quotes
  to delimit strings, while others allow quotes as simple parts of
  the assigned value.  In those files font locking will be wrong,
  and you can correct it with this command.  (Some files even do
  both, i.e. quotes delimit strings, except when they are
  unbalanced, but hey...)"
!   (interactive "P")
    (let ((table (copy-syntax-table (syntax-table))))
!     (if (or (not arg) (= (prefix-numeric-value arg) 1)) (modify-syntax-entry 
?\' "." table))
!     (if (or (not arg) (= (prefix-numeric-value arg) 2)) (modify-syntax-entry 
?\" "." table))
      (set-syntax-table table)
      (and (boundp 'font-lock-mode)
         font-lock-mode
***************
*** 284,292 ****
  command, it will parse the buffer.  It will generally well
  identify the first four cases listed below.  If the buffer
  doesn't have enough contents to decide, this is identical to
! `conf-windows-mode' on Windows, elsewhere to `conf-unix-mode'.  See
! also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode' and
! `conf-xdefaults-mode'.
  
  \\{conf-mode-map}"
  
--- 295,303 ----
  command, it will parse the buffer.  It will generally well
  identify the first four cases listed below.  If the buffer
  doesn't have enough contents to decide, this is identical to
! `conf-windows-mode' on Windows, elsewhere to `conf-unix-mode'.
! See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode',
! `conf-ppd-mode' and `conf-xdefaults-mode'.
  
  \\{conf-mode-map}"
  
***************
*** 328,334 ****
          mode-name name)
      (set (make-local-variable 'comment-start) comment)
      (set (make-local-variable 'comment-start-skip)
!        (concat comment-start "+\\s *"))
      (set (make-local-variable 'comment-use-syntax) t)
      (set (make-local-variable 'parse-sexp-ignore-comments) t)
      (set (make-local-variable 'outline-regexp)
--- 339,345 ----
          mode-name name)
      (set (make-local-variable 'comment-start) comment)
      (set (make-local-variable 'comment-start-skip)
!        (concat (regexp-quote comment-start) "+\\s *"))
      (set (make-local-variable 'comment-use-syntax) t)
      (set (make-local-variable 'parse-sexp-ignore-comments) t)
      (set (make-local-variable 'outline-regexp)
***************
*** 343,349 ****
            ;; [section]
            (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1)
            ;; section { ... }
!           (nil "^[ \t]*\\([^=:\n]+\\)[ \t\n]*{" 1)))
  
      (run-mode-hooks 'conf-mode-hook)))
  
--- 354,360 ----
            ;; [section]
            (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1)
            ;; section { ... }
!           (nil "^[ \t]*\\([^=:{} \t\n][^=:{}\n]+\\)[ \t\n]*{" 1)))
  
      (run-mode-hooks 'conf-mode-hook)))
  
***************
*** 504,509 ****
--- 515,535 ----
          ,@(cdr imenu-generic-expression))))
  
  ;;;###autoload
+ (defun conf-ppd-mode ()
+   "Conf Mode starter for Adobe/CUPS PPD files.
+ Comments start with `*%' and \"assignments\" are with `:'.
+ For details see `conf-mode'.  Example:
+ 
+ *% Conf mode font-locks this right with C-c C-p (PPD)
+ 
+ *DefaultTransfer: Null
+ *Transfer Null.Inverse: \"{ 1 exch sub }\""
+   (interactive)
+   (conf-colon-mode "*%" conf-ppd-mode-syntax-table "Conf[PPD]")
+   ;; no sections, they match within PostScript code
+   (setq imenu-generic-expression (list (car imenu-generic-expression))))
+ 
+ ;;;###autoload
  (defun conf-xdefaults-mode ()
    "Conf Mode starter for Xdefaults files.
  Comments start with `!' and \"assignments\" are with `:'.




reply via email to

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