From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: michael-franzese@gmx.com Newsgroups: gmane.emacs.help Subject: Re: Determining existence of text following point Date: Wed, 19 May 2021 12:32:26 +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="15581"; 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 Wed May 19 12:33:53 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 1ljJWS-0003uU-Ri for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 19 May 2021 12:33:52 +0200 Original-Received: from localhost ([::1]:35694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljJWQ-0007CT-W7 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 19 May 2021 06:33:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljJVn-0007C5-7U for help-gnu-emacs@gnu.org; Wed, 19 May 2021 06:33:11 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:48127) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljJVl-0001QZ-1K for help-gnu-emacs@gnu.org; Wed, 19 May 2021 06:33:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621420346; bh=3ORQkn9d4Gx8ewqGEyTyb60Biihto2VvCHtjUQcA8uE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=GOURdj664XM4o3iA8Mz53XsLGPUZo9DbGMc/khTqK/DEQBmNnhyGfG5CuXz4gZPFB Vc6TDVPEs6mnr7aaZH9s9tfDS274h51z2Rw8Oy5Ly24TilsJA3iybyxyPDIHEi5Ch+ qbKaG+N0NpqgGWiA7zTRQaZ4gopWTvxugoYaLhDs= 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-bs08.server.lan [172.19.170.176]) (via HTTP); Wed, 19 May 2021 12:32:26 +0200 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:44t8Vc9TBYUqAdklotl5N2CKNqbUoxSUNKBEGtjJlGjSlXZ9MLbOLMsbGHiq2BP4aT/87 h804pLEyvF1Y9cRQF0OOpEfrbXYRj5xe6j5wicz0SPD5u6fG4x4Zl0rQsA4E9JsSKiGHdO2be0nB HmY2pbeY6GFTM5Mg+zeiOiIwWq92IBovXNMlepyFepew0l1HAqbC4GPHfPPhgq6vcVqEwJmNBlT6 qOWj75K7Keozkl2i1n5ESy71epojKH4LyOTfSXRDTLYOSPCT8tGNfPhHZqQE0mBsnr6u29mLNm6d iw= X-UI-Out-Filterresults: notjunk:1;V03:K0:4u2+kC3vyvI=:ahSc3z8Re0PfeZDtXtUJvP imiZ17z1l8H+OW5z+4MYw9hFzIonrzc/6yRr4W/6qxko35JyCgri87ca3DdRMPIOzYSab2qmH Fb0C7jze8PLNABiZTyyT7rdU1fLfmtjluuUlIWy9wLYxPodI0yZEl+4C1ViQs3jL6EvlsQ4yk 9dk4i4bb7/tnTVWeP9OcUGQpgPen4QJYGJF265W1ONC4BBJIX6SfvW3tLtvhst5v2+qOxtiYr jWt85iry+iXM/odrFDIx+KXwjdvigGs9XLbNn7vbI4Z2ZoZ/d+FFjrj2sCEQdIrdXgoshj2wQ bSh2MesYya6lXYs3srRT8TpF2Q9dFUwxxdiukLEESLy7xavuxXkVLDAhY6/G5bZHhaaNeXZnG N49o0xAJEIT4I0ftNeyP1B968+5L/98EGsvDm+lCdq8dgsmV30/e39R8YLtmiB0F63+IhMxTn onDzS4FNCZ9Wd4VI36iGJk/zuHrVm7MJHO2vLg8nRdhUuDttO0iAkRsn/BK5Ya0i03UniYbad XS7NZ3VtyBBldMtvfOv6uJkZrYiGLfVdmVRiYSbXAQZ0aR5vXCjNja6Uhga3LQVEWVihhxJB4 qUFf+6FA8ReT91b5a3N+dYYg8D8qRLnTznUs1pwXSEzuZMkyRyGptD6ulpucwMBp2kXlAbrbf kChzs6PSWJu5AXOh3wksvScIy9iBV/Bi5C02eZi1wAF6Hf6MzUSzEUnHgNdGoyNurpDeBeYMZ ICcqRMuyrz/37rWimp+fb5wys3VmWhplydqoDsTvVYTF6NbRrBCJnOGIdZQ9hsjV4DOYya8x Received-SPF: pass client-ip=212.227.15.19; envelope-from=michael-franzese@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:129927 Archived-At: Currently the code inserts if the region is blank=2E But I have a keybinding to change from ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to ;; ++++++++++++++++++++++++++++++++++++ > Sent: Wednesday, May 19, 2021 at 10:23 PM > From: "Jean Louis" > To: michael-franzese@gmx=2Ecom > Cc: "Eric Abrahamsen" , "Skip Montanaro" , "Help Gnu Emacs" > Subject: Re: Determining existence of text following point > > * michael-franzese@gmx=2Ecom [2021-05-19 10= :29]: > > Point will always be at the beginning of a comment on a separate line > >=20 > > The "^" shows the position of the cursor=2E > >=20 > > ^;; ;;;;;;;;;;;;;;;;;;;;;;;;;; > >=20 > > ^;; +++++++++++++++++++++++++++ > >=20 > > ^;; ---------------------------- > >=20 > > I want to have a keybinding that if I continue to hit will change > > a comment from > >=20 > > ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > >=20 > > to > >=20 > > ;; +++++++++++++++++++++++++++++++++++++ > >=20 > > Currently I have the following code > >=20 > >=20 > > (defun insert-bifurcation (s n) > > "todo" > >=20 > > (let* ( (a (point)) (b (line-end-position)) > > (line-cut (buffer-substring-no-properties a b)) ) > >=20 > > (when (or (not (string-match > > "[^[:blank:]]" line-cut)) (eolp)) > > (pcase n > >=20 > > (0 > > (save-excursion (insert s)) > > (comment-region a b)) > > =20 > > ((or 1 2 3 4 5) > > (delete-region a b) > > (save-excursion (insert s)) > > (comment-region a b)) > >=20 > > (_ > > (delete-region a b))) )) ) > >=20 > > (defvar count 1) > >=20 > > (defun insert-bifurcating-comment () > > "Insert bifurcating line at cursor position" > > (interactive) > >=20 > > (let* ( (m 62) (n 69) > > (lena (- m (current-column))) ; lena =3D m - (current-column) > > (lenb (- n (current-column))) ) > >=20 > > (pcase count > > (0 > > ;; makes s to be line with repeating ";" > > (setq-local s (make-string lena ?\;)) ; repeats lena times > > (insert-bifurcation s count) > > (setq-local count 1)) > > (1 > > ;; makes s to be line with repeating ";" > > (setq-local s (make-string lenb ?\;)) ; string length lenb > > (insert-bifurcation s count) > > (setq-local count 2)) > > (2 > > ;; makes s to be line with repeating "+" > > (setq-local s (make-string lena ?+)) > > (insert-bifurcation s count) > > (setq-local count 3)) > > (_ > > ;; deactivates the bifurcating line > > (insert-bifurcation s count) > > (setq-local count 1)) )) ) >=20 > I am done and obfuscated now=2E =E2=98=BA >=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 >=20 >