emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lispref/variables.texi


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/lispref/variables.texi
Date: Mon, 13 May 2002 15:04:52 -0400

Index: emacs/lispref/variables.texi
diff -c emacs/lispref/variables.texi:1.30 emacs/lispref/variables.texi:1.31
*** emacs/lispref/variables.texi:1.30   Tue Feb 12 14:33:46 2002
--- emacs/lispref/variables.texi        Mon May 13 15:04:27 2002
***************
*** 1185,1194 ****
  with @code{setq-default}.
  
    @strong{Warning:} When a variable has buffer-local values in one or
! more buffers, you can get Emacs very confused by binding the variable
! with @code{let}, changing to a different current buffer in which a
! different binding is in effect, and then exiting the @code{let}.  This
! can scramble the values of the buffer-local and default bindings.
  
    To preserve your sanity, avoid using a variable in that way.  If you
  use @code{save-excursion} around each piece of code that changes to a
--- 1185,1194 ----
  with @code{setq-default}.
  
    @strong{Warning:} When a variable has buffer-local values in one or
! more buffers, binding the variable with @code{let} and changing to a
! different current buffer in which a different binding is in
! effect, and then exiting the @code{let}, the variable may not be
! restored to the value it had before the @code{let}.
  
    To preserve your sanity, avoid using a variable in that way.  If you
  use @code{save-excursion} around each piece of code that changes to a
***************
*** 1197,1218 ****
  
  @example
  @group
! (setq foo 'b)
  (set-buffer "a")
  (make-local-variable 'foo)
  @end group
  (setq foo 'a)
  (let ((foo 'temp))
    (set-buffer "b")
    @address@hidden)
  @group
! foo @result{} 'a      ; @r{The old buffer-local value from buffer @samp{a}}
!                ;   @r{is now the default value.}
  @end group
  @group
! (set-buffer "a")
! foo @result{} 'temp   ; @r{The local @code{let} value that should be gone}
!                ;   @r{is now the buffer-local value in buffer @samp{a}.}
  @end group
  @end example
  
--- 1197,1219 ----
  
  @example
  @group
! (setq foo 'g)
  (set-buffer "a")
  (make-local-variable 'foo)
  @end group
  (setq foo 'a)
  (let ((foo 'temp))
+   ;; foo @result{} 'temp  ; @r{let binding in buffer @samp{a}}
    (set-buffer "b")
+   ;; foo @result{} 'g     ; @r{the global value since foo is not local in 
@samp{b}}
    @address@hidden)
  @group
! foo @result{} 'a        ; @r{we are still in buffer @samp{b}, but exiting the 
let}
!                  ; @r{restored the local value in buffer @samp{a}}
  @end group
  @group
! (set-buffer "a") ; @r{This can be seen here:}
! foo @result{} 'a        ; @r{we are back to the local value in buffer 
@samp{a}}
  @end group
  @end example
  



reply via email to

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