Re: Save & load file
Blake McBride <[email protected]> Wed, 15 Jul 2015 05:59:28 -0500
| Newsgroups | gmane.lisp.slime.devel |
|---|---|
| Message-ID | <CABwHSOtMxXP_KCz24Zzbrm9vKysA3gRCzbDrGJtrUZSKe+Cs+w@mail.gmail.com> |
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 <[email protected]> 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 <[email protected]> wrote: > >> Am Tue, 14 Jul 2015 16:58:31 -0500 >> schrieb Blake McBride <[email protected]>: >> >> > 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 > >