* emacs 20.7.1 forgets c-basic-offset after find-file
@ 2004-07-13 16:11 Kurumi
2004-07-13 16:53 ` Michael Slass
2004-07-13 16:56 ` martin
0 siblings, 2 replies; 4+ messages in thread
From: Kurumi @ 2004-07-13 16:11 UTC (permalink / raw)
I'm running emacs 20.7.1 in Redhat 7.1, Linux 2.4.2-2.
I have a modified .emacs file (included) to give me some key
bindings matching the other machines I work on. I also
have c-basic-offset set to 3.
What's annoying is that after I do a "find file" (aka
open a file), emacs resets c-basic-offset to 2. This
is immediately apparent whenever it auto-indents a
line of code. When I do Customize -> specific option
-> c-basic-offset, it is indeed at 2, and I have to
change it and save it.
In other words:
1. start emacs; c-basic-offset is at 3
2. open a file; c-b-o changes to 2. However, .emacs
still shows 3
3. re-edit the value in "customize"; c-b-o back at 3
4. open another file; c-b-o back to 2
As you can imagine, this is irritating. In a previous
installation of 7.1/20.7.1, I didn't have this
problem. Any ideas what's causing it?
My .emacs is shown below. Thanks!
Scott
---- contents of ~/.emacs ---------
;; Red Hat Linux default .emacs initialization file
;; Are we running XEmacs or Emacs?
(defvar running-xemacs (string-match "XEmacs\\|Lucid"
emacs-version))
;; Set up the keyboard so the delete key on both the
regular keyboard
;; and the keypad delete the character under the
cursor and to the right
;; under X, instead of the default, backspace
behavior.
(global-set-key [delete] 'delete-char)
(global-set-key [kp-delete] 'delete-char)
;; Turn on font-lock mode for Emacs
(cond ((not running-xemacs)
(global-font-lock-mode t)
))
;; Always end a file with a newline
(setq require-final-newline t)
;; Stop at the end of the file, not just add lines
(setq next-line-add-newlines nil)
(custom-set-variables
'(c-basic-offset 3)
'(pc-selection-mode t nil (pc-select)))
(custom-set-faces)
(global-set-key [(control s)] 'save-buffer)
(global-set-key [(control o)] 'find-file)
(global-set-key [(control g)] 'goto-line)
(global-set-key [(control i)] 'indent-region)
(global-set-key [(control f)] 'isearch-forward)
(global-set-key [(control b)] 'isearch-backward)
(global-set-key [(control z)] 'undo)
(global-set-key [(control w)] 'kill-this-buffer)
(global-set-key [(control q)]
'do-you-really-want-to-save-buffers-kill-emacs)
(global-set-key [(control end)] 'end-of-buffer)
(global-set-key [(control home)] 'beginning-of-buffer)
--
Kurumi http://www.kurumi.com/
3di's, Conn. Roads, maps, interchanges
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: emacs 20.7.1 forgets c-basic-offset after find-file
2004-07-13 16:11 emacs 20.7.1 forgets c-basic-offset after find-file Kurumi
@ 2004-07-13 16:53 ` Michael Slass
2004-07-14 5:45 ` Kurumi
2004-07-13 16:56 ` martin
1 sibling, 1 reply; 4+ messages in thread
From: Michael Slass @ 2004-07-13 16:53 UTC (permalink / raw)
Kurumi <sales@xupiter.com> writes:
>I'm running emacs 20.7.1 in Redhat 7.1, Linux 2.4.2-2.
>
>I have a modified .emacs file (included) to give me some key
>bindings matching the other machines I work on. I also
>have c-basic-offset set to 3.
>
>What's annoying is that after I do a "find file" (aka
>open a file), emacs resets c-basic-offset to 2. This
>is immediately apparent whenever it auto-indents a
>line of code. When I do Customize -> specific option
>-> c-basic-offset, it is indeed at 2, and I have to
>change it and save it.
c-mode is overwriting your setting when it loads, so you need to set
your basic offset in a mode-hook.
I don't know the customization interface (if any) to the c-mode hook,
but you can add this to your .emacs:
(defun kurimi-c-mode-setup ()
(setq c-basic-offset 3)
;; other c-mode customizations here
)
(add-hook 'c-mode-hook 'kurimi-c-mode-setup)
--
Mike Slass
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: emacs 20.7.1 forgets c-basic-offset after find-file
2004-07-13 16:11 emacs 20.7.1 forgets c-basic-offset after find-file Kurumi
2004-07-13 16:53 ` Michael Slass
@ 2004-07-13 16:56 ` martin
1 sibling, 0 replies; 4+ messages in thread
From: martin @ 2004-07-13 16:56 UTC (permalink / raw)
"K" == Kurumi <sales@xupiter.com> writes:
K> Date: Tue, 13 Jul 2004 16:11:16 GMT
K>
K> I'm running emacs 20.7.1 in Redhat 7.1, Linux 2.4.2-2.
K>
K> I have a modified .emacs file (included) to give me some key
K> bindings matching the other machines I work on. I also
K> have c-basic-offset set to 3.
K>
K> What's annoying is that after I do a "find file" (aka
K> open a file), emacs resets c-basic-offset to 2. This
K> is immediately apparent whenever it auto-indents a
K> line of code. When I do Customize -> specific option
-> c-basic-offset, it is indeed at 2, and I have to
K> change it and save it.
K>
K> In other words:
K> 1. start emacs; c-basic-offset is at 3
K> 2. open a file; c-b-o changes to 2. However, .emacs
K> still shows 3
K> 3. re-edit the value in "customize"; c-b-o back at 3
K> 4. open another file; c-b-o back to 2
hi,
as you open a new file in c-mode the variable c-basic-offset becomes
local in that buffer and receives its value from somwhere else than
your .emacs file. look at the documentation (C-h v c-basic-offset
RET).
martin
K>
K> As you can imagine, this is irritating. In a previous
K> installation of 7.1/20.7.1, I didn't have this
K> problem. Any ideas what's causing it?
K>
K> My .emacs is shown below. Thanks!
K>
K> Scott
K>
K>
K>
K>
K>
K> ---- contents of ~/.emacs ---------
K> ;; Red Hat Linux default .emacs initialization file
K>
K> ;; Are we running XEmacs or Emacs?
K> (defvar running-xemacs (string-match "XEmacs\\|Lucid"
K> emacs-version))
K>
K> ;; Set up the keyboard so the delete key on both the
K> regular keyboard
K> ;; and the keypad delete the character under the
K> cursor and to the right
K> ;; under X, instead of the default, backspace
K> behavior.
K> (global-set-key [delete] 'delete-char)
K> (global-set-key [kp-delete] 'delete-char)
K>
K> ;; Turn on font-lock mode for Emacs
K> (cond ((not running-xemacs)
K> (global-font-lock-mode t)
K> ))
K>
K> ;; Always end a file with a newline
K> (setq require-final-newline t)
K>
K> ;; Stop at the end of the file, not just add lines
K> (setq next-line-add-newlines nil)
K>
K> (custom-set-variables
K> '(c-basic-offset 3)
K> '(pc-selection-mode t nil (pc-select)))
K> (custom-set-faces)
K>
K> (global-set-key [(control s)] 'save-buffer)
K> (global-set-key [(control o)] 'find-file)
K> (global-set-key [(control g)] 'goto-line)
K> (global-set-key [(control i)] 'indent-region)
K> (global-set-key [(control f)] 'isearch-forward)
K> (global-set-key [(control b)] 'isearch-backward)
K> (global-set-key [(control z)] 'undo)
K> (global-set-key [(control w)] 'kill-this-buffer)
K> (global-set-key [(control q)]
K> 'do-you-really-want-to-save-buffers-kill-emacs)
K> (global-set-key [(control end)] 'end-of-buffer)
K> (global-set-key [(control home)] 'beginning-of-buffer)
K>
K> --
K> Kurumi http://www.kurumi.com/
K> 3di's, Conn. Roads, maps, interchanges
K>
--
martin dot fischer at boschrexroth dot de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: emacs 20.7.1 forgets c-basic-offset after find-file
2004-07-13 16:53 ` Michael Slass
@ 2004-07-14 5:45 ` Kurumi
0 siblings, 0 replies; 4+ messages in thread
From: Kurumi @ 2004-07-14 5:45 UTC (permalink / raw)
In article <m3wu17x306.fsf@eric.rossnet.com>, Michael Slass
<miknrene@drizzle.com> wrote:
> Kurumi <sales@xupiter.com> writes:
>
> >I'm running emacs 20.7.1 in Redhat 7.1, Linux 2.4.2-2.
> >
> >I have a modified .emacs file (included) to give me some key
> >bindings matching the other machines I work on. I also
> >have c-basic-offset set to 3.
> >
> >What's annoying is that after I do a "find file" (aka
> >open a file), emacs resets c-basic-offset to 2. This
> >is immediately apparent whenever it auto-indents a
> >line of code. When I do Customize -> specific option
> >-> c-basic-offset, it is indeed at 2, and I have to
> >change it and save it.
>
> c-mode is overwriting your setting when it loads, so you need to set
> your basic offset in a mode-hook.
>
> I don't know the customization interface (if any) to the c-mode hook,
> but you can add this to your .emacs:
>
> (defun kurimi-c-mode-setup ()
> (setq c-basic-offset 3)
> ;; other c-mode customizations here
> )
>
> (add-hook 'c-mode-hook 'kurimi-c-mode-setup)
Thanks, that worked. (For C++, I included an add-hook for
'c++-mode-hook.)
--
Kurumi http://www.kurumi.com/
3di's, Conn. Roads, maps, interchanges
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-07-14 5:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-13 16:11 emacs 20.7.1 forgets c-basic-offset after find-file Kurumi
2004-07-13 16:53 ` Michael Slass
2004-07-14 5:45 ` Kurumi
2004-07-13 16:56 ` martin
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).