From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alexandre S Iline Newsgroups: gmane.emacs.help Subject: Re: Storing of a buffer line number to a file Date: Mon, 24 Mar 2003 20:51:54 GMT Organization: AT&T Broadband Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <3E7F7210.50107@yandex.ru> References: <3E7F6389.9080607@yandex.ru> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1048539400 14494 80.91.224.249 (24 Mar 2003 20:56:40 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 24 Mar 2003 20:56:40 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 24 21:56:36 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18xYzj-0003lB-00 for ; Mon, 24 Mar 2003 21:56:36 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18xYyU-0008QK-02 for gnu-help-gnu-emacs@m.gmane.org; Mon, 24 Mar 2003 15:55:18 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830 X-Accept-Language: en-us, en Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-NNTP-Posting-Host: 12.234.103.210 Original-X-Complaints-To: abuse@attbi.com Original-X-Trace: rwcrnsc53 1048539114 12.234.103.210 (Mon, 24 Mar 2003 20:51:54 GMT) Original-NNTP-Posting-Date: Mon, 24 Mar 2003 20:51:54 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:111354 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:7856 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7856 Thank you very much - it helps a lot. Now I'm able to create the function I need: (defun my-what-line () (interactive) (let (buff line) (setq line (int-to-string (count-lines (point-min) (point)))) (kill-buffer (get-buffer-create "linenum")) (find-file "/tmp/linenum"); (delete-region (point-min) (point-max)) (insert line) (insert "\n") (save-buffer) (kill-buffer (get-buffer-create "linenum")))) It does exactly what I need. But, I'm still wondering: is there any simplier way to write something to file? Thanks. Shura. Bastien Guerry wrote: > Alexandre S Iline hat geschrieben: > > >>I'm trying to create a list function which would simply >>output a number of a currently selected line in the selected buffer. > > > (insert (int-to-string (count-lines (point-min) (point)))) > > ... will insert the current line number in your buffer just after the > point location. Maybe you will be also interested by the `what-line' > command. >