all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* why read only buffer?
@ 2012-07-06 19:04 notbob
  2012-07-06 19:44 ` Alp Aker
       [not found] ` <mailman.4213.1341603883.855.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: notbob @ 2012-07-06 19:04 UTC (permalink / raw)
  To: help-gnu-emacs

Jes tried to edit a file from emacs dired w/ edit cmd (e).  I get this
error:

Buffer is read-only: #<buffer .slrn.sig~>

As you can see, it's a backup file.  So?  I can edit the regular file,
but not the backup (~) file.  Identical permissions.  WTF!?

nb

-- 
vi --the heart of evil!
"The Constitution is not an instrument for the government to restrain
the people, it is an instrument for the people to restrain the
government." -- Patrick Henry



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why read only buffer?
  2012-07-06 19:04 why read only buffer? notbob
@ 2012-07-06 19:44 ` Alp Aker
  2012-07-06 20:58   ` PJ Weisberg
       [not found]   ` <mailman.4218.1341608337.855.help-gnu-emacs@gnu.org>
       [not found] ` <mailman.4213.1341603883.855.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 6+ messages in thread
From: Alp Aker @ 2012-07-06 19:44 UTC (permalink / raw)
  Cc: help-gnu-emacs

On Fri, Jul 6, 2012 at 3:04 PM, notbob <notbob@nothome.com> wrote:
> As you can see, it's a backup file.  So?  I can edit the regular file,
> but not the backup (~) file.  Identical permissions.  WTF!?

Use the command 'toggle-read-only' (default binding C-x C-q) if you
want to edit a backup file.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why read only buffer?
  2012-07-06 19:44 ` Alp Aker
@ 2012-07-06 20:58   ` PJ Weisberg
       [not found]   ` <mailman.4218.1341608337.855.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: PJ Weisberg @ 2012-07-06 20:58 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Jul 6, 2012 at 12:44 PM, Alp Aker <alptekin.aker@gmail.com> wrote:
> On Fri, Jul 6, 2012 at 3:04 PM, notbob <notbob@nothome.com> wrote:
>> As you can see, it's a backup file.  So?  I can edit the regular file,
>> but not the backup (~) file.  Identical permissions.  WTF!?
>
> Use the command 'toggle-read-only' (default binding C-x C-q) if you
> want to edit a backup file.

That's deliberately there to stop you from accidentally modifying a
backup file when you meant to be working with the regular file.  If
you searched through the source you'd find this in files.el:

-----
  ;; Make people do a little extra work (C-x C-q)
  ;; before altering a backup file.
  (when (backup-file-name-p buffer-file-name)
    (setq buffer-read-only t))
-----

-PJ

Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why read only buffer?
       [not found] ` <mailman.4213.1341603883.855.help-gnu-emacs@gnu.org>
@ 2012-07-06 21:02   ` notbob
  0 siblings, 0 replies; 6+ messages in thread
From: notbob @ 2012-07-06 21:02 UTC (permalink / raw)
  To: help-gnu-emacs

On 2012-07-06, Alp Aker <alptekin.aker@gmail.com> wrote:
> On Fri, Jul 6, 2012 at 3:04 PM, notbob <notbob@nothome.com> wrote:
>> As you can see, it's a backup file.  So?  I can edit the regular file,
>> but not the backup (~) file.  Identical permissions.  WTF!?
>
> Use the command 'toggle-read-only' (default binding C-x C-q) if you
> want to edit a backup file.

Well, I'll be dbl dogged damned!  I did not know that.  ;)

You helped me fill my daily quota for learning one thing new about
emacs.  Thank you, Alp.  

nb

-- 
vi --the heart of evil!




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why read only buffer?
       [not found]   ` <mailman.4218.1341608337.855.help-gnu-emacs@gnu.org>
@ 2012-07-06 21:50     ` notbob
  2012-07-06 22:40       ` Barry Margolin
  0 siblings, 1 reply; 6+ messages in thread
From: notbob @ 2012-07-06 21:50 UTC (permalink / raw)
  To: help-gnu-emacs

On 2012-07-06, PJ Weisberg <pj@irregularexpressions.net> wrote:

> That's deliberately there to stop you from accidentally modifying a
> backup file when you meant to be working with the regular file.  If
> you searched through the source you'd find this in files.el:

Yeah, that's not gonna happen.  ;)

What I seem to recall is, backup files were progressively renamed for
more than on "back-up", as in foo~1, foo~2, or something similar.
Perhaps I'm thinking of jed.  I'm old.  I ferget.  ;)

>
> -----
>   ;; Make people do a little extra work (C-x C-q)
>   ;; before altering a backup file.
>   (when (backup-file-name-p buffer-file-name)
>     (setq buffer-read-only t))
> -----

So, how does none set it to make it overwriteable, by default.  Jes
delete the above code?

nb


-- 
vi --the heart of evil!




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why read only buffer?
  2012-07-06 21:50     ` notbob
@ 2012-07-06 22:40       ` Barry Margolin
  0 siblings, 0 replies; 6+ messages in thread
From: Barry Margolin @ 2012-07-06 22:40 UTC (permalink / raw)
  To: help-gnu-emacs

In article <slrnjvenia.3be.notbob@nbleet.hcc.net>,
 notbob <notbob@nothome.com> wrote:

> On 2012-07-06, PJ Weisberg <pj@irregularexpressions.net> wrote:
> 
> > That's deliberately there to stop you from accidentally modifying a
> > backup file when you meant to be working with the regular file.  If
> > you searched through the source you'd find this in files.el:
> 
> Yeah, that's not gonna happen.  ;)
> 
> What I seem to recall is, backup files were progressively renamed for
> more than on "back-up", as in foo~1, foo~2, or something similar.
> Perhaps I'm thinking of jed.  I'm old.  I ferget.  ;)

foo.~1~, foo.~2~, etc.

> 
> >
> > -----
> >   ;; Make people do a little extra work (C-x C-q)
> >   ;; before altering a backup file.
> >   (when (backup-file-name-p buffer-file-name)
> >     (setq buffer-read-only t))
> > -----
> 
> So, how does none set it to make it overwriteable, by default.  Jes
> delete the above code?

A better way would be to add your own code to undo it to find-file-hook.  
The hooks are run at the end of this function.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-07-06 22:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-06 19:04 why read only buffer? notbob
2012-07-06 19:44 ` Alp Aker
2012-07-06 20:58   ` PJ Weisberg
     [not found]   ` <mailman.4218.1341608337.855.help-gnu-emacs@gnu.org>
2012-07-06 21:50     ` notbob
2012-07-06 22:40       ` Barry Margolin
     [not found] ` <mailman.4213.1341603883.855.help-gnu-emacs@gnu.org>
2012-07-06 21:02   ` notbob

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.