Hello everyone,
I've recently started using SLIME with SBCl on Debian, where SLIME defaults to using SBCL, at least when it is installed. So far I am very impressed. I haven't been able to take off and fly yet, but I'm on the runway.:-)
I'm particularly impressed by the underlining source which has compile errors, and doing a popup on mouseover feature. I don't know whose idea this was, but it is pretty damn cool. Does anyone know the history of this feature?
So, I have a question about SLIME. When debugging, or indeed otherwise, I find it useful to copy and paste S-expressions from a buffer to the REPL. I've been using the mouse for this, which is decidedly sub-optimal. I hate using the mouse. I was thinking that it would be handy to have a command which would copy and paste S-expressions from a buffer to the REPL, while at the same time switching the buffer to the REPL. The S-expression would be chosen by having the cusor to the right of the closing expression. I'm not sure if this position has a name.
I don't know if this command already exists. I could not find it in the manual. If it doesn't, could someone tell me what code would tell emacs to do this? My knowledge of Emacs programming is non-existent.
Please CC me on any reply. Thanks. Regards, Faheem
Hi Faheem,
With the cursor on the _opening_ paren of an s-expression, you can do
C-M-<space>
to select the S-expression, then
M-w
to copy it.
Then go over to the repl (I bind a personal shortcut of C-x & for this), then
C-y
to "yank" (paste) the expression to the repl.
I'm not sure about automatically switching to the repl and pasting in one go, but I'm sure that would be a few lines of emacs lisp...
And a quick way to get the cursor to the opening paren of an s-expression is
C-M-b
On Mon, May 14, 2012 at 1:35 PM, Faheem Mitha faheem@faheem.info wrote:
Hello everyone,
I've recently started using SLIME with SBCl on Debian, where SLIME defaults to using SBCL, at least when it is installed. So far I am very impressed. I haven't been able to take off and fly yet, but I'm on the runway.:-)
I'm particularly impressed by the underlining source which has compile errors, and doing a popup on mouseover feature. I don't know whose idea this was, but it is pretty damn cool. Does anyone know the history of this feature?
So, I have a question about SLIME. When debugging, or indeed otherwise, I find it useful to copy and paste S-expressions from a buffer to the REPL. I've been using the mouse for this, which is decidedly sub-optimal. I hate using the mouse. I was thinking that it would be handy to have a command which would copy and paste S-expressions from a buffer to the REPL, while at the same time switching the buffer to the REPL. The S-expression would be chosen by having the cusor to the right of the closing expression. I'm not sure if this position has a name.
I don't know if this command already exists. I could not find it in the manual. If it doesn't, could someone tell me what code would tell emacs to do this? My knowledge of Emacs programming is non-existent.
Please CC me on any reply. Thanks. Regards, Faheem
slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel
I think Faheem wants "C:x, C:e" with the cursor at the right of the expression, C:M:f to get it there. I could be wrong, too.
On Mon, May 14, 2012 at 1:07 PM, Dave Cooper gendl@genworks.com wrote:
Hi Faheem,
With the cursor on the _opening_ paren of an s-expression, you can do
C-M-<space>
to select the S-expression, then
M-w
to copy it.
Then go over to the repl (I bind a personal shortcut of C-x & for this), then
C-y
to "yank" (paste) the expression to the repl.
I'm not sure about automatically switching to the repl and pasting in one go, but I'm sure that would be a few lines of emacs lisp...
And a quick way to get the cursor to the opening paren of an s-expression is
C-M-b
On Mon, May 14, 2012 at 1:35 PM, Faheem Mitha faheem@faheem.info wrote:
Hello everyone,
I've recently started using SLIME with SBCl on Debian, where SLIME
defaults
to using SBCL, at least when it is installed. So far I am very
impressed. I
haven't been able to take off and fly yet, but I'm on the runway.:-)
I'm particularly impressed by the underlining source which has compile errors, and doing a popup on mouseover feature. I don't know whose idea
this
was, but it is pretty damn cool. Does anyone know the history of this feature?
So, I have a question about SLIME. When debugging, or indeed otherwise, I find it useful to copy and paste S-expressions from a buffer to the REPL. I've been using the mouse for this, which is decidedly sub-optimal. I
hate
using the mouse. I was thinking that it would be handy to have a command which would copy and paste S-expressions from a buffer to the REPL,
while at
the same time switching the buffer to the REPL. The S-expression would be chosen by having the cusor to the right of the closing expression. I'm
not
sure if this position has a name.
I don't know if this command already exists. I could not find it in the manual. If it doesn't, could someone tell me what code would tell emacs
to
do this? My knowledge of Emacs programming is non-existent.
Please CC me on any reply. Thanks. Regards, Faheem
slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel
slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel
Oh yes - C-x C-e to evaluate the preceding expression "in place." That would indeed normally accomplish what it sounds like he is trying to do.
In this regard, Slime is consistent for Common Lisp with the emacs bindings for Emacs Lisp (e.g. in a *scratch* buffer you can use C-x C-e to evaluate the preceding elisp expression).
On Mon, May 14, 2012 at 2:27 PM, Grant Rettke grettke@acm.org wrote:
I think Faheem wants "C:x, C:e" with the cursor at the right of the expression, C:M:f to get it there. I could be wrong, too.
On Mon, May 14, 2012 at 1:07 PM, Dave Cooper gendl@genworks.com wrote:
Hi Faheem,
With the cursor on the _opening_ paren of an s-expression, you can do
C-M-<space>
to select the S-expression, then
M-w
to copy it.
Then go over to the repl (I bind a personal shortcut of C-x & for this), then
C-y
to "yank" (paste) the expression to the repl.
I'm not sure about automatically switching to the repl and pasting in one go, but I'm sure that would be a few lines of emacs lisp...
And a quick way to get the cursor to the opening paren of an s-expression is
C-M-b
On Mon, May 14, 2012 at 1:35 PM, Faheem Mitha faheem@faheem.info wrote:
Hello everyone,
I've recently started using SLIME with SBCl on Debian, where SLIME defaults to using SBCL, at least when it is installed. So far I am very impressed. I haven't been able to take off and fly yet, but I'm on the runway.:-)
I'm particularly impressed by the underlining source which has compile errors, and doing a popup on mouseover feature. I don't know whose idea this was, but it is pretty damn cool. Does anyone know the history of this feature?
So, I have a question about SLIME. When debugging, or indeed otherwise, I find it useful to copy and paste S-expressions from a buffer to the REPL. I've been using the mouse for this, which is decidedly sub-optimal. I hate using the mouse. I was thinking that it would be handy to have a command which would copy and paste S-expressions from a buffer to the REPL, while at the same time switching the buffer to the REPL. The S-expression would be chosen by having the cusor to the right of the closing expression. I'm not sure if this position has a name.
I don't know if this command already exists. I could not find it in the manual. If it doesn't, could someone tell me what code would tell emacs to do this? My knowledge of Emacs programming is non-existent.
Please CC me on any reply. Thanks. Regards, Faheem
slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel
slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel
-- http://www.wisdomandwonder.com/ ACM, AMA, COG, IEEE
On Mon, 14 May 2012, Dave Cooper wrote:
Oh yes - C-x C-e to evaluate the preceding expression "in place." That would indeed normally accomplish what it sounds like he is trying to do.
No, I'm trying to copy it over to the REPL. The idea is to try to evaluate the S-expression on its own. This doesn't work if one tries to evaluate it directly inside the function because typically it needs to use stuff (variables) that are defined by evaluations outside that expression. This works fine for self-contained expressions, but those are the exception.
Anyway, the idea of copying it over to the REPL is so I can modify it suitably.
Regards, Faheem
Do "C:h, k" and then do "C:x, C:e" an emacs will open a window to describe what that keybinding does.
It sends the last s-expr to the repl.
On Mon, May 14, 2012 at 1:33 PM, Faheem Mitha faheem@faheem.info wrote:
On Mon, 14 May 2012, Grant Rettke wrote:
I think Faheem wants "C:x, C:e" with the cursor at the right of the
expression, C:M:f to get it there. I could be wrong, too.
What does "C:x, C:e" do?
Regards, Faheem
Faheem Mitha faheem@faheem.info writes:
On Mon, 14 May 2012, Grant Rettke wrote:
I think Faheem wants "C:x, C:e" with the cursor at the right of the expression, C:M:f to get it there. I could be wrong, too.
What does "C:x, C:e" do?
It shows that Grant Rettke doesn't know anything about emacs. If he had only read the tutorial (control-h t), he would know that it's written C-x C-e.
On Mon, May 14, 2012 at 7:50 PM, Pascal J. Bourguignon < pjb@informatimago.com> wrote:
Faheem Mitha faheem@faheem.info writes:
On Mon, 14 May 2012, Grant Rettke wrote:
I think Faheem wants "C:x, C:e" with the cursor at the right of the expression, C:M:f to get it there. I could be wrong, too.
What does "C:x, C:e" do?
It shows that Grant Rettke doesn't know anything about emacs. If he had only read the tutorial (control-h t), he would know that it's written C-x C-e.
I would have read it but someone told that it was:
C:h, t
On Mon, 14 May 2012, Dave Cooper wrote:
Hi Faheem,
With the cursor on the _opening_ paren of an s-expression, you can do
C-M-<space>
to select the S-expression, then
M-w
to copy it.
Then go over to the repl (I bind a personal shortcut of C-x & for this), then
C-y
to "yank" (paste) the expression to the repl.
I'm not sure about automatically switching to the repl and pasting in one go, but I'm sure that would be a few lines of emacs lisp...
And a quick way to get the cursor to the opening paren of an s-expression is
C-M-b
Hi Dave,
Wow, that was a fast reply. Thanks for the helpful tips. I tried them, and they work.
Yes, I'd like to be able to do it in one shot, but I don't know any Emacs Lisp. I wonder how different Emacs Lisp is from Common Lisp.
Regards, Faheem
Faheem Mitha faheem@faheem.info writes:
Hello everyone,
I've recently started using SLIME with SBCl on Debian, where SLIME defaults to using SBCL, at least when it is installed. So far I am very impressed. I haven't been able to take off and fly yet, but I'm on the runway.:-)
I'm particularly impressed by the underlining source which has compile errors, and doing a popup on mouseover feature. I don't know whose idea this was, but it is pretty damn cool. Does anyone know the history of this feature?
So, I have a question about SLIME. When debugging, or indeed otherwise, I find it useful to copy and paste S-expressions from a buffer to the REPL. I've been using the mouse for this, which is decidedly sub-optimal. I hate using the mouse. I was thinking that it would be handy to have a command which would copy and paste S-expressions from a buffer to the REPL, while at the same time switching the buffer to the REPL. The S-expression would be chosen by having the cusor to the right of the closing expression. I'm not sure if this position has a name.
I don't know if this command already exists. I could not find it in the manual. If it doesn't, could someone tell me what code would tell emacs to do this? My knowledge of Emacs programming is non-existent.
Please CC me on any reply. Thanks. Regards, Faheem
I found "M-x slime-eval-last-expression" in other buffer is an alternative way to achieve.
On Mon, 2012-05-14 at 23:05 +0530, Faheem Mitha wrote:
Hello everyone,
I've recently started using SLIME with SBCl on Debian, where SLIME defaults to using SBCL, at least when it is installed. So far I am very impressed. I haven't been able to take off and fly yet, but I'm on the runway.:-)
I'm particularly impressed by the underlining source which has compile errors, and doing a popup on mouseover feature. I don't know whose idea this was, but it is pretty damn cool. Does anyone know the history of this feature?
So, I have a question about SLIME. When debugging, or indeed otherwise, I find it useful to copy and paste S-expressions from a buffer to the REPL. I've been using the mouse for this, which is decidedly sub-optimal. I hate using the mouse. I was thinking that it would be handy to have a command which would copy and paste S-expressions from a buffer to the REPL, while at the same time switching the buffer to the REPL. The S-expression would be chosen by having the cusor to the right of the closing expression. I'm not sure if this position has a name.
I don't know if this command already exists. I could not find it in the manual. If it doesn't, could someone tell me what code would tell emacs to do this? My knowledge of Emacs programming is non-existent.
This is what I have in my .emacs(wasn't written by me and I don't remember where I copied it from):
(defun slime-send-dwim (arg) "Send the appropriate forms to CL to be evaluated." (interactive "P") (save-excursion (cond ;;Region selected - evaluate region ((not (equal mark-active nil)) (copy-region-as-kill (mark) (point))) ;; At/before sexp - evaluate next sexp ((or (looking-at "(") (save-excursion (ignore-errors (forward-char 1)) (looking-at "("))) (forward-list 1) (let ((end (point)) (beg (save-excursion (backward-list 1) (point)))) (copy-region-as-kill beg end))) ;; At/after sexp - evaluate last sexp ((or (looking-at ")") (save-excursion (backward-char 1) (looking-at ")"))) (if (looking-at ")") (forward-char 1)) (let ((end (point)) (beg (save-excursion (backward-list 1) (point)))) (copy-region-as-kill beg end))) ;; Default - evaluate enclosing top-level sexp (t (progn (while (ignore-errors (progn (backward-up-list) t))) (forward-list 1) (let ((end (point)) (beg (save-excursion (backward-list 1) (point)))) (copy-region-as-kill beg end))))) (set-buffer (slime-output-buffer)) (unless (eq (current-buffer) (window-buffer)) (pop-to-buffer (current-buffer) t)) (goto-char (point-max)) (yank) (if arg (progn (slime-repl-return) (other-window 1)))))
(define-key slime-mode-map (kbd "C-c s") 'slime-send-dwim) (define-key slime-mode-map (kbd "C-c M-s") '(lambda () (interactive) (slime-send-dwim 1)))
The advantage of using these as opposed to a simple eval-expression is that a trace of it remains in the REPL buffer, useful if you're using cl:dribble or something similar
On Mon, 14 May 2012, Stelian Ionescu wrote:
On Mon, 2012-05-14 at 23:05 +0530, Faheem Mitha wrote:
Hello everyone,
I've recently started using SLIME with SBCl on Debian, where SLIME defaults to using SBCL, at least when it is installed. So far I am very impressed. I haven't been able to take off and fly yet, but I'm on the runway.:-)
I'm particularly impressed by the underlining source which has compile errors, and doing a popup on mouseover feature. I don't know whose idea this was, but it is pretty damn cool. Does anyone know the history of this feature?
So, I have a question about SLIME. When debugging, or indeed otherwise, I find it useful to copy and paste S-expressions from a buffer to the REPL. I've been using the mouse for this, which is decidedly sub-optimal. I hate using the mouse. I was thinking that it would be handy to have a command which would copy and paste S-expressions from a buffer to the REPL, while at the same time switching the buffer to the REPL. The S-expression would be chosen by having the cusor to the right of the closing expression. I'm not sure if this position has a name.
I don't know if this command already exists. I could not find it in the manual. If it doesn't, could someone tell me what code would tell emacs to do this? My knowledge of Emacs programming is non-existent.
This is what I have in my .emacs(wasn't written by me and I don't remember where I copied it from):
[snip code]
(define-key slime-mode-map (kbd "C-c s") 'slime-send-dwim) (define-key slime-mode-map (kbd "C-c M-s") '(lambda () (interactive) (slime-send-dwim 1)))
Nice! That works for me. However, may I clarify/confirm usage?
If I put the cursor on the closing parenthesis of the expression, then the first command just copies it to the REPL, the second copies and then evaluates it. Is this correct usage?
The advantage of using these as opposed to a simple eval-expression is that a trace of it remains in the REPL buffer, useful if you're using cl:dribble or something similar
Well, like I said earlier, in practice, you may have to modify the expression before you can run it.
Personally, I think SLIME could do with a command like this.
Thanks for the nice piece of code, Stelian.
Regards, Faheem
On Tue, 2012-05-15 at 00:49 +0530, Faheem Mitha wrote: [...]
(define-key slime-mode-map (kbd "C-c s") 'slime-send-dwim) (define-key slime-mode-map (kbd "C-c M-s") '(lambda () (interactive) (slime-send-dwim 1)))
Nice! That works for me. However, may I clarify/confirm usage?
If I put the cursor on the closing parenthesis of the expression, then the first command just copies it to the REPL, the second copies and then evaluates it. Is this correct usage?
The advantage of using these as opposed to a simple eval-expression is that a trace of it remains in the REPL buffer, useful if you're using cl:dribble or something similar
Well, like I said earlier, in practice, you may have to modify the expression before you can run it.
Indeed. If you need to modify it, use the first command, otherwise use the second