8000 read-char binding in sunrise-loop extension · Issue #89 · sunrise-commander/sunrise-commander · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
read-char binding in sunrise-loop extension #89
Open
@lassik

Description

@lassik

package-lint warns:

sunrise-loop.el:212:1: error: "read-char" doesn't start with package's prefix "sunrise-loop".

That function looks like this:

(defun sunrise-loop-cmd-loop ()
  "Main execution loop for the background Elisp interpreter."
  (sunrise-ad-disable "^sunrise-loop-")
  (defun read-char nil ?y) ;; Always answer "yes" to any prompt
  (let ((command) (signature))
    (while t
      (setq command (read))
      (setq signature (md5 (prin1-to-string command)))
      (condition-case description
          (progn
            (if sunrise-loop-debug
                (message "%s" (concat "[[Executing in background: "
                                      (prin1-to-string command) "]]")))
            (eval command)
            (message "[[Command successfully invoked in background]]"))
        (error (message "%s" (concat "[[*ERROR IN BACKGROUND JOB: "
                                     (prin1-to-string description) "*]]"))))
        (message "^%s" signature))))

So it seems it's using a Scheme-style defun-within-a-defun to rebind the standard read-char function to a different for the duration of sunrise-loop-cmd-loop. Then the standard read-char binding is restored at the end.

@zonuexe Can we use (let ((read-char (lambda (&rest _ignored) ?y))) ...) instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0