🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #100019

Two bugs (?) related to revert-buffer function

#100019
From: Shinichirou Sugou
Date: Thu, 08 Mar 1990 09:45
65 lines
2650 bytes
Dear sirs:

Emacs version is 18.55 running on Sun3/60 with SunOS-3.5.

(1) revert-buffer function seems to try to keep the value of buffer's
    buffer-read-only variable.  Following program, which is about the middle
    part of revert-buffer program, reveals it.

       ....
       ....
       (let ((buffer-read-only nil))    <-- look here
         ;; Bind buffer-file-name to nil
         ....
         ....

    But, after-find-file function, which revert-buffer calls as the last
    step, forces to set buffer-read-only variable ignoring its current value.
    Following is the header part of after-find-file program.

       (setq buffer-read-only (not (file-writable-p buffer-file-name)))


    This fact sometimes causes the situation to which the user doesn't intend.

    For example, after opening some file in read-mode, that is, opening the
    file with ^X-^r (find-file-read-only) command, invoking revert-buffer
    function changes this buffer to non-read-mode.

(2) Invoking the following tiny function shows something strange.


       (defun wn-revert-buffer (buf &optional no-autosave-offer-p noconfirm)
         (save-excursion
           (set-buffer buf)
           (revert-buffer no-autosave-offer-p noconfirm)))


    First, visit some file with ^X-^f (find-file) command, and move the cursor
    to the end of the buffer.

    Then, invoke

        (wn-revert-buffer (current-buffer))

    and you will see the cursor moving to the beginning of the buffer.

    revert-buffer function is designed to keep the cursor position as much as
    (as far as?  English is difficult :-)) possible.  Why does the cursor
    move?

Thanks.





CAUTION: (1) Reply-command in the mail system may NOT generate my address
             correctly.  Please use the following address instead.

               shin%sgtp.apple.juice.or.jp@uunet.uu.net

         (2) I have no relation to Apple Computer Inc. :-)

---
S.Sugou
Technical Details
Message-ID: <9003080945.AA23203@sgtp.apple.juice.or.jp>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!sunic!uupsi!rpi!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!sgtp.apple.juice.or.jp!shin

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,35e11bd06a6d60e3,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-03-08 01:45:07 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!sunic!uupsi!rpi!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!sgtp.apple.juice.or.jp!shin
From: shin@sgtp.apple.juice.or.jp (Shinichirou Sugou)
Newsgroups: gnu.emacs.bug
Subject: Two bugs (?) related to revert-buffer function
Message-ID: <9003080945.AA23203@sgtp.apple.juice.or.jp>
Date: 8 Mar 90 09:45:07 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 65
Posted: Thu Mar  8 10:45:07 1990