unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs and Read-Only Files
@ 2006-10-18 18:03 Mark Elston
  2006-10-18 18:11 ` Mark Elston
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Elston @ 2006-10-18 18:03 UTC (permalink / raw)


I have GNU Emacs 23.0.0.1 and GNU Emacs 22.0.50.1 compiled for
Windows.  Both versions behave strangely when loading files
that are Read-Only.

In both cases the file gets loaded, I get a message saying
'Mark Set' but the window doesn't switch to the newly loaded
file.  This doesn't happen when I load a file with write permission.

Unfortunately (or fortunately), when I start up emacs with
--no-init this behavior doesn't occur.

I have a rather extensive .emacs file and would *really* hate to
go through the cycle of commenting out blocks and re-starting
necessary to track this down.

So, does anyone have any ideas what could be happening?  Obviously,
something I have loaded is interfering with the loading of these
read-only files, but I don't have a clue what it could be.

Mark

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

* Re: Emacs and Read-Only Files
  2006-10-18 18:03 Emacs and Read-Only Files Mark Elston
@ 2006-10-18 18:11 ` Mark Elston
  2006-10-18 18:47   ` Mark Elston
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Elston @ 2006-10-18 18:11 UTC (permalink / raw)


One other thing I noticed - when I look at the *Messages*
buffer I get the following messages:

   Note: file is write protected
   Loading semantic-c...done
   byte-code: Buffer is read-only: #<buffer abc.cpp>
   Loading semantic-edit...done
   Loading semanticdb-file...done
   Mark set

However, I commented out the loading of the cedet code (and the
ecb that requires it) and I still get the same issue.

Mark

* Mark Elston wrote (on 10/18/2006 11:03 AM):
> I have GNU Emacs 23.0.0.1 and GNU Emacs 22.0.50.1 compiled for
> Windows.  Both versions behave strangely when loading files
> that are Read-Only.
> 
> In both cases the file gets loaded, I get a message saying
> 'Mark Set' but the window doesn't switch to the newly loaded
> file.  This doesn't happen when I load a file with write permission.
> 
> Unfortunately (or fortunately), when I start up emacs with
> --no-init this behavior doesn't occur.
> 
> I have a rather extensive .emacs file and would *really* hate to
> go through the cycle of commenting out blocks and re-starting
> necessary to track this down.
> 
> So, does anyone have any ideas what could be happening?  Obviously,
> something I have loaded is interfering with the loading of these
> read-only files, but I don't have a clue what it could be.
> 
> Mark

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

* Re: Emacs and Read-Only Files
  2006-10-18 18:11 ` Mark Elston
@ 2006-10-18 18:47   ` Mark Elston
  2006-10-19  4:10     ` Barry Margolin
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Elston @ 2006-10-18 18:47 UTC (permalink / raw)


OK.  I bit the bullet and did a little debugging.

I have the following in my .emacs file that seems to be causing
the problem.  This worked in GNU Emacs 21 but seems to cause a problem
in version 22.

(defun my-c-mode-hook ()
   (setq c-file-style "local")
   (setq tab-width 4
	;; this ought to make sure spaces are used instead of tabs
	indent-tabs-mode nil)
   ;; we like auto-newline and hungry-delete
   (c-toggle-auto-hungry-state 1)
   (define-key c-mode-base-map "\C-m" 'newline-and-indent)
   (c-set-offset 'substatement-open 0)
   )
(add-hook 'c-mode-common-hook 'my-c-mode-hook)

Any idea why this is causing a problem in 22 and 23?

Mark

* Mark Elston wrote (on 10/18/2006 11:11 AM):
> One other thing I noticed - when I look at the *Messages*
> buffer I get the following messages:
> 
>   Note: file is write protected
>   Loading semantic-c...done
>   byte-code: Buffer is read-only: #<buffer abc.cpp>
>   Loading semantic-edit...done
>   Loading semanticdb-file...done
>   Mark set
> 
> However, I commented out the loading of the cedet code (and the
> ecb that requires it) and I still get the same issue.
> 
> Mark
> 
> * Mark Elston wrote (on 10/18/2006 11:03 AM):
>> I have GNU Emacs 23.0.0.1 and GNU Emacs 22.0.50.1 compiled for
>> Windows.  Both versions behave strangely when loading files
>> that are Read-Only.
>>
>> In both cases the file gets loaded, I get a message saying
>> 'Mark Set' but the window doesn't switch to the newly loaded
>> file.  This doesn't happen when I load a file with write permission.
>>
>> Unfortunately (or fortunately), when I start up emacs with
>> --no-init this behavior doesn't occur.
>>
>> I have a rather extensive .emacs file and would *really* hate to
>> go through the cycle of commenting out blocks and re-starting
>> necessary to track this down.
>>
>> So, does anyone have any ideas what could be happening?  Obviously,
>> something I have loaded is interfering with the loading of these
>> read-only files, but I don't have a clue what it could be.
>>
>> Mark

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

* Re: Emacs and Read-Only Files
  2006-10-18 18:47   ` Mark Elston
@ 2006-10-19  4:10     ` Barry Margolin
  2006-10-19 17:37       ` Mark Elston
  0 siblings, 1 reply; 5+ messages in thread
From: Barry Margolin @ 2006-10-19  4:10 UTC (permalink / raw)


In article <453676C1.8020307@advantest-ard.com>,
 Mark Elston <m.elston@advantest-ard.com> wrote:

> OK.  I bit the bullet and did a little debugging.
> 
> I have the following in my .emacs file that seems to be causing
> the problem.  This worked in GNU Emacs 21 but seems to cause a problem
> in version 22.
> 
> (defun my-c-mode-hook ()
>    (setq c-file-style "local")
>    (setq tab-width 4
> 	;; this ought to make sure spaces are used instead of tabs
> 	indent-tabs-mode nil)
>    ;; we like auto-newline and hungry-delete
>    (c-toggle-auto-hungry-state 1)
>    (define-key c-mode-base-map "\C-m" 'newline-and-indent)
>    (c-set-offset 'substatement-open 0)
>    )
> (add-hook 'c-mode-common-hook 'my-c-mode-hook)
> 
> Any idea why this is causing a problem in 22 and 23?

I'm not sure how that could be the problem.  Nothing up there tries to 
modify the buffer.

The *Messages* messages indicate that the error is occurring when 
semantic-c is loaded.  I suggest you set debug-on-error to t, so you'll 
get a stack trace when the read-only error occurs.  Then post the stack 
trace here.

> 
> Mark
> 
> * Mark Elston wrote (on 10/18/2006 11:11 AM):
> > One other thing I noticed - when I look at the *Messages*
> > buffer I get the following messages:
> > 
> >   Note: file is write protected
> >   Loading semantic-c...done
> >   byte-code: Buffer is read-only: #<buffer abc.cpp>
> >   Loading semantic-edit...done
> >   Loading semanticdb-file...done
> >   Mark set
> > 
> > However, I commented out the loading of the cedet code (and the
> > ecb that requires it) and I still get the same issue.
> > 
> > Mark
> > 
> > * Mark Elston wrote (on 10/18/2006 11:03 AM):
> >> I have GNU Emacs 23.0.0.1 and GNU Emacs 22.0.50.1 compiled for
> >> Windows.  Both versions behave strangely when loading files
> >> that are Read-Only.
> >>
> >> In both cases the file gets loaded, I get a message saying
> >> 'Mark Set' but the window doesn't switch to the newly loaded
> >> file.  This doesn't happen when I load a file with write permission.
> >>
> >> Unfortunately (or fortunately), when I start up emacs with
> >> --no-init this behavior doesn't occur.
> >>
> >> I have a rather extensive .emacs file and would *really* hate to
> >> go through the cycle of commenting out blocks and re-starting
> >> necessary to track this down.
> >>
> >> So, does anyone have any ideas what could be happening?  Obviously,
> >> something I have loaded is interfering with the loading of these
> >> read-only files, but I don't have a clue what it could be.
> >>
> >> Mark

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

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

* Re: Emacs and Read-Only Files
  2006-10-19  4:10     ` Barry Margolin
@ 2006-10-19 17:37       ` Mark Elston
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Elston @ 2006-10-19 17:37 UTC (permalink / raw)


Well, here is what I have discovered.

In Emacs 21 I used, in my c-mode-common-hook, a call to

   (setq c-file-style "local")

to set the style for editing C/C++ files.  This worked just fine
in version 21, even for read-only files.

Apparently, in versions 22 and 23 this is a problem, though
the variable still exists.  I have now replaced the (setq ...)
call with

   (c-set-style "local")

and I no longer see the behavior I mentioned.

In the end that is the only change I made to my .emacs file and
all is well.

If anyone can tell me why this makes such a difference I would
be a happy camper.

Mark

* Barry Margolin wrote (on 10/18/2006 9:10 PM):
> In article <453676C1.8020307@advantest-ard.com>,
>  Mark Elston <m.elston@advantest-ard.com> wrote:
> 
>> OK.  I bit the bullet and did a little debugging.
>>
>> I have the following in my .emacs file that seems to be causing
>> the problem.  This worked in GNU Emacs 21 but seems to cause a problem
>> in version 22.
>>
>> (defun my-c-mode-hook ()
>>    (setq c-file-style "local")
>>    (setq tab-width 4
>> 	;; this ought to make sure spaces are used instead of tabs
>> 	indent-tabs-mode nil)
>>    ;; we like auto-newline and hungry-delete
>>    (c-toggle-auto-hungry-state 1)
>>    (define-key c-mode-base-map "\C-m" 'newline-and-indent)
>>    (c-set-offset 'substatement-open 0)
>>    )
>> (add-hook 'c-mode-common-hook 'my-c-mode-hook)
>>
>> Any idea why this is causing a problem in 22 and 23?
> 
> I'm not sure how that could be the problem.  Nothing up there tries to 
> modify the buffer.
> 
> The *Messages* messages indicate that the error is occurring when 
> semantic-c is loaded.  I suggest you set debug-on-error to t, so you'll 
> get a stack trace when the read-only error occurs.  Then post the stack 
> trace here.
> 
>> Mark
>>
>> * Mark Elston wrote (on 10/18/2006 11:11 AM):
>>> One other thing I noticed - when I look at the *Messages*
>>> buffer I get the following messages:
>>>
>>>   Note: file is write protected
>>>   Loading semantic-c...done
>>>   byte-code: Buffer is read-only: #<buffer abc.cpp>
>>>   Loading semantic-edit...done
>>>   Loading semanticdb-file...done
>>>   Mark set
>>>
>>> However, I commented out the loading of the cedet code (and the
>>> ecb that requires it) and I still get the same issue.
>>>
>>> Mark
>>>
>>> * Mark Elston wrote (on 10/18/2006 11:03 AM):
>>>> I have GNU Emacs 23.0.0.1 and GNU Emacs 22.0.50.1 compiled for
>>>> Windows.  Both versions behave strangely when loading files
>>>> that are Read-Only.
>>>>
>>>> In both cases the file gets loaded, I get a message saying
>>>> 'Mark Set' but the window doesn't switch to the newly loaded
>>>> file.  This doesn't happen when I load a file with write permission.
>>>>
>>>> Unfortunately (or fortunately), when I start up emacs with
>>>> --no-init this behavior doesn't occur.
>>>>
>>>> I have a rather extensive .emacs file and would *really* hate to
>>>> go through the cycle of commenting out blocks and re-starting
>>>> necessary to track this down.
>>>>
>>>> So, does anyone have any ideas what could be happening?  Obviously,
>>>> something I have loaded is interfering with the loading of these
>>>> read-only files, but I don't have a clue what it could be.
>>>>
>>>> Mark
> 

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

end of thread, other threads:[~2006-10-19 17:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-18 18:03 Emacs and Read-Only Files Mark Elston
2006-10-18 18:11 ` Mark Elston
2006-10-18 18:47   ` Mark Elston
2006-10-19  4:10     ` Barry Margolin
2006-10-19 17:37       ` Mark Elston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).