help-gnu-emacs
[Top][All Lists]
Advanced

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

mark-sexp not marking the entire sexp


From: Adam Cohen
Subject: mark-sexp not marking the entire sexp
Date: Thu, 16 Dec 2004 00:09:33 -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."
  (interactive)
  (backward-up-list)
  (mark-sexp)
)

(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
problem.

I'm using the copy of emacs provided by the fink package manager on OS
X 10.3.4 (GNU Emacs 21.3.50.1 powerpc-apple-darwin7.4.0, X toolkit,
Xaw3d scroll bars) and this same behaviour occurs with the Carbon
emacs from Andrew Choi (also v 21.3.50.1).  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,

Adam




reply via email to

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