emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch: Syntax and Hard Newlines


From: Herbert Euler
Subject: Re: Patch: Syntax and Hard Newlines
Date: Thu, 16 Nov 2006 20:37:09 +0800

> No, `kill-local-variable' only makes a variable no longer have a
> separate value in the current buffer.

That's what I meant.  For example, in cc-mode.el you have

    (when (boundp 'parse-sexp-lookup-properties)
      (make-local-variable 'parse-sexp-lookup-properties)
      (setq parse-sexp-lookup-properties t))

that is cc-mode makes a "separate value in the current buffer" and sets
that locally to t.  When you turn off longlines in that buffer you turn
that off for cc-mode too.  Or am I missing something?

No, `make-local-variable' makes a variable local to a buffer,
not to a mode:

(setq b1 (get-buffer-create "b1"))
==> #<buffer b1>
(setq b2 (get-buffer-create "b2"))
==> #<buffer b2>
(save-window-excursion (switch-to-buffer b1)
                      (c-mode)
                      major-mode)
==> c-mode
(save-window-excursion (switch-to-buffer b2)
                      (c-mode)
                      major-mode)
==> c-mode
parse-sexp-lookup-properties
==> nil
(save-window-excursion (switch-to-buffer b1)
                      parse-sexp-lookup-properties)
==> nil
(save-window-excursion (switch-to-buffer b2)
                      parse-sexp-lookup-properties)
==> nil
(save-window-excursion (switch-to-buffer b1)
                      (make-local-variable 'parse-sexp-lookup-properties)
                      (setq parse-sexp-lookup-properties t)
                      parse-sexp-lookup-properties)
==> t
(save-window-excursion (switch-to-buffer b2)
                      (make-local-variable 'parse-sexp-lookup-properties)
                      (setq parse-sexp-lookup-properties nil)
                      parse-sexp-lookup-properties)
==> nil
parse-sexp-lookup-properties
==> nil
(save-window-excursion (switch-to-buffer b1)
                      (kill-local-variable 'parse-sexp-lookup-properties)
                      parse-sexp-lookup-properties)
==> nil
(save-window-excursion (switch-to-buffer b2)
                      parse-sexp-lookup-properties)
==> nil
(save-window-excursion (switch-to-buffer b2)
                      (setq parse-sexp-lookup-properties t)
                      parse-sexp-lookup-properties)
==> t
parse-sexp-lookup-properties
==> nil

Regards,
Guanpeng Xu

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/





reply via email to

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