[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdesdk/scripts/kde-emacs
From:       David Faure <faure () kde ! org>
Date:       2008-07-16 9:42:15
Message-ID: 1216201335.212857.29753.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 833163 by dfaure:

Ensure "magic spaces inside parentheses" can also be enabled/disabled per project using .emacs-dirvars.


 M  +3 -6      kde-emacs-core.el  
 M  +8 -2      kde-emacs-utils.el  


--- trunk/KDE/kdesdk/scripts/kde-emacs/kde-emacs-core.el #833162:833163
@@ -164,12 +164,9 @@
        (progn
 	 (define-key c++-mode-map "\," 'insert-comma)
 	 (define-key c++-mode-map "\{" 'insert-curly-brace)
-	 ;; Add (setq magic-parens-mode nil) to your .emacs (before loading this file)
-	 ;; to disable the automatic spaces inside "( ... )" in C++ mode.
-	 (and (boundp 'magic-parens-mode) magic-parens-mode
-	      (define-key c++-mode-map "\(" 'insert-parens)
-	      (define-key c++-mode-map "\)" 'insert-parens2)
-	 )))
+	 (define-key c++-mode-map "\(" 'insert-parens)
+	 (define-key c++-mode-map "\)" 'insert-parens2)
+	 ))
   )
 
 (defun kde-c-mode-hook ()
--- trunk/KDE/kdesdk/scripts/kde-emacs/kde-emacs-utils.el #833162:833163
@@ -488,9 +488,14 @@
     )
   )
 
+;; Add (setq magic-parens-mode nil) to your .emacs (before loading this file)
+;; to disable the automatic spaces inside "( ... )" in C++ mode.
+;; This can also be enabled/disabled per project using  magic-parens-mode: t  in .emacs-dirvars.
+
 ; Makes '(' insert '(' or ' ( ' where appropiate
 (defun insert-parens (arg) (interactive "*P")
-  (if (not (c-in-literal))
+  (if (and (not (c-in-literal))
+           (boundp 'magic-parens-mode) magic-parens-mode)
       (let ((n nil) (except nil))
         (save-excursion
           (setq n (or (progn (forward-char -2) (looking-at "\\bif"))
@@ -519,7 +524,8 @@
   )
 
 (defun insert-parens2 (arg) (interactive "*P")
-  (if (not (c-in-literal))
+  (if (and (not (c-in-literal))
+           (boundp 'magic-parens-mode) magic-parens-mode)
       (let ((remv nil) (nospac nil))
         (forward-char -2)
         (setq remv (looking-at "( ")) ; () -> we'll have to remove that space
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic