From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: Determining existence of text following point Date: Tue, 18 May 2021 12:08:42 +0200 Message-ID: References: <87cztpx8oz.fsf@ericabrahamsen.net> <87zgwsx5r3.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28571"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eric Abrahamsen , Skip Montanaro , Help Gnu Emacs To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 18 12:35:41 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lix4e-00076F-Lz for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 18 May 2021 12:35:40 +0200 Original-Received: from localhost ([::1]:52164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lix4Y-0007xj-RH for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 18 May 2021 06:35:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liwfB-0003nT-Jp for help-gnu-emacs@gnu.org; Tue, 18 May 2021 06:09:21 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:56415) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liwf8-00084n-DJ for help-gnu-emacs@gnu.org; Tue, 18 May 2021 06:09:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621332522; bh=NAadqPEhTWvYWxGBVJyNzm5OhSBSJwKyI/5zPAtLh18=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=CcNrSZW8a8MZmJ1/H9pkv8BCFYOjW2KmcIKOlzaQCJOwhHG2zK55alnq0pQUiIu/I 9C/AVy+WmBPNVWw0Q8JfK7Yem7wsQkXtTq5d5H1Pdm0emxq04pi1N36YFNDo5PYscq vnW/zHPp5FLaCR+8u5cMv95WXu2lo9vu8yBlhVJA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs13.server.lan [172.19.170.181]) (via HTTP); Tue, 18 May 2021 12:08:42 +0200 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:ftQyO/yew/dc5Cw9Hf4bAaxp+lJQMasT7evgN65RieJ8Tix5duoumCS3D/6qmyteWMQ0Y Y3byLDYj9XFpfxUzstfuF7+VtM4AfZ+FGqChMjPfjgCrDgWNA+1pmWN/VfE5dP2UFQYjI6t7pIt1 0xGxxqsw4wfHVfkf7niyp+I/W2pJshyOsO//zu8Br3lAawDsyU4QhE36Htdk6wNQLf6FiVLs8sJJ Hd+I2VEMi9UOO6xEAreTpN5LU/3+CqDoLpoWSc0aYkm5mYzaC2GNwUyv3IQkjmQljzamsYB4ztrD VM= X-UI-Out-Filterresults: notjunk:1;V03:K0:/M1j0dFoWmc=:VUyHhujYUJsJeI4OalcdBZ s1Hm7xUmGa43VvxD5VciBzaUUZG5nmccgZDbvefWYTheYzwvRELj394mSVLAOcpnof6iN4UGf dzfdKSNaunkeceSC0lOEsTvsHFIdbyMhL+XB9MzXvCXClZSEE78Wsh4muE5Kd8/2H32MwM6wG vxgErN5dkUGFV/0RJ9ylzVT0/jXgspQEbNptNR2idPF3XizqPWgtHLJbKBWDM1B+QzDIsE6tB pjris3M2uAm9Kpqd0ZtVO33nOrPE/JVgMVHBz5dTYxd0+AvsKcMRU5NTIo5Lcn6WhBme0KA8K UYvNt8BbjQf6v2iYszyO662vO/YH+Ag4L05uoHxLSCBlFJjSGBw6zdbKZP20zEiVcUFCwvisM nYzeFg5o06/CtB+Mdx1+zKxVqhoH/pCdlMdZVcyS6s7Ca9BDHaKdDE+bZIQuqJVeGS546DaR4 gvvdNioc5Ds55E/GtgvjB1ihPOE6i/RpRHvtVKSJuyOeqGHGF1Zz1a0q2HbiB7jLYll1AMT7g u66H8/NaEAj2Mm23KsEH7cpS8fxGHcp3nm1Mi3S4U8ZEF8+/iOA42j0Z9FGn1kbYNP2eNoLNt 2m8lN7sIoNo4bzOai/L0IEEjFfw9B9PuX78Oe0C3LqhBlOLCLXBSab/fqraOlfb8gGCc1zI/X 37akeFYf5cGJ9yR+8v0stygzDaIE8dNLEzXzjrpxyTNz5/BBG7q2YvhvRjjhe6wc1i/cwshQ1 IGbyMuMVc+RekPHXFfiZz+RmHSk7TbzWLl8oZEzfeT0PH5KkmFPWtLC5sTYiSRX5CVyDOiMd Received-SPF: pass client-ip=212.227.15.19; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129865 Archived-At: How is it that the following returns nil? (setq sa (string-match "[^[:blank:]]" " ")) > Sent: Tuesday, May 18, 2021 at 9:54 PM > From: "Jean Louis" > To: "Christopher Dimech" > Cc: "Eric Abrahamsen" , "Skip Montanaro" , "Help Gnu Emacs" > Subject: Re: Determining existence of text following point > > * Christopher Dimech [2021-05-18 12:31]: > > > Sent: Tuesday, May 18, 2021 at 8:56 PM > > > From: "Jean Louis" > > > To: "Eric Abrahamsen" > > > Cc: "Skip Montanaro" , "Help Gnu Emacs= " , michael-franzese@gmx=2Ecom > > > Subject: Re: Determining existence of text following point > > > > > > * Eric Abrahamsen [2021-05-18 03:09]: > > > > michael-franzese@gmx=2Ecom writes: > > > > > > > > > But if there are only empty spaces it is ok too=2E > > > > > > (defun my-insert-on-empty-end-of-line (s) > > > (let ((line-cut (buffer-substring-no-properties (point) (line-end-= position)))) > > > (when (or (not (string-match "[^[:blank:]]" line-cut)) (eolp)) > > > (insert s)))) > >=20 > > I understand that "string-match" returns index of start of first blank= match=2E > >=20 > > Suppose the cursor is just after the first period=2E Then because the= re is still > > text left on the line, the string "s" is not inserted=2E The text sho= uld only be > > inserted when the rest of the line is blank=2E > >=20 > > A neutrino is a fermion=2E Some more text here=2E >=20 > That (not (string-match "[^[:blank:]]" line-cut)) means it is true if > nothing is found that is not blank space=2E >=20 > Test it here where is the block (remove block): >=20 > (string-match "[^[:blank:]]"=20 > (buffer-substring-no-properties (point) (line-end-position)))=E2= =96=88 ;; something >=20 > (not (string-match "[^[:blank:]]"=20 > (buffer-substring-no-properties (point) (line-end-position))))=E2= =96=88 ;; something >=20 > (not (string-match "[^[:blank:]]"=20 > (buffer-substring-no-properties (point) (line-end-position))))=E2= =96=88 =E2=87=92 t >=20 > There is blank space after last parenthesis here, you can test: >=20 > (not (string-match "[^[:blank:]]"=20 > (buffer-substring-no-properties (point) (line-end-position)))) = =20 >=20 > --=20 > Jean >=20 > Take action in Free Software Foundation campaigns: > https://www=2Efsf=2Eorg/campaigns >=20 > Sign an open letter in support of Richard M=2E Stallman > https://stallmansupport=2Eorg/ > https://rms-support-letter=2Egithub=2Eio/ >=20 >