[slime-cvs] CVS slime
CVS User heller
heller at common-lisp.net
Tue Oct 27 12:46:32 UTC 2009
Update of /project/slime/cvsroot/slime
In directory cl-net:/tmp/cvs-serv31296
Modified Files:
ChangeLog slime.el
Log Message:
* slime.el: Fix some docstrings and comments.
--- /project/slime/cvsroot/slime/ChangeLog 2009/10/26 19:17:00 1.1889
+++ /project/slime/cvsroot/slime/ChangeLog 2009/10/27 12:46:32 1.1890
@@ -1,3 +1,7 @@
+2009-10-27 Helmut Eller <heller at common-lisp.net>
+
+ * slime.el: Fix some docstrings and comments.
+
2009-10-26 Tobias C. Rittweiler <tcr at freebits.de>
* test.sh: Shebang on bash, not just on sh.
--- /project/slime/cvsroot/slime/slime.el 2009/10/25 18:44:35 1.1236
+++ /project/slime/cvsroot/slime/slime.el 2009/10/27 12:46:32 1.1237
@@ -59,9 +59,6 @@
(eval-and-compile
(require 'cl)
- (unless (fboundp 'define-minor-mode)
- (require 'easy-mmode)
- (defalias 'define-minor-mode 'easy-mmode-define-minor-mode))
(when (locate-library "hyperspec")
(require 'hyperspec)))
(require 'thingatpt)
@@ -666,8 +663,8 @@
do (define-key slime-mode-map key command)))
(defun slime-define-both-key-bindings (keymap bindings)
+ "Add BINDINGS to KEYMAP, both unmodified and with control."
(loop for (char command) in bindings do
- ;; We bind both unmodified and with control.
(define-key keymap `[,char] command)
(unless (equal char ?h) ; But don't bind C-h
(define-key keymap `[(control ,char)] command))))
@@ -707,8 +704,7 @@
;;;;; Syntactic sugar
(defmacro* when-let ((var value) &rest body)
- "Evaluate VALUE, and if the result is non-nil bind it to VAR and
-evaluate BODY.
+ "Evaluate VALUE, if the result is non-nil bind it to VAR and eval BODY.
\(fn (VAR VALUE) &rest BODY)"
`(let ((,var ,value))
@@ -881,9 +877,7 @@
(defun slime-read-symbol-name (prompt &optional query)
"Either read a symbol name or choose the one at point.
The user is prompted if a prefix argument is in effect, if there is no
-symbol at point, or if QUERY is non-nil.
-
-This function avoids mistaking the REPL prompt for a symbol."
+symbol at point, or if QUERY is non-nil."
(cond ((or current-prefix-arg query (not (slime-symbol-at-point)))
(slime-read-from-minibuffer prompt (slime-symbol-at-point)))
(t (slime-symbol-at-point))))
@@ -945,11 +939,16 @@
(list (previous-single-char-property-change end prop) end)))
(defun slime-curry (fun &rest args)
+ "Partially apply FUN to ARGS. The result is a new function.
+This idiom is preferred over `lexical-let'."
`(lambda (&rest more) (apply ',fun (append ',args more))))
(defun slime-rcurry (fun &rest args)
+ "Like `slime-curry' but ARGS on the right are applied."
`(lambda (&rest more) (apply ',fun (append more ',args))))
+
+;; FIXME: Get rid or snapshots.
;;;;; Snapshots of current Emacs state
;;; Window configurations do not save (and hence not restore)
@@ -1170,8 +1169,10 @@
;;; these functions. This way users who run Emacs and Lisp on separate
;;; machines have a chance to integrate file operations somehow.
-(defvar slime-to-lisp-filename-function #'convert-standard-filename)
-(defvar slime-from-lisp-filename-function #'identity)
+(defvar slime-to-lisp-filename-function #'convert-standard-filename
+ "Function to translate Emacs filenames to CL namestrings.")
+(defvar slime-from-lisp-filename-function #'identity
+ "Function to translate CL namestrings to Emacs filenames.")
(defun slime-to-lisp-filename (filename)
"Translate the string FILENAME to a Lisp filename."
@@ -1197,16 +1198,11 @@
(defvar slime-lisp-implementations nil
"*A list of known Lisp implementations.
The list should have the form:
- ((NAME (PROGRAM PROGRAM-ARGS...) &key INIT CODING-SYSTEM ENV) ...)
+ ((NAME (PROGRAM PROGRAM-ARGS...) &key KEYWORD-ARGS) ...)
NAME is a symbol for the implementation.
PROGRAM and PROGRAM-ARGS are strings used to start the Lisp process.
-INIT is a function that should return a string to load and start
- Swank. The function will be called with the PORT-FILENAME and ENCODING as
- arguments. INIT defaults to `slime-init-command'.
-CODING-SYSTEM a symbol for the coding system. The default is
- slime-net-coding-system
-ENV environment variables for the subprocess (see `process-environment').
+For KEYWORD-ARGS see `slime-start'.
Here's an example:
((cmucl (\"/opt/cmucl/bin/lisp\" \"-quiet\") :init slime-init-command)
@@ -1294,6 +1290,23 @@
(buffer "*inferior-lisp*")
init-function
env)
+ "Start a Lisp process and connect to it.
+This function is intended for programmatic use if `slime' is not
+flexible enough.
+
+PROGRAM and PROGRAM-ARGS are the filename and argument strings
+ for the subprocess.
+INIT is a function that should return a string to load and start
+ Swank. The function will be called with the PORT-FILENAME and ENCODING as
+ arguments. INIT defaults to `slime-init-command'.
+CODING-SYSTEM a symbol for the coding system. The default is
+ slime-net-coding-system
+ENV environment variables for the subprocess (see `process-environment').
+INIT-FUNCTION function to call right after the connection is established.
+BUFFER the name of the buffer to use for the subprocess.
+NAME a symbol to describe the Lisp implementation
+DIRECTORY change to this directory before starting the process.
+"
(let ((args (list :program program :program-args program-args :buffer buffer
:coding-system coding-system :init init :name name
:init-function init-function :env env)))
@@ -1309,7 +1322,7 @@
(apply #'slime-start options))
(defun slime-connect (host port &optional coding-system)
- "Connect to a running Swank server. Returns the connection."
+ "Connect to a running Swank server. Return the connection."
(interactive (list (read-from-minibuffer "Host: " slime-lisp-host)
(read-from-minibuffer "Port: " (format "%d" slime-port)
nil t)))
@@ -1324,30 +1337,13 @@
(slime-dispatching-connection process))
(slime-setup-connection process))))
-;;(defun slime-start-and-load (filename &optional package)
-;; "Start Slime, if needed, load the current file and set the package."
-;; (interactive (list (expand-file-name (buffer-file-name))
-;; (slime-find-buffer-package)))
-;; (cond ((slime-connected-p)
-;; (slime-load-file-set-package filename package))
-;; (t
-;; (slime-start-and-init (slime-lisp-options)
-;; (slime-curry #'slime-start-and-load
-;; filename package)))))
-
+;; FIXME: seems redundant
(defun slime-start-and-init (options fun)
(let* ((rest (plist-get options :init-function))
(init (cond (rest `(lambda () (funcall ',rest) (funcall ',fun)))
(t fun))))
(slime-start* (plist-put (copy-list options) :init-function init))))
-;;(defun slime-load-file-set-package (filename package)
-;; (let ((filename (slime-to-lisp-filename filename)))
-;; (slime-eval-async `(swank:load-file ,filename)
-;; (lexical-let ((package package))
-;; (lambda (ignored)
-;; (slime-repl-set-package package))))))
-
;;;;; Start inferior lisp
;;;
;;; Here is the protocol for starting SLIME:
@@ -1453,7 +1449,8 @@
(slime-read-port-and-connect process nil))
(defvar slime-inferior-lisp-args nil
- "A buffer local variable in the inferior proccess.")
+ "A buffer local variable in the inferior proccess.
+See `slime-start'.")
(defun slime-start-swank-server (process args)
"Start a Swank server on the inferior lisp."
@@ -1467,6 +1464,8 @@
(process-send-string process str)))))
(defun slime-inferior-lisp-args (process)
+ "Return the initial process arguments.
+See `slime-start'."
(with-current-buffer (process-buffer process)
slime-inferior-lisp-args))
@@ -1615,9 +1614,9 @@
The functions are called with the process as their argument.")
(defun slime-secret ()
- "Finds the magic secret from the user's home directory.
-Returns nil if the file doesn't exist or is empty; otherwise the first
-line of the file."
+ "Find the magic secret from the user's home directory.
+Return nil if the file doesn't exist or is empty; otherwise the
+first line of the file."
(condition-case err
(with-temp-buffer
(insert-file-contents "~/.slime-secret")
@@ -1662,8 +1661,6 @@
;;;;; Coding system madness
-
-
(defun slime-check-coding-system (coding-system)
"Signal an error if CODING-SYSTEM isn't a valid coding system."
(interactive)
@@ -1881,6 +1878,7 @@
(error "Connection closed."))
(t conn))))
+;; FIXME: should be called auto-start
(defcustom slime-auto-connect 'never
"Controls auto connection when information from lisp process is needed.
This doesn't mean it will connect right after Slime is loaded."
@@ -1901,7 +1899,7 @@
(t nil)))
(defcustom slime-auto-select-connection 'ask
- "Controls auto selection after the default connection was quited."
+ "Controls auto selection after the default connection was closed."
:group 'slime-mode
:type '(choice (const never)
(const always)
@@ -1932,8 +1930,6 @@
slime-net-processes))
(p (car tail)))
(slime-select-connection p)
-;; (unless (eq major-mode 'slime-repl-mode)
-;; (setq slime-buffer-connection p))
(message "Lisp: %s %s" (slime-connection-name p) (process-contact p))))
(defmacro* slime-with-connection-buffer ((&optional process) &rest body)
@@ -1948,7 +1944,6 @@
(put 'slime-with-connection-buffer 'lisp-indent-function 1)
-
(defun slime-compute-connection-state (conn)
(cond ((null conn) :disconnected)
((slime-stale-connection-p conn) :stale)
@@ -2116,9 +2111,8 @@
;;;;; Commands on connections
-(defun slime-disconnect (&optional connection)
- "If CONNECTION is non-nil disconnect it, otherwise disconnect
-the current slime connection."
+(defun slime-disconnect ()
+ "Close the current connection."
(interactive)
(slime-net-close (or connection (slime-connection))))
@@ -2135,7 +2129,7 @@
(defun slime-process (&optional connection)
"Return the Lisp process for CONNECTION (default `slime-connection').
-Can return nil if there's no process object for the connection."
+Return nil if there's no process object for the connection."
(let ((proc (slime-inferior-process connection)))
(if (and proc
(memq (process-status proc) '(run stop)))
@@ -2437,7 +2431,6 @@
(error "Invalid channel id: %S %S" id msg))
msg))
((:emacs-channel-send id msg)
- ;; FIXME: Guard against errors like in :emacs-rex?
(slime-send `(:emacs-channel-send ,id ,msg)))
((:read-from-minibuffer thread tag prompt initial-value)
(slime-read-from-minibuffer-for-swank thread tag prompt initial-value))
@@ -2492,8 +2485,6 @@
(interactive)
(setf (slime-rex-continuations) '())
(mapc #'kill-buffer (sldb-buffers))
- ;; Due to character encoding errors, a half-processed RPC result may
- ;; get stuck in the connection buffer and keep Slime choking.
(slime-with-connection-buffer ()
(erase-buffer)))
@@ -2614,6 +2605,7 @@
(pp event buffer)))
(defun slime-events-buffer ()
+ "Return or create the event log buffer."
(or (get-buffer slime-event-buffer-name)
(let ((buffer (get-buffer-create slime-event-buffer-name)))
(with-current-buffer buffer
@@ -2625,11 +2617,11 @@
(outline-minor-mode)))
buffer)))
-
;;;;; Cleanup after a quit
(defun slime-restart-inferior-lisp ()
+ "Kill and restart the Lisp subprocess."
(interactive)
(assert (slime-inferior-process) () "No inferior lisp process")
(slime-quit-lisp-internal (slime-connection) 'slime-restart-sentinel t))
@@ -2646,22 +2638,14 @@
(plist-get args :program-args)
(plist-get args :env)
nil
- buffer))
- ;;(repl-buffer (slime-repl-buffer nil process))
- ;;(repl-window (and repl-buffer (get-buffer-window repl-buffer)))
- )
+ buffer)))
(slime-net-close process)
(slime-inferior-connect new-proc args)
- (cond ;;((and repl-window (not buffer-window))
- ;; (set-window-buffer repl-window buffer)
- ;; (select-window repl-window))
- ;;(repl-window
- ;; (select-window repl-window))
- (t
- (pop-to-buffer buffer)))
+ (pop-to-buffer buffer)
(switch-to-buffer buffer)
(goto-char (point-max))))
+;; FIXME: move to slime-repl
(defun slime-kill-all-buffers ()
"Kill all the slime related buffers.
This is only used by the repl command sayoonara."
@@ -2684,6 +2668,7 @@
The function receive two arguments: the beginning and the end of the
region that will be compiled.")
+;; FIXME: remove some of the options
(defcustom slime-compilation-finished-hook 'slime-maybe-show-compilation-log
"Hook called with a list of compiler notes after a compilation."
:group 'slime-mode
@@ -2696,6 +2681,8 @@
slime-maybe-show-xrefs-for-notes
slime-goto-first-note))
+;; FIXME: I doubt that anybody uses this directly and it seems to be
+;; only an ugly way to pass arguments.
(defvar slime-compilation-policy nil
"When non-nil compile defuns with this debug optimization level.")
@@ -2744,8 +2731,6 @@
See `slime-compile-and-load-file' for further details."
(interactive)
- ;;(unless (memq major-mode slime-lisp-modes)
- ;; (error "Only valid in lisp-mode"))
(check-parens)
(unless buffer-file-name
(error "Buffer %s is not associated with a file." (buffer-name)))
@@ -2778,6 +2763,7 @@
(slime-compile-string (buffer-substring-no-properties start end) start))
(defun slime-flash-region (start end &optional timeout)
+ "Temporarily highlight region from START to END."
(let ((overlay (make-overlay start end)))
(overlay-put overlay 'face 'secondary-selection)
(run-with-timer (or timeout 0.2) nil 'delete-overlay overlay)))
@@ -2845,6 +2831,9 @@
;;;;; Recompilation.
+;; FIXME: This whole idea is questionable since it depends so
+;; crucially on precise source-locs.
+
(defun slime-recompile-location (location)
(save-excursion
(slime-goto-source-location location)
@@ -2954,6 +2943,7 @@
(display-buffer (current-buffer)))))))
(defun slime-show-compilation-log (notes)
+ "Create and display the compilation log buffer."
(interactive (list (slime-compiler-notes)))
(slime-with-popup-buffer ("*SLIME Compilation*")
(slime-insert-compilation-log notes)))
@@ -2999,8 +2989,8 @@
(slime-indent-rigidly start (point) column)))
(defun slime-canonicalized-location (location)
- "Takes a `slime-location' and returns a list consisting of
-file/buffer name, line, and column number."
+ "Return a list (FILE LINE COLUMN) for slime-location LOCATION.
+This is quite an expensive operation so use carefully."
(save-excursion
(slime-goto-location-buffer (slime-location.buffer location))
(save-excursion
@@ -3106,7 +3096,7 @@
"Create an overlay representing a compiler note.
The overlay has several properties:
FACE - to underline the relevant text.
- SEVERITY - for future reference, :NOTE, :STYLE-WARNING, :WARNING, or :ERROR.
+ SEVERITY - for future reference :NOTE, :STYLE-WARNING, :WARNING, or :ERROR.
MOUSE-FACE - highlight the note when the mouse passes over.
HELP-ECHO - a string describing the note, both for future reference
and for display as a tooltip (due to the special
@@ -3273,6 +3263,10 @@
(beginning-of-sexp))
(error (goto-char origin)))))
+
+;; FIXME: really fix this mess
+;; FIXME: the check shouln't be done here anyway but by M-. itself.
+
(defun slime-filesystem-toplevel-directory ()
;; Windows doesn't have a true toplevel root directory, and all
;; filenames look like "c:/foo/bar/quux.baz" from an Emacs
[518 lines skipped]
More information about the slime-cvs
mailing list