From 56de583445c367176a02edc8f1823e228f05c939 Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Wed, 20 Mar 2024 14:11:14 +0100 Subject: [PATCH] Clarify setting and getting of the slynk string elision length --- README.org | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/README.org b/README.org index b808363..4254ccd 100644 --- a/README.org +++ b/README.org @@ -4843,20 +4843,23 @@ silent]{(describe-variable 'no-littering-var-directory)}. Listing "(cdr (assoc 'slynk:*string-elision-length* slynk:*slynk-pprint-bindings*))" "Slynk \"string elision length\" getter command.") - (defun slynk-command-set-sel (sel) - "Slynk SEL \"string elision length\" setter command. -SEL values must be positive integers to enable or `nil' to disable elision." - (format "(setf %s %s)" slynk-command-get-sel sel)) + (defun slynk-command-set-sel (length) + "Slynk LENGTH \"string elision length\" setter command. +LENGTH values must be positive integers to enable or `nil' to disable elision." + (format "(setf %s %s)" slynk-command-get-sel length)) (defun slynk-get-sel () "Get the Slynk \"string-elision-length\"." (cadr (sly-eval `(slynk:eval-and-grab-output ,slynk-command-get-sel)))) - (defun slynk-set-sel (sel) - "Set the Slynk \"string-elision-length\" SEL. -SEL values must be positive integers to enable or `nil' to disable elision." - (cadr (sly-eval `(slynk:eval-and-grab-output ,(slynk-command-set-sel sel))))) + ;; Most useful for Org source blocks. + (defun slynk-set-sel (length) + "Set the Slynk \"string-elision-length\" LENGTH. +LENGTH values must be positive integers to enable or `nil' to disable elision." + (cadr + (sly-eval `(slynk:eval-and-grab-output ,(slynk-command-set-sel length))))) + ;; Most useful for interactive use. (defun slynk-eval-sel-command (string) "Evaluate the Slynk \"string-elision-length\" command STRING." (unless (sly-connected-p) @@ -4869,14 +4872,14 @@ SEL values must be positive integers to enable or `nil' to disable elision." (interactive) (slynk-eval-sel-command slynk-command-get-sel)) - (defun slynk-set-string-elision-length (&optional sel) - "Set the Slynk \"string-elision-length\" by evaluating SEL. -Valid SEL values are positive integers to enable or `nil' to disable elision." - (interactive "XSlynk string-elision-length (nil or sel > 0): ") - (unless (or (null sel) (and (integerp sel) (> sel 0))) + (defun slynk-set-string-elision-length (&optional length) + "Set the Slynk \"string-elision-length\" LENGTH. +Valid LENGTH values are positive integers to set or `nil' to reset." + (interactive "X\ Slink string elision length: ") + (unless (or (null length) (and (integerp length) (> length 0))) (user-error - "Slynk `sel' must evaluate to `nil' or a positive integer (got `%S')" sel)) - (slynk-eval-sel-command (slynk-command-set-sel sel)))) + "Slynk `length' must be `nil' or a positive integer (got `%S')" length)) + (slynk-eval-sel-command (slynk-command-set-sel length)))) #+end_src #+caption[Script to dump a SBCL core for the Sly Common Lisp IDE]: