From 8050bee438b14cc551d4022d643edece8c5a884b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Bela=C3=AFche?= Date: Thu, 10 Jul 2025 12:53:25 +0200 Subject: [PATCH] Run ses-after-entry-functions with run-hook-with-args. * lisp/ses.el (ses-after-entry-functions): Indicate that `ses--row' and `ses--col' are dynamically bound while hook is run. (ses-read-cell, ses-read-symbol): Use `run-hook-with-args' rather than `dolist'+`funcall' to run hook `ses-after-entry-functions'. --- lisp/ses.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lisp/ses.el b/lisp/ses.el index e3b81438178..1b99cc500d0 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -101,7 +101,9 @@ (defcustom ses-after-entry-functions '(forward-char) "Things to do after entering a value into a cell. An abnormal hook that usually runs a cursor-movement function. -Each function is called with ARG=1." +Each function is called with ARG=1. +Variables `ses--row' and `ses--col' are dynamically bound to cell +coordinates during hook call." :type 'hook :options '(forward-char backward-char next-line previous-line)) @@ -2596,9 +2598,9 @@ Return nil if cell formula was unsafe and user declined confirmation." curval))))))) (when (ses-edit-cell row col newval) (ses-command-hook) ; Update cell widths before movement. - (cl-progv '(row col) (list row col) ; cl-progv to have dynamic binding - (dolist (x ses-after-entry-functions) - (funcall x 1))))) + (let ((ses--row row) + (ses--col col)) + (run-hook-with-args 'ses-after-entry-functions 1)))) (defun ses-read-symbol (row col symb) "Self-insert for a symbol as a cell formula. @@ -2617,9 +2619,9 @@ spreadsheet is available for completions." (list 'quote (intern newval)))))) (when (ses-edit-cell row col symb) (ses-command-hook) ; Update cell widths before movement. - (cl-progv '(row col) (list row col) ; cl-progv to have dynamic binding - (dolist (x ses-after-entry-functions) - (funcall x 1))))) + (let ((ses--row row) + (ses--col col)) + (run-hook-with-args 'ses-after-entry-functions 1)))) (defun ses-clear-cell-forward (count) "Delete formula and printer for current cell and then move to next cell.