* Transpose Sentences but stay at point
@ 2020-10-29 23:26 Christopher Dimech
0 siblings, 0 replies; only message in thread
From: Christopher Dimech @ 2020-10-29 23:26 UTC (permalink / raw)
To: Help Gnu Emacs
Dear Compeers,
I am writing a function to Transpose Sentences but keep at same point
in the sentence, rather than going to the end or the beginning after
the transpose is completed.
Have put the following code:
(defun transpose-stc--impl (arg)
---(let ((bounds (bounds-of-thing-at-point 'sentence)))
------(when bounds
----------(let*
-------------( (pt-init (point))
---------------(pt-end-of-stc (cdr bounds))
---------------(pt-offset (- pt-init pt-end-of-stc))
---------------(pt-transpose
------------------(save-excursion
---------------------;; Without this, the first character will move the previous word.
---------------------(goto-char pt-end-of-stc)
---------------------(if
------------------------;;
------------------------(condition-case err
---------------------------(progn ; No error
------------------------------(transpose-sentences arg)
------------------------------t
---------------------------)
---------------------------(message err)
-------------------------)
-------------------------;;
-------------------------(+ (point) pt-offset)
-------------------------;;
-------------------------nil
---------------------)
------------------)
---------------)
-------------)
-------------(when pt-transpose
----------------(goto-char pt-transpose))
-------------)
--------)
----)
)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-29 23:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-29 23:26 Transpose Sentences but stay at point Christopher Dimech
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.