Skip to content

Put Haskell symbol chars in punctuation char class. #471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 9 additions & 36 deletions haskell-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -459,55 +459,28 @@ Run M-x describe-variable haskell-mode-hook for a list of such modes."))
(modify-syntax-entry ?\t " " table)
(modify-syntax-entry ?\" "\"" table)
(modify-syntax-entry ?\' "_" table)
(modify-syntax-entry ?_ "w" table)
(modify-syntax-entry ?_ "_" table)
(modify-syntax-entry ?\( "()" table)
(modify-syntax-entry ?\) ")(" table)
(modify-syntax-entry ?\[ "(]" table)
(modify-syntax-entry ?\] ")[" table)

(cond ((featurep 'xemacs)
;; I don't know whether this is equivalent to the below
;; (modulo nesting). -- fx
(modify-syntax-entry ?{ "(}5" table)
(modify-syntax-entry ?} "){8" table)
(modify-syntax-entry ?- "_ 1267" table))
(t
;; In Emacs 21, the `n' indicates that they nest.
;; The `b' annotation is actually ignored because it's only
;; meaningful on the second char of a comment-starter, so
;; on Emacs 20 and before we get wrong results. --Stef
(modify-syntax-entry ?\{ "(}1nb" table)
(modify-syntax-entry ?\} "){4nb" table)
(modify-syntax-entry ?- "_ 123" table)))
(modify-syntax-entry ?\{ "(}1nb" table)
(modify-syntax-entry ?\} "){4nb" table)
(modify-syntax-entry ?- ". 123" table)
(modify-syntax-entry ?\n ">" table)

(let (i lim)
(map-char-table
(lambda (k v)
(when (equal v '(1))
;; The current Emacs 22 codebase can pass either a char
;; or a char range.
(if (consp k)
(setq i (car k)
lim (cdr k))
(setq i k
lim k))
(while (<= i lim)
(when (> i 127)
(modify-syntax-entry i "_" table))
(setq i (1+ i)))))
(standard-syntax-table)))

(modify-syntax-entry ?\` "$`" table)
(modify-syntax-entry ?\\ "\\" table)
(mapc (lambda (x)
(modify-syntax-entry x "_" table))
;; Some of these are actually OK by default.
(modify-syntax-entry x "." table))
"!#$%&*+./:<=>?@^|~")

;; Precise syntax table entries for symbol characters
;; Haskell symbol characters are treated as punctuation because
;; they are not able to form identifiers with word constituent 'w'
;; class characters.
(dolist (charcodes haskell--char-syntax-symbols)
(modify-syntax-entry charcodes "_" table))
(modify-syntax-entry charcodes "." table))
;; ... and for identifier characters
(dolist (charcodes haskell--char-syntax-identifiers)
(modify-syntax-entry charcodes "w" table))
Expand Down