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

saving subed buffer removes flyspell overlays #55

Open
mooseyboots opened this issue Jan 14, 2022 · 5 comments
Open

saving subed buffer removes flyspell overlays #55

mooseyboots opened this issue Jan 14, 2022 · 5 comments

Comments

@mooseyboots
Copy link

not sure if others have this issue.

when i save a subed buffer, all flyspell underlines disappear, which means i have to keep running flyspell-buffer to see them again, even when flyspell-mode is enabled.

@sachac
Copy link
Owner

sachac commented Jan 14, 2022 via email

@mooseyboots
Copy link
Author

yeah i guess the buffer gets fully re-written, so prob not much we can do. re-running flyspell-buffer after save is also going to be too slow, at least for longer videos.

@sachac
Copy link
Owner

sachac commented Jan 14, 2022 via email

@sachac
Copy link
Owner

sachac commented Jan 23, 2022

Hmm... If you don't mind losing the sorting behaviour, we could probably change this so that sorting is controlled by a custom variable. That way, SRT subtitles can still be renumbered as needed, but if you don't often need to completely sort the buffer, we can skip that part and you can keep flyspell. Would something like that work for you?

@sachac
Copy link
Owner

sachac commented Feb 3, 2022 via email

sachac added a commit that referenced this issue Feb 7, 2022
This should reduce the disruption to things like the mark
ring. (Related to #57 and #55, and might address #35 as well?)

* subed/subed-common.el (sanitize): Separate the sanitize and
  sanitize-format functions.
  (sanitize-format): New generic function.
  (validate): Separate the validate and validate-format functions.
  (validate-format): New generic function.
  (regenerate-ids): Have generic implementation.
  (subed-sanitize-functions): Move to subed-config.el.
  (subed-validate-functions): Move to subed-config.el.
  (subed-prepare-to-save): Call subed-sanitize and subed-validate.
  (subed--sorted-p): New function to test if the subtitles are sorted.
  (sort): Make interactive. Sort only if unsorted, which should
  minimize interference with flycheck and the mark ring.
* subed/subed-config.el (subed-sanitize-functions): New customizable
  variable.
  (subed-validate-functions): New customizable variable.
* subed/subed-srt.el (subed--sanitize-format): Define this instead of
  subed--sanitize.
  (subed--validate-format): Define this instead of subed--validate.
* subed/subed-vtt.el (subed--sanitize-format): Define this instead of
  subed--sanitize.
  (subed--validate-format): Define this instead of subed--validate.
  (subed--sort): Remove format-specific implementation.
* tests/test-subed-common.el ("Trimming subtitles when configured to
  check on save reports overlaps."): Specify options.
  ("Sorting"): Add test cases.
* tests/test-subed-vtt.el ("Sorting preserves point in the current
  subtitle when subtitle text is empty."): Tweak position check.
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

2 participants