help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Storing of a buffer line number to a file


From: Alexandre S Iline
Subject: Re: Storing of a buffer line number to a file
Date: Mon, 24 Mar 2003 20:51:54 GMT
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830

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 <shurymury@yandex.ru> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]