[Top][All Lists]

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

Re: Confused about buffer-local variables

From: Thorsten Jolitz
Subject: Re: Confused about buffer-local variables
Date: Mon, 31 Mar 2014 23:10:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Nicolas Richard <address@hidden> writes:

> Thorsten Jolitz <address@hidden> writes:
>> assume function `foo' is defined in library A and uses variable `bar'
>> defined in that library with value "X". Now I call function `foo' from a
>> buffer where variable `bar' is set as a buffer-local variable to a
>> different value "Y".
>> Which value is `foo' going to use - "X" or "Y"? I would have said "Y"
>> but feel a bit confused right now ...
> I'd say 'Y' also, but maybe I'm confused and I do not know it. Do you
> have any code sample that doesn't do what you expected ?

You are right, I should have rather tested it:

Evaluating library mylib.el:

| (defvar mylib-bar "X")
| (defun mylib-foo ()
|   (print mylib-bar))

after opening buffer

| * 1st Level
| Lorem Ipsum
|   # Local Variables:
|   # mylib-bar: "Y"
|   # End:

does not change the expected result when doing 

| M-: (mylib-foo)

with point in buffer

| "Y"


reply via email to

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