I am still new to emacs and Common Lisp, so this may be a trivial
question. When I am working in SLIME, I typically have 2 buffers, one
for the REPL, and one for editing code. When a function is small, and
I close a parenthesis, emacs quickly flashes the corresponding
parenthesis that is being closed. However, when a function is very
long, I can not see what open parenthesis corresponds to the closed
parenthesis I just typed. This is because it is above what is viewable
on the screen. How should I deal with this? Is there any key binding
in SLIME that allows me to quickly flash the corresponding open paren
that I am working in? Thanks.
On Mar 30, 10:51 am, dstein64 <········@gmail.com> wrote:
> when a function is very long, I can not see what
> open parenthesis corresponds to the closed parenthesis
> I just typed.
Doesn't it display "Matches (foo ..." at the bottom of
the screen? I don't know if there's a better way, but
I usually just delete the right paren and then retype it.
--Dan
------------------------------------------------
Dan Bensen
http://www.prairienet.org/~dsb/
On Sun, 30 Mar 2008 09:12:28 -0700, danb wrote:
> On Mar 30, 10:51 am, dstein64 <········@gmail.com> wrote:
>> when a function is very long, I can not see what open parenthesis
>> corresponds to the closed parenthesis I just typed.
>
> Doesn't it display "Matches (foo ..." at the bottom of the screen? I
> don't know if there's a better way, but I usually just delete the right
> paren and then retype it.
Yeah, that's been a feature of GNU emacs for a while now. I'm not sure if
xemacs does the same, though.
You can also try using C-M-f and C-M-b to move forward and backwards over
Lisp forms, rather than deleting the last parenthesis (in fact, this will
work in any major-mode, unless it rebinds the keys).
Rudy
On Sun, 30 Mar 2008 09:12:28 -0700, danb wrote:
> On Mar 30, 10:51 am, dstein64 <········@gmail.com> wrote:
>> when a function is very long, I can not see what open parenthesis
>> corresponds to the closed parenthesis I just typed.
>
> Doesn't it display "Matches (foo ..." at the bottom of the screen? I
> don't know if there's a better way, but I usually just delete the right
> paren and then retype it.
Yeah, that's been a feature of GNU emacs for a while now. I'm not sure if
xemacs does the same, though.
You can also try using C-M-f and C-M-b to move forward and backwards over
Lisp forms, rather than deleting the last parenthesis (in fact, this will
work in any major-mode, unless it rebinds the keys).
Rudy
On Sun, 30 Mar 2008 08:51:18 -0700, dstein64 wrote:
> I am still new to emacs and Common Lisp, so this may be a trivial
> question. When I am working in SLIME, I typically have 2 buffers, one
> for the REPL, and one for editing code. When a function is small, and I
> close a parenthesis, emacs quickly flashes the corresponding parenthesis
> that is being closed. However, when a function is very long, I can not
> see what open parenthesis corresponds to the closed parenthesis I just
> typed. This is because it is above what is viewable on the screen. How
> should I deal with this? Is there any key binding in SLIME that allows
> me to quickly flash the corresponding open paren that I am working in?
> Thanks.
You might want to try show-paren-mode. It always highlights the matching
paren.
I've got it activated as part of a lisp-mode hook:
(add-hook 'lisp-mode-hook
(lambda () (show-paren-mode 1)))
Rupert
On Sun, 30 Mar 2008 08:51:18 -0700 (PDT), dstein64 <········@gmail.com> tried to
confuse everyone with this message:
>I am still new to emacs and Common Lisp, so this may be a trivial
>question. When I am working in SLIME, I typically have 2 buffers, one
>for the REPL, and one for editing code. When a function is small, and
>I close a parenthesis, emacs quickly flashes the corresponding
>parenthesis that is being closed. However, when a function is very
>long, I can not see what open parenthesis corresponds to the closed
>parenthesis I just typed. This is because it is above what is viewable
>on the screen. How should I deal with this? Is there any key binding
>in SLIME that allows me to quickly flash the corresponding open paren
>that I am working in? Thanks.
1. Watch the minibuffer when you close the paren, it should show the line
with the opening paren.
2. Use C-M-right C-M-left to quickly jump to the opening paren and back.
3. Use some keybinding in SLIME to add closing parens DWIM-style
(I think it was C-c C-q)
There are also other options like using Paredit editing mode.
--
|Don't believe this - you're not worthless ,gr---------.ru
|It's us against millions and we can't take them all... | ue il |
|But we can take them on! | @ma |
| (A Wilhelm Scream - The Rip) |______________|
Wow thanks for all the quick replies. The function definitely is too
big, and I plan on 'abstract[ing] away'. However, I will need to use
macros, which I have not really learned yet (I read the macros chapter
in PCL, but I haven't written any yet). My minibuffer is not not
displaying anything. I am using SLIME with SBCL. Any ideas what might
be the problem? Thanks.
On Mar 30, 9:36 am, ····@mail.ru (Timofei Shatrov) wrote:
> There are also other options like using Paredit editing mode.
Yes, I was hoping someone would mention Paredit. Parens should never
be unbalanced in the first place!!!
http://mumble.net/~campbell/emacs/paredit.el
I think David Chapman and I get credit for being the first to make an
Emacs-class editor support balanced-paren Lisp editing; we did it for
Zmacs c. 1980. I've edited Lisp that way ever since.
-- Scott
dstein64 wrote:
> I am still new to emacs and Common Lisp, so this may be a trivial
> question. When I am working in SLIME, I typically have 2 buffers, one
> for the REPL, and one for editing code. When a function is small, and
> I close a parenthesis, emacs quickly flashes the corresponding
> parenthesis that is being closed. However, when a function is very
> long, I can not see what open parenthesis corresponds to the closed
> parenthesis I just typed. This is because it is above what is viewable
> on the screen. How should I deal with this? Is there any key binding
> in SLIME that allows me to quickly flash the corresponding open paren
> that I am working in? Thanks.
(defun goto-match-paren (arg)
"Go to the matching parenthesis if on parenthesis."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t nil)))
(global-set-key [(control c) (\])] 'goto-match-paren)
dstein64 <········@gmail.com> writes:
> I am still new to emacs and Common Lisp, so this may be a trivial
> question. When I am working in SLIME, I typically have 2 buffers, one
> for the REPL, and one for editing code. When a function is small, and
> I close a parenthesis, emacs quickly flashes the corresponding
> parenthesis that is being closed. However, when a function is very
> long, I can not see what open parenthesis corresponds to the closed
> parenthesis I just typed. This is because it is above what is viewable
> on the screen. How should I deal with this? Is there any key binding
> in SLIME that allows me to quickly flash the corresponding open paren
> that I am working in? Thanks.
If you cannot see the opening parenthesis, it means your function is
way too big. Factorize! Abstract away!
--
__Pascal Bourguignon__ http://www.informatimago.com/
READ THIS BEFORE OPENING PACKAGE: According to certain suggested
versions of the Grand Unified Theory, the primary particles
constituting this product may decay to nothingness within the next
four hundred million years.
On Mar 30, 11:51 pm, dstein64 <········@gmail.com> wrote:
> I am still new to emacs and Common Lisp, so this may be a trivial
> question. When I am working in SLIME, I typically have 2 buffers, one
> for the REPL, and one for editing code. When a function is small, and
> I close a parenthesis, emacs quickly flashes the corresponding
> parenthesis that is being closed. However, when a function is very
> long, I can not see what open parenthesis corresponds to the closed
> parenthesis I just typed. This is because it is above what is viewable
> on the screen. How should I deal with this? Is there any key binding
> in SLIME that allows me to quickly flash the corresponding open paren
> that I am working in? Thanks.
I use mic-paren for that. You can get mic-paren.el from:
http://www.emacswiki.org/cgi-bin/emacs/download/mic-paren.el
Then put mic-paren.el in your emacs load path
(http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/Loading-
Files.html).
Then put the following in your .emacs:
(require 'mic-paren)
(paren-activate)
(setq paren-display-message 'only)
However, for some reason, if a parenthesized expression is
very long, matching of parentheses will fail. To fix that,
put the following in your .emacs:
(setq blink-matching-paren-distance nil)
More info on the aforementioned function(s) and variables
can be accesed via the emacs help system:
C-h f paren-activate RET
C-h v paren-display-message RET
C-h v blink-matching-paren-distance RET
(^o^)
--
Rommel M. Martinez