diff options
| author | Craig Jennings <c@cjennings.net> | 2025-11-13 17:21:23 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-11-13 17:21:23 -0600 |
| commit | bc1115144d8bab0f0ab87e8582f102c3eec37f55 (patch) | |
| tree | fe77d8004dc2c767c1e4fbfd959817c1ddcd0f2f | |
| parent | eeb06e6adf32fc173aad5f6b6df2803d87fba5ee (diff) | |
| download | org-drill-bc1115144d8bab0f0ab87e8582f102c3eec37f55.tar.gz org-drill-bc1115144d8bab0f0ab87e8582f102c3eec37f55.zip | |
fix: prevent window corruption in org-drill-merge-buffers
Replaced switch-to-buffer with with-current-buffer to avoid changing
visible buffers during merge operation. This prevents window state
corruption and allows the function to work correctly in batch mode.
Changed line 3374-3375 from:
(save-excursion
(switch-to-buffer (marker-buffer marker))
...)
To:
(with-current-buffer (marker-buffer marker)
(save-excursion
...))
| -rw-r--r-- | org-drill.el | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/org-drill.el b/org-drill.el index f84b357..056cf3c 100644 --- a/org-drill.el +++ b/org-drill.el @@ -3370,22 +3370,22 @@ copy them across." (setq last-reviewed (org-entry-get (point) "DRILL_LAST_REVIEWED") last-quality (org-entry-get (point) "DRILL_LAST_QUALITY") scheduled-time (org-get-scheduled-time (point))) - (save-excursion - ;; go to matching entry in destination buffer - (switch-to-buffer (marker-buffer marker)) - (goto-char marker) - (org-drill-strip-entry-data) - (unless (zerop total-repeats) - (org-drill-store-item-data last-interval repetitions failures - total-repeats meanq ease) - (if last-quality - (org-set-property "LAST_QUALITY" last-quality) - (org-delete-property "LAST_QUALITY")) - (if last-reviewed - (org-set-property "LAST_REVIEWED" last-reviewed) - (org-delete-property "LAST_REVIEWED")) - (if scheduled-time - (org-schedule nil scheduled-time))))) + ;; go to matching entry in destination buffer + (with-current-buffer (marker-buffer marker) + (save-excursion + (goto-char marker) + (org-drill-strip-entry-data) + (unless (zerop total-repeats) + (org-drill-store-item-data last-interval repetitions failures + total-repeats meanq ease) + (if last-quality + (org-set-property "LAST_QUALITY" last-quality) + (org-delete-property "LAST_QUALITY")) + (if last-reviewed + (org-set-property "LAST_REVIEWED" last-reviewed) + (org-delete-property "LAST_REVIEWED")) + (if scheduled-time + (org-schedule nil scheduled-time)))))) (remhash id org-drill-dest-id-table) (set-marker marker nil))) (t |
