sachac / subed

subed is a subtitle editor for Emacs
177 stars 16 forks source link

subed recenters on save, breaking scroll-all-mode #35

Open mooseyboots opened 3 years ago

mooseyboots commented 3 years ago

first, thx for your great package, it's nifty as.

so subed recenters, or rather scrolls so that point is 4/5 down the frame, on save. i guess in its sanitizing of things.

i didn't mind it all that much until i started using scroll-all-mode, which allows you to synchronize the scrolling of two windows. using it with subed, you can align the scrolling of two subtitles files, for translating. but when i save my srt file, only one of the windows gets recentered, putting the synchronized scroll out of sync.

it's not a killer issue, but perhaps it's also simple to avoid?

update: hm maybe scroll-all-mode is just too bare bones, as it really ought to work with recenter, which emacs calls the "basic scrolling command"(!). perhaps some subed users have an alternative approach for synchronized scrolling?

i guess scroll-syncing the subtitles by their numbers would be a colossal effort? that would be killer, but i'm not sure how it could be done.

rndusr commented 3 years ago

I just spent 20 minutes trying to disable this feature and I couldn't figure out how. Either my Emacs-fu is too rusty or the recentering is implemented somewhere else.

If you can find out how to disable it, feel free to make a PR.

mooseyboots commented 3 years ago

thanks for taking a look. unfortunately i'm more subtitler than programmer. my emacs debugging mostly amounts to enabling edebug-defun and hitting space bar and looking on.

seems like its in subed-srt--sort, but not the santitize or validate functions it runs, or in subed-save-excursion. the latter i struggled to take a look at w my beginner's skills. if i swapped it out for a vanilla save-excursion, point would be at beginning of buffer after save.

thanks anyway, and again for the package.

mooseyboots commented 3 years ago

a workaround to run recenter-top-bottom after saving, only when in subed mode:

(setq-default subed-save-buffer-advice nil)

(add-hook 'subed-mode-hook (lambda () (setq-local subed-save-buffer-advice t)))

(defadvice save-buffer (after recenter activate)
  (when (equal subed-save-buffer-advice t)
    (recenter-top-bottom)))