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

Feature Request: New command(s) to remove styling #283

Closed
hmelman opened this issue Nov 13, 2017 · 6 comments
Closed

Feature Request: New command(s) to remove styling #283

hmelman opened this issue Nov 13, 2017 · 6 comments
Labels

Comments

@hmelman
Copy link
Contributor

hmelman commented Nov 13, 2017

I wanted to remove bolding from some text. It would be nice if there was a command to do so. I'm not sure how it would work.

  1. Should it turn bold text into italics or straight to plain text? Maybe a user option to choose.
  2. I'd be fine having to highlight all the (possibly multi-word) text to remove formatting though currently having point on a word without a region and using C-c C-s b will bold the whole word and leave point where it is. It would be nice for a remove function to have symmetry with this behavior.
  3. I originally thought of a single command (say on C-c C-r) that would remove paired formatting (bold, italics, headings, code, etc). Perhaps it would be better to have the existing commands be a toggle. Currently if point is in a bolded word, C-c C-s b will add more asterisks which probably isn't what is wanted. Perhaps a toggle is more efficient behavior and works better in nested circumstances (this text is bold and code, remove the code tags) . This could also be easier to implement because code could know what specific chars to look for rather than working on the inner most nested styling.
@jrblevin
Copy link
Owner

Most of the markup insertion/styling commands work as toggles already, including bold.

currently having point on a word without a region and using C-c C-s b will bold the whole word and leave point where it is. It would be nice for a remove function to have symmetry with this behavior.

That's the intended behavior of the toggle functionality. If it's not working like that, can you give a test case or instructions to replicate?

Currently if point is in a bolded word, C-c C-s b will add more asterisks which probably isn't what is wanted.

If so, then I think that would be a bug.

@hmelman
Copy link
Contributor Author

hmelman commented Nov 13, 2017

Took a little to narrow it down. Create a buffer with two list items:

     - [foo](bar) - 
     - [**abc**](def) -

The important point is that 'abc' must be bolded. Put point in foo after the 'f'. C-c C-s b repeatedly will add asterisks. If point is between the two o's in foo it will behave more oddly.

@jrblevin
Copy link
Owner

Thanks for narrowing this down. I can reproduce what you described and will look into it.

@jrblevin jrblevin added the bug label Nov 15, 2017
@sten0
Copy link

sten0 commented Apr 29, 2020

Confirmed bug in toggle functionality, following @hmelman's steps to reproduce,

If point is between the two o's in foo it will behave more oddly.

Transforms

- [foo](bar) - 
- [foo](bar) - 
- [**abc**](def) -

to (first interation with point in between the two os)

- [foo](bar) - 
- [**foo**](bar) - 
- [**abc**](def) -

to (second interation with point in between the two os)

- [foo](bar) - 
- [**foo](bar) - 
- [abc**](def) -

with Emacs 26.1 and markdown-mode f3c54e3

@syohex
Copy link
Collaborator

syohex commented May 1, 2020

I have merged #466. Please check latest version.

@syohex syohex closed this as completed May 1, 2020
@sten0
Copy link

sten0 commented May 1, 2020

Thank you @syohex ! Confirmed fixed in c15f67f with Emacs 26.1

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

No branches or pull requests

4 participants