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

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

Re: How to change and save a read-only file?


From: Emanuel Berg
Subject: Re: How to change and save a read-only file?
Date: Sat, 29 Jun 2013 15:30:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

> (defun su-edit ()
>   "Edit the current buffer file as superuser -
> in a new buffer, that should look the same."
>   (interactive)
>   (let ((start-point-pos (point)))
>     (recenter-top-bottom 0)
>     (let ((top-window-pos (point))
>           (buffer (buffer-file-name)) )
>       (kill-buffer)
>       (find-file (format "/sudo::%s" buffer))
>       (goto-char top-window-pos)
>       (recenter-top-bottom 0)
>       (goto-char start-point-pos) )))

Aha, now I see, `recenter-top-bottom' doesn't change the point!
Silly. Still, even though with this realization I could fix it, I
leave it open to you foxes as you more than once have provided me
with standard solutions (for which I am grateful, because they
work better - and not without pride I add that last word :) )

-- 
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573


reply via email to

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