structured-haskell-mode 1.0.8 → 1.0.9
raw patch · 7 files changed
+64/−15 lines, 7 filesdep ~descriptive
Dependency ranges changed: descriptive
Files
- elisp/shm-ast.el +17/−3
- elisp/shm-customizations.el +8/−0
- elisp/shm-insert-del.el +10/−1
- elisp/shm-manipulation.el +16/−0
- elisp/shm.el +2/−0
- src/Main.hs +9/−9
- structured-haskell-mode.cabal +2/−2
elisp/shm-ast.el view
@@ -185,7 +185,8 @@ (let ((temp-buffer (current-buffer))) (with-current-buffer buffer (condition-case e- (call-process-region start+ (apply #'call-process-region+ (append (list start end shm-program-name nil@@ -193,6 +194,7 @@ nil "parse" type)+ (shm-extra-arguments))) ((file-error) (error "Unable to find structured-haskell-mode executable! See README for help."))))) (read (buffer-string))))))@@ -207,7 +209,8 @@ (with-temp-buffer (let ((temp-buffer (current-buffer))) (with-current-buffer buffer- (call-process-region start+ (apply #'call-process-region+ (append (list start end shm-program-name nil@@ -224,8 +227,19 @@ (if (save-excursion (goto-char start) (= (point) (line-beginning-position))) "decl"- type))))+ type))+ (shm-extra-arguments))))) (string= "" (buffer-string)))))++(defun shm-extra-arguments ()+ "Extra arguments to pass to the structured-haskell-mode process."+ (shm-language-extensions))++(defun shm-language-extensions ()+ "Get the number of spaces to indent."+ (if (boundp 'haskell-language-extensions)+ haskell-language-extensions+ shm-language-extensions)) (defun shm-get-nodes (ast start end) "Get the nodes of the given AST.
elisp/shm-customizations.el view
@@ -87,6 +87,14 @@ :group 'shm :type 'string) +(defcustom shm-language-extensions+ (if (boundp 'haskell-language-extensions)+ haskell-language-extensions+ '())+ "Language extensions in use. Should be in format: -XFoo, -XNoFoo etc."+ :group 'shm+ :type '(repeat 'string))+ (defcustom shm-lambda-indent-style nil "Specify a particular style for indenting lambdas?"
elisp/shm-insert-del.el view
@@ -98,8 +98,17 @@ (- (point) 6)) (looking-at "[ ]*$")) (shm-auto-insert-module))- (t (shm-insert-string " "))))+ (t (shm-insert-string " ")))+ ) (t (shm-insert-string " "))))))++(defun shm-auto-insert-lambda ()+ "Lambda insertion."+ (save-excursion+ (shm/insert-underscore)+ (forward-char)+ (insert " -> ")+ (shm/insert-undefined))) (defun shm-nothing-following-p () "Is there nothing following me (other than closing delimiters)?"
elisp/shm-manipulation.el view
@@ -19,6 +19,22 @@ (require 'shm-layout) +(defun shm/$ ()+ "Swap parens with a dollar."+ (interactive)+ (let* ((current-pair (shm-current-node-pair))+ (current (cdr current-pair)))+ (if (eq (shm-node-cons current) 'Paren)+ (progn (let ((child (shm-node-child current-pair)))+ (shm-raise-to child current)+ (if (looking-back " ")+ nil+ (shm-insert-string " "))+ (shm-insert-string "$")+ (if (looking-at " ")+ nil+ (shm-insert-string " ")))))))+ (defun shm/add-operand () "When in an infix application, figure out the operator and add a new operand. E.g.
elisp/shm.el view
@@ -94,6 +94,7 @@ (define-key map (kbd "C-c C-w") 'shm/goto-where) ;; Splitting, slurping, barfing, etc. (define-key map (kbd "C-+") 'shm/add-operand)+ (define-key map (kbd "C-$") 'shm/$) (define-key map (kbd "M-r") 'shm/raise) (define-key map (kbd "M-s") 'shm/splice) (define-key map (kbd "C-c C-q") 'shm/qualify-import)@@ -158,6 +159,7 @@ (define-key map (kbd "M-DEL") 'shm/backward-kill-word) (define-key map (kbd "C-<backspace>") 'shm/backward-kill-word) ;; Splitting, slurping, barfing, etc.+ (define-key map (kbd "C-$") 'shm/$) (define-key map (kbd "C-+") 'shm/add-operand) (define-key map (kbd "M-r") 'shm/raise) (define-key map (kbd "M-s") 'shm/splice)
src/Main.hs view
@@ -45,9 +45,9 @@ do code <- getContents args <- getArgs case consume options (map T.pack args) of- Right (action,typ,exts) ->+ Succeeded (action,typ,exts) -> outputWith action typ exts code- Left _err ->+ _ -> error (T.unpack (textDescription (describe options []))) -- | Action to perform.@@ -57,17 +57,17 @@ data ParseType = Decl | Stmt -- | Command line options.-options :: Consumer [Text] Option (Action,ParseType,[Extension])+options :: Consumer [Text] (Option ()) (Action,ParseType,[Extension]) options = (,,) <$> action <*> typ <*> exts where action =- sumConstant Parse "parse" <|>- sumConstant Check "check"+ sumConstant Parse "parse" "Parse and spit out spans" <|>+ sumConstant Check "check" "Just check the syntax" typ =- sumConstant Decl "decl" <|>- sumConstant Stmt "stmt"- sumConstant sum' text =+ sumConstant Decl "decl" "Parse a declaration" <|>+ sumConstant Stmt "stmt" "Parse a statement"+ sumConstant sum' text desc = fmap (const sum')- (constant text)+ (constant text desc) exts = fmap getExtensions (many (prefix "X" "Language extension"))
structured-haskell-mode.cabal view
@@ -1,5 +1,5 @@ name: structured-haskell-mode-version: 1.0.8+version: 1.0.9 synopsis: Structured editing Emacs mode for Haskell description: Structured editing Emacs mode for Haskell. homepage: https://github.com/chrisdone/structured-haskell-mode@@ -44,4 +44,4 @@ build-depends: base >= 4 && < 5 , haskell-src-exts == 1.15.* , text- , descriptive >= 0.0.2 && < 0.1+ , descriptive == 0.2.*