thanks
Slobodan
I think this should do it:
(setq inferior-lisp-program "sbcl"))
(require 'slime)
(add-hook 'lisp-mode-hook
(lambda ()
(slime-mode t)
(setq lisp-indent-function 'common-lisp-indent-function)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
Petter
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Petter I'm already using SLIME, I'm trying to *steal* some more
tricks.
Below is my .emacs. Here are some things I would like to have:
1. Automatically adding closing paren once I type (
2. Automatic indentation in teh lisp file buffer as I type, like in
the listener.
3. Map [ and ] to ( & ) respectevily
4. Shortcut for seeing the all the available slime buffers with
ability to pick one with typing one letter
Slobodan
(add-to-list 'load-path "/home/bobi/slime/")
(require 'slime)
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode
t)))
(setq inferior-lisp-program "sbcl"
lisp-indent-function 'common-lisp-indent-function
slime-complete-symbol-function 'slime-fuzzy-complete-symbol
common-lisp-hyperspec-root "/home/bobi/lisp/HyperSpec-7-0/
HyperSpec/"
slime-startup-animation nil)
(require 'mic-paren)
(paren-activate)
(setf paren-priority 'close)
(define-key slime-mode-map (kbd "C-=") (lambda () (interactive)
(insert "(")))
(define-key slime-mode-map (kbd "C-\\") (lambda () (interactive)
(insert ")")))
(slime-setup); :autodoc t :record-changed-definitions t)
Did you look for Paredit and Redshank?
Redshank looks good, at least at the video, but I don't notice any
difference when I installed it. Automatic indentation doesn't work in
the editor buffer, My .emacs file looks like this:
(add-to-list 'load-path "/home/bobi/slime/")
(add-to-list 'load-path "/home/bobi/elisp/")
(require 'slime)
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode
t)))
(setq inferior-lisp-program "sbcl"
;lisp-indent-function 'common-lisp-indent-function
;slime-complete-symbol-function 'slime-fuzzy-complete-symbol
common-lisp-hyperspec-root "/home/bobi/lisp/HyperSpec-7-0/
HyperSpec/"
slime-startup-animation nil)
(require 'mic-paren)
(paren-activate)
(setf paren-priority 'close)
(define-key slime-mode-map (kbd "C-=") (lambda () (interactive)
(insert "(")))
(define-key slime-mode-map (kbd "C-\\") (lambda () (interactive)
(insert ")")))
(slime-setup);
(require 'paredit)
(require 'redshank)
(autoload 'redshank-mode "redshank"
"Minor mode for editing and refactoring (Common) Lisp code."
t)
(autoload 'turn-on-redshank-mode "redshank"
"Turn on Redshank mode. Please see function `redshank-mode'."
t)
(add-hook '...-mode-hook 'turn-on-redshank-mode)
(put 'upcase-region 'disabled nil)
Paredit is very good. You'll also want something like:
(keyboard-translate ?\( ?\[)
(keyboard-translate ?\[ ?\()
(keyboard-translate ?\) ?\])
(keyboard-translate ?\] ?\))
In your .emacs to globally map everything shortcut bound to ( or ) to
[ or ] and visa versa.
You could implement the switch to slime named buffers with an keyboard
macro that performs C-x b *slime-<tab> , but this won't bring up lisp
files. I always toggle between open documents with C-x b though so I'm
not sure why you want it. :p
I really like pretty greek.
(defun pretty-greek ()
(let ((greek '("alpha" "beta" "gamma" "delta" "epsilon" "zeta" "eta"
"theta" "iota"
"kappa" "lambda" "mu" "nu" "xi" "omicron" "pi" "rho" "sigma_final"
"sigma"
"tau" "upsilon" "phi" "chi" "psi" "omega")))
(loop for word in greek
for code = 97 then (+ 1 code)
do (let ((greek-char (make-char 'greek-iso8859-7 code)))
(font-lock-add-keywords
nil
`((,(concatenate 'string "\\(^\\|[^a-zA-Z0-9]\\)\\(" word "\\)[a-zA-
Z]")
(0 (progn (decompose-region (match-beginning 2) (match-end 2))
nil)))))
(font-lock-add-keywords
nil
`((,(concatenate 'string "\\(^\\|[^a-zA-Z0-9]\\)\\(" word "\\)[^a-
zA-Z]")
(0 (progn (compose-region (match-beginning 2) (match-end 2)
,greek-char)
nil)))))))))
(add-hook 'lisp-mode-hook 'pretty-greek 'hs-minor-mode)
But unless your using mathematical notation its less cool.
>2) Automatic indentation in teh lisp file buffer as I type, like in
>the listener.
(defun customised-lisp-keyboard()
(local-set-key [C-tab] 'slime-fuzzy-complete-symbol)
(local-set-key [return] 'newline-and-indent))
(add-hook 'lisp-mode-hook 'customised-lisp-keyboard)
Thank you Chris works great.
Slobodan
> Redshank looks good, at least at the video, but I don't notice any
> difference when I installed it.
[...]
> (add-hook '...-mode-hook 'turn-on-redshank-mode)
That might have something to do with not replacing the ellipsis with a
real mode hook. 'lisp-mode-hook is a good candidate, but also 'slime-
repl-mode-hook, for example.
Probably the same holds for paredit.
Cheers,
Michael
Thanks for noticing I've changed to 'slime-repl-mode-hook but I don't
notice any difference.
Actually I don't know what to notice.
Basically with current setup I need only one more thing :
How to show menu with switching between buffers, in the Marco
Baringer video shows a menu with all buffers binded to a letter, so
typing one letter a for example will get you to the buffer editing
application.lisp file.
And why (slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
doesn't work, or I don't know how to use it . When I comment slime-
fuzzy-complete-symbol line C-c Tab autocompletaion works as expected
else it don't.
Slobodan
Slobodan
c-x o
a mouse click?
You can also customize the commands and use other key combinations.
>
> a mouse click?
That's what I'm trying to avoid, want to keep my hand on the keyboard.
> On Nov 17, 7:50 pm, Rainer Joswig <jos...@lisp.de> wrote:
> > In article
> > <80f36bce-041f-411a-9f23-4a9c0e434...@41g2000hsh.googlegroups.com>,
> > Slobodan Blazeski <slobodan.blaze...@gmail.com> wrote:
> >
> > > One more question , when I have a split screen setup with buffer with
> > > file above and listener below. What's the easiest way to switch
> > > between them, back and forth?
> >
> > > Slobodan
> >
> > c-x o
> No that leaves me with a single buffer.
Huh?
c-x 2 splits the window and c-x o switches between the buffers.
c-x b prompts for a buffer.
other-window C-x o
Command: Select the ARG'th different window on this frame.
http://www.gnu.org/software/emacs/manual/html_node/emacs/Other-Window.html
Maybe time to read the manual?
> I want to keep split screen
> setup. Just switch from working in repl to editor, write some
> definiton there , than switch to repl to try them.
> I want both of the to be visible to see results of the evaluation.
> I guess the best thing is c-x o to get into editor and c-c c-z to show
> the repl, but it hides the repl.
>
> >
> > a mouse click?
> That's what I'm trying to avoid, want to keep my hand on the keyboard.
> >
> > You can also customize the commands and use other key combinations.
>
> >
> > --http://lispm.dyndns.org/
little "oh", not "zero".
- Daniel
> No that leaves me with a single buffer.
That's C-x 0 (zero). C-x o (letter o) will leave the screen layout as
it is, just move the focus to the other window(s).
C-x o should be bound to the emacs command other-window. If you've
messed up your key bindings, do a C-h w other-window RET and see what
the minibuffer tells you.
...Peder...
--
I wish a new life awaited _me_ in some off-world colony.
C-x o(utput-stream-p) is exactly what I wanted.
I've mixed it with zero. Sorry for my confusion.
Slobodan
>
> Did you look for Paredit and Redshank?
>
> --
> http://lispm.dyndns.org/
Now I did look at redshank- life just got faster (not necessarily
easier). Thanks, Rainer, for the pointer!
Frank
--
Frank Goenninger
frgo(at)mac(dot)com
"Don't ask me! I haven't been reading comp.lang.lisp long enough to
really know ..."
Well, most prominently, you should see a new submenu "Redshank"
appearing when you are in the slime repl buffer (same for lisp buffers
if you added it to lisp-mode-hook). At the very least, you should see
"Redshank" appearing in the minor mode list (in the mode line).
If you don't see a menu, please drop me a note with your emacs version
and your lisp/slime/redshank related configuration.
You could try out keybindings from the screencast, of course. They
are shown in the right frame.
Also, the menu or C-h m or C-h b in a redshank-enabled buffer give you
some starting points to explore. C-h f on a function name shows a
short description what it's purpose is.
In general, it's a good idea to get familiar with Emacs first. It has
a good deal of help built in for getting further help. :)
Cheers,
Michael
> Rainer Joswig <jos...@lisp.de> writes:
>
> >
> > Did you look for Paredit and Redshank?
> >
> > --
> > http://lispm.dyndns.org/
>
> Now I did look at redshank- life just got faster (not necessarily
> easier). Thanks, Rainer, for the pointer!
>
> Frank
You owe me something. ;-)
That's an 'oh', as other have pointed out. But I just want to show my
customisation too.
Because I switch windows so much, I just have other-window bound to C-
o instead. The original (default) binding was used to insert a
newline, and I can do that manually.
As an alternative, if you just want to switch quickly without having
both buffers in view, you could use slime-selector. I have that bound
to f5, so quickly, one can go f5 then r, for REPL, or f5 then l for
Lisp buffer (can be used multiple times, but it only switches between
2 lisp buffers), or f5 then d, if you have a debugger buffer
somewhere. It unfortunately doesn't do f5 i for the Inspector buffer.
Sorry I don't have time to explain (and sorry for the tab that may not
render well), but here is mine.
Evan
;; outline mode
(add-hook 'lisp-mode-hook (lambda ()
(outline-minor-mode 1)))
;; parenthesis highlighting
(require 'slime)
(require 'mic-paren)
(require 'paredit)
(paren-activate)
;; sexp-editing key bindings
(defun my/move-past-close ()
"Move past next `)' and ensure just one space after it.
from http://paste.lisp.org/display/10269/"
(interactive)
(delete-horizontal-space)
(up-list))
;; snippet for Emacs interaction with lispdoc, by Bill Clementson
;; http://bc.tech.coop/blog/070515.html
(defun lispdoc ()
"Searches lispdoc.com for SYMBOL, which is by default the
symbol currently under the curser"
(interactive)
(let* ((word-at-point (word-at-point))
(symbol-at-point (symbol-at-point))
(default (symbol-name symbol-at-point))
(inp (read-from-minibuffer
(if (or word-at-point symbol-at-point)
(concat "Symbol (default " default "): ")
"Symbol (no default): "))))
(if (and (string= inp "")
(not word-at-point)
(not symbol-at-point))
(message "you didn't enter a symbol!")
(let ((search-type
(read-from-minibuffer
"full-text (f) or basic (b) search (default b)? ")))
(browse-url (concat "http://lispdoc.com?q="
(if (string= inp "")
default
inp)
"&search;="
(if (string-equal search-type "f")
"full+text+search"
"basic+search")))))))
(defun my/install-lisp-bindings (&rest maps)
"install my lisp key bindings for the keymap map (example:
emacs-lisp-mode-map, slime-mode-map, etc.)"
(dolist (map maps)
;; make it easy to use parentheses
(define-key map (kbd "]") 'my/move-past-close)
(define-key map (kbd "[") 'insert-parentheses)
(define-key map (kbd "(") (lambda () (interactive) (insert "[")))
(define-key map (kbd ")") (lambda () (interactive) (insert "]")))
(define-key map (kbd "C-=") (lambda () (interactive) (insert "(")))
(define-key map (kbd "C-^") (lambda () (interactive) (insert "(")))
;; sep operations
(define-key map (kbd "C-t") 'transpose-sexps)
(define-key map (kbd "C-M-t") 'transpose-chars)
(define-key map (kbd "C-b") 'backward-sexp)
(define-key map (kbd "C-M-b") 'backward-char)
(define-key map (kbd "C-f") 'forward-sexp)
(define-key map (kbd "C-M-f") 'forward-char)
(define-key map (kbd "C-k") 'kill-sexp)
(define-key map (kbd "M-k") 'kill-line)
(define-key map (kbd "C-,") 'backward-up-list)
(define-key map (kbd "C-.") 'down-list)
(define-key map (kbd "M-s") 'paredit-splice-sexp)
(define-key map (kbd "C-c C-d l") 'lispdoc)
(define-key map (kbd "<tab>") 'slime-indent-and-complete-symbol)))
(defun my/install-lisp-ret-bindings (&rest maps)
(dolist (map maps)
;; (define-key map (kbd "<return>") 'newline-and-indent)
(define-key map (kbd "RET") 'newline-and-indent)))
(my/install-lisp-bindings emacs-lisp-mode-map
lisp-mode-map
lisp-interaction-mode-map
slime-mode-map
slime-repl-mode-map)
(my/install-lisp-ret-bindings emacs-lisp-mode-map
lisp-interaction-mode-map
slime-mode-map)
(define-key lisp-interaction-mode-map (kbd "C-c C-c") 'eval-defun)
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
(setq inferior-lisp-program "/usr/bin/sbcl --noinform"
lisp-indent-function 'common-lisp-indent-function
slime-complete-symbol-function 'slime-fuzzy-complete-symbol
slime-startup-animation nil)
(slime-setup :autodoc t)
(add-hook 'slime-mode-hook 'turn-on-auto-fill)
; utf-8 for slime (??)
;;(setq slime-net-coding-system 'iso-latin-1-unix)
(setq slime-net-coding-system 'utf-8-unix)
(setq slime-log-event nil)
(define-key global-map (kbd "<f12>") 'slime-selector)
> (defun customised-lisp-keyboard()
> (local-set-key [C-tab] 'slime-fuzzy-complete-symbol)
> (local-set-key [return] 'newline-and-indent))
>
> (add-hook 'lisp-mode-hook 'customised-lisp-keyboard)
Whoops. I've had a couple of complaints that this stops return from
sending values from the repl to the lisp process
use this instead:
(add-hook 'lisp-mode-hook
(lambda ()
(local-set-key [C-tab] 'slime-fuzzy-complete-symbol)
(local-set-key [return] 'newline-and-indent)))
(add-hook 'slime-repl-mode-hook
(lambda () (local-set-key [return] 'slime-repl-return)))
or use C-return or C-M to send the values.
Sorry guys,
Chris
Slobodan
Slobodan
Don't know what you are refering to but
*
gives the last return value
as in
(+ 2 2)
(* * *)
gives
16
check + ++ +++ and * ** *** operations from REPL
--------------
John Thingstad
I have 2 button mouse , actually there's a third button but I don't
what purpose it serves
http://www.amazon.co.uk/gp/product/images/B0007UAY90/ref=dp_image_0/202-8097139-2003028?ie=UTF8&n=560798&s=electronics
any way to emulate middle button click? Pressing little button is
pasting text. Pressing left and right button simultaneosly is pasting
text too. Alt + left or right button doesn't do nothing .
Any idea?
Slobodan
Slobodan
>> Afterward he points to #<HASH-TABLE :TEST EQL :COUNT 0 {AC29DC1}> and
>> hand shows up and he's able to use the object. How he's doing that?
Middle/right mouse click. But make sure you have SLIME presentations
enabled, if you're using a recent CVS, as is usually recommended, then
you need to load it from contrib/ in SLIME distribution. You can tell if
presentations are enabled by the fact that they turn the text red (by
default), and also make it sensitive to mouse-over.
Cheers,
Maciej