unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Christopher Dimech <dimech@gmx.com>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: bounds-of-thing-at-point for paragraphs
Date: Sun, 1 Nov 2020 21:22:26 +0300	[thread overview]
Message-ID: <X5784jrSo42VFf7l@protected.rcdrun.com> (raw)
In-Reply-To: <trinity-8809fd78-2a0c-4b7c-b6b7-2339f0ed6b7e-1604246883991@3c-app-mailcom-bs11>

* Christopher Dimech <dimech@gmx.com> [2020-11-01 19:09]:
> Been trying to write a function to transpose two paragraphs but keep the cursor
> at the same position.  How is it that bounds-of-thing-at-point does not 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.



  reply	other threads:[~2020-11-01 18:22 UTC|newest]

Thread overview: 205+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-01 16:08 bounds-of-thing-at-point for paragraphs Christopher Dimech
2020-11-01 18:22 ` Jean Louis [this message]
2020-11-01 18:34   ` Christopher Dimech
2020-11-01 18:45     ` Drew Adams
2020-11-01 18:52       ` Jean Louis
2020-11-01 19:00         ` Drew Adams
2020-11-01 20:07           ` Christopher Dimech
2020-11-01 22:06             ` Drew Adams
2020-11-01 22:36               ` Christopher Dimech
2020-11-01 22:47                 ` Jean Louis
2020-11-01 22:52                   ` Drew Adams
2020-11-01 23:14                     ` Christopher Dimech
2020-11-02  1:07                       ` Drew Adams
2020-11-02  4:09                         ` Robert Thorpe
2020-11-02 15:41                           ` Drew Adams
2020-11-03  6:00                             ` Corwin Brust
2020-11-03  6:40                               ` Stefan Kangas
2020-11-03  7:41                                 ` Corwin Brust
2020-11-03 16:07                                   ` Drew Adams
2020-11-06 23:45                                     ` Corwin Brust
2020-11-07  1:26                                       ` Stefan Kangas
2020-11-02  6:07                     ` finder-commentary Jean Louis
2020-11-02 15:48                       ` finder-commentary Drew Adams
2020-11-02 16:02                         ` finder-commentary Drew Adams
2020-11-02 16:58                           ` finder-commentary Jean Louis
2020-11-02 17:27                             ` finder-commentary Drew Adams
2020-11-01 22:49                 ` RE: RE: bounds-of-thing-at-point for paragraphs Jean Louis
2020-11-01 22:51                 ` Drew Adams
2020-11-01 23:10                   ` Christopher Dimech
2020-11-02  1:05                     ` Drew Adams
2020-11-01 20:36           ` Jean Louis
2020-11-01 21:32             ` Michael Heerdegen
2020-11-01 21:43               ` Jean Louis
2020-11-01 21:43               ` Jean Louis
2020-11-01 19:27         ` Eli Zaretskii
2020-11-01 19:51           ` Christopher Dimech
2020-11-01 20:00             ` Eli Zaretskii
2020-11-01 20:09               ` Christopher Dimech
2020-11-01 20:13                 ` Eli Zaretskii
2020-11-01 20:27                 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-11-01 20:31                   ` Christopher Dimech
2020-11-01 22:10                     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-11-01 21:46             ` Drew Adams
2020-11-01 20:23           ` Michael Heerdegen
2020-11-01 20:29             ` Christopher Dimech
2020-11-01 22:10               ` Drew Adams
2020-11-01 21:01             ` Stefan Monnier
2020-11-01 18:45     ` Jean Louis
2020-11-01 18:51       ` Drew Adams
     [not found] <mailman.5042.1543777897.1284.help-gnu-emacs@gnu.org>
2018-12-04  9:04 ` using setq to create lists based on other lists Barry Margolin
2018-12-04 13:56   ` Stefan Monnier
2018-12-05  1:07   ` Robert Thorpe
2018-12-05  2:32     ` Drew Adams
2018-12-05  6:45       ` Jean-Christophe Helary
2018-12-05  8:00         ` Marcin Borkowski
2018-12-05  8:11           ` Jean-Christophe Helary
2018-12-05 14:57         ` Drew Adams
     [not found]         ` <mailman.5218.1544021892.1284.help-gnu-emacs@gnu.org>
2018-12-05 16:59           ` Barry Margolin
     [not found]     ` <mailman.5186.1543978155.1284.help-gnu-emacs@gnu.org>
2018-12-05 16:50       ` Barry Margolin
     [not found]   ` <mailman.5145.1543931778.1284.help-gnu-emacs@gnu.org>
2018-12-05 16:47     ` Barry Margolin
     [not found] <mailman.7307.1515801433.27995.help-gnu-emacs@gnu.org>
2018-01-13  0:43 ` info-find-source Emanuel Berg
2018-01-13  3:43   ` info-find-source Robert Thorpe
2018-01-13  5:23     ` info-find-source Marcin Borkowski
2018-01-13 16:31       ` info-find-source Drew Adams
2018-01-14  7:03         ` info-find-source Marcin Borkowski
2018-01-16 23:10           ` info-find-source Drew Adams
2018-01-13 15:50     ` info-find-source Drew Adams
     [not found]     ` <mailman.7314.1515821013.27995.help-gnu-emacs@gnu.org>
2018-01-14  2:57       ` info-find-source Emanuel Berg
2018-01-14  7:00         ` info-find-source Marcin Borkowski
     [not found]         ` <mailman.7369.1515913231.27995.help-gnu-emacs@gnu.org>
2018-01-15  4:17           ` info-find-source Emanuel Berg
2018-01-15 18:54             ` info-find-source Marcin Borkowski
     [not found]             ` <mailman.7435.1516042498.27995.help-gnu-emacs@gnu.org>
2018-01-15 19:55               ` info-find-source Emanuel Berg
2018-01-16 23:58                 ` info-find-source Robert Thorpe
2018-01-19  6:22                 ` info-find-source Marcin Borkowski
     [not found]                 ` <mailman.7609.1516342943.27995.help-gnu-emacs@gnu.org>
2018-01-19  7:12                   ` info-find-source Emanuel Berg
2018-01-19 20:31                     ` info-find-source Marcin Borkowski
2018-01-19 21:05                       ` info-find-source Drew Adams
     [not found]                       ` <mailman.7653.1516395915.27995.help-gnu-emacs@gnu.org>
2018-01-19 22:19                         ` info-find-source Emanuel Berg
2018-01-19 23:21                           ` info-find-source Drew Adams
     [not found]                           ` <mailman.7656.1516404112.27995.help-gnu-emacs@gnu.org>
2018-01-20 19:49                             ` info-find-source Emanuel Berg
2018-01-20 20:18                               ` info-find-source Eli Zaretskii
     [not found]                               ` <<83bmhos2qd.fsf@gnu.org>
2018-01-20 23:50                                 ` info-find-source Drew Adams
2018-01-21  0:04                               ` info-find-source Drew Adams
     [not found]                               ` <mailman.7695.1516493072.27995.help-gnu-emacs@gnu.org>
2018-01-21 11:49                                 ` info-find-source Emanuel Berg
     [not found]                     ` <mailman.7650.1516393881.27995.help-gnu-emacs@gnu.org>
2018-01-19 20:43                       ` info-find-source Emanuel Berg
2018-01-13  5:17   ` info-find-source Marcin Borkowski
     [not found]   ` <mailman.7313.1515820700.27995.help-gnu-emacs@gnu.org>
2018-01-14  2:54     ` info-find-source Emanuel Berg
2018-01-15 18:52       ` info-find-source Marcin Borkowski
     [not found]       ` <mailman.7433.1516042345.27995.help-gnu-emacs@gnu.org>
2018-01-15 19:50         ` info-find-source Emanuel Berg
  -- strict thread matches above, loose matches on Subject: below --
2016-08-03  9:30 How to get back to a place in a buffer, or: what is a window configuration? Marcin Borkowski
2016-08-03 11:25 ` Kaushal Modi
2016-08-03 18:31   ` Marcin Borkowski
2016-08-03 14:42 ` Drew Adams
2016-08-03 18:42   ` Marcin Borkowski
2016-08-03 19:39     ` Drew Adams
2016-08-03 21:47 ` Robert Thorpe
2016-08-03 22:06   ` Drew Adams
2016-05-13 14:20 Overriding emacs key bindings xiongtk
2016-05-16 18:04 ` Eli Zaretskii
2016-05-16 21:15   ` xiongtk
2016-05-16 18:59 ` Emanuel Berg
2016-05-16 21:14   ` xiongtk
2016-05-16 23:29     ` Emanuel Berg
2016-05-17  1:55       ` Robert Thorpe
2016-05-17  2:41         ` Emanuel Berg
2016-05-17  4:07           ` Drew Adams
2016-05-17  3:25         ` Kaushal Modi
2016-05-17  4:07           ` Drew Adams
2016-05-17  4:15           ` Emanuel Berg
2016-05-17 20:38           ` Robert Thorpe
2016-05-17  4:07         ` Drew Adams
2016-05-18  1:42           ` Emacs conventions (was: Re: Overriding emacs key bindings) Emanuel Berg
2016-05-18  4:38             ` Drew Adams
2016-05-18  5:22               ` Emanuel Berg
2016-05-18  5:36                 ` "First line is not a complete sentence" (was: Re: Emacs conventions (was: Re: Overriding emacs key bindings)) Emanuel Berg
     [not found]                 ` <mailman.40.1463549841.6543.help-gnu-emacs@gnu.org>
2016-05-18 13:27                   ` Joost Kremers
2016-05-19  4:32                     ` Emanuel Berg
     [not found]             ` <mailman.37.1463546355.6543.help-gnu-emacs@gnu.org>
2016-05-18 14:31               ` Emacs conventions (was: Re: Overriding emacs key bindings) Barry Margolin
2016-05-19  4:38                 ` Emanuel Berg
2016-05-17  4:44         ` Overriding emacs key bindings Marcin Borkowski
2016-05-17 20:37           ` Robert Thorpe
2016-05-18  2:21             ` Emanuel Berg
2016-05-18 20:34               ` Robert Thorpe
2016-05-19  1:33                 ` Emanuel Berg
2016-05-18 17:52             ` Marcin Borkowski
2016-05-18 20:30               ` Robert Thorpe
2016-05-17  4:43       ` Marcin Borkowski
2016-05-18  1:51         ` Emanuel Berg
2016-05-17  4:49       ` Marcin Borkowski
2016-05-18  2:02         ` Emanuel Berg
2015-03-03  0:47 Opening a bookmark in the init file Robert Thorpe
2015-03-03  0:56 ` Drew Adams
2015-03-03  2:32   ` Robert Thorpe
2015-03-08 19:18     ` Robert Thorpe
2015-03-08 21:24       ` Drew Adams
2015-03-08 21:48         ` Robert Thorpe
2015-03-08 22:52           ` Drew Adams
2015-01-14 22:12 Info: how to get back from a footnote Marcin Borkowski
2015-01-15  2:42 ` Robert Thorpe
2015-01-15  3:11   ` Drew Adams
2015-01-15  5:51   ` Marcin Borkowski
2015-01-16  2:38     ` Robert Thorpe
     [not found] <mailman.16504.1419019164.1147.help-gnu-emacs@gnu.org>
2014-12-29  4:21 ` Abbrevs for the most frequent elisp symbols Emanuel Berg
2014-12-29 11:24   ` Marcin Borkowski
2014-12-29 13:09     ` Robert Thorpe
2014-12-29 15:28       ` Drew Adams
2014-12-29 16:28         ` Robert Thorpe
2014-12-29 13:26     ` Stefan Monnier
2014-12-29 13:40       ` Marcin Borkowski
2014-12-29 14:57         ` Stefan Monnier
2014-12-29 15:49   ` Tom
     [not found]   ` <mailman.16844.1419852282.1147.help-gnu-emacs@gnu.org>
2015-01-03  2:25     ` Emanuel Berg
2015-01-04  0:19       ` Artur Malabarba
     [not found]       ` <mailman.17204.1420330787.1147.help-gnu-emacs@gnu.org>
2015-01-05 21:16         ` Emanuel Berg
2015-01-08 20:53           ` Artur Malabarba
2015-01-03  2:31     ` Emanuel Berg
2014-11-24 16:40 When do you prefer frames instead of windows? Raffaele Ricciardi
2014-11-24 17:20 ` Drew Adams
2014-11-25  8:03   ` Gian Uberto Lauri
2014-11-25 15:46     ` Drew Adams
2014-11-25 15:54       ` Gian Uberto Lauri
2014-11-25  8:33   ` When do you prefer windows instead of frames? Was: " H. Dieter Wilhelm
2014-11-25 15:46     ` Drew Adams
2014-11-25 18:40       ` MBR
2014-11-25 18:52         ` Drew Adams
2014-11-26  2:31         ` Yuri Khan
2014-12-19 16:08         ` Jude DaShiell
2014-11-25  8:52   ` Rainer M Krug
2014-11-24 19:10 ` MBR
2014-11-24 19:14   ` Drew Adams
2014-11-24 22:12 ` H. Dieter Wilhelm
     [not found] ` <mailman.14497.1416867184.1147.help-gnu-emacs@gnu.org>
2014-11-25  0:59   ` Barry Margolin
2014-11-25  1:29 ` Robert Thorpe
2014-11-25  4:21   ` Drew Adams
2014-11-25  8:54     ` Rainer M Krug
2014-11-25 15:47       ` Drew Adams
2014-11-25  1:45 ` Yuri Khan
2014-11-25  9:27 ` Ralf Fassel
2014-11-25 15:47   ` Drew Adams
     [not found]   ` <mailman.14554.1416930453.1147.help-gnu-emacs@gnu.org>
2014-11-25 15:57     ` Ralf Fassel
2014-11-25 16:57       ` Drew Adams
     [not found]       ` <mailman.14564.1416934703.1147.help-gnu-emacs@gnu.org>
2014-11-25 17:16         ` Ralf Fassel
2014-11-25 18:09           ` Drew Adams
2014-11-25 22:08             ` Subhan Michael Tindall
2014-11-25 22:22               ` Drew Adams
     [not found]             ` <mailman.14600.1416953316.1147.help-gnu-emacs@gnu.org>
2014-11-26  9:34               ` Joost Kremers
2014-11-25 22:02           ` Subhan Michael Tindall
2014-11-26  5:02       ` Yuri Khan
     [not found] ` <mailman.14479.1416849631.1147.help-gnu-emacs@gnu.org>
2014-11-24 17:47   ` Barry Margolin
2014-11-24 18:06     ` Jai Dayal
2014-11-25 17:32   ` Joost Kremers
     [not found]   ` <<slrnm79f8k.a37.joost.m.kremers@j.kremers4.news.arnhem.chello.nl>
2014-11-25 18:09     ` Drew Adams
2014-11-25 22:28 ` Bob Proulx
2014-11-25 22:54   ` Drew Adams
2014-11-26  8:12     ` Alan Schmitt
2014-11-26 13:42       ` H. Dieter Wilhelm
2014-11-28 13:51       ` Tom Davey
2014-11-28 15:39         ` Drew Adams
2014-11-26 16:37 ` Ken Goldman
2014-11-27 21:02 ` Chris F.A. Johnson
2014-07-23 21:37 when you gotta have a variable value for a symbol name Buchs, Kevin J.
2014-07-23 22:02 ` Drew Adams
     [not found]   ` <(message>
     [not found]     ` <from>
     [not found]       ` <Barry>
     [not found]       ` <Robert>
     [not found]       ` <Drew>
     [not found]         ` <Adams>
     [not found]           ` <on>
     [not found]             ` <Sun>
     [not found]             ` <Tue>
     [not found]               ` <03>
     [not found]               ` <17>
     [not found]                 ` <May>
     [not found]                   ` <2016>
     [not found]                     ` <01:29:37>
     [not found]             ` <Sat>
     [not found]             ` <Mon>
     [not found]               ` <24>
     [not found]                 ` <Nov>
     [not found]                   ` <2020>
     [not found]                     ` <17:07:29>
     [not found]                       ` <-0800>
     [not found]               ` <29>
     [not found]             ` <Wed>
     [not found]               ` <23>
     [not found]                 ` <Jul>
     [not found]                   ` <2014>
     [not found]                     ` <17:40:42>
     [not found]                     ` <15:02:38>
     [not found]                       ` <-0700>
     [not found]               ` <14>
     [not found]                 ` <Jan>
     [not found]                   ` <2018>
     [not found]                     ` <04:04:52>
     [not found]                   ` <2015>
     [not found]                     ` <02:32:50>
     [not found]       ` <Raffaele>
     [not found]       ` <Emanuel>
     [not found]       ` <Marcin>
2014-07-24 21:57   ` Robert Thorpe
2014-07-25  0:06     ` Drew Adams
     [not found] ` <mailman.5936.1406152985.1147.help-gnu-emacs@gnu.org>
2014-07-23 22:12   ` Pascal J. Bourguignon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X5784jrSo42VFf7l@protected.rcdrun.com \
    --to=bugs@gnu.support \
    --cc=dimech@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).