[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mark-sexp bug in emacs

From: Adam Cohen
Subject: mark-sexp bug in emacs
Date: Tue, 28 Dec 2004 12:33:05 -0500

I created the following function definition so that I can select all
the text in between two parentheses, including the parentheses
themselves, but unfortunately it doesn't work as expected:

;;the following is from my .emacs file
(defun select-to-matching-brace ()
  "Selects text in between matching braces, including the braces themselves."

(global-set-key (kbd "M-RET") 'select-to-matching-brace)

For example, if I place the cursor in between [test test] with the
following text:

[[[test test] test] test]

and then hit M-RET three times, the mark ends up selecting the following:

[[[test test] test

and it misses the trailing "] test]".  What should've happened is that
the first time I hit M-RET, it should've selected "[test test]", the
second time I pressed M-RET, it should've selected "[[test test]
test]" and the third time I hit M-RET, it should've selected
everything.  To better illustrate what I'm talking about, you can
check out a small movie I made here:
<http://www.crackaddict.com/~adam/emacs.mov>.  The strange thing is,
if I manually type "M-x select-to-matching-brace" three times, it
works perfectly.  It's only when bound to a key that the function
fails.  I've tried binding it to another key, but I still get the same

I'm using the copy of emacs provided by the fink package manager on OS
X 10.3.4 (GNU Emacs powerpc-apple-darwin7.4.0, X toolkit,
Xaw3d scroll bars) and this same behaviour occurs with the Carbon
emacs from Andrew Choi (also v  However, it does _not_
occur with the copy of emacs provided by Apple for OS X 10.3 (GNU
Emacs 21.2.1 powerpc-apple-darwin7.0 of 2003-09-28).

I've also tried loading only the above configuration file, just to
make sure that it wasn't something else in my .emacs file that was
causing it to mess up.

Anyways,  if anyone has any suggestions, please let me know, cause I'd
really love to get this working.  Thanks in advance,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]