From: Javier
Subject: Emacs tips for Lisp programming
Date: 
Message-ID: <92d7961b-b14d-4e6e-9066-cc8dedba6504@t18g2000prt.googlegroups.com>
I've been using emacs for some years now, and I'm not an expert at
all. I feel the default configuration very nice, except for some key
shortcuts I programmed myself.
I mostly use Emacs for Lisp and raw C coding, sometimes python too.
Here are some shorcuts for a spanish keyboard, wich greatly increases
Lisp programming typing:

(global-set-key [?º] 'insert-parentheses)
(global-set-key [?ç] 'forward-char)
(global-set-key [?Ç] 'other-window)
(global-set-key [?¡] 'slime-complete-symbol)
(global-set-key [?¿] 'slime-documentation)

I use the "º", "ç", "¡" and "¿" because they are really rare to be
used when programming (they are common when writing plain spanish,
anyway), so you can imagine how fast I can insert (), complete
symbols, look for documentation, and change to another window (for
example, for the REPL). The important thing is not to have to push
Ctrl or Alt.

It would be nice if you put here in this thread your own configuration
or tip for using Emacs, so it can be helpful for everybody.

From: Tamas K Papp
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <6lka20Fa452oU1@mid.individual.net>
On Tue, 14 Oct 2008 12:01:00 -0700, Javier wrote:

> It would be nice if you put here in this thread your own configuration
> or tip for using Emacs, so it can be helpful for everybody.

This does not belong here.  Please post to gnu.emacs.help or something 
similar instead.

Tamas
From: Javier
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <2a12576e-f78a-4b93-8762-e9a060478bc9@z18g2000prn.googlegroups.com>
On 14 oct, 21:25, Tamas K Papp <······@gmail.com> wrote:
> On Tue, 14 Oct 2008 12:01:00 -0700, Javier wrote:
> > It would be nice if you put here in this thread your own configuration
> > or tip for using Emacs, so it can be helpful for everybody.
>
> This does not belong here.  Please post to gnu.emacs.help or something
> similar instead.
>
> Tamas

Well, I'm talking about a tool for programming in Lisp, I think it is
fully and 100% on topic.
From: Tim X
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <87ej2iifpz.fsf@lion.rapttech.com.au>
Javier <·······@gmail.com> writes:

> On 14 oct, 21:25, Tamas K Papp <······@gmail.com> wrote:
>> On Tue, 14 Oct 2008 12:01:00 -0700, Javier wrote:
>> > It would be nice if you put here in this thread your own configuration
>> > or tip for using Emacs, so it can be helpful for everybody.
>>
>> This does not belong here.  Please post to gnu.emacs.help or something
>> similar instead.
>>
>> Tamas
>
> Well, I'm talking about a tool for programming in Lisp, I think it is
> fully and 100% on topic.

I agree. furthermore, gnu.emacs.help only has small amounts of posts
regarding elisp, rare ones for lisp and mostly has quesitons regarding
more general emacs configuration issues. 

Advice on how to use and configure emacs to work with lisp seems on
topic to me. As would posts on slime.

my only real 'configuration' for lisp programming is to use
paredit-mode, and some texi/info files generated from  the ANSI CL
book. 

Tim


-- 
tcross (at) rapttech dot com dot au
From: Thomas A. Russ
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <ymitzbe7uf3.fsf@blackcat.isi.edu>
Tamas K Papp <······@gmail.com> writes:

> On Tue, 14 Oct 2008 12:01:00 -0700, Javier wrote:
> 
> > It would be nice if you put here in this thread your own configuration
> > or tip for using Emacs, so it can be helpful for everybody.
> 
> This does not belong here.  Please post to gnu.emacs.help or something 
> similar instead.

I have to disagree, since the specific Emacs tips were for assisting
lisp programming.  So it seems on-topic for a lisp programming group.

=Tom.
From: Tamas K Papp
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <6lkk7qFcm55fU1@mid.individual.net>
On Tue, 14 Oct 2008 14:12:32 -0700, Thomas A. Russ wrote:

> Tamas K Papp <······@gmail.com> writes:
> 
>> On Tue, 14 Oct 2008 12:01:00 -0700, Javier wrote:
>> 
>> > It would be nice if you put here in this thread your own
>> > configuration or tip for using Emacs, so it can be helpful for
>> > everybody.
>> 
>> This does not belong here.  Please post to gnu.emacs.help or something
>> similar instead.
> 
> I have to disagree, since the specific Emacs tips were for assisting
> lisp programming.  So it seems on-topic for a lisp programming group.

I appreciate the OP's enthusiasm, but his posts showed how to bind 
functions to keys.  Spanish letters at that.  Honestly, do you find this 
useful?  How to bind functions to keys can be found in the Emacs FAQ, and 
hardly deserves posting (unless someone asks about it of course).

Anyhow, I didn't intend to make this thread into a meta-discussion about 
what is on-topic here, because it is of course not for me to decide.  I 
hope Javier finds Lisp and Emacs enjoyable.

Best,

Tamas
From: Javier
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <9bb47f58-4391-4247-a8fd-6e2b7b6e2a45@n33g2000pri.googlegroups.com>
On 15 oct, 00:19, Tamas K Papp <······@gmail.com> wrote:
> On Tue, 14 Oct 2008 14:12:32 -0700, Thomas A. Russ wrote:
> > Tamas K Papp <······@gmail.com> writes:
>
> >> On Tue, 14 Oct 2008 12:01:00 -0700, Javier wrote:
>
> >> > It would be nice if you put here in this thread your own
> >> > configuration or tip for using Emacs, so it can be helpful for
> >> > everybody.
>
> >> This does not belong here.  Please post to gnu.emacs.help or something
> >> similar instead.
>
> > I have to disagree, since the specific Emacs tips were for assisting
> > lisp programming.  So it seems on-topic for a lisp programming group.
>
> I appreciate the OP's enthusiasm,
> Anyhow, I didn't intend to make this thread into a meta-discussion about
> what is on-topic here, because it is of course not for me to decide.  I
> hope Javier finds Lisp and Emacs enjoyable.

So I don't understand what people are doing in usenet at all.
Almost everything, if not everything, can be reached in the Lisp
standard, or in the documentation of the specific platform, or even in
the mailing list of that platform, or even on some on-line books...
Using your logic, at the end c.l.l is hardly useful...

> his posts showed how to bind
> functions to keys.  Spanish letters at that.  Honestly, do you find this
> useful?  How to bind functions to keys can be found in the Emacs FAQ, and
> hardly deserves posting (unless someone asks about it of course).

It was just an example, it was supposedly going to be the start of a
thread of useful tips for using Emacs for Lisp programming.
From: Rainer Joswig
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <joswig-CA80D3.21321914102008@news-europe.giganews.com>
In article <··············@mid.individual.net>,
 Tamas K Papp <······@gmail.com> wrote:

> On Tue, 14 Oct 2008 12:01:00 -0700, Javier wrote:
> 
> > It would be nice if you put here in this thread your own configuration
> > or tip for using Emacs, so it can be helpful for everybody.
> 
> This does not belong here.  Please post to gnu.emacs.help or something 
> similar instead.
> 
> Tamas

I disagree. Tips and hints how to improve tools for Lisp
programming are welcome. Though I don't have a spanish
keyboard and my keyboard has keys for things like
parentheses and completion. ;-)

-- 
http://lispm.dyndns.org/
From: ·······@eurogaran.com
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <f53d4914-d460-4b49-9fd9-0edd4ee90aa4@g25g2000prf.googlegroups.com>
Tamas K Papp wrote:
> This does not belong here.  Please post to gnu.emacs.help or something
> similar instead.
I use a Sun-Type6 spanish keyboard to program Lisp, so I think it is
fully on-topic.
Javier: If you ever use emacs inferior-lisp mode, you will find
usefull the following customization I made:
http://www.eurogaran.com/downloads/lisp/emacs/lispmstyle.el
It basically transforms the *inferior-lisp* buffer in something closer
to a lispMachine listener.
Saludos ;)
From: ······@gmail.com
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <eac1285d-5628-48e3-97c8-3d95321a37ca@e38g2000prn.googlegroups.com>
On Oct 14, 12:01 pm, Javier <·······@gmail.com> wrote:
> I've been using emacs for some years now, and I'm not an expert at
> all. I feel the default configuration very nice, except for some key
> shortcuts I programmed myself.
> I mostly use Emacs for Lisp and raw C coding, sometimes python too.
> Here are some shorcuts for a spanish keyboard, wich greatly increases
> Lisp programming typing:
>
> (global-set-key [?º] 'insert-parentheses)
> (global-set-key [?ç] 'forward-char)
> (global-set-key [?Ç] 'other-window)
> (global-set-key [?¡] 'slime-complete-symbol)
> (global-set-key [?¿] 'slime-documentation)
>
> I use the "º", "ç", "¡" and "¿" because they are really rare to be
> used when programming (they are common when writing plain spanish,
> anyway), so you can imagine how fast I can insert (), complete
> symbols, look for documentation, and change to another window (for
> example, for the REPL). The important thing is not to have to push
> Ctrl or Alt.
>
> It would be nice if you put here in this thread your own configuration
> or tip for using Emacs, so it can be helpful for everybody.

You might be interested in a ergonomic keyboard shortcut set design
based on emacs's command usage frequency statistics.

A Ergonomic Keyboard Shortcut Layout For Emacs
http://xahlee.org/emacs/ergonomic_emacs_keybinding.html

  Xah
∑ http://xahlee.org/

☄
From: Javier
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <68bdb587-243b-4757-85e4-908cb4fc09f4@c36g2000prc.googlegroups.com>
On 15 oct, 04:50, ·······@gmail.com" <······@gmail.com> wrote:
> On Oct 14, 12:01 pm, Javier <·······@gmail.com> wrote:
>
>
>
> > I've been using emacs for some years now, and I'm not an expert at
> > all. I feel the default configuration very nice, except for some key
> > shortcuts I programmed myself.
> > I mostly use Emacs for Lisp and raw C coding, sometimes python too.
> > Here are some shorcuts for a spanish keyboard, wich greatly increases
> > Lisp programming typing:
>
> > (global-set-key [?º] 'insert-parentheses)
> > (global-set-key [?ç] 'forward-char)
> > (global-set-key [?Ç] 'other-window)
> > (global-set-key [?¡] 'slime-complete-symbol)
> > (global-set-key [?¿] 'slime-documentation)
>
> > I use the "º", "ç", "¡" and "¿" because they are really rare to be
> > used when programming (they are common when writing plain spanish,
> > anyway), so you can imagine how fast I can insert (), complete
> > symbols, look for documentation, and change to another window (for
> > example, for the REPL). The important thing is not to have to push
> > Ctrl or Alt.
>
> > It would be nice if you put here in this thread your own configuration
> > or tip for using Emacs, so it can be helpful for everybody.
>
> You might be interested in a ergonomic keyboard shortcut set design
> based on emacs's command usage frequency statistics.
>
> A Ergonomic Keyboard Shortcut Layout For Emacshttp://xahlee.org/emacs/ergonomic_emacs_keybinding.html


Really useful, but I insist in what I primely think are the keys that
are mostly used when programming CL:
- Insert parenthesis ()
- Move forward without having to move the entire hand to the keyboard
arrows in the right and/or having to push Ctrl or Alt. In the spanish
keyboard there is the key "ç", which is just in the perfect position
for this, and is not used when programming (it is not used even in the
spanish language, but only in a dialect called Catalan).
- Complete the symbol rapidly without having to press Alt or Ctrl.
- Look for documentation without having to press complicated
combinations like Ctrl-C Ctrl-D H.
- Change to other window (usually between the REPL and the code) with
a simple keypress not Ctrl-X Ctrl-O.

I don't actually know what keycombinations are good for other keyboard
languages like US, but there might be dead keys too which can be used
for these purposes when programing.
From: ·······@eurogaran.com
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <fff7b2ed-b71c-48d3-bbc5-2c41044ca421@40g2000prx.googlegroups.com>
Javier wrote:
> ...keyboard there is the key "ç", which is just in the perfect position
> for this, and is not used when programming (it is not used even in the
> spanish language,

It is used in ancient modes of spanish.
Cervantes did use it, and -believe me- he did write in spanish.
Also used in spanish for foreign words in a natural manner for the
above reason.

> but only in a dialect called Catalan).

Catalan is not a dialect of spanish, but a tongue with its own
dialects.
Catalan belongs to you, Javier, whether you like it or not. Catalan is
something yours, and you can not understand your history and what you
are without it.
From: Javier
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <c1217043-8610-4c71-ac55-79bd2aa19ef3@31g2000prz.googlegroups.com>
On 15 oct, 10:34, ·······@eurogaran.com wrote:
> Javier wrote:
> > ...keyboard there is the key "ç", which is just in the perfect position
> > for this, and is not used when programming (it is not used even in the
> > spanish language,
>
> It is used in ancient modes of spanish.
> Cervantes did use it, and -believe me- he did write in spanish.
> Also used in spanish for foreign words in a natural manner for the
> above reason.
>
> > but only in a dialect called Catalan).
>
> Catalan is not a dialect of spanish, but a tongue with its own
> dialects.
> Catalan belongs to you, Javier, whether you like it or not. Catalan is
> something yours, and you can not understand your history and what you
> are without it.

I never said I didn't like Catalan, but I never use it. Catalan is
hardly in use outside of Cataluña, Valencia and Baleares...
I have never used the "ç" key, even for writing "ancient" spanish
texts... its use is deprecated in plain spanish, and it is not part of
the actual and official spanish alphabet, as you know. ;)
But we are now really off-topic... :)

So for me and for several million more users, the "ç" key is just a
dead key, which can be safely used for other purposes, for example, to
call forward-char. ;)
From: ······@gmail.com
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <fc0a6b1b-a616-420b-a101-9a664a56847d@t39g2000prh.googlegroups.com>
2008-10-14

On Oct 14, 8:08 pm, Javier <·······@gmail.com> wrote:
> On 15 oct, 04:50, ·······@gmail.com" <······@gmail.com> wrote:
>
>
>
> > On Oct 14, 12:01 pm, Javier <·······@gmail.com> wrote:
>
> > > I've been using emacs for some years now, and I'm not an expert at
> > > all. I feel the default configuration very nice, except for some key
> > > shortcuts I programmed myself.
> > > I mostly use Emacs for Lisp and raw C coding, sometimes python too.
> > > Here are some shorcuts for a spanish keyboard, wich greatly increases
> > > Lisp programming typing:
>
> > > (global-set-key [?º] 'insert-parentheses)
> > > (global-set-key [?ç] 'forward-char)
> > > (global-set-key [?Ç] 'other-window)
> > > (global-set-key [?¡] 'slime-complete-symbol)
> > > (global-set-key [?¿] 'slime-documentation)
>
> > > I use the "º", "ç", "¡" and "¿" because they are really rare to be
> > > used when programming (they are common when writing plain spanish,
> > > anyway), so you can imagine how fast I can insert (), complete
> > > symbols, look for documentation, and change to another window (for
> > > example, for the REPL). The important thing is not to have to push
> > > Ctrl or Alt.
>
> > > It would be nice if you put here in this thread your own configuration
> > > or tip for using Emacs, so it can be helpful for everybody.
>
> > You might be interested in a ergonomic keyboard shortcut set design
> > based on emacs's command usage frequency statistics.
>
> > A Ergonomic Keyboard Shortcut Layout For Emacs http://xahlee.org/emacs/ergonomic_emacs_keybinding.html
>
> Really useful, but I insist in what I primely think are the keys that
> are mostly used when programming CL:
> - Insert parenthesis ()
> - Move forward without having to move the entire hand to the keyboard
> arrows in the right and/or having to push Ctrl or Alt. In the spanish
> keyboard there is the key "ç", which is just in the perfect position
> for this, and is not used when programming (it is not used even in the
> spanish language, but only in a dialect called Catalan).
> - Complete the symbol rapidly without having to press Alt or Ctrl.
> - Look for documentation without having to press complicated
> combinations like Ctrl-C Ctrl-D H.
> - Change to other window (usually between the REPL and the code) with
> a simple keypress not Ctrl-X Ctrl-O.
>
> I don't actually know what keycombinations are good for other keyboard
> languages like US, but there might be dead keys too which can be used
> for these purposes when programing.

Some comments...

• Since your customization is based on a spanish keyword, so it isn't
much useful for most people.

• You emphasized few shortcuts that are done without pressing a
modifier key. I think this is hard to achieve. Standard PC keyboards
doesn't have any “spare” keys on its main section that one would want
to replace.

• Personally, i also have some shortcuts customization to do lisp
programing. The most useful related to lisp i found are:

;; for lisp mode
(global-set-key (kbd "M-<up>") 'backward-up-list)
(global-set-key (kbd "M-<down>") 'down-list)
(global-set-key (kbd "M-<left>") 'backward-sexp)
(global-set-key (kbd "M-<right>") 'forward-sexp)

(global-set-key (kbd "H-t") (lambda () (interactive) (insert "()")
(backward-char 1)))
(global-set-key (kbd "H-C") (lambda () (interactive) (insert "\"\"")
(backward-char 1)))
(global-set-key (kbd "H-g") (lambda () (interactive) (insert "+")))
(global-set-key (kbd "H-c") (lambda () (interactive) (insert "=")))

The H is the Hyper key bound to the Windows key, and my choice of
letters are based on Dvorak layout. These are just personal ones, not
part of the ergonomic shortcut design.

...

other customization i have related to lisp are:

(show-paren-mode t)
(setq show-paren-style 'expression)
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(show-paren-match ((((class color) (background light)) (:background
"azure2")))))

(defalias 'eb 'eval-buffer)
(defalias 'er 'eval-region)

... here's my init files:
http://xahlee.org/emacs/xah_emacs_init.html

one feature i really want is to able to have something similar to fill-
paragraph and unfill-paragraph for lisp code. That is, you press one
key, all your code is shrinked to one line, press the key again, your
code is pretty formatted. See http://xahlee.org/emacs/lisp_formatter.html

I think i'll be coding this soon... before i thought i need much
parser knowledge to do this... but now i think this problem is rather
not that much related to language parsing, but more heuristics
approach... but lately i think i found a easy way to implement it...
by first insert line breaks at end paren points, then use emacs's many
built in indent functions on each line.

  Xah
∑ http://xahlee.org/

☄
From: Tim X
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <87prm1gxuh.fsf@lion.rapttech.com.au>
·······@gmail.com" <······@gmail.com> writes:

> 2008-10-14
>
>
> ;; for lisp mode
> (global-set-key (kbd "M-<up>") 'backward-up-list)
> (global-set-key (kbd "M-<down>") 'down-list)
> (global-set-key (kbd "M-<left>") 'backward-sexp)
> (global-set-key (kbd "M-<right>") 'forward-sexp)
>

Why use global-set-key if the keybindings are for a specific mode? 

For mode specific bindings, I think your better off using local-set-key
inside a mode hook. This way, you can bind different functions for
different modes for the same keys. for example, in text mode, you might
want M-<right> to be bound to forward-word, in lisp, forward-sexp, in
spreadsheet-mode, forward cell etc.  Key bindings are best treated in a
similar manner to variables in programming - keep them as local as
possible. Only make them global when you need them globally.

Also note that global-set-key is shadowed by local-set-key, which means
your global key setting cna be overridden by a local-set-key, which
could lead to unexpected results.

Tim


-- 
tcross (at) rapttech dot com dot au
From: Javier
Subject: Re: Emacs tips for Lisp programming
Date: 
Message-ID: <4299a425-00e0-4eb1-8002-d30137c9f601@h60g2000hsg.googlegroups.com>
On 16 oct, 02:58, Tim X <····@nospam.dev.null> wrote:
> ·······@gmail.com" <······@gmail.com> writes:
> > 2008-10-14
>
> > ;; for lisp mode
> > (global-set-key (kbd "M-<up>") 'backward-up-list)
> > (global-set-key (kbd "M-<down>") 'down-list)
> > (global-set-key (kbd "M-<left>") 'backward-sexp)
> > (global-set-key (kbd "M-<right>") 'forward-sexp)
>
> Why use global-set-key if the keybindings are for a specific mode?

They are also useful in other modes, specially on programming modes,
and most people use Emacs just for programming.