[slime-devel] Re: [Patch] Improve slime-edit-definition-other-window and ...-frame

Luke Gorrie luke at synap.se
Thu Mar 31 20:24:03 UTC 2005


Howdy Matthias,

Matthias Koeppe <mkoeppe+slime at mail.math.uni-magdeburg.de> writes:

> I am sending a little patch that improves the commands
> slime-edit-definition-other-window and ...-frame.  Would someone like
> to merge it into CVS?

Can you try to rewrite the function below in a hairless way? Often
it's possible to do a clearer job than Emacs itself does.

The name could probably be more informative too. Our coding standard
(http://www.norvig.com/luv-slides.ps) wisely suggests we be wary of
symbol names ending in "-AUX".

> +(defun slime-goto-definition-other-window-aux (definition)
> +  ;; Taken from the Emacs function `find-tag-other-window':
> +  ;; This hair is to deal with the case where the tag is found in the
> +  ;; selected window's buffer; without the hair, point is moved in both
> +  ;; windows.  To prevent this, we save the selected window's point before
> +  ;; doing find-tag-noselect, and restore it after.
> +  (let ((window-point (window-point (selected-window))))
> +    (slime-goto-source-location (slime-definition.location
> +                                 definition))
> +    (let ((tagbuf (current-buffer))
> +          (tagpoint (point)))
> +      (set-window-point (prog1
> +                            (selected-window)
> +                          (switch-to-buffer-other-window tagbuf)
> +                          ;; We have to set this new window's point; it
> +                          ;; might already have been displaying a
> +                          ;; different portion of tagbuf, in which case
> +                          ;; switch-to-buffer-other-window doesn't set
> +                          ;; the window's point from the buffer.
> +                          (set-window-point (selected-window) tagpoint))
> +                        window-point))))
> +




More information about the slime-devel mailing list