From 9fd1ef5da3b9dcdd60ca65662c99146e66c3baa7 Mon Sep 17 00:00:00 2001 From: m00nlight Date: Sat, 23 Aug 2014 10:53:34 +0800 Subject: [PATCH 1/5] add support to indent and align guard and rhs for unicode haskell --- haskell-indent.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haskell-indent.el b/haskell-indent.el index 34b90dbbe..5954cbc1d 100644 --- a/haskell-indent.el +++ b/haskell-indent.el @@ -396,7 +396,7 @@ Returns the location of the start of the comment, nil otherwise." ((looking-at "\\(\\([[:alpha:]]\\(\\sw\\|'\\)*\\)\\|_\\)[ \t\n]*") 'ident) ((looking-at "\\(|[^|]\\)[ \t\n]*") 'guard) - ((looking-at "\\(=[^>=]\\|::\\|->\\|<-\\)[ \t\n]*") 'rhs) + ((looking-at "\\(=[^>=]\\|::\\|∷\\|→\\|←\\|->\\|<-\\)[ \t\n]*") 'rhs) (t 'other))) (defvar haskell-indent-current-line-first-ident "" From 66c5f054ab3709c00450d824d22d0da5d4e2bd38 Mon Sep 17 00:00:00 2001 From: m00nlight Date: Sat, 23 Aug 2014 13:18:23 +0800 Subject: [PATCH 2/5] add require inf-haskell solve reference to variable find-tag-marker-ring --- haskell-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/haskell-mode.el b/haskell-mode.el index 407dbfb2b..c332af888 100644 --- a/haskell-mode.el +++ b/haskell-mode.el @@ -134,6 +134,7 @@ (require 'haskell-align-imports) (require 'haskell-sort-imports) (require 'haskell-string) +(require 'inf-haskell) (with-no-warnings (require 'cl)) ;; FIXME: code-smell: too many forward decls for haskell-session are required here From 6edce403939c7ffa467140898cefe0887a41ff61 Mon Sep 17 00:00:00 2001 From: m00nlight Date: Sat, 23 Aug 2014 13:40:05 +0800 Subject: [PATCH 3/5] solve reference to free variable find-tag-marker-rings and pass the check --- haskell-mode.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/haskell-mode.el b/haskell-mode.el index c332af888..54d5ded5a 100644 --- a/haskell-mode.el +++ b/haskell-mode.el @@ -134,9 +134,10 @@ (require 'haskell-align-imports) (require 'haskell-sort-imports) (require 'haskell-string) -(require 'inf-haskell) (with-no-warnings (require 'cl)) +(defvar find-tag-marker-ring) + ;; FIXME: code-smell: too many forward decls for haskell-session are required here (defvar haskell-session) (declare-function haskell-process "haskell-process" ()) From 818985b6f17f73c968306a163aa2689684271dfb Mon Sep 17 00:00:00 2001 From: m00nlight Date: Sat, 23 Aug 2014 17:20:46 +0800 Subject: [PATCH 4/5] update all unicode counterpart for haskell-mode --- haskell-align-imports.el | 2 +- haskell-font-lock.el | 2 +- haskell-indentation.el | 2 +- inf-haskell.el | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/haskell-align-imports.el b/haskell-align-imports.el index 7ae45ed8f..0be331334 100644 --- a/haskell-align-imports.el +++ b/haskell-align-imports.el @@ -222,7 +222,7 @@ "Are we after the imports list?" (save-excursion (goto-char (line-beginning-position)) - (not (not (search-forward-regexp "\\( = \\|\\\\| :: \\)" + (not (not (search-forward-regexp "\\( = \\|\\\\| :: \\| ∷ \\)" (line-end-position) t 1))))) (provide 'haskell-align-imports) diff --git a/haskell-font-lock.el b/haskell-font-lock.el index 340958bcb..97525b10d 100644 --- a/haskell-font-lock.el +++ b/haskell-font-lock.el @@ -274,7 +274,7 @@ Returns keywords suitable for `font-lock-keywords'." (concat "\\S_" ;; (regexp-opt '(".." "::" "=" "\\" "|" "<-" "->" ;; "@" "~" "=>") t) - "\\(->\\|\\.\\.\\|::\\|∷\\|<-\\|=>\\|[=@\\|~]\\)" + "\\(->\\|→\\|\\.\\.\\|::\\|∷\\|<-\\|←\\|=>\\|[=@\\|~]\\)" "\\S_")) ;; Reserved identifiers (reservedid diff --git a/haskell-indentation.el b/haskell-indentation.el index 30cd024fe..f6358031a 100644 --- a/haskell-indentation.el +++ b/haskell-indentation.el @@ -1057,7 +1057,7 @@ Preserves indentation and removes extra whitespace" (match-string-no-properties 1)) ((looking-at "[][(){}[,;]") (match-string-no-properties 0)) - ((looking-at "\\(\\\\\\|->\\|<-\\|::\\|=\\||\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)") + ((looking-at "\\(\\\\\\|->\\|→\\|<-\\|←\\|::\\|∷\\|=\\||\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)") (match-string-no-properties 1)) ((looking-at "\\(→\\|←\\|∷\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)") (let ((tok (match-string-no-properties 1))) diff --git a/inf-haskell.el b/inf-haskell.el index 80dd83019..15e523756 100644 --- a/inf-haskell.el +++ b/inf-haskell.el @@ -497,7 +497,7 @@ The returned info is cached for reuse by `haskell-doc-mode'." (if (string-match "\\`\\s_+\\'" expr) (setq expr (concat "(" expr ")"))) (let ((type (inferior-haskell-get-result (concat ":type " expr)))) (if (not (string-match (concat "^\\(" (regexp-quote expr) - "[ \t\n]+::[ \t\n]*\\(.\\|\n\\)*\\)") + "[ \t\n]+\\(::\\|∷\\)[ \t\n]*\\(.\\|\n\\)*\\)") type)) (error "No type info: %s" type) (progn @@ -506,7 +506,7 @@ The returned info is cached for reuse by `haskell-doc-mode'." (when (and (boundp 'haskell-doc-mode) haskell-doc-mode (boundp 'haskell-doc-user-defined-ids) ;; Haskell-doc only works for idents, not arbitrary expr. - (string-match "\\`(?\\(\\s_+\\|\\(\\sw\\|\\s'\\)+\\)?[ \t]*::[ \t]*" + (string-match "\\`(?\\(\\s_+\\|\\(\\sw\\|\\s'\\)+\\)?[ \t]*\\(::\\|∷\\)[ \t]*" type)) (let ((sym (match-string 1 type))) (setq haskell-doc-user-defined-ids From 29f365625c53c2dafc3eb2809c99ca8176369808 Mon Sep 17 00:00:00 2001 From: m00nlight Date: Sat, 23 Aug 2014 23:08:22 +0800 Subject: [PATCH 5/5] merge upstream #325 for find-tag-marker-ring --- haskell-mode.el | 1 - 1 file changed, 1 deletion(-) diff --git a/haskell-mode.el b/haskell-mode.el index 6fe030731..a536e49e5 100644 --- a/haskell-mode.el +++ b/haskell-mode.el @@ -137,7 +137,6 @@ (require 'haskell-string) (with-no-warnings (require 'cl)) -(defvar find-tag-marker-ring) ;; FIXME: code-smell: too many forward decls for haskell-session are required here (defvar haskell-session)