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: Transpose Sentences but stay at point Date: Fri, 30 Oct 2020 00:26:51 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6341"; mail-complaints-to="usenet@ciao.gmane.io" To: Help Gnu Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 30 00:28:39 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 1kYHLS-0001YE-D1 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 30 Oct 2020 00:28:38 +0100 Original-Received: from localhost ([::1]:50970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYHLR-0002dV-8x for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 29 Oct 2020 19:28:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYHJo-0002dM-QK for help-gnu-emacs@gnu.org; Thu, 29 Oct 2020 19:26:56 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:60211) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYHJm-0000Gb-Nb for help-gnu-emacs@gnu.org; Thu, 29 Oct 2020 19:26:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1604014011; bh=TK2IakueG/EbPU4jdmv3Lwz/SyyDyaoCMZdYRrSi+iw=; h=X-UI-Sender-Class:From:To:Subject:Date; b=Url6r3e+M28kqgAKgOGcC/aNvdfIw6cOtxAqZ8ihODw38GHcWKvjbhgikheml3LJb 0nUyqjyLDJ7jKJi5szNPvx5Ks5fAbMkVHqxL07UsJ/MsLk7bBK+xzvIpJBmQocPOhQ gDrainO2g87j7dKrH0M9vv33IyAoD5TdPF2iThS8= 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-bs12.server.lan [172.19.170.180]) (via HTTP); Fri, 30 Oct 2020 00:26:51 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:l/jK+dJuMhJkLNgjGSYdfk7lLgJMLF5hMI9J2ee+Hs55ResH0eB6GozTcE+aDqF0ylxOZ t6BQxw5EL0sN92Trm0+rtlKCrWDmL5cJHn9/Iwf8anXo2zcCkxyQ3KNZxw2UaUXSA+Or11qrf7RN fANU966oOUSjp2r7wq9MDStlFPm+kpUnqssRR99mvopyBbU7Hs7l6IwEAJ1KUJtBENl+nuDh6aQp ny77pU8xZZJuxCxmN7R1tD3AdMDYCjyuVcdmzdzruZAnEuxBOONRUV50Rt+l2LbLJhrzvEqT9Yuf dw= X-UI-Out-Filterresults: notjunk:1;V03:K0:4LqBX7A79X8=:68Rx7STTv5bBBbnrudzTzF VHwSnr1gkSmh65DJAvlyPP6G8MjBhX/LCO0U76/nE8Srs7u5ixSMMqi3WGifDKGbv8VKIqBQM lbRa8TfXGu4DqgdabfrI2o3lguhfxVO0giMvGvB0637noUBZIKhKS+OBmFMbfg9nGhXOoVYq7 J41DHFL+sHNbHvCoWS/4ZjHjCUUR1KtJv2zzx7oHZiNS83QHZVHhE1gJZp4pIz9I0cNFEHzsK HNG7k3H2gvyxVMpoCYDUnsVXl4VdnrkNHboSbQ61avkArJJ1HWeWjPjU3wbbdfl5IVE5mPj03 39/h645L0yUDvtbuF4tgj6Tl+9vcSBsqaxiCLnK/222sJpvwVvVkn8rhw5IEYdeNUkCdUQKa3 YMGdoT56sC7o5BdEWnxIzH5j5ixdqzV/h/Xj/W5qYpDvfEdSbXOr1+0Q8tu55o7wYvnTK7qve 8fpXjlOQH7LXns/HBOe2fyGB1rhicbrKbZeUTzle2tDtnexFoXJQ+KkaC2AVyTGKxCctn4jY9 YIiCiyzcdCS2zg2L6qH5sPqrLlTK4mnyKIO9tyTt8agkQ9KtRVC2c98NKhh8JzGxak+kOLhDs RNklV9fZvsIEs= Received-SPF: pass client-ip=212.227.17.21; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/29 17:34:28 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:124799 Archived-At: 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)) -------------) --------) ----) )