Function: ses-command-hook

ses-command-hook is a byte-compiled function defined in ses.el.gz.

Signature

(ses-command-hook)

Documentation

Invoked from post-command-hook. If point has moved to a different cell, move the underlining overlay. Perform any recalculations or cell-data writes that have been deferred. If buffer-narrowing has been deferred, narrow the buffer now.

Source Code

;; Defined in /usr/src/emacs/lisp/ses.el.gz
(defun ses-command-hook ()
  "Invoked from `post-command-hook'.  If point has moved to a different cell,
move the underlining overlay.  Perform any recalculations or cell-data
writes that have been deferred.  If buffer-narrowing has been deferred,
narrow the buffer now."
  (condition-case err
      (when (eq major-mode 'ses-mode)  ; Otherwise, not our buffer anymore.
	(when ses--deferred-recalc
	  ;; We reset the deferred list before starting on the recalc --- in
	  ;; case of error, we don't want to retry the recalc after every
	  ;; keystroke!
	  (ses-initialize-Dijkstra-attempt)
	  (let ((old ses--deferred-recalc))
	    (setq ses--deferred-recalc nil)
	    (ses-update-cells old)))
	(when ses--deferred-write
	  ;; We don't reset the deferred list before starting --- the most
	  ;; likely error is keyboard-quit, and we do want to keep trying these
	  ;; writes after a quit.
	  (ses-write-cells)
	  (push '(apply ses-widen) buffer-undo-list))
	(when ses--deferred-narrow
	  ;; We're not allowed to narrow the buffer until after-find-file has
	  ;; read the local variables at the end of the file.  Now it's safe to
	  ;; do the narrowing.
	  (narrow-to-region (point-min) ses--data-marker)
	  (setq ses--deferred-narrow nil)))
    ;; Prevent errors in this post-command-hook from silently erasing the hook!
    (error
     (unless executing-kbd-macro
       (ding))
     (message "%s" (error-message-string err))))
  nil) ; Make coverage-tester happy.