[Gd-chatter] r11341 - trunk/gwydion/tools/elisp

cpage at gwydiondylan.org cpage at gwydiondylan.org
Thu May 10 14:04:09 CEST 2007


Author: cpage
Date: Thu May 10 14:04:08 2007
New Revision: 11341

Modified:
   trunk/gwydion/tools/elisp/dylan-mode.el
Log:
Job: minor

Instead of forcing Dylan Mode to always indent with spaces (no tab characters),
use the mode hook to set `indent-tabs-mode' to nil. Although tabs are still
turned off by default, the user can now customize this behavior. The new
function `dylan-indent-spaces-only' is listed as an option when customizing
`dylan-mode-hook'.


Modified: trunk/gwydion/tools/elisp/dylan-mode.el
==============================================================================
--- trunk/gwydion/tools/elisp/dylan-mode.el	(original)
+++ trunk/gwydion/tools/elisp/dylan-mode.el	Thu May 10 14:04:08 2007
@@ -188,10 +188,18 @@
   :type  'boolean
   :group 'dylan)
 
-(defcustom dylan-mode-hook nil
+(defun dylan-indent-spaces-only ()
+  "Indent using spaces only, without any tab characters.
+
+A trivial function that sets `indent-tabs-mode' to nil, suitable
+for use as a Dylan mode hook."
+  (setq indent-tabs-mode nil))
+
+(defcustom dylan-mode-hook '(dylan-indent-spaces-only)
   "*Hook called by `dylan-mode'."
   ;; To Do: Add support for imenu, then enable this option.
   ;; :options '(imenu-add-menubar-index)
+  :options '(dylan-indent-spaces-only)
   :type  'hook
   :group 'dylan)
 
@@ -334,6 +342,7 @@
   (define-key map ">"       'dylan-arrow-insert)
   (define-key map "\n"      'dylan-newline-and-indent)
   (define-key map "\t"      'dylan-indent-line)
+  (define-key map "\177"    'backward-delete-char-untabify)
   (define-key map "\M-a"    'dylan-beginning-of-form)
   (define-key map "\M-e"    'dylan-end-of-form)
   (define-key map "\M-)"    'dylan-insert-block-end)
@@ -342,7 +351,7 @@
   (define-key map "\M-\C-h" 'dylan-mark-function))
 
 (defvar dylan-mode-map ()
-  "Keymap used in dylan mode.")
+  "Keymap for Dylan mode.")
 (if (not dylan-mode-map)
     (progn
       (setq dylan-mode-map (make-sparse-keymap))
@@ -1546,7 +1555,6 @@
 	  (setq after-change-functions nil))))
   (make-local-variable 'after-change-function)
   (setq after-change-function nil)
-  (setq indent-tabs-mode nil)
   (when dylan-mode-for-emacs-21-and-later
     (set-syntax-table dylan-indent-syntax-table)
     (dylan-set-up-syntax-tables)



More information about the chatter mailing list