Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
79aa712d
Commit
79aa712d
authored
Nov 05, 2001
by
Richard M. Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Fbuffer_local_value): New function.
(syms_of_buffer): defsubr it.
parent
afd16d46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
src/buffer.c
src/buffer.c
+53
-0
No files found.
src/buffer.c
View file @
79aa712d
...
...
@@ -808,6 +808,58 @@ If BUFFER is not indirect, return nil. */)
return
base_buffer
;
}
DEFUN
(
"buffer-local-value"
,
Fbuffer_local_value
,
Sbuffer_local_value
,
2
,
2
,
0
,
doc
:
/* Return the value of VARIABLE in BUFFER.
If VARIABLE does not have a buffer-local binding in BUFFER, the value
is the default binding of variable. */
)
(
symbol
,
buffer
)
register
Lisp_Object
symbol
;
register
Lisp_Object
buffer
;
{
register
struct
buffer
*
buf
;
register
Lisp_Object
result
;
CHECK_SYMBOL
(
symbol
,
0
);
CHECK_BUFFER
(
buffer
,
0
);
buf
=
XBUFFER
(
buffer
);
/* Look in local_var_list */
result
=
Fassoc
(
symbol
,
buf
->
local_var_alist
);
if
(
NILP
(
result
))
{
int
offset
,
idx
;
int
found
=
0
;
/* Look in special slots */
for
(
offset
=
PER_BUFFER_VAR_OFFSET
(
name
);
offset
<
sizeof
(
struct
buffer
);
/* sizeof EMACS_INT == sizeof Lisp_Object */
offset
+=
(
sizeof
(
EMACS_INT
)))
{
idx
=
PER_BUFFER_IDX
(
offset
);
if
((
idx
==
-
1
||
PER_BUFFER_VALUE_P
(
buf
,
idx
))
&&
SYMBOLP
(
PER_BUFFER_SYMBOL
(
offset
))
&&
EQ
(
PER_BUFFER_SYMBOL
(
offset
),
symbol
))
{
result
=
PER_BUFFER_VALUE
(
buf
,
offset
);
found
=
1
;
break
;
}
}
if
(
!
found
)
result
=
Fdefault_value
(
symbol
);
}
else
result
=
XCDR
(
result
);
if
(
EQ
(
result
,
Qunbound
))
return
Fsignal
(
Qvoid_variable
,
Fcons
(
symbol
,
Qnil
));
return
result
;
}
DEFUN
(
"buffer-local-variables"
,
Fbuffer_local_variables
,
Sbuffer_local_variables
,
0
,
1
,
0
,
doc
:
/* Return an alist of variables that are buffer-local in BUFFER.
...
...
@@ -5571,6 +5623,7 @@ The space is measured in pixels, and put below lines on window systems. */);
/*defsubr (&Sbuffer_number);*/
defsubr
(
&
Sbuffer_file_name
);
defsubr
(
&
Sbuffer_base_buffer
);
defsubr
(
&
Sbuffer_local_value
);
defsubr
(
&
Sbuffer_local_variables
);
defsubr
(
&
Sbuffer_modified_p
);
defsubr
(
&
Sset_buffer_modified_p
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment