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: Emacs Function to add dashes to leading spaces in a Selected Region Date: Fri, 30 Oct 2020 04:17:37 +0100 Message-ID: References: <87d010saly.fsf@zoho.eu> 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="3399"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: moasenwood@zoho.eu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 30 04:19:28 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 1kYKwp-0000mZ-Na for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 30 Oct 2020 04:19:27 +0100 Original-Received: from localhost ([::1]:38666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYKwo-0003ZA-Jo for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 29 Oct 2020 23:19:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYKv9-0003Z4-4i for help-gnu-emacs@gnu.org; Thu, 29 Oct 2020 23:17:43 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:44517) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYKv6-0005qg-Tn for help-gnu-emacs@gnu.org; Thu, 29 Oct 2020 23:17:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1604027858; bh=AirZ+mluaLEcFvNGB5itwZI3XFiB3oa0sYetEflFdKk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Ge0lmM3B0DAajOEO0NT853VzOEOi8C6W72dn7CagMBN0nGZSjZWob+LvFba17f6Ik q4aLUzpeKwG4ifgLj41nn8CqwhTDbVdN4H2PCvArA3uOJiIgAn/oHqrqZq7xg3fppe /ddZEdvNsJWEzj4wbljDmti2OGn30QKkRM8ZyKl4= 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 04:17:37 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <87d010saly.fsf@zoho.eu> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:ilUeLy3POsTU5BjHWlGRr7yEn0upY456ElfFXT7mXz7NOs3vM6yXa3Z4ASws9mIO72Y0W YX8q7fRBeDjsa7TUqL1AatAsyauUgecT67KL5LOsx4ZXYjnaMZbyror0/nThug2/jYp4ydaRw9Uc 5tJZfSHe8XK85IaVXpv+wzfWVBNYuTjl9r5x8CE1jK94gH706K1CIYUgaSxI6bnfuiWNYSbAg/rD 673UJMO7qAVlTlwRtHFPbZAfKtKooWZxYeg8zhw6EYrZ/B2XWwiumYqCnfk9Acrz4xHUVdh8N24K EU= X-UI-Out-Filterresults: notjunk:1;V03:K0:TdXPNza5v/Q=:b/oTePQlwTA/GNltzrASHX D2uW3N2m7XTAeSk6AofY0BQ/QUYraDrvS+xvl2SifnoK/au++eHaqQxNLk2iTNDtgEgIT1oBN EA9yxSBkw3W/qQCR205O+6XsvZsAIAT7MS6BEroROow5eFuVlvYm0Og5U/fTorr2whxqnEuMK XqrU9QKo+9ghuxKqA4XsQo9xXbvZDGD5g7nUGjBnT6v2/17dFVFGMCevf8m5yrCCduIWwpJrg l1DfiannfhRPjzWD3iOljYJhuxfjJUjDNTqGPXoC2rTaCiZ7fztmBimYTcv8LafoZ5DkUZz8N tX5S9Cv7XjqTybFnQuNOFhLmaNtRjT00l+PwFWRRRt+cjTKpcTFb+UqBga2tstWhdre445RMW Rk/kx+XQ9Xx2KSGw+We2EDBkBYiXuPO8tUFFJOjUT4O2fiwyomXMjHISKKQEZfvVraFeT5sMf WJJ5wphqyHBeHMuxnOxm+/xhq63QzApmxbzOZRbYcHytalICSkONi4bTzVi9s7A3FN6D/1sHo kjyCLyaxz30ZEMpHaFcZpz7rkf/MeZn0g39V9krXFVP4gypk4ikMHVUwdKt2LhnhciVKN7v8v 4K4R9ay+bcwco= Received-SPF: pass client-ip=212.227.15.19; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/29 23:17:39 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:124804 Archived-At: I figured that I can use exactly the same function for transposing words, to transpose sentences. But currently I am just copying the code and replacing (transpose-words arg) with (transpose-sentences arg) I need assistance so that I could have just one function that can do both = things. (defun transpose-words--impl (arg) =2D--(let ((Wrd-Bounds (bounds-of-thing-at-point 'word))) =2D-----;; ---------------------------------------------------------------= - =2D-----(when Wrd-Bounds =2D--------(let* =2D-----------( (Beg (point)) =2D-------------(End (cdr Wrd-Bounds)) =2D-------------(Shift (- Beg End)) =2D-------------;; -------------------------------------------------------= - =2D-------------(Cursor-Psn =2D----------------(save-excursion =2D-------------------(goto-char End) ; [#A] =2D-------------------(if =2D----------------------;; =2D----------------------(condition-case err =2D-------------------------(progn ; No error =2D---------------------------(transpose-words arg) =2D---------------------------t =2D-------------------------) =2D-------------------------(message err) =2D----------------------) =2D----------------------;; =2D----------------------(+ (point) Shift) =2D----------------------;; =2D----------------------nil =2D-------------------) =2D----------------) =2D-------------) =2D-------------;; -------------------------------------------------------= - =2D-----------) =2D-----------(when Cursor-Psn =2D--------------(goto-char Cursor-Psn) =2D-----------) =2D--------) =2D-----) =2D-----;;----------------------------------------------------------------= - =2D--) ; let bounds (start and end locations of word) ) (defun transpose-wrd-forward () (interactive) (transpose-words--impl 1) ) (defun transpose-wrd-backward () (interactive) (transpose-words--impl -1) ) (global-set-key (kbd "M-H-") #'transpose-stc-forward) (global-set-key (kbd "M-H-") #'transpose-stc-backward) > Sent: Friday, October 30, 2020 at 3:36 AM > From: "Emanuel Berg via Users list for the GNU Emacs text editor" > To: help-gnu-emacs@gnu.org > Subject: Re: Emacs Function to add dashes to leading spaces in a Selecte= d Region > > Christopher Dimech wrote: > > > I need an Emacs Function to add dashes to leading spaces in > > a Selected Region. Require help to do this thing. > > Reading your post, "Transpose Sentences but stay at point", it would > be helpful if your function could also have a REVERSE option. Good point > > -- > underground experts united > http://user.it.uu.se/~embe8573 > https://dataswamp.org/~incal > > >