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 14:31:32 +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="19519"; 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 14:32:58 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 1ljLNi-0004uW-Bw for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 19 May 2021 14:32:58 +0200 Original-Received: from localhost ([::1]:42162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljLNh-0007RM-F0 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 19 May 2021 08:32:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljLN2-0007RD-NG for help-gnu-emacs@gnu.org; Wed, 19 May 2021 08:32:16 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:50989) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljLN0-0005UQ-I6 for help-gnu-emacs@gnu.org; Wed, 19 May 2021 08:32:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621427492; bh=yKkaUSWlXH9t/MF9HlkhGN9UUUYK8/hzBMnfOMnCBcE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=baVltGp0LoftM+myocLN2dasti03rvCsjptOZNRVRuLDlOcxw0gvGJ9eoH0+MGT0l QgC5QL0NZuo5Mueh8TGWsqgDtN327qn0Uv4Uv3chfy2y9UfruR4212gdpQyPpAYIIU 7jAE4f2vlI1rtNsrJ04hQNOMFrwnxfTJcpfXs60s= 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 14:31:32 +0200 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:nURtlN5/8QNx+1lilJYFeC2SKt886DM05ZYYTK2IgQCt5+nXFQnTzdJEcjuPs/PqQ186D yPhI+lW6u0WL66bfmXxQ6CTnKziXJSt8xPVRspYfJlgnV0Dl7Y4tvZfTS5/mHexg2EGTtKAen8Ig M5vmxlx9aeh95xDxYbiAatdzX9piWgkOow8D1FiU60hR1/d99fuQSZ9GQO3GUv2qrHfph5LsbP50 FAFLo4eNNjtLY9asNw4uik7tLB3n/u8mFbREAn+Jk12dcv4kc12kylxsAsNvmliCgqcZmweHN4B1 Cw= X-UI-Out-Filterresults: notjunk:1;V03:K0:ySVOJSeUW3E=:7jQtxQjMRujZz1aLH9sM3I 3ekPOhTasQR1KtrqgdNy96pWz1DEDpn9K2+a8lEQPMs5lwmNbyCqwazUiemozpcc3JNgpYSTp jO/jK8i6m0MnGBtFtx7CRBSSSdk173riYBM5UBMELnieoG9DOYi9Fzs++EUD3vcOyONYyekVy HJXwtUghoGlGBm5/SsbUxv8xjH8yxzt71/D4SgwvXx1qO7TWJ9zOMov/Bg/kCgDEw0MGiGhMy za65jjjM87WV8V/TVk+UaJyfm1asMSZBBo5r9ZaRJKQqWV0AsszJ5RlQFFpA8stYIV45zyt9N MQM5Nqz34dUv/cs4a8f8vXhEqesGS6e33t5nyfkpmMiCnPBkBX6DY+d262JL0phmfdR0HYh6R NCcBLf0FE8VDYRIBzNt3DfQ/miXI9SaRvEKFi2kRyUKzato3A9SDdtuRUwv5Xb3E7u6M1Vxcn YnMlf1jEUgYvdej2ur+ffq9qmxn/dn9luKknPtZ/YmCmwzxRoL4jIMKtm+XylMcNmRPhcP856 TyTsPgxA9oQJrLmhXg9FlKIroFDuvlL9AYhOsq47uedYetfCvjv7V7Uz+Tpd3oLyQ8KVFw8fp dz8eddBNwKKInmPm0NmuM54Qgms+2TyzGFWPTt76ZGqzjt3iD0RwhfC0Rx7H92KeW8Yth3TYP ty1aM8BNqlS9WY/FFjeFzin79GygwmF7XIcL1+NvRI98Ga/wpzmpindfLE1l6qpwIBvoB9ydc E+jpT4dMzSddSe+1cIdZynWklmcBBAMPir2o2Li6ZscfcFSF2Owk5X/IiKGDmouucbWG0d3N 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:129929 Archived-At: > I am done and obfuscated now=2E =E2=98=BA Will simplify=2E How can I detect a comment line composed of ";", "+", "-= ", or "=2E" because I want to insert the string if I find the following lines First one is comment composed of ";", second one is comment composed of "+= ", and the rest are comments composed of "-" and "=2E"=2E The comments could also start at any column=2E ;; ;;;;;;;;;;;;;;;;;;;;;;;;; ;; +++++++++++++++++++++++++++ ;; -------------------------- ;; =2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E= =2E > 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 >