From: Oleh Krehel <ohwoeowho@gmail.com>
To: emacs-devel@gnu.org
Subject: forward-sexp when on a floating point number
Date: Tue, 12 Jan 2016 11:42:26 +0100 [thread overview]
Message-ID: <87y4bvf59p.fsf@gmail.com> (raw)
Hi all,
When working with C++ or Python code an having e.g. this point position:
1|23.456
I'd like "C-M-f" (`forward-sexp') to move the point here:
123.456|
Instead, I get this:
123|.456
This of course extends to all other sexp interactions (`mark-sexp',
`kill-sexp', `bounds-of-thing-at-point' etc). The problem here is that
I can't do something like:
(modify-syntax-entry ?\. "w" c++-mode-syntax-table)
since the current behavior is actually correct for things like:
f|oo.bar ()
I finally ended up with this solution:
(setq forward-sexp-function 'my-forward-sexp-function)
(defun my-forward-sexp-function (arg)
(let ((forward-sexp-function nil))
(forward-sexp arg))
(when (and (eq (char-after) ?.)
(looking-back "[0-9]+" (line-beginning-position)))
(forward-char)
(skip-chars-forward "[0-9]")))
Is there any interest in making this behavior, i.e. treating each
floating point number as a single sexp, the default (or at least easily
customizable) in the core?
regards,
Oleh
next reply other threads:[~2016-01-12 10:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-12 10:42 Oleh Krehel [this message]
2016-01-12 13:58 ` forward-sexp when on a floating point number Herring, Davis
2016-01-12 14:20 ` Andreas Schwab
2016-01-12 14:41 ` Oleh Krehel
2016-01-12 17:35 ` John Wiegley
2016-01-12 17:45 ` Dmitry Gutov
2016-01-17 23:07 ` Stefan Monnier
2016-01-17 23:42 ` John Wiegley
2016-01-18 1:36 ` Stefan Monnier
2016-01-18 5:08 ` John Wiegley
2016-01-18 13:30 ` Stefan Monnier
2016-01-18 19:02 ` John Wiegley
2016-01-18 21:03 ` Marcin Borkowski
2016-01-18 21:34 ` Stefan Monnier
2016-01-20 22:15 ` Marcin Borkowski
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y4bvf59p.fsf@gmail.com \
--to=ohwoeowho@gmail.com \
--cc=emacs-devel@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.