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,v


From: Dan Nicolaescu
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/conf-mode.el,v
Date: Wed, 02 Apr 2008 06:35:21 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   08/04/02 06:35:21

Index: textmodes/conf-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/textmodes/conf-mode.el,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- textmodes/conf-mode.el      8 Jan 2008 20:45:40 -0000       1.22
+++ textmodes/conf-mode.el      2 Apr 2008 06:35:20 -0000       1.23
@@ -69,9 +69,9 @@
   :type 'boolean
   :group 'conf)
 
-
 (defvar conf-mode-map
-  (let ((map (make-sparse-keymap)))
+  (let ((map (make-sparse-keymap))
+       (menu-map (make-sparse-keymap)))
     (define-key map "\C-c\C-u" 'conf-unix-mode)
     (define-key map "\C-c\C-w" 'conf-windows-mode)
     (define-key map "\C-c\C-j" 'conf-javaprop-mode)
@@ -85,6 +85,49 @@
     (define-key map "\C-c\"" 'conf-quote-normal)
     (define-key map "\C-c'" 'conf-quote-normal)
     (define-key map "\C-c\C-a" 'conf-align-assignments)
+    (define-key map [menu-bar sh-script] (cons "Conf" menu-map))
+    (define-key menu-map [conf-windows-mode]
+      '(menu-item "Windows mode"
+                 conf-windows-mode
+                 :help "Conf Mode starter for Windows style Conf files"
+                 :button (:radio . (eq major-mode 'conf-windows-mode))))
+    (define-key menu-map [conf-javaprop-mode]
+      '(menu-item "Java properties mode"
+                 conf-javaprop-mode
+                 :help "Conf Mode starter for Java properties files"
+                 :button (:radio . (eq major-mode 'conf-javaprop-mode))))
+    (define-key menu-map [conf-space-keywords]
+      '(menu-item "Space keywords mode..."
+                 conf-space-keywords
+                 :help "Enter Conf Space mode using regexp KEYWORDS to match 
the keywords"
+                 :button (:radio . (eq major-mode 'conf-space-keywords))))
+    (define-key menu-map [conf-ppd-mode]
+      '(menu-item "PPD mode"
+                 conf-ppd-mode
+                 :help "Conf Mode starter for Adobe/CUPS PPD files"
+                 :button (:radio . (eq major-mode 'conf-ppd-mode))))
+    (define-key menu-map [conf-colon-mode]
+      '(menu-item "Colon mode"
+                 conf-colon-mode
+                 :help "Conf Mode starter for Colon files"
+                 :button (:radio . (eq major-mode 'conf-colon-mode))))
+    (define-key menu-map [conf-unix-mode]
+      '(menu-item "Unix mode"
+                 conf-unix-mode
+                 :help "Conf Mode starter for Unix style Conf files"
+                 :button (:radio . (eq major-mode 'conf-unix-mode))))
+    (define-key menu-map [conf-xdefaults-mode]
+      '(menu-item "Xdefaults mode"
+                 conf-xdefaults-mode
+                 :help "Conf Mode starter for Xdefaults files"
+                 :button (:radio . (eq major-mode 'conf-xdefaults-mode))))
+    (define-key menu-map [c-s0] '("--"))
+    (define-key menu-map [conf-quote-normal]
+      '(menu-item "Set quote syntax normal" conf-quote-normal
+                 :help "Set the syntax of \' and \" to punctuation"))
+    (define-key menu-map [conf-align-assignments]
+      '(menu-item "Align assignments" conf-align-assignments
+                 :help "Align assignments"))
     map)
   "Local keymap for `conf-mode' buffers.")
 
@@ -215,10 +258,16 @@
 ;; `align', I'd be glad to hear.
 (defun conf-align-assignments (&optional arg)
   (interactive "P")
+  "Align the assignments in the buffer or active region.
+In Transient Mark mode, if the mark is active, operate on the
+contents of the region.  Otherwise, operate on the whole buffer."
   (setq arg (if arg
                (prefix-numeric-value arg)
              conf-assignment-column))
   (save-excursion
+    (save-restriction
+      (when (use-region-p)
+       (narrow-to-region (region-beginning) (region-end)))
     (goto-char (point-min))
     (while (not (eobp))
       (let ((cs (comment-beginning)))  ; go before comment if within
@@ -245,7 +294,7 @@
            (if (>= (current-column) (abs arg))
                (insert ?\s)
              (indent-to-column (abs arg))))))
-      (forward-line))))
+       (forward-line)))))
 
 
 (defun conf-quote-normal (arg)
@@ -259,13 +308,12 @@
 unbalanced, but hey...)"
   (interactive "P")
   (let ((table (copy-syntax-table (syntax-table))))
-    (if (or (not arg) (= (prefix-numeric-value arg) 1))
+    (when (or (not arg) (= (prefix-numeric-value arg) 1))
         (modify-syntax-entry ?\' "." table))
-    (if (or (not arg) (= (prefix-numeric-value arg) 2))
+    (when (or (not arg) (= (prefix-numeric-value arg) 2))
         (modify-syntax-entry ?\" "." table))
     (set-syntax-table table)
-    (and (boundp 'font-lock-mode)
-        font-lock-mode
+    (when font-lock-mode
         (font-lock-fontify-buffer))))
 
 




reply via email to

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