Skip to content
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

uncomment-region-function for #; sexp comments #217

Open
stchang opened this issue Jul 14, 2016 · 4 comments
Open

uncomment-region-function for #; sexp comments #217

stchang opened this issue Jul 14, 2016 · 4 comments

Comments

@stchang
Copy link

stchang commented Jul 14, 2016

UPDATE: This description is no longer true. See next comment.

Not sure if anything can be done about this, but I thought it was interesting behavior.

Using emacs M-x uncomment to remove a #; removes the comment, but also deletes the closing parens. For example:

#;(define (f x) x)

becomes

(define (f x) x
@stchang
Copy link
Author

stchang commented Jul 14, 2016

Realized I was using an old version of racket-mode, sorry. Updated, and the current behavior is that trying to M-x uncomment a #; does nothing. Is that the intended behavior?

@stchang stchang changed the title uncommenting #; s-exp comment removes closing paren uncommenting #; s-exp comment does nothing Jul 14, 2016
@greghendershott
Copy link
Owner

Not to nit-pick but just to confirm, I think you mean M-x uncomment-region?

Currently uncomment-region doesn't work because a sexp comment is only drawn (font-locked) as a comment. The expression text has the usual Emacs syntax, not comment syntax.1 Therefore things like uncomment-region won't see it as a comment. Even if it did, uncomment-region by default probably wouldn't know to remove the #;. And probably not how to deal with nested sexp comments.

There is an uncomment-region-function which racket-mode could redefine to attempt to do all these special things. I'll try to find time to take a look.

(FWIW, it looks like uncomment-region also is a no-op in clojure-mode for #_ sexp comments.)


Footnotes

  1. Why? So you can still navigate the sexp. AFAICT sexp comments odd that way: You want them to act like comments except when you don't want them to. :)

@stchang
Copy link
Author

stchang commented Jul 14, 2016

Whoops, yes I meant M-x uncomment-region.

And I think the current behavior is reasonable so I'm ok with closing this issue as "no plan to implement".

@greghendershott greghendershott changed the title uncommenting #; s-exp comment does nothing uncomment-region-function for #; sexp comments Jul 14, 2016
@greghendershott
Copy link
Owner

OK. I'll keep it open. But tag as a feature not a bug. And not assign it to me (for now).

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

No branches or pull requests

2 participants