GNU bug report logs - #31204
25.3; Make word motion more customizable

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Yuri Khan <yuri.v.khan@HIDDEN>; dated Wed, 18 Apr 2018 08:56:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Apr 2018 08:55:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 18 04:55:50 2018
Received: from localhost ([127.0.0.1]:58447 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1f8isY-00024K-6v
	for submit <at> debbugs.gnu.org; Wed, 18 Apr 2018 04:55:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33414)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yurivkhan@HIDDEN>) id 1f8isW-000247-6f
 for submit <at> debbugs.gnu.org; Wed, 18 Apr 2018 04:55:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <yurivkhan@HIDDEN>) id 1f8isP-0002Ef-C7
 for submit <at> debbugs.gnu.org; Wed, 18 Apr 2018 04:55:43 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:32942)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <yurivkhan@HIDDEN>) id 1f8isP-0002EZ-8W
 for submit <at> debbugs.gnu.org; Wed, 18 Apr 2018 04:55:41 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52590)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <yurivkhan@HIDDEN>) id 1f8isN-0004cC-I5
 for bug-gnu-emacs@HIDDEN; Wed, 18 Apr 2018 04:55:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <yurivkhan@HIDDEN>) id 1f8isM-0002DV-7J
 for bug-gnu-emacs@HIDDEN; Wed, 18 Apr 2018 04:55:39 -0400
Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]:47008)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <yurivkhan@HIDDEN>) id 1f8isL-0002D6-W4
 for bug-gnu-emacs@HIDDEN; Wed, 18 Apr 2018 04:55:38 -0400
Received: by mail-oi0-x22d.google.com with SMTP id e123-v6so880533oih.13
 for <bug-gnu-emacs@HIDDEN>; Wed, 18 Apr 2018 01:55:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:sender:from:date:message-id:subject:to
 :content-transfer-encoding;
 bh=soiIjgzG6EAAFOdLcIbeo70NB2h4Z/thJm8GZZFaxwc=;
 b=hyHe9alp1uM3Qsr998HR55B56Jx5ZJk44rBYaRm7apR0PSAAlpS+gpMTc90+YH/QZF
 pcNP8IMMKp9M2IvBD6N6CYu4DwchkZZCzbXiUM2+Q3Izyp7xEJY/0Lf23n7Bnr91W7Q/
 ZoSFXCaRPDEd2q4SJ0u6bcd6pgO4UAYCdlyPYs01F5MQoDVanq7KhARdueSEX7q7Q4Ly
 Dnuvk4qT81gm17dpcvjrW/u4tK2z9Gr4Dk63/PAjzHq+RiN4obooggog5kmFACiBq/Bs
 LJA8VvMN9SLmYSDY0uXCaINesN+p2lLEJSviZoID8Z9a2kEcilCrAFeyiHMhkaFxe6DC
 J28w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:sender:from:date:message-id:subject
 :to:content-transfer-encoding;
 bh=soiIjgzG6EAAFOdLcIbeo70NB2h4Z/thJm8GZZFaxwc=;
 b=uCanRYywu5+UtsojKqR4a8/XZjQt4kBwyuO8034kXiIZnD7MpCSNf01/llPLgvr5Ef
 x7yHYASmqCRMtcm1dWQ6tpAu1EdWuLk92VH6zha7jRq8nUCKNXN0iwNrDVp3RoavU9vL
 /AzrcFkJyXJGRCFKKzm5wXvf9n5zk4rkDDsiz1SqtGH2kR0ix2Gd34qvsrpksiIwZTTW
 FnaorKjl98tH2WUreIWulDUuB9usXBdw26GLeAqP4HbnkVEQabFPfw+N9EFpEZky7w0R
 Nss/AUmrpnGmmG2/DPiM8+K/DPog1z3a9Z208R/V1WMo4jgqILnHtWJfFLdBWeSk8Jou
 ROKw==
X-Gm-Message-State: ALQs6tC80Dl8flYPSxUqM0PL5XEIhOR7cG7MamZ1Nz4X9b1JqhgN06D+
 wCnNiiddSqtiTQC4aFqtCrnCN51QN9Fp0hsx8iqSPg==
X-Google-Smtp-Source: AIpwx48lNqzQYyt6mKlUJ7FErsCoNL6KlrQP2v2+Sx3Q9804+30a28THfW9FHyGoRufx8XDuIjXc9ZmFQMwuooiukAk=
X-Received: by 2002:aca:f03:: with SMTP id 3-v6mr643706oip.191.1524041736945; 
 Wed, 18 Apr 2018 01:55:36 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.74.186.8 with HTTP; Wed, 18 Apr 2018 01:55:16 -0700 (PDT)
From: Yuri Khan <yuri.v.khan@HIDDEN>
Date: Wed, 18 Apr 2018 15:55:16 +0700
X-Google-Sender-Auth: zHOic5qdM_X4BaThpzhwSEVAr0o
Message-ID: <CAP_d_8UvVdeVngKSe1A2_mB5p5wHhhhWLzTP7VnAs=jZQqOxpg@HIDDEN>
Subject: 25.3; Make word motion more customizable
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

While trying to make word motion commands (Ctrl+left/right, M-f/b) more
similar to that implemented in other editors:

http://lists.gnu.org/archive/html/help-gnu-emacs/2018-04/msg00230.html

I encountered a difficulty.

The function =E2=80=98forward-word=E2=80=99 behaves as follows:

1. Skip to the nearest character having word constituent syntax.
2. Skip to the nearest word boundary.

Step 2, by default, finds:

* a non-word-constituent character, OR
* a transition between two adjacent characters of different scripts
  (subject to exceptions controlled by =E2=80=98word-combining-categories=
=E2=80=99 and
  =E2=80=98word-separating-categories=E2=80=99),

whichever comes first.

Step 2 can also be customized by modifying
=E2=80=98find-word-boundary-function-table=E2=80=99. This enables various u=
seful
behaviors such as =E2=80=98subword-mode=E2=80=99, =E2=80=98superword-mode=
=E2=80=99, and possibly CJK
word breaking rules.

Step 1, on the other hand, is not customizable at all.


The specific behavior that I was trying to implement was to find the
nearest transition:

* from a word character to a non-word character, OR
* from a non-word non-whitespace character to a word character, OR
* from a non-word non-whitespace character to a whitespace character.

As an illustration (where =E2=80=98|=E2=80=99 specifies word motion stops w=
hen going
left to right):

    foo| ***| +++| (|bar|)|
       ^

When cursor is after =E2=80=98foo=E2=80=99, step 1 of =E2=80=98forward-word=
=E2=80=99 skips to directly
before =E2=80=98bar=E2=80=99, missing two stops.

As a result, implementing the desired behavior requires either:

* defining separate functions =E2=80=98my-forward-word=E2=80=99, =E2=80=98m=
y-backward-word=E2=80=99,
  =E2=80=98my-left-word=E2=80=99, =E2=80=98my-right-word=E2=80=99, =E2=80=
=98my-kill-word=E2=80=99,
  =E2=80=98my-backward-kill-word=E2=80=99, and possibly more, and remapping=
 their key
  bindings; OR

* advising =E2=80=98forward-word=E2=80=99 with an :override.


Perhaps it would be nice to have an optional hook for step 1 of
=E2=80=98forward-word=E2=80=99, a function that would take two arguments PO=
S and LIMIT,
and returning the starting word boundary position from which step 2 would
then work.


In GNU Emacs 25.3.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2017-09-13 built on lcy01-32
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
System Description:    Ubuntu 16.04.4 LTS

Configured using:
 'configure --build=3Dx86_64-linux-gnu --prefix=3D/usr
 '--includedir=3D${prefix}/include' '--mandir=3D${prefix}/share/man'
 '--infodir=3D${prefix}/share/info' --sysconfdir=3D/etc --localstatedir=3D/=
var
 --disable-silent-rules '--libdir=3D${prefix}/lib/x86_64-linux-gnu'
 '--libexecdir=3D${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode
 --disable-dependency-tracking --prefix=3D/usr --sharedstatedir=3D/var/lib
 --program-suffix=3D25 --with-modules --with-x=3Dyes --with-x-toolkit=3Dgtk=
3
 'CFLAGS=3D-g -O2 -fstack-protector-strong -Wformat
 -Werror=3Dformat-security' 'CPPFLAGS=3D-Wdate-time -D_FORTIFY_SOURCE=3D2'
 'LDFLAGS=3D-Wl,-Bsymbolic-functions -Wl,-z,relro''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_DK.utf8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr mail-utils time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 86338 5928)
 (symbols 48 19769 0)
 (miscs 40 49 121)
 (strings 32 14363 4733)
 (string-bytes 1 409522)
 (vectors 16 11755)
 (vector-slots 8 430899 3852)
 (floats 8 166 64)
 (intervals 56 231 0)
 (buffers 976 18)
 (heap 1024 33279 1050))




Acknowledgement sent to Yuri Khan <yuri.v.khan@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#31204; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.