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: bounds-of-thing-at-point for paragraphs Date: Sun, 1 Nov 2020 19:34:31 +0100 Message-ID: References: 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="31245"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 01 19:37:16 2020 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 1kZIE7-0007zi-H6 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 01 Nov 2020 19:37:15 +0100 Original-Received: from localhost ([::1]:37400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZIE6-0003k7-CS for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 01 Nov 2020 13:37:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZIC3-0003jG-0p for help-gnu-emacs@gnu.org; Sun, 01 Nov 2020 13:35:07 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:38933) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZIBz-0003hQ-V2 for help-gnu-emacs@gnu.org; Sun, 01 Nov 2020 13:35:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1604255671; bh=Yjx2I3Itafbs+jtMFioIjXpS5iTNULwwpfCii4sVwMI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=cQvJEqX6sVAEA4atf0tA093R7LXs9jDSp7fwjr18ASAG+zpR42KYhHdWvs5kppfIA 88/K4fEUcPRMaPLoMygQ1Q1m8OCK8UZYdtWTxYG823/xwq7JgpBJp0zkYXGHbopbIG pa1VCK8VwAUohDmlyTRPtMOwT+/nFcN3a4THL12Y= 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-bs11.server.lan [172.19.170.179]) (via HTTP); Sun, 1 Nov 2020 19:34:31 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:ns6ooqxoJMUQKq9zYV6h3R5ffM7sdAjwa1509NtCl/emA6BaJhArynjh5gPX7tSnXKnMm pf2H0Jd8HCwbGwo2Im24v2ROmudM5oanIgp+8lqfwZ3Vfh8/J2sAPPmfJTo9Lx2YUoganUC2YdZS MgUB/1Knx0y3Qc128GBnHgDPo89jFbvJHoeO1DVjCFLohCsR/ML4JzS5Pxos8gOzPwx9YJy0tzJv Cs+7vPBJPL87NxMv+IdPXMvr758QjYzQMkp8CicS831Hdqq5+zWPZZOYiKTS4OpbrOrSDQyAklk9 PM= X-UI-Out-Filterresults: notjunk:1;V03:K0:U6Pnx3/0WQg=:NT4WfXnDclrfJ+I2RjqmW9 j1HeFDd85qKGAxLj2sQ11Xoj+Y2mECID+Aj0D1XmFFX/Je8GVPrX5jKoX519v+irDt+9ijZcz PM9kpBa2pbvz78cliHTFNz40ANXi0OW4CsOFFYe962kdnp7QCEufIaeqUOSRrnyzoJfDp7S1p kvvIL8j1ir1uPJat5zkbV8jZY6G25KDT95Htk1Tmkb1zXu2afBoUQxBzwBt9bd5X0ZbGGhpq+ YaSe74jEd2eFCMuqlBsq5yWUg/SlWyswy993KRN9outLyTev8XBdXX165n9nPSupiN+92HdNk +vrGY+SN+MPHMoSug8t+eoo63O0KB4NT6zXXfpWtP7LPqCsrAvhkQCrzH9e6lWk5QNNckI+Fu +cxvRRFXM7dM4GsYCttxZNXB7LzVuHxEQiidj3jMLo+sE0WElc6SN72IKDtq6cvf0VHrA9M5B 1ZJQnd0+agNYJrhZhqLI3Z/WeTeJjj8VOgzaomYWEnb8EvlrB14FGzczg+6/1Ii3jBt1dy2SI uiGZngVQLP3DpNiQo6wuU824IHThzNdhrFB8NovywjAgQUqlurs59dNHbfPXcVsxXLRoKWUvr Jr4G4tOLOEbL4= Received-SPF: pass client-ip=212.227.17.22; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/01 13:35:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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:124883 Archived-At: Yes, but transpose-paragraph does not keep at the same point position. I was asking how bounds-of-thing-at-point does not take paragraph as argum= ent as well, since it does for word, sentence, line. Can paragraph be included= as well? > Sent: Sunday, November 01, 2020 at 7:22 PM > From: "Jean Louis" > To: "Christopher Dimech" > Cc: "Help Gnu Emacs" > Subject: Re: bounds-of-thing-at-point for paragraphs > > * Christopher Dimech [2020-11-01 19:09]: > > Been trying to write a function to transpose two paragraphs but keep t= he cursor > > at the same position. How is it that bounds-of-thing-at-point does no= t take > > paragraph as argument? > > That is very nice. > > I like ivy-mode from GNU ELPA, it is package for automatic completion > of many functions. There are many various completion packages. > > It may help you faster explore which functions are available. > > I was looking if such function already exists by doing {C-h f} and > then I get list of functions, I have tried typing "trans" and "para" > and I can find function `transpose-paragraphs' > > You may spare your efforts by finding some probably already existing > functions. > > If you wish to make your own function out of `transpose-paragraphs' > you may come with cursor on the function name, above here ^ and type > {C-h f} then you press TAB and enter into file `paragraphs.el' where > you can find how function is written. > > Then you may copy the same function and name it > `my-transpose-paragraphs' and try modifying it as you wish. You could > as well modify original function to do what you wish and save it in > your configuration. > > See below: > > > (defun Skip-Over-Paragraphs (arg) > > I understand that some programming languages have mixture of upper > case and lower case function names, in Lisp that is not so common. I > believe it is common in some versions of Lisp, not in Emacs > lisp. > > As: > > (setq A 1) > (setq a 2) > > are not same so, so it is better writing all lower case letters. > > > (let ((Prg-Bounds (bounds-of-thing-at-point 'paragraph))) > > > > ;; -------------------------------------------------------------= --- > > (when Wrd-Bounds > > (let* > > ( (Beg (point)) > > (End (cdr Prg-Bounds)) > > (Shift (- Beg End)) > > I understand you may need now for visibility or orientation some space > at ( (Beg)) yet by convention there is no such space. You better not > make new lines after let* to make it easier readable for people who > are familiar to different style. Lisp is great, you may write it > anyhow, but for readability there are some conventions. > > You may mark the function and simply press TAB and it will indent it > for you. > > Please see the Emacs Lisp manual as it is built into Emacs. There is > section "Tips" where you can read various conventions. > > > ;; -----------------------------------------------------= --- > > (Cursor-Psn > > (save-excursion > > (goto-char End) ; [#A] > > (if (condition-case err > > (progn ; bodyform > > (transpose-paragraphs arg) ; [#B] > > t > > ) > > Normally ending parenthesis you put straight after t. > > I suggest you use Options -> Highlight matching parenthesis to help > you see where you are. > > -- > There are 50 messages yet in my incoming mailbox. >