From bc1115144d8bab0f0ab87e8582f102c3eec37f55 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 13 Nov 2025 17:21:23 -0600 Subject: 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 ...)) --- org-drill.el | 32 ++++++++++++++++---------------- 1 file 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 -- cgit v1.2.3