multi-line sort of actually works

This commit is contained in:
Ivan Malison 2015-11-21 20:16:43 -08:00
parent d7b4d1206a
commit 2d5c9fb89a

View File

@ -202,10 +202,12 @@ FIND-STRATEGY is a class with the method multi-line-find-next."
(defmethod multi-line-set-default-find ((config multi-line-config-manager) find-strategy) (defmethod multi-line-set-default-find ((config multi-line-config-manager) find-strategy)
(oset config :default-find find-strategy)) (oset config :default-find find-strategy))
(defmethod multi-line-set-default-enter ((config multi-line-config-manager) enter-strategy) (defmethod multi-line-set-default-enter ((config multi-line-config-manager)
enter-strategy)
(oset config :default-enter enter-strategy)) (oset config :default-enter enter-strategy))
(defmethod multi-line-set-default-respacer ((config multi-line-config-manager) respacer-strategy) (defmethod multi-line-set-default-respacer ((config multi-line-config-manager)
respacer-strategy)
(oset config :default-respacer respacer-strategy)) (oset config :default-respacer respacer-strategy))
(setq multi-line-config (make-instance multi-line-config-manager)) (setq multi-line-config (make-instance multi-line-config-manager))
@ -218,19 +220,26 @@ FIND-STRATEGY is a class with the method multi-line-find-next."
(defun multi-line-set-per-major-mode-strategies () (defun multi-line-set-per-major-mode-strategies ()
"Set language specific strategies." "Set language specific strategies."
(interactive) (interactive)
(multi-line-set-find-strategy multi-line-config 'emacs-lisp-mode (make-instance multi-line-forward-sexp-find-strategy :split-regex "[[:space:]]+" :done-regex "[[:space:]]*)" :split-advance-fn 'multi-line-lisp-advance-fn)) (multi-line-set-find-strategy multi-line-config 'emacs-lisp-mode
(make-instance
multi-line-forward-sexp-find-strategy
:split-regex "[[:space:]]+"
:done-regex "[[:space:]]*)"
:split-advance-fn 'multi-line-lisp-advance-fn))
(let ((newline-respacer (let ((newline-respacer
(make-instance multi-line-always-newline (make-instance multi-line-always-newline
:skip-first t :skip-last t))) :skip-first t :skip-last t)))
(multi-line-set-repacer-strategy (multi-line-set-respacer-strategy
multi-line-config 'emacs-lisp-mode (make-instance multi-line-column-number multi-line-config 'emacs-lisp-mode (make-instance multi-line-column-number
:newline-respacer newline-respacer))) :newline-respacer
newline-respacer)))
;; No match for done regex ;; No match for done regex
(multi-line-set-enter-strategy multi-line-config 'emacs-lisp-mode (multi-line-set-enter-strategy multi-line-config 'emacs-lisp-mode
(make-instance multi-line-forward-sexp-enter-strategy (make-instance
:done-regex "``````"))) multi-line-forward-sexp-enter-strategy
:done-regex "``````")))
(multi-line-set-per-major-mode-strategies) (multi-line-set-per-major-mode-strategies)
@ -238,7 +247,8 @@ FIND-STRATEGY is a class with the method multi-line-find-next."
(defun multi-line () (defun multi-line ()
"Multi-line the statement at point." "Multi-line the statement at point."
(interactive) (interactive)
(multi-line-adjust-whitespace (multi-line-get-respacer-strategy multi-line-config))) (multi-line-adjust-whitespace (multi-line-get-respacer-strategy
multi-line-config)))
;;;###autoload ;;;###autoload
(defun multi-line-singleline () (defun multi-line-singleline ()