From: ·········@gmail.com
Subject: new to lisp/lispbox - question on automatic indentation of code with lispbox 0.7
Date: 
Message-ID: <1144206190.576108.6340@u72g2000cwu.googlegroups.com>
Hello,

I'm new to Lisp and the Lispbox package, but not entirely new to emacs.


I was wondering whether a .emacs file can be used with the version of
Xemacs that comes with Lispbox.

I'd like to put my customizations back in, specifically settings for
automatically indenting lisp code when the Enter key is hit (from
http://ssinghi.kreeti.com/Xemacs%20&%20Lisp%20For%20Dummies.html).

I've tried putting the lines below in my computer's
C:\lispbox-0.7\emacs-21.3\site-lisp\lispbox.el file, which does
introduce the auto-indent feature, but curiously it breaks the
connection with Slime after I compile something.  Is there some error
in the settings that clashes with Xemacs itself, with Slime, or with
Lispbox?

Thanks for any pointers.

"5.  You can also put the following code so that when you press the
cursor is at properly indented position

;indenting

(defun my-set-newline-and-indent()

    (local-set-key [return] 'newline-and-indent))

(add-hook 'c++-mode-hook 'my-set-newline-and-indent)

(add-hook 'lisp-mode-hook 'my-set-newline-and-indent)

(add-hook 'Lisp-mode-hook 'my-set-newline-and-indent)"

from http://ssinghi.kreeti.com/Xemacs%20&%20Lisp%20For%20Dummies.html

From: Peter Seibel
Subject: Re: new to lisp/lispbox - question on automatic indentation of code with lispbox 0.7
Date: 
Message-ID: <m23bgshg7j.fsf@gigamonkeys.com>
·········@gmail.com writes:

> Hello,
>
> I'm new to Lisp and the Lispbox package, but not entirely new to emacs.
>
> I was wondering whether a .emacs file can be used with the version of
> Xemacs that comes with Lispbox.

So, for starters, the Emacs that Lispbox uses is GNU Emacs not XEmacs.
I don't know that this matters in this case but be aware that they are
different in some ways.

> I'd like to put my customizations back in, specifically settings for
> automatically indenting lisp code when the Enter key is hit (from
> http://ssinghi.kreeti.com/Xemacs%20&%20Lisp%20For%20Dummies.html).
>
> I've tried putting the lines below in my computer's
> C:\lispbox-0.7\emacs-21.3\site-lisp\lispbox.el file, which does
> introduce the auto-indent feature, but curiously it breaks the
> connection with Slime after I compile something.  Is there some error
> in the settings that clashes with Xemacs itself, with Slime, or with
> Lispbox?

It's unlikely to be with Lispbox. Maybe you can post here (or email
me) the complete contents of your lispbox.el.

You could also hack the script that starts Lispbox so it doesn't pass
Emacs the --no-init-file flag and then put your customizations in your
~/.emacs as normal. (I pass that flag and also the --no-site-file flag
since the point of Lispbox is to Just Work for folks with little or no
Emacs experience--I don't want the remnants of some ~/.emacs from an
earlier failed attempt to install Emacs to break Lispbox.)

-Peter

-- 
Peter Seibel           * ·····@gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp  * http://www.gigamonkeys.com/book/
From: kw
Subject: Re: new to lisp/lispbox - question on automatic indentation of code with lispbox 0.7
Date: 
Message-ID: <1144461701.994512.224330@j33g2000cwa.googlegroups.com>
Peter,

Thanks for the quick reply.

I appended the customization to the end of the lispbox.el file (below);
I tried variations on this (without really knowing what I was doing) by
situating these lines at different points within the file and
restarting Lispbox a few times.  The indentation feature does work when
I edit a file in emacs, but the connection to Slime is thereafter
terminated and I am unable to submit any more code for evaluation.

I did attempt to use my own .emacs file and removed the --no-init-file
flag; however, I was uncertain where to place it (originally I was
unsure whether introducing my own .emacs file would interfere with the
Lispbox setup).  Anyhow, would you be able to tell me where the .emacs
file should go, given the default configuration with Lispbox 0.7 on
Windows (where Lispbox is in c:\lispbox-0.7) as this might be the
quickest way to get me where I want?

Thanks again.

Kelvin

lispbox.el:

(require 'cl)

(defun lispbox-list-to-filename (list)
  (apply
   #'concat
   (maplist
    #'(lambda (cons)
        (if (cdr cons) (file-name-as-directory (car cons)) (car cons)))
    list)))

(defun lispbox-file (rest)
  (concat
   (file-name-as-directory
    (expand-file-name
     (or (getenv "LISPBOX_HOME")
         (file-name-directory load-file-name))))
   rest))

(defun lispbox-find-lisps ()
  (dolist (file (file-expand-wildcards (lispbox-file
"*/lispbox-register.el")))
    (load file)))

(defun lispbox-install-lisp-license (license-path lisp-name)
  (let ((license (concat (file-name-directory load-file-name)
(lispbox-list-to-filename license-path))))
    (if (not (file-exists-p license))
      (let* ((prompt (format "Need to install license for %s . Please
enter name of file where you saved it: " lisp-name))
             (to-install (read-file-name prompt)))
        (copy-file (expand-file-name to-install) license)))))

(global-font-lock-mode t)

(setq load-path (cons (lispbox-file "slime-20060110") load-path))
(setenv "SBCL_HOME" (lispbox-file "sbcl-0.9.7/lib/sbcl"))
(setenv "CCL_DEFAULT_DIRECTORY" (lispbox-file "openmcl-1.0"))
(require 'slime)
(slime-setup)
(lispbox-find-lisps)
(provide 'lispbox)

(defun my-set-newline-and-indent()

    (local-set-key [return] 'newline-and-indent))

(add-hook 'c++-mode-hook 'my-set-newline-and-indent)

(add-hook 'lisp-mode-hook 'my-set-newline-and-indent)

(add-hook 'Lisp-mode-hook 'my-set-newline-and-indent)