From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: michael-franzese@gmx.com Newsgroups: gmane.emacs.help Subject: Re: Inserting some text in a working buffer Date: Sun, 9 May 2021 05:59:07 +0200 Message-ID: References: <87lf8pxfvy.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="26961"; 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 Sun May 09 05:59:42 2021 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 1lfabV-0006sF-8J for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 09 May 2021 05:59:41 +0200 Original-Received: from localhost ([::1]:35936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfabT-0001ex-Cv for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 08 May 2021 23:59:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfab2-0001en-Hk for help-gnu-emacs@gnu.org; Sat, 08 May 2021 23:59:12 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:52629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfab0-0000kZ-BU for help-gnu-emacs@gnu.org; Sat, 08 May 2021 23:59:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620532747; bh=MJVFfNzQd+YYb3geqFbyKaAGawhNY5GHyDcuQZKghIY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Zy05yCO4TVu9XlBonORUkNyAnWrkUuddB4tHut7NHOlb/E/iU23lixdfy1ejwezSp x6kCX61RacAKvRCqC7AYaAZ0zEC/B88/mJmJ3TQRSjtc/pfmcdIbAmHDkrVgqwa6vY HM+Dvnsq7UqzOmFqrC4WeELRHNpHdX5AyBq7ByZk= 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-bs07.server.lan [172.19.170.175]) (via HTTP); Sun, 9 May 2021 05:59:07 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <87lf8pxfvy.fsf@zoho.eu> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:HQ5g7bS8DKPGI+FSFLSemRG8M/+ki0cezAb5k6w/UHvxMUeLzUH9tfWjbW235EvnGRIm1 Z+zFTp84fVGbOjSO2h/fZYWP7TWUUc2LqBkJDV1fJUqFV7JUezRXoJQSZulpQlHYZM0OQxsaOz3T hwF/AjXMqW6/OkQoNxpQhY2fElFeZHT9cYk5f3hGnDb/Drm+T/h8aIou5Voaoyb88KOYrFxHvGCQ qqOpMkmrM9tnMPW9vy3jD9LllVt8BhyXpcTpU7aeAIArAAjDgyDPtf/V+eYIeCUxDg/ibFAGjJzz 9E= X-UI-Out-Filterresults: notjunk:1;V03:K0:zuArGnuArK0=:uorasbW1ddavPAtWtvtzLK wOUwK2sEw/+MQN9JUKfAaulYpzgkHD3RjABHu0XCha94jm3dTc/VIABcQvRDsARNlT99SMMTd nEHOqOSUkMacVXRc6Zo1HXA/gyqfzfN0zkzPxEeuQ3DHgNRNwDS+WYmxuCFd7hok+xNAPYuGC 4cZCrvYW+zX4iaQgZVJNxmpc1pBYF+Z40HGzHQKO48YBMB4bnyXCqNVwGJ9/GXYxAP3Wj4iib SiRLMwbyP7WHSsrOmNLutj1pDVnvdb7A5CAUohAAS6oj2PGZ49AxCK0EM3HQFMtLM9drKxNmn YXRnq6eWPKwJPPuEyN5D58FKSFMB/v1muoAU9B17T76s3SxEyDAmxN7ppnn+4+yINtGAD1z// WXSNz3wGuf3B0RrIXriRntBW3MjzO4zqcLqvXYS63sID4GRfAFwDLdPvgTNo8Ir+4iRnm2RiQ Ie0SBjh0NRN5l7hRdvB9cwWgxQ8zJPFJZyyEwmwXE4KseQvDlfwOnwmZjZkM6yFm+U1lYsVtO ft/4mcT8PxW+4zVK5L5J6FHVodjCcJFsUE1WCWUbpF3x0rntXOFzc2KD5hAXFcunkdQW/K12a 5vvY4vJEOCWDx1RjqKvend9vJPr9DSvaBhtqgeAoCiVeqgb7GWuOzOzKUMHWwd28Z4P3PgeC5 6GaebiPd31uhk6VbqNHElCdwGU3A8HG4rD0xvQqUylsXMJtjVzZ/oJ7VKMIzezSimKZlabXQS JuB0fvnOHOwnpKh9uOgf1qdeQyfiIjtsmCU1ceEcWzS9dMMfwOb+HDrfFHC7aKG1igxYfJ7q Received-SPF: pass client-ip=212.227.15.18; envelope-from=michael-franzese@gmx.com; helo=mout.gmx.net 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:129595 Archived-At: Thank you Emanuel, glad you found the post amusing. Apart further into giggles, I would like to insert the text starting from= the current point to column position 62. But with the following code, the text is bei= ng inserted before (point) rather than at (point). (defun text-insert (text) "Inserts text starting at cursor point." (interactive) (message "[text-insert] p %d" (point)) (insert text) (forward-line) ) (defun bifurc () "Insert text at point" (interactive) (message "(line-beginning-position) (point) %d %d" (line-beginning-position) (point)) (setq-local d (- (point) (line-beginning-position))) (setq-local n (- 63 d)) (setq-local m (- 69 d)) (message "[bifurc] (m,n) %d %d %d" m n d) (setq-local s (make-string n ?\;)) (text-insert s) ) > Sent: Sunday, May 09, 2021 at 6:02 AM > From: "Emanuel Berg via Users list for the GNU Emacs text editor" > To: help-gnu-emacs@gnu.org > Subject: Re: Inserting some text in a working buffer > > michael-franzese wrote: > > > (defun insert-text (text) > > "Inserts text frem beginning of line located at cursor point." > > (interactive) > > (with-current-buffer (buffer-name) > > (goto-char (point)) > > (insert text) > > (next-line)) ) > > Hahaha :) > > "(with-current-buffer (buffer-name)" - you are already in that > buffer... > > and "(goto-char (point))" - you are already there! > > "(next-line)" - see the help, one should use `forward-line'... > > There is nothing in the code to do it "frem" beginning of line > but you can use `beginning-of-line' for that... > > -- > underground experts united > https://dataswamp.org/~incal > > >