Skip to content

Prettify symbol troubles with dot operator #589

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

Closed
hmgibson23 opened this issue Apr 21, 2015 · 8 comments
Closed

Prettify symbol troubles with dot operator #589

hmgibson23 opened this issue Apr 21, 2015 · 8 comments

Comments

@hmgibson23
Copy link
Contributor

Great fix for the issues with >>=. Thanks for the super fast response. The fix however has unfortunately introduced another bug. Now in imports . is transformed into ∘ so you get the fairly unpleasant import Data∘ByteString∘Char8 instead of Data.ByteString.Char8.

Sorry I feel like the scrooge of prettify-symbols-mode!

@gracjan
Copy link
Contributor

gracjan commented Apr 21, 2015

@hmgibson23: If you look through the code you will see that "." requires special handling.

Are you able to look at this yourself and create a pull request?

@hmgibson23
Copy link
Contributor Author

Yes will have a look

@gracjan
Copy link
Contributor

gracjan commented Apr 21, 2015

@hmgibson23: should be pretty easy: just check if a dot has space before and space after.

@hmgibson23
Copy link
Contributor Author

Yeah good call.

@ivan-m
Copy link
Contributor

ivan-m commented Apr 21, 2015

@gracjan it can't just be a matter of requiring a space before/after: that means that (.) wouldn't be pretty-fied.

Then again, how do you tell if Foo.Bar is subsequently applying two constructors or just applying one qualified constructor?

@gracjan
Copy link
Contributor

gracjan commented Apr 21, 2015

See here:

https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-180002.4

specifically this table:

This Lexes as this

f.g     f . g (three tokens)
F.g     F.g (qualified ‘g’)
f..     f .. (two tokens)
F..     F.. (qualified ‘.’)
F.      F . (two tokens) 

@hmgibson23
Copy link
Contributor Author

I'm not that familiar with Elisp, so would something like

    (or (re-search-backward "\\<forall\\>[^.\"]*\\="
                            (line-beginning-position) t)
        (re-search-backward "[^ ]\.[^ ]"
                            (line-beginning-position) t))))

work?

Which makes me think the forall regex is actually redundant.

@gracjan
Copy link
Contributor

gracjan commented Apr 21, 2015

Close, but no cigar. I guess using char-before and char-after would be better idea. You can read about those here:

http://www.gnu.org/software/emacs/manual/html_node/elisp/Near-Point.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants