Greetings,
Long-time lisp user, short time slime user here. There is something I like to do frequently but seems to be a real hassle with slime. I'm sure either there is a command to do what I want, or it is easy for me to write one. I thought rather than going doen an ignorant path, I'd ask the list. Sure appreciate any help.
What I would like is a keyboard command that would:
1. save the current file being edited
2. load (not compile) that file without asking it's name
Thanks.
Blake McBride
Am Tue, 14 Jul 2015 16:58:31 -0500 schrieb Blake McBride blake@mcbride.name:
Greetings,
Long-time lisp user, short time slime user here. There is something I like to do frequently but seems to be a real hassle with slime. I'm sure either there is a command to do what I want, or it is easy for me to write one. I thought rather than going doen an ignorant path, I'd ask the list. Sure appreciate any help.
What I would like is a keyboard command that would:
save the current file being edited
load (not compile) that file without asking it's name
A basic Emacs function doing both could look like this:
(defun slime-save-and-load-file () (interactive "P") (let ((filename (buffer-file-name))) (if (not filename) (message "Buffer %s is not associated with a file." (buffer-name)) (save-buffer) (slime-load-file filename))))
- edgar
I had to take the "P" argument out, and then everything worked perfectly. Thanks!!
(I am using GNU Emacs 24.3.1)
I am surprised this sequence isn't a pre-configured feature of standard slime with a keyboard shortcut. It is my most used sequence.
Thanks!
Blake
On Tue, Jul 14, 2015 at 6:17 PM, edgar edgar-rft@web.de wrote:
Am Tue, 14 Jul 2015 16:58:31 -0500 schrieb Blake McBride blake@mcbride.name:
Greetings,
Long-time lisp user, short time slime user here. There is something I like to do frequently but seems to be a real hassle with slime. I'm sure either there is a command to do what I want, or it is easy for me to write one. I thought rather than going doen an ignorant path, I'd ask the list. Sure appreciate any help.
What I would like is a keyboard command that would:
save the current file being edited
load (not compile) that file without asking it's name
A basic Emacs function doing both could look like this:
(defun slime-save-and-load-file () (interactive "P") (let ((filename (buffer-file-name))) (if (not filename) (message "Buffer %s is not associated with a file." (buffer-name)) (save-buffer) (slime-load-file filename))))
- edgar
On 07/14/2015 06:15 PM, Blake McBride wrote:
I had to take the "P" argument out, and then everything worked perfectly. Thanks!!
(I am using GNU Emacs 24.3.1)
I am surprised this sequence isn't a pre-configured feature of standard slime with a keyboard shortcut. It is my most used sequence.
Thanks!
Blake
On Tue, Jul 14, 2015 at 6:17 PM, edgar <edgar-rft@web.de mailto:edgar-rft@web.de> wrote:
Am Tue, 14 Jul 2015 16:58:31 -0500 schrieb Blake McBride <blake@mcbride.name <mailto:blake@mcbride.name>>: > Greetings, > > Long-time lisp user, short time slime user here. There is something > I like to do frequently but seems to be a real hassle with slime. > I'm sure either there is a command to do what I want, or it is easy > for me to write one. I thought rather than going doen an ignorant > path, I'd ask the list. Sure appreciate any help. > > What I would like is a keyboard command that would: > > 1. save the current file being edited > > 2. load (not compile) that file without asking it's name A basic Emacs function doing both could look like this: (defun slime-save-and-load-file () (interactive "P") (let ((filename (buffer-file-name))) (if (not filename) (message "Buffer %s is not associated with a file." (buffer-name)) (save-buffer) (slime-load-file filename)))) - edgar
Just out of curiosity, why do you do this all the time? What's the scenario?
--Jeff
Most often I edit several functions within a particular lisp file in order to add a feature or fix a bug. I would then like to save and load the whole file in order to test it.
I don't like to pass each function to lisp when I am done editing it (^X^E) because I often bounce back and forth between several functions while programming. When I am ready to test, it is too burdensome for me to remember which functions I passed to lisp, which I have not, and which were passed to lisp _after_ my last edit of it. Re-loading the whole file when I am done is perfect.
I don't like to be forced to re-compile it in order to load it for the following reasons:
1. Some lisp's take longer to compile/load than to just load
2. Compiling often creates a bunch of junk files that I don't want to see when developing
3. (I imagine) some lisp's can provide better debugging information on interpreted code rather than compiled code
4. When developing, the run-time speed of the particular module I am working on almost never matters. If other parts need to be fast, I can compile those. (Of course I would compile the whole thing for production use.)
I appreciate this dialog because my development process makes a lot of sense to me. But I recognize that, out of ignorance, I may not be doing the best thing. If I am right, clearly slime needs a key bound to a slime-save-and-load function as described below. If I am wrong, I just need to understand it, and learn to use the correct procedure.
Thanks.
Blake McBride
On Wed, Jul 15, 2015 at 12:49 AM, Jeff Cunningham jeffrey@jkcunningham.com wrote:
On 07/14/2015 06:15 PM, Blake McBride wrote:
I had to take the "P" argument out, and then everything worked perfectly. Thanks!!
(I am using GNU Emacs 24.3.1)
I am surprised this sequence isn't a pre-configured feature of standard slime with a keyboard shortcut. It is my most used sequence.
Thanks!
Blake
On Tue, Jul 14, 2015 at 6:17 PM, edgar edgar-rft@web.de wrote:
Am Tue, 14 Jul 2015 16:58:31 -0500 schrieb Blake McBride blake@mcbride.name:
Greetings,
Long-time lisp user, short time slime user here. There is something I like to do frequently but seems to be a real hassle with slime. I'm sure either there is a command to do what I want, or it is easy for me to write one. I thought rather than going doen an ignorant path, I'd ask the list. Sure appreciate any help.
What I would like is a keyboard command that would:
save the current file being edited
load (not compile) that file without asking it's name
A basic Emacs function doing both could look like this:
(defun slime-save-and-load-file () (interactive "P") (let ((filename (buffer-file-name))) (if (not filename) (message "Buffer %s is not associated with a file." (buffer-name)) (save-buffer) (slime-load-file filename))))
- edgar
Just out of curiosity, why do you do this all the time? What's the scenario?
--Jeff
I don't like to be forced to re-compile it in order to load it for the following reasons:
ASDF solves most of these problems, including fasl file placement, especially if you are willing to write a line or two to load your codebase with some debugging extras (a (DECLAIM (OPTIMIZE DEBUG)), and i also have some macros that react to variables, notably dribble level logging stops being a no-op).
among the things you listed the only thing that i don't know how to solve in my ASDF/slime setup is losing track of what i've edited and haven't given to the lisp for redefinition yet. what i do is i keep track of it in my head, and whenever i suspect that things may be out of sync, then i press 3 key combination to restart the lisp and recompile/reload the project.
hth,
On Wed, Jul 15, 2015 at 6:48 AM, Attila Lendvai attila@lendvai.name wrote:
I don't like to be forced to re-compile it in order to load it for the following reasons:
ASDF solves most of these problems, including fasl file placement, especially if you are willing to write a line or two to load your codebase with some debugging extras (a (DECLAIM (OPTIMIZE DEBUG)), and i also have some macros that react to variables, notably dribble level logging stops being a no-op).
among the things you listed the only thing that i don't know how to solve in my ASDF/slime setup is losing track of what i've edited and haven't given to the lisp for redefinition yet. what i do is i keep track of it in my head, and whenever i suspect that things may be out of sync, then i press 3 key combination to restart the lisp and recompile/reload the project.
hth,
So, it sounds like we can setup ASDF, learn a bunch of steps, add debugging code to our app, and just reset the whole world if we think we might have gotten confused,
or,
we can just use slime-save-and-load.
Is that a fair statement?
Blake
Blake McBride blake@mcbride.name writes:
On Wed, Jul 15, 2015 at 6:48 AM, Attila Lendvai attila@lendvai.name wrote:
I don't like to be forced to re-compile it in order to load it for the following reasons:
ASDF solves most of these problems, including fasl file placement, especially if you are willing to write a line or two to load your codebase with some debugging extras (a (DECLAIM (OPTIMIZE DEBUG)), and i also have some macros that react to variables, notably dribble level logging stops being a no-op).
among the things you listed the only thing that i don't know how to solve in my ASDF/slime setup is losing track of what i've edited and haven't given to the lisp for redefinition yet. what i do is i keep track of it in my head, and whenever i suspect that things may be out of sync, then i press 3 key combination to restart the lisp and recompile/reload the project.
hth,
So, it sounds like we can setup ASDF, learn a bunch of steps, add debugging code to our app, and just reset the whole world if we think we might have gotten confused,
or,
we can just use slime-save-and-load.
Is that a fair statement?
compile-file has different semantics from load, so what you load may not compile. Then why bother loading at all? C-M-x or C-c C-c is what you should use 98% of the time instead. If you want C-c C-k to put compiled files away use (setq slime-compile-file-options '(:fasl-directory "/tmp/junk-fasls"))
But however much I hate ASDF, if you have more than one file (or that one file should be two files), you have really no other choice than to use ASDF.
And many implementations do have interpreters, not just compilers, in 2015.
Stas Boukarev stassats@gmail.com writes:
Blake McBride blake@mcbride.name writes:
On Wed, Jul 15, 2015 at 6:48 AM, Attila Lendvai attila@lendvai.name wrote:
I don't like to be forced to re-compile it in order to load it for the following reasons:
ASDF solves most of these problems, including fasl file placement, especially if you are willing to write a line or two to load your codebase with some debugging extras (a (DECLAIM (OPTIMIZE DEBUG)), and i also have some macros that react to variables, notably dribble level logging stops being a no-op).
among the things you listed the only thing that i don't know how to solve in my ASDF/slime setup is losing track of what i've edited and haven't given to the lisp for redefinition yet. what i do is i keep track of it in my head, and whenever i suspect that things may be out of sync, then i press 3 key combination to restart the lisp and recompile/reload the project.
hth,
So, it sounds like we can setup ASDF, learn a bunch of steps, add debugging code to our app, and just reset the whole world if we think we might have gotten confused,
or,
we can just use slime-save-and-load.
Is that a fair statement?
compile-file has different semantics from load, so what you load may not compile. Then why bother loading at all? C-M-x or C-c C-c is
And load has different semantics from compile-file, sow what you compile may not load. Then why bother compiling at all?
I too, use C-x C-l to load files from slime.
And yesterday, I found something strage: when using C-x C-l apparently the functions I have in a (eval-when (:compile-toplevel :load-toplevel :execute) block weren't updated/redefined! I had to go (load "file.lisp") in the REPL… (I can't reproduce it now).
what you should use 98% of the time instead.
Again, some implementations do a better job at debugging when you load than when you compile.
But however much I hate ASDF, if you have more than one file (or that one file should be two files), you have really no other choice than to use ASDF.
When your modifications impact several other files, indeed, it might be a good idea to go asdf (or quickload).
Perhaps we could have a few slime-asdf-load slime-asdf-load-source and slime-quickload commands, with a default current system determined semi-automatically?
And many implementations do have interpreters, not just compilers, in 2015.
On Wed, 15 Jul 2015 07:48:17 -0500, Blake McBride said:
On Wed, Jul 15, 2015 at 6:48 AM, Attila Lendvai attila@lendvai.name wrote:
I don't like to be forced to re-compile it in order to load it for the following reasons:
ASDF solves most of these problems, including fasl file placement, especially if you are willing to write a line or two to load your codebase with some debugging extras (a (DECLAIM (OPTIMIZE DEBUG)), and i also have some macros that react to variables, notably dribble level logging stops being a no-op).
among the things you listed the only thing that i don't know how to solve in my ASDF/slime setup is losing track of what i've edited and haven't given to the lisp for redefinition yet. what i do is i keep track of it in my head, and whenever i suspect that things may be out of sync, then i press 3 key combination to restart the lisp and recompile/reload the project.
hth,
So, it sounds like we can setup ASDF, learn a bunch of steps, add debugging code to our app, and just reset the whole world if we think we might have gotten confused,
or,
we can just use slime-save-and-load.
Is that a fair statement?
A third option is to implement slime-compile-buffer using slime-compile-region. I often use Compile Buffer when developing in the LispWorks IDE.
The main advantage of compiling v.s. source code loading is that you get the compiler diagnostics such as "assumed special" warnings.
On Jul 15, 2015, at 18:49 , Martin Simmons martin@lispworks.com wrote:
On Wed, 15 Jul 2015 07:48:17 -0500, Blake McBride said:
On Wed, Jul 15, 2015 at 6:48 AM, Attila Lendvai attila@lendvai.name wrote:
I don't like to be forced to re-compile it in order to load it for the following reasons:
ASDF solves most of these problems, including fasl file placement, especially if you are willing to write a line or two to load your codebase with some debugging extras (a (DECLAIM (OPTIMIZE DEBUG)), and i also have some macros that react to variables, notably dribble level logging stops being a no-op).
among the things you listed the only thing that i don't know how to solve in my ASDF/slime setup is losing track of what i've edited and haven't given to the lisp for redefinition yet. what i do is i keep track of it in my head, and whenever i suspect that things may be out of sync, then i press 3 key combination to restart the lisp and recompile/reload the project.
hth,
So, it sounds like we can setup ASDF, learn a bunch of steps, add debugging code to our app, and just reset the whole world if we think we might have gotten confused,
or,
we can just use slime-save-and-load.
Is that a fair statement?
A third option is to implement slime-compile-buffer using slime-compile-region. I often use Compile Buffer when developing in the LispWorks IDE.
The main advantage of compiling v.s. source code loading is that you get the compiler diagnostics such as "assumed special" warnings.
I second that.
“Compile Buffer” is a very good thing to have.
MA
On Wed, Jul 15, 2015 at 6:28 PM, Marco Antoniotti marcoxa@cs.nyu.edu wrote:
I second that.
“Compile Buffer” is a very good thing to have.
Any suggestions for a key binding?
On Wed, Jul 15 2015, Blake McBride wrote:
- (I imagine) some lisp's can provide better debugging information on
interpreted code rather than compiled code
That's the case for some implementations but for some it's the other way around. At least CMUCL/SBCL produce better debugging information for compiled code.
Helmut
Am Tue, 14 Jul 2015 20:15:23 -0500 schrieb Blake McBride blake@mcbride.name:
I had to take the "P" argument out, and then everything worked perfectly. Thanks!!
(I am using GNU Emacs 24.3.1)
I am surprised this sequence isn't a pre-configured feature of standard slime with a keyboard shortcut. It is my most used sequence.
Maybe because in 2015 most Common Lisp implementations are compilers and not interpreters anymore?
To me it looks as if you either do unusual things or have an unusual operating system or Common Lisp implementation, where both could be a valid explanation.
There's nothing bad in using CL:LOAD, but I can't remember a situation from the last ten years where I have used it.
- edgar
On Tue, Jul 14, 2015 at 6:17 PM, edgar edgar-rft@web.de wrote:
Am Tue, 14 Jul 2015 16:58:31 -0500 schrieb Blake McBride blake@mcbride.name:
Greetings,
Long-time lisp user, short time slime user here. There is something I like to do frequently but seems to be a real hassle with slime. I'm sure either there is a command to do what I want, or it is easy for me to write one. I thought rather than going doen an ignorant path, I'd ask the list. Sure appreciate any help.
What I would like is a keyboard command that would:
save the current file being edited
load (not compile) that file without asking it's name
A basic Emacs function doing both could look like this:
(defun slime-save-and-load-file () (interactive "P") (let ((filename (buffer-file-name))) (if (not filename) (message "Buffer %s is not associated with a file." (buffer-name)) (save-buffer) (slime-load-file filename))))
- edgar
On Wed, Jul 15, 2015 at 4:36 AM, edgar edgar-rft@web.de wrote:
Am Tue, 14 Jul 2015 20:15:23 -0500 schrieb Blake McBride blake@mcbride.name:
...
I am surprised this sequence isn't a pre-configured feature of standard slime with a keyboard shortcut. It is my most used sequence.
Maybe because in 2015 most Common Lisp implementations are compilers and not interpreters anymore?
Fine. In those cases, load compiles anyway. No necessity to _compile_ before loading.
To me it looks as if you either do unusual things or have an unusual operating system or Common Lisp implementation, where both could be a valid explanation.
I gave my exact reasons in another message.
There's nothing bad in using CL:LOAD, but I can't remember a situation from the last ten years where I have used it.
Funny. I almost always use load. I only compile when done. (And I do understand that many lisp's just compile as they load - but of course, I don't end up with a bunch of compile files.)
- edgar
On Wed, Jul 15, 2015 at 2:15 AM, Blake McBride blake@mcbride.name wrote:
I am surprised this sequence isn't a pre-configured feature of standard slime with a keyboard shortcut. It is my most used sequence.
Any suggestions to what key chord slime-save-and-load-file (or something along those lines, we can perhaps make its behavior more similar to slime-compile-and-load-file) should be bound?
Cheers,
On Tue, Jul 21, 2015 at 6:17 PM, Luís Oliveira luismbo@gmail.com wrote:
On Wed, Jul 15, 2015 at 2:15 AM, Blake McBride blake@mcbride.name wrote:
I am surprised this sequence isn't a pre-configured feature of standard slime with a keyboard shortcut. It is my most used sequence.
Any suggestions to what key chord slime-save-and-load-file (or something along those lines, we can perhaps make its behavior more similar to slime-compile-and-load-file) should be bound?
There's already such a feature, but the binding may be a bit unwieldy --- C-x h C-c C-c
On 07/21/2015 09:50 AM, Stas Boukarev wrote:
On Tue, Jul 21, 2015 at 6:17 PM, Luís Oliveira luismbo@gmail.com wrote:
On Wed, Jul 15, 2015 at 2:15 AM, Blake McBride blake@mcbride.name wrote:
I am surprised this sequence isn't a pre-configured feature of standard slime with a keyboard shortcut. It is my most used sequence.
Any suggestions to what key chord slime-save-and-load-file (or something along those lines, we can perhaps make its behavior more similar to slime-compile-and-load-file) should be bound?
There's already such a feature, but the binding may be a bit unwieldy --- C-x h C-c C-c
How about something simple and intuitive like C-c b ?
Jeff Cunningham jeffrey@jkcunningham.com writes:
On 07/21/2015 09:50 AM, Stas Boukarev wrote:
On Tue, Jul 21, 2015 at 6:17 PM, Luís Oliveira luismbo@gmail.com wrote:
On Wed, Jul 15, 2015 at 2:15 AM, Blake McBride blake@mcbride.name wrote:
I am surprised this sequence isn't a pre-configured feature of standard slime with a keyboard shortcut. It is my most used sequence.
Any suggestions to what key chord slime-save-and-load-file (or something along those lines, we can perhaps make its behavior more similar to slime-compile-and-load-file) should be bound?
There's already such a feature, but the binding may be a bit unwieldy --- C-x h C-c C-c
How about something simple and intuitive like C-c b ?
Too similar to C-c C-b
On 07/21/2015 10:55 AM, Stas Boukarev wrote:
Jeff Cunningham jeffrey@jkcunningham.com writes:
On 07/21/2015 09:50 AM, Stas Boukarev wrote:
On Tue, Jul 21, 2015 at 6:17 PM, Luís Oliveira luismbo@gmail.com wrote:
On Wed, Jul 15, 2015 at 2:15 AM, Blake McBride blake@mcbride.name wrote:
I am surprised this sequence isn't a pre-configured feature of standard slime with a keyboard shortcut. It is my most used sequence.
Any suggestions to what key chord slime-save-and-load-file (or something along those lines, we can perhaps make its behavior more similar to slime-compile-and-load-file) should be bound?
There's already such a feature, but the binding may be a bit unwieldy --- C-x h C-c C-c
How about something simple and intuitive like C-c b ?
Too similar to C-c C-b
Why is that a problem?
On Tue, Jul 21 2015, Jeff Cunningham wrote:
How about something simple and intuitive like C-c b ?
Too similar to C-c C-b
Why is that a problem?
There's a convention that state taht C-c <letter>, where <letter> has no control or shift key, should be reserved for users. Not terribly important some poeple might never have heard it.
An idea would be to make C-c C-r a prefix key so that these not so important commands don't eat up too many keys. E.g.
C-c C-r r compile-region C-c C-r e eval-region C-c C-r b compile-buffer
compile-region could also take the entire buffer if no use-region-p returns false.
Helmut
Hi,
Helmut Eller wrote:
There's a convention that state taht C-c <letter>, where <letter> has no control or shift key, should be reserved for users.
It may not be important in your eyes, but you can bet it's important to users who make use of that *documented* feature. They'd be p.o.'ed if a random library would overwrite their settings, in violation of Emacs standards.
I define C-c <letter>, in my .emacs, e.g.
(global-set-key "\C-cw" 'compare-windows)
The elisp manual says: [emphasis is *not* mine] "[...] are reserved for users; they are the *only* sequences reserved for users, so do not block them".
Not terribly important some poeple might never have heard it.
One probably has to read a lot of Emacs style guides to come across it.
BTW, you're wrong about shift. It's reserved for users as well. http://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Convent...
Regards, Jörg Höhle
On Wed, Jul 22 2015, Joerg-Cyril.Hoehle@t-systems.com wrote:
Not terribly important some poeple might never have heard it.
One probably has to read a lot of Emacs style guides to come across it.
BTW, you're wrong about shift. It's reserved for users as well. http://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Convent...
Now I remember. It's not terribly important because for years we violate the shift part with a couple of bindings and nobody complained about it.
Helmut
On Tue, Jul 21, 2015 at 5:50 PM, Stas Boukarev stassats@gmail.com wrote:
On Tue, Jul 21, 2015 at 6:17 PM, Luís Oliveira luismbo@gmail.com wrote:
On Wed, Jul 15, 2015 at 2:15 AM, Blake McBride blake@mcbride.name wrote: Any suggestions to what key chord slime-save-and-load-file (or something along those lines, we can perhaps make its behavior more similar to slime-compile-and-load-file) should be bound?
There's already such a feature, but the binding may be a bit unwieldy --- C-x h C-c C-c
That's an interesting answer to the "Compile Buffer" question. Is that what you meant?