Skip to content

Instantly share code, notes, and snippets.

@g000001
Created March 7, 2009 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g000001/75250 to your computer and use it in GitHub Desktop.
Save g000001/75250 to your computer and use it in GitHub Desktop.
(progn
;; edit-definitionで(setf foo)を拾えるようにする
;; slime-read-function-name に変更しただけ
(defun slime-edit-definition (name &optional where)
"Lookup the definition of the name at point.
If there's no name at point, or a prefix argument is given, then the
function name is prompted."
(interactive (list (slime-read-function-name "Name: ")))
(or (run-hook-with-args-until-success 'slime-edit-definition-hooks
name where)
(slime-edit-definition-cont (slime-find-definitions name)
name where)))
;; setf関数名を取り出す
(defun setf-function-name (str)
(let ((expr (car (read-from-string str))))
(cond ((eq 'setf (car expr))
(format "%s" expr))
(t (and (eq 'function (car expr))
(and (eq 'setf (car (cadr expr)))
(format "%s" (cadr expr))))))))
(defun slime-function-name-at-point ()
(let ((name (thing-at-point 'list)))
(if (and name (setf-function-name name))
(setf-function-name name)
(slime-symbol-at-point))))
(defun slime-read-function-name (prompt &optional query)
(cond ((or current-prefix-arg query (not (slime-function-name-at-point)))
(slime-read-from-minibuffer prompt (slime-function-name-at-point)))
(t (slime-function-name-at-point)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment