packages feed

structured-haskell-mode 1.0.19 → 1.0.20

raw patch · 5 files changed

+46/−9 lines, 5 filesdep ~descriptive

Dependency ranges changed: descriptive

Files

elisp/shm-insert-del.el view
@@ -271,6 +271,13 @@   (interactive)   (shm-delimit "[" "]")) +(defun shm/open-bars ()+  "Delimit bars."+  (interactive)+  (if (region-active-p)+      (shm-delimit "[|" "|]")+    (call-interactively 'self-insert-command)))+ (defun shm/open-brace ()   "Delimit braces."   (interactive)
elisp/shm-manipulation.el view
@@ -205,4 +205,33 @@             (shm-insert-string " qualified")             (just-one-space 1)))))))) +(defun shm/bind-toggle ()+  "Swap the monadicness of a bind."+  (interactive)+  (let ((node (shm-get-binding-parent (shm-current-node-pair))))+    (case (shm-node-cons node)+      (Generator (progn (goto-char (shm-node-start node))+                        (search-forward " <- ")+                        (delete-region (- (point) (length " <- "))+                                       (point))+                        (insert " = ")+                        (goto-char (shm-node-start node))+                        (shm-insert-string "let ")))+      (LetStmt (progn (goto-char (shm-node-start node))+                      (delete-region (point) (+ (point) (length "let ")))+                      (search-forward " = ")+                      (delete-region (- (point) (length " = "))+                                     (point))+                      (insert " <- "))))))++(defun shm-get-binding-parent (node-pair)+  "Get the binding parent of the node."+  (if (or (eq 'Generator (shm-node-cons (cdr node-pair)))+          (eq 'LetStmt (shm-node-cons (cdr node-pair))))+      (cdr node-pair)+    (let ((parent-pair (shm-node-parent node-pair)))+      (if parent-pair+          (shm-get-binding-parent parent-pair)+        (error "Couldn't find a let/generator statement in the node's parents.")))))+ (provide 'shm-manipulation)
elisp/shm.el view
@@ -47,6 +47,7 @@     (define-key map (kbd "(") 'shm/open-paren)     (define-key map (kbd "M-(") 'shm/wrap-parens)     (define-key map (kbd "[") 'shm/open-bracket)+    (define-key map (kbd "|") 'shm/open-bars)     (define-key map (kbd "{") 'shm/open-brace)     (define-key map (kbd "-") 'shm/hyphen)     (define-key map (kbd "#") 'shm/hash)
src/Main.hs view
@@ -110,17 +110,17 @@ -- parseTopLevel :: ParseMode -> String -> ParseResult D parseTopLevel mode code =-  D . fix <$> parseDeclWithMode mode code   <|>-  D       <$> parseImport mode code         <|>-  D . fix <$> parseModuleWithMode mode code <|>-  D       <$> parseModulePragma mode code+  [i|(D . fix) (parseDeclWithMode mode code)|] <|>+  [i|D (parseImport mode code)|] <|>+  [i|(D . fix) (parseModuleWithMode mode code)|] <|>+  [i|D (parseModulePragma mode code)|]  -- | Parse a do-notation statement. parseSomeStmt :: ParseMode -> String -> ParseResult D parseSomeStmt mode code =-  D . fix <$> parseStmtWithMode mode code <|>-  D . fix <$> parseExpWithMode mode code <|>-  D       <$> parseImport mode code+  [i|(D . fix) (parseStmtWithMode mode code)|] <|>+  [i|(D . fix) (parseExpWithMode mode code)|] <|>+  [i|D (parseImport mode code)|]  -- | Apply fixities after parsing. fix ast = fromMaybe ast (applyFixities baseFixities ast)
structured-haskell-mode.cabal view
@@ -1,5 +1,5 @@ name:                structured-haskell-mode-version:             1.0.19+version:             1.0.20 synopsis:            Structured editing Emacs mode for Haskell description:         Structured editing Emacs mode for Haskell. homepage:            https://github.com/chrisdone/structured-haskell-mode@@ -44,6 +44,6 @@   build-depends:     base >= 4 && < 5                    , haskell-src-exts == 1.16.*                    , text-                   , descriptive >= 0.7 && < 0.9+                   , descriptive >= 0.7 && < 0.10                    , applicative-quoters                    , ghc-prim