[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
forward-sexp when on a floating point number
From: |
Oleh Krehel |
Subject: |
forward-sexp when on a floating point number |
Date: |
Tue, 12 Jan 2016 11:42:26 +0100 |
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
- forward-sexp when on a floating point number,
Oleh Krehel <=
- RE: forward-sexp when on a floating point number, Herring, Davis, 2016/01/12
- Re: forward-sexp when on a floating point number, Andreas Schwab, 2016/01/12
- Re: forward-sexp when on a floating point number, John Wiegley, 2016/01/12
- Re: forward-sexp when on a floating point number, Dmitry Gutov, 2016/01/12
- Re: forward-sexp when on a floating point number, Stefan Monnier, 2016/01/17