From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Krehel Newsgroups: gmane.emacs.devel Subject: forward-sexp when on a floating point number Date: Tue, 12 Jan 2016 11:42:26 +0100 Message-ID: <87y4bvf59p.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1452595360 26011 80.91.229.3 (12 Jan 2016 10:42:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Jan 2016 10:42:40 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 12 11:42:36 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aIwPL-0005xl-Kb for ged-emacs-devel@m.gmane.org; Tue, 12 Jan 2016 11:42:35 +0100 Original-Received: from localhost ([::1]:59120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIwPL-0004ad-0G for ged-emacs-devel@m.gmane.org; Tue, 12 Jan 2016 05:42:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIwPG-0004Xu-5m for emacs-devel@gnu.org; Tue, 12 Jan 2016 05:42:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIwPC-00058t-Vy for emacs-devel@gnu.org; Tue, 12 Jan 2016 05:42:30 -0500 Original-Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:37157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIwPC-00058b-QE for emacs-devel@gnu.org; Tue, 12 Jan 2016 05:42:26 -0500 Original-Received: by mail-wm0-x22b.google.com with SMTP id f206so312913365wmf.0 for ; Tue, 12 Jan 2016 02:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=njaD0BJ8DypZtA5y0FtS2KUcQ9JwJ+t3spyoD7Y7BKM=; b=HHMMe0OPvGdT0qXp4ms1lq2GjaQA69RYMwhAGJd4dYE/35y59MI0luiGBlB7qoVtWB Rv7/1hzN/fdxV+VBhqBs8cFl/yzo3Lu2dFsmWR5hc9CNxdOynCGqd7JD4ffd8WiX5blC YdK0yFor9HGMiDQztE6haU2EKqhciNw0HxFmDmCCl0rMCgy2DKjaPBZWDDf1FjgMXYgu cnXayPdxjX+I75aVaR/kXv438UmnqQl7EsybTjMMppJwX0NrBbyQoG4RYxEE/f9sjrU6 aOzuHkVzMeysoRfdqnbJZeu/xNV4lCfjheNpHis8vgTET2JMNnTZD3ZMlazX3fSn1xLI 831g== X-Received: by 10.195.13.129 with SMTP id ey1mr97884503wjd.132.1452595344584; Tue, 12 Jan 2016 02:42:24 -0800 (PST) Original-Received: from firefly ([91.219.111.102]) by smtp.gmail.com with ESMTPSA id c185sm15258050wma.5.2016.01.12.02.42.23 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 12 Jan 2016 02:42:23 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198070 Archived-At: 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