branch: elpa/scala-mode commit 600d27b7aaf1e00edd6150adebd7ab626790582a Author: Heikki Vesalainen <heikkivesalai...@yahoo.com> Commit: Heikki Vesalainen <heikkivesalai...@yahoo.com>
join-line cannot be re-defined like this --- README.md | 22 ++++++++++------------ scala-mode2-map.el | 21 +++++---------------- scala-mode2.el | 4 +--- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index b778e8d..0516fad 100644 --- a/README.md +++ b/README.md @@ -274,12 +274,17 @@ To re-fill a paragraph, use the *fill-paragraph* command ( **M-q** command. To set the default, you use the *customize-variable* command or a mode-hook. -## Joinin lines +## Joinin lines (delete indentation) -Scala-mode defines its own join-line function. Besides doing what the -normal join-line function does, it also removes comment marks -(asterisks and slashes) when comment lines are joined and space when -code lines are joined and the uppper line ended with a dot. +Scala-mode defines its own *scala-indent:join-line' function. Besides +doing what the normal *join-line* (aka *delete-indentation*) function +does, it also removes comment marks (asterisks and slashes) when +comment lines are joined and space when code lines are joined and the +uppper line ended with a dot. + +In scala-mode2 buffers *scala-indent:join-line* replaces +*delete-indentation* in your key bindings. The default binding is +**M-^**. ## Motion @@ -342,13 +347,6 @@ you may want to try. Just copy-paste it to your `.emacs` file. ;; (newline-and-indent) ;; (scala-indent:insert-asterisk-on-multiline-comment))) - ;; Bind the 'join-line' command to M-RET. This command is normally - ;; bound to M-^ which is hard to access, especially on some European - ;; keyboards. The 'join-line' command has the effect or joining the - ;; current line with the previous while fixing whitespace at the - ;; joint. - (local-set-key (kbd "M-RET") 'join-line) - ;; Bind the backtab (shift tab) to ;; 'scala-indent:indent-with-reluctant-strategy command. This is usefull ;; when using the 'eager' mode by default and you want to "outdent" a diff --git a/scala-mode2-map.el b/scala-mode2-map.el index 8870730..be35b31 100644 --- a/scala-mode2-map.el +++ b/scala-mode2-map.el @@ -4,13 +4,11 @@ (require 'scala-mode2-indent) -(defmacro scala-mode-map:define-keys (key-map key-funcs) - (cons 'progn (mapcar - #'(lambda (key-func) - `(define-key ,key-map ,(car key-func) ,(cadr key-func))) - key-funcs))) - -(defvar scala-mode-map nil +(defvar scala-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map prog-mode-map) + (substitute-key-definition 'delete-indentation 'scala-ident:join-line map global-map) + map) "Local key map used for scala mode") (defun scala-mode-map:add-self-insert-hooks () @@ -25,13 +23,4 @@ (add-hook 'post-command-hook 'scala-indent:remove-indent-from-previous-empty-line)) -(when (not scala-mode-map) - (let ((keymap (make-sparse-keymap))) - (scala-mode-map:define-keys - keymap - ( -;; ([(control c)(control r)] 'scala-indent:rotate-run-on-strategy) - )) - (setq scala-mode-map keymap))) - (provide 'scala-mode2-map) diff --git a/scala-mode2.el b/scala-mode2.el index 5e5b5b2..ff25e5e 100644 --- a/scala-mode2.el +++ b/scala-mode2.el @@ -106,8 +106,7 @@ When started, runs `scala-mode-hook'. 'forward-sexp-function 'find-tag-default-function 'indent-line-function - 'indent-tabs-mode - 'join-line) + 'indent-tabs-mode) (add-hook 'syntax-propertize-extend-region-functions 'scala-syntax:propertize-extend-region) @@ -139,7 +138,6 @@ When started, runs `scala-mode-hook'. find-tag-default-function 'scala-mode:find-tag indent-line-function 'scala-indent:indent-line indent-tabs-mode nil - join-line 'scala-indent:join-line ) (use-local-map scala-mode-map) ;; add indent functionality to some characters