[slime-devel] Slime opening files behind users back

Nikodemus Siivola nikodemus at random-state.net
Wed Apr 29 22:34:43 UTC 2009

Currently some part of the compilation note magic opens files where
notes occur if they are not already open.

This can be highly annoying if those files eg. set buffer local
variables that are not considered safe, so Emacs asks what to do about
them. It is undesirable in other ways as well to me -- consider eg. a
slow NFS partition, or compiling on a remote host.

Ideally I would like it if the opening were deferred to the point in
time where the user browses the compilation note buffer, and hits
enter to be taken to the source location in question.

As a stopgap measure, something like this -- used in appropriate
places -- would also make life better for me:

(defvar slime-try-set-buffer-opens-files :ask
  "Defines the behaviror or `slime-try-set-buffer': if T opens files without
asking; if NIL never opens a file; if anything else permission asks before

(defun slime-try-set-buffer (reason filename &optional nowarn)
  "Returns the buffer for FILENAME if one exists. Behavior depends on
  (let ((buffer (or (get-buffer filename)
                    (when (and slime-try-set-buffer-opens-files
                               (or (eq slime-maybe-set-buffer-opens-files t)
                                   (y-or-n-p "Open %s for %s? "
filename reason)))
                      (find-file-noselect filename nowarn)))))
    (when buffer
      (set-buffer buffer))))


 -- Nikodemus

More information about the slime-devel mailing list