Penetrating the `set-process-sentinel` hierarchy with let-bound variables

后端 未结 3 1726
时光说笑
时光说笑 2020-12-10 17:08

I have never been able to come up with a method to penetrate the set-process-sentinel hierarchy with let-bound variables defined at the outset of the fu

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-10 17:41

    The following is an example using dynamic bindings:

    (defun example-dynamic-fn ()
    "Doc-string"
    (interactive)
      (let ((test-variable "Hello-world!"))
        (set-process-sentinel
          (start-process "process-one" "*one*" "echo" test-variable)
          `(lambda (p e) (when (= 0 (process-exit-status p))
            (set-process-sentinel
              (start-process "process-two" "*two*" "echo" ,test-variable)
              '(lambda (p e) (when (= 0 (process-exit-status p))
                (start-process "process-three" "*three*" "echo" ,test-variable)
                (set-process-sentinel
                  (start-process "process-four" "*four*" "echo" ,test-variable)
                  '(lambda (p e) (when (= 0 (process-exit-status p))
                    (set-process-sentinel
                      (start-process "process-five" "*five*" "echo" ,test-variable)
                      '(lambda (p e) (when (= 0 (process-exit-status p))
                        (message "test-variable:  %s" ,test-variable)))))))))))))))
    

提交回复
热议问题