unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Adam Cohen <random50k@gmail.com>
Subject: mark-sexp not marking the entire sexp
Date: Thu, 16 Dec 2004 00:09:33 -0500	[thread overview]
Message-ID: <bfecef3e0412152109645a445a@mail.gmail.com> (raw)

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	other threads:[~2004-12-16  5:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bfecef3e0412152109645a445a@mail.gmail.com \
    --to=random50k@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).