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


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/conf-mode.el
Date: Tue, 18 Oct 2005 11:26:08 -0400

Index: emacs/lisp/textmodes/conf-mode.el
diff -c emacs/lisp/textmodes/conf-mode.el:1.11 
emacs/lisp/textmodes/conf-mode.el:1.12
*** emacs/lisp/textmodes/conf-mode.el:1.11      Wed Aug 31 10:25:00 2005
--- emacs/lisp/textmodes/conf-mode.el   Tue Oct 18 15:26:08 2005
***************
*** 86,92 ****
      (define-key map "\C-c'" 'conf-quote-normal)
      (define-key map "\C-c\C-a" 'conf-align-assignments)
      map)
!   "Local keymap for conf-mode buffers.")
  
  (defvar conf-mode-syntax-table
    (let ((table (make-syntax-table)))
--- 86,92 ----
      (define-key map "\C-c'" 'conf-quote-normal)
      (define-key map "\C-c\C-a" 'conf-align-assignments)
      map)
!   "Local keymap for `conf-mode' buffers.")
  
  (defvar conf-mode-syntax-table
    (let ((table (make-syntax-table)))
***************
*** 99,105 ****
      (modify-syntax-entry ?\n ">" table)
      (modify-syntax-entry ?\r ">" table)
      table)
!   "Syntax table in use in Windows style conf-mode buffers.")
  
  (defvar conf-unix-mode-syntax-table
    (let ((table (make-syntax-table conf-mode-syntax-table)))
--- 99,105 ----
      (modify-syntax-entry ?\n ">" table)
      (modify-syntax-entry ?\r ">" table)
      table)
!   "Syntax table in use in Windows style `conf-mode' buffers.")
  
  (defvar conf-unix-mode-syntax-table
    (let ((table (make-syntax-table conf-mode-syntax-table)))
***************
*** 107,113 ****
      ;; override
      (modify-syntax-entry ?\; "." table)
      table)
!   "Syntax table in use in Unix style conf-mode buffers.")
  
  (defvar conf-javaprop-mode-syntax-table
    (let ((table (make-syntax-table conf-unix-mode-syntax-table)))
--- 107,113 ----
      ;; override
      (modify-syntax-entry ?\; "." table)
      table)
!   "Syntax table in use in Unix style `conf-mode' buffers.")
  
  (defvar conf-javaprop-mode-syntax-table
    (let ((table (make-syntax-table conf-unix-mode-syntax-table)))
***************
*** 124,130 ****
      (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)))
--- 124,130 ----
      (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)))
***************
*** 132,138 ****
      ;; override
      (modify-syntax-entry ?\; "." table)
      table)
!   "Syntax table in use in Xdefaults style conf-mode buffers.")
  
  
  (defvar conf-font-lock-keywords
--- 132,138 ----
      ;; override
      (modify-syntax-entry ?\; "." table)
      table)
!   "Syntax table in use in Xdefaults style `conf-mode' buffers.")
  
  
  (defvar conf-font-lock-keywords
***************
*** 144,150 ****
       (2 'font-lock-constant-face nil t))
      ;; section { ... } (do this last because some assign ...{...)
      ("^[ \t]*\\([^=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face 
prepend))
!   "Keywords to hilight in Conf mode")
  
  (defvar conf-javaprop-font-lock-keywords
    '(;; var=val
--- 144,150 ----
       (2 'font-lock-constant-face nil t))
      ;; section { ... } (do this last because some assign ...{...)
      ("^[ \t]*\\([^=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face 
prepend))
!   "Keywords to hilight in Conf mode.")
  
  (defvar conf-javaprop-font-lock-keywords
    '(;; var=val
***************
*** 156,162 ****
       (5 'font-lock-variable-name-face nil t)
       (6 'font-lock-constant-face nil t)
       (7 'font-lock-variable-name-face nil t)))
!   "Keywords to hilight in Conf Java Properties mode")
  
  (defvar conf-space-keywords-alist
    '(("\\`/etc/gpm/" . "key\\|name\\|foreground\\|background\\|border\\|head")
--- 156,162 ----
       (5 'font-lock-variable-name-face nil t)
       (6 'font-lock-constant-face nil t)
       (7 'font-lock-variable-name-face nil t)))
!   "Keywords to hilight in Conf Java Properties mode.")
  
  (defvar conf-space-keywords-alist
    '(("\\`/etc/gpm/" . "key\\|name\\|foreground\\|background\\|border\\|head")
***************
*** 188,194 ****
                '(1 'font-lock-keyword-face)
                '(2 'font-lock-variable-name-face))
          '("^[ \t]*\\([^\000- ]+\\)" 1 'font-lock-variable-name-face)))
!   "Keywords to hilight in Conf Space mode")
  
  (defvar conf-colon-font-lock-keywords
    `(;; [section] (do this first because it may look like a parameter)
--- 188,194 ----
                '(1 'font-lock-keyword-face)
                '(2 'font-lock-variable-name-face))
          '("^[ \t]*\\([^\000- ]+\\)" 1 'font-lock-variable-name-face)))
!   "Keywords to hilight in Conf Space mode.")
  
  (defvar conf-colon-font-lock-keywords
    `(;; [section] (do this first because it may look like a parameter)
***************
*** 198,204 ****
       (1 'font-lock-variable-name-face))
      ;; section { ... } (do this last because some assign ...{...)
      ("^[ \t]*\\([^:\n]+\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend))
!   "Keywords to hilight in Conf Colon mode")
  
  (defvar conf-assignment-sign ?=
    "What sign is used for assignments.")
--- 198,204 ----
       (1 'font-lock-variable-name-face))
      ;; section { ... } (do this last because some assign ...{...)
      ("^[ \t]*\\([^:\n]+\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend))
!   "Keywords to hilight in Conf Colon mode.")
  
  (defvar conf-assignment-sign ?=
    "What sign is used for assignments.")
***************
*** 231,242 ****
            (if (>= arg 0)
                (progn
                  (indent-to-column arg)
!                 (or (not conf-assignment-space) (memq (char-before (point)) 
'(?\s ?\t)) (insert ?\s))
!                 (insert conf-assignment-sign (if (and conf-assignment-space 
(not (eolp))) ?\s "")))
              (insert (if conf-assignment-space ?\s "") conf-assignment-sign)
              (unless (eolp)
                (indent-to-column (- arg))
!               (or (not conf-assignment-space) (memq (char-before (point)) 
'(?\s ?\t)) (insert ?\s))))
          (unless (eolp)
            (if (>= (current-column) (abs arg))
                (insert ?\s)
--- 231,245 ----
            (if (>= arg 0)
                (progn
                  (indent-to-column arg)
!                 (or (not conf-assignment-space)
!                       (memq (char-before (point)) '(?\s ?\t)) (insert ?\s))
!                 (insert conf-assignment-sign
!                           (if (and conf-assignment-space (not (eolp))) ?\s 
"")))
              (insert (if conf-assignment-space ?\s "") conf-assignment-sign)
              (unless (eolp)
                (indent-to-column (- arg))
!               (or (not conf-assignment-space)
!                     (memq (char-before (point)) '(?\s ?\t)) (insert ?\s))))
          (unless (eolp)
            (if (>= (current-column) (abs arg))
                (insert ?\s)
***************
*** 255,262 ****
  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
--- 258,267 ----
  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
***************
*** 326,350 ****
                  ((looking-at ".*{"))          ; nop
                  ((setq space (1+ space))))
            (forward-line)))
!       (if (> jp (max unix win 3))
!           (conf-javaprop-mode)
!         (if (> colon (max equal space))
!             (conf-colon-mode)
!           (if (> space (max equal colon))
!               (conf-space-mode)
!             (if (or (> win unix)
!                     (and (= win unix) (eq system-type 'windows-nt)))
!                 (conf-windows-mode)
!               (conf-unix-mode))))))
      (kill-all-local-variables)
      (use-local-map conf-mode-map)
  
      (setq major-mode 'conf-mode
          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)
         "[ \t]*\\(?:\\[\\|.+[ \t\n]*{\\)")
--- 331,355 ----
                  ((looking-at ".*{"))          ; nop
                  ((setq space (1+ space))))
            (forward-line)))
!       (cond
!          ((> jp (max unix win 3)) (conf-javaprop-mode))
!          ((> colon (max equal space)) (conf-colon-mode))
!          ((> space (max equal colon)) (conf-space-mode))
!          ((or (> win unix) (and (= win unix) (eq system-type 'windows-nt)))
!           (conf-windows-mode))
!          (t (conf-unix-mode))))
      (kill-all-local-variables)
      (use-local-map conf-mode-map)
  
      (setq major-mode 'conf-mode
          mode-name name)
+     (set (make-local-variable 'font-lock-defaults)
+          '(conf-font-lock-keywords nil t nil nil))
      (set (make-local-variable 'comment-start) comment)
      (set (make-local-variable 'comment-start-skip)
         (concat (regexp-quote comment-start) "+\\s *"))
!     ;; Let newcomment.el decide this for himself.
!     ;; (set (make-local-variable 'comment-use-syntax) t)
      (set (make-local-variable 'parse-sexp-ignore-comments) t)
      (set (make-local-variable 'outline-regexp)
         "[ \t]*\\(?:\\[\\|.+[ \t\n]*{\\)")
***************
*** 368,374 ****
  Comments start with `#'.
  For details see `conf-mode'.  Example:
  
! # Conf mode font-locks this right on Unix and with C-c C-u
  
  \[Desktop Entry]
         Encoding=UTF-8
--- 373,379 ----
  Comments start with `#'.
  For details see `conf-mode'.  Example:
  
! # Conf mode font-locks this right on Unix and with \\[conf-unix-mode]
  
  \[Desktop Entry]
         Encoding=UTF-8
***************
*** 384,390 ****
  Comments start with `;'.
  For details see `conf-mode'.  Example:
  
! ; Conf mode font-locks this right on Windows and with C-c C-w
  
  \[ExtShellFolderViews]
  Default={5984FFE0-28D4-11CF-AE66-08002B2E1262}
--- 389,395 ----
  Comments start with `;'.
  For details see `conf-mode'.  Example:
  
! ; Conf mode font-locks this right on Windows and with \\[conf-windows-mode]
  
  \[ExtShellFolderViews]
  Default={5984FFE0-28D4-11CF-AE66-08002B2E1262}
***************
*** 407,413 ****
  between `/*' and `*/'.
  For details see `conf-mode'.  Example:
  
! # Conf mode font-locks this right with C-c C-j (Java properties)
  // another kind of comment
  /* yet another */
  
--- 412,418 ----
  between `/*' and `*/'.
  For details see `conf-mode'.  Example:
  
! # Conf mode font-locks this right with \\[conf-javaprop-mode] (Java 
properties)
  // another kind of comment
  /* yet another */
  
***************
*** 441,447 ****
  
  For details see `conf-mode'.  Example:
  
! # Conf mode font-locks this right with C-c C-s (space separated)
  
  image/jpeg                    jpeg jpg jpe
  image/png                     png
--- 446,452 ----
  
  For details see `conf-mode'.  Example:
  
! # Conf mode font-locks this right with \\[conf-space-mode] (space separated)
  
  image/jpeg                    jpeg jpg jpe
  image/png                     png
***************
*** 495,501 ****
  \"Assignments\" are with `:'.
  For details see `conf-mode'.  Example:
  
! # Conf mode font-locks this right with C-c C-c (colon)
  
  <Multi_key> <exclam> <exclam>         : \"\\241\"     exclamdown
  <Multi_key> <c> <slash>                       : \"\\242\"     cent"
--- 500,506 ----
  \"Assignments\" are with `:'.
  For details see `conf-mode'.  Example:
  
! # Conf mode font-locks this right with \\[conf-colon-mode] (colon)
  
  <Multi_key> <exclam> <exclam>         : \"\\241\"     exclamdown
  <Multi_key> <c> <slash>                       : \"\\242\"     cent"
***************
*** 524,530 ****
  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 }\""
--- 529,535 ----
  Comments start with `*%' and \"assignments\" are with `:'.
  For details see `conf-mode'.  Example:
  
! *% Conf mode font-locks this right with \\[conf-ppd-mode] (PPD)
  
  *DefaultTransfer: Null
  *Transfer Null.Inverse: \"{ 1 exch sub }\""
***************
*** 539,559 ****
  Comments start with `!' and \"assignments\" are with `:'.
  For details see `conf-mode'.  Example:
  
! ! Conf mode font-locks this right with C-c C-x (.Xdefaults)
  
  *background:                  gray99
  *foreground:                  black"
    (interactive)
    (conf-colon-mode "!" conf-xdefaults-mode-syntax-table "Conf[Xdefaults]"))
- 
- 
- ;; font lock support
- (if (boundp 'font-lock-defaults-alist)
-     (add-to-list
-      'font-lock-defaults-alist
-      (cons 'conf-mode
-          (list 'conf-font-lock-keywords nil t nil nil))))
- 
  
  (provide 'conf-mode)
  
--- 544,555 ----
  Comments start with `!' and \"assignments\" are with `:'.
  For details see `conf-mode'.  Example:
  
! ! Conf mode font-locks this right with \\[conf-xdefaults-mode] (.Xdefaults)
  
  *background:                  gray99
  *foreground:                  black"
    (interactive)
    (conf-colon-mode "!" conf-xdefaults-mode-syntax-table "Conf[Xdefaults]"))
  
  (provide 'conf-mode)
  




reply via email to

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