aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2018-03-23 11:01:31 -0400
committerStefan Monnier2018-03-23 11:01:31 -0400
commit6695c1be51bd8a1e208ae02505b2a6fa64c85e68 (patch)
tree5b98a40ea7c74b7e9c24d1187c9ed6f332e5b2f2
parent8e5ab342aac11ccc54fdcdc9593e989b562f7ae7 (diff)
parentb8ebf5fb64dbf261315bfdb281a8b0a119e7cc2b (diff)
downloademacs-6695c1be51bd8a1e208ae02505b2a6fa64c85e68.tar.gz
emacs-6695c1be51bd8a1e208ae02505b2a6fa64c85e68.zip
Merge from origin/emacs-26
b8ebf5fb64 * src/lisp.h (struct Lisp_Buffer_Local_Value): Update comm... 8c92a37cb4 * doc/emacs/trouble.texi: Fix location of `emacs-version' ... 10b1f2fdd5 Explain more about (defvar foo) form (Bug#18059) 68c2f336b1 * doc/lispref/buffers.texi (Buffer List): Fix grammar. 7e720c6851 * doc/lispref/anti.texi (Antinews): Fix grammar. a6a821d29b * lisp/org/ob-lisp.el (org-babel-lisp-eval-fn): Tweak type.
-rw-r--r--doc/emacs/trouble.texi2
-rw-r--r--doc/lispref/anti.texi7
-rw-r--r--doc/lispref/buffers.texi2
-rw-r--r--doc/lispref/compile.texi3
-rw-r--r--doc/lispref/variables.texi39
-rw-r--r--lisp/org/ob-lisp.el2
-rw-r--r--src/lisp.h17
7 files changed, 53 insertions, 19 deletions
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index c0dc3d472e3..fc9a64d375e 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -594,7 +594,6 @@ with the manual, one of them must be wrong; that is a bug.
594@cindex bug reporting 594@cindex bug reporting
595@cindex report an Emacs bug, how to 595@cindex report an Emacs bug, how to
596 596
597@findex emacs-version
598 When you decide that there is a bug, it is important to report it 597 When you decide that there is a bug, it is important to report it
599and to report it in a way which is useful. What is most useful is an 598and to report it in a way which is useful. What is most useful is an
600exact description of what commands you type, starting with the shell 599exact description of what commands you type, starting with the shell
@@ -717,6 +716,7 @@ should include all these things:
717The version number of Emacs. Without this, we won't know whether there is any 716The version number of Emacs. Without this, we won't know whether there is any
718point in looking for the bug in the current version of GNU Emacs. 717point in looking for the bug in the current version of GNU Emacs.
719 718
719@findex emacs-version
720@kbd{M-x report-emacs-bug} includes this information automatically, 720@kbd{M-x report-emacs-bug} includes this information automatically,
721but if you are not using that command for your report you can get the 721but if you are not using that command for your report you can get the
722version number by typing @kbd{M-x emacs-version @key{RET}}. If that 722version number by typing @kbd{M-x emacs-version @key{RET}}. If that
diff --git a/doc/lispref/anti.texi b/doc/lispref/anti.texi
index ef28415d591..556203b69f0 100644
--- a/doc/lispref/anti.texi
+++ b/doc/lispref/anti.texi
@@ -164,9 +164,10 @@ come, and learning to use yet another API is a burden.
164 164
165@item 165@item
166The function @code{read-multiple-choice} is also gone, in recognition 166The function @code{read-multiple-choice} is also gone, in recognition
167of the fact that nothing makes Emacs Lisp hacker rejoice more than the 167of the fact that nothing makes Emacs Lisp hackers rejoice more than
168need to sit down and write yet another interactive question-and-answer 168the need to sit down and write yet another interactive
169function, and make it optimal for each specific case. 169question-and-answer function, and make it optimal for each specific
170case.
170 171
171@item 172@item
172The function @code{add-variable-watcher} and the corresponding 173The function @code{add-variable-watcher} and the corresponding
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index a72e1eb69fc..cfd2fb7715b 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -891,7 +891,7 @@ This function operates on each frame's @code{buffer-list} parameter as
891well as the fundamental buffer list; therefore, the buffer that you bury 891well as the fundamental buffer list; therefore, the buffer that you bury
892will come last in the value of @code{(buffer-list @var{frame})} and in 892will come last in the value of @code{(buffer-list @var{frame})} and in
893the value of @code{(buffer-list)}. In addition, it also puts the buffer 893the value of @code{(buffer-list)}. In addition, it also puts the buffer
894at the end of the list of buffer of the selected window (@pxref{Window 894at the end of the list of buffers of the selected window (@pxref{Window
895History}) provided it is shown in that window. 895History}) provided it is shown in that window.
896 896
897If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the 897If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi
index 0e39866d349..e665b84f9b8 100644
--- a/doc/lispref/compile.texi
+++ b/doc/lispref/compile.texi
@@ -500,7 +500,8 @@ You can tell the compiler that a function is defined using
500@item 500@item
501Likewise, you can tell the compiler that a variable is defined using 501Likewise, you can tell the compiler that a variable is defined using
502@code{defvar} with no initial value. (Note that this marks the 502@code{defvar} with no initial value. (Note that this marks the
503variable as special, i.e.@: dynamically bound.) @xref{Defining 503variable as special, i.e.@: dynamically bound, but only within the
504current lexical scope, or file if at top-level.) @xref{Defining
504Variables}. 505Variables}.
505@end itemize 506@end itemize
506 507
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index b80bc88a585..4d04335d83a 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -443,9 +443,13 @@ dynamically bound value; @pxref{Void Variables}), then @var{value} is
443evaluated and @var{symbol} is set to the result. But if @var{symbol} 443evaluated and @var{symbol} is set to the result. But if @var{symbol}
444is not void, @var{value} is not evaluated, and @var{symbol}'s value is 444is not void, @var{value} is not evaluated, and @var{symbol}'s value is
445left unchanged. If @var{value} is omitted, the value of @var{symbol} 445left unchanged. If @var{value} is omitted, the value of @var{symbol}
446is not changed in any case. Using @code{defvar} with no value is one 446is not changed in any case.
447method of suppressing byte compilation warnings, see @ref{Compiler 447
448Errors}. 448Note that specifying a value, even @code{nil}, marks the variable as
449special permanently. Whereas if @var{value} is omitted then the
450variable is only marked special locally (i.e.@: within the current
451lexical scope, or file if at the top-level). This can be useful for
452suppressing byte compilation warnings, see @ref{Compiler Errors}.
449 453
450If @var{symbol} has a buffer-local binding in the current buffer, 454If @var{symbol} has a buffer-local binding in the current buffer,
451@code{defvar} acts on the default value, which is buffer-independent, 455@code{defvar} acts on the default value, which is buffer-independent,
@@ -489,6 +493,9 @@ it a documentation string:
489 493
490The @code{defvar} form returns @var{symbol}, but it is normally used 494The @code{defvar} form returns @var{symbol}, but it is normally used
491at top level in a file where its value does not matter. 495at top level in a file where its value does not matter.
496
497For a more elaborate example of using @code{defvar} without a value,
498see @ref{Local defvar example}.
492@end defspec 499@end defspec
493 500
494@cindex constant variables 501@cindex constant variables
@@ -1165,6 +1172,32 @@ variables}. Every variable that has been defined with @code{defvar},
1165(@pxref{Defining Variables}). All other variables are subject to 1172(@pxref{Defining Variables}). All other variables are subject to
1166lexical binding. 1173lexical binding.
1167 1174
1175@anchor{Local defvar example}
1176Using @code{defvar} without a value, it is possible to bind a variable
1177dynamically just in one file, or in just one part of a file while
1178still binding it lexically elsewhere. For example:
1179
1180@example
1181@group
1182(let (_)
1183 (defvar x) ; @r{Let-bindings of @code{x} will be dynamic within this let.}
1184 (let ((x -99)) ; @r{This is a dynamic binding of @code{x}.}
1185 (defun get-dynamic-x ()
1186 x)))
1187
1188(let ((x 'lexical)) ; @r{This is a lexical binding of @code{x}.}
1189 (defun get-lexical-x ()
1190 x))
1191
1192(let (_)
1193 (defvar x)
1194 (let ((x 'dynamic))
1195 (list (get-lexical-x)
1196 (get-dynamic-x))))
1197 @result{} (lexical dynamic)
1198@end group
1199@end example
1200
1168@defun special-variable-p symbol 1201@defun special-variable-p symbol
1169This function returns non-@code{nil} if @var{symbol} is a special 1202This function returns non-@code{nil} if @var{symbol} is a special
1170variable (i.e., it has a @code{defvar}, @code{defcustom}, or 1203variable (i.e., it has a @code{defvar}, @code{defcustom}, or
diff --git a/lisp/org/ob-lisp.el b/lisp/org/ob-lisp.el
index c156ca34a7c..d4a7c37133d 100644
--- a/lisp/org/ob-lisp.el
+++ b/lisp/org/ob-lisp.el
@@ -54,7 +54,7 @@ Valid values include `slime-eval' and `sly-eval'."
54 :group 'org-babel 54 :group 'org-babel
55 :version "26.1" 55 :version "26.1"
56 :package-version '(Org . "9.0") 56 :package-version '(Org . "9.0")
57 :type 'function) 57 :type 'symbol)
58 58
59(defcustom org-babel-lisp-dir-fmt 59(defcustom org-babel-lisp-dir-fmt
60 "(let ((*default-pathname-defaults* #P%S\n)) %%s\n)" 60 "(let ((*default-pathname-defaults* #P%S\n)) %%s\n)"
diff --git a/src/lisp.h b/src/lisp.h
index a7f0a1d78ff..aefdaeaf12f 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2685,13 +2685,12 @@ struct Lisp_Buffer_Objfwd
2685 variable, you must first make sure the right binding is loaded; 2685 variable, you must first make sure the right binding is loaded;
2686 then you can access the value in (or through) `realvalue'. 2686 then you can access the value in (or through) `realvalue'.
2687 2687
2688 `buffer' and `frame' are the buffer and frame for which the loaded 2688 `where' is the buffer for which the loaded binding was found. If
2689 binding was found. If those have changed, to make sure the right 2689 it has changed, to make sure the right binding is loaded it is
2690 binding is loaded it is necessary to find which binding goes with 2690 necessary to find which binding goes with the current buffer, then
2691 the current buffer and selected frame, then load it. To load it, 2691 load it. To load it, first unload the previous binding, then copy
2692 first unload the previous binding, then copy the value of the new 2692 the value of the new binding into `realvalue' (or through it).
2693 binding into `realvalue' (or through it). Also update 2693 Also update LOADED-BINDING to point to the newly loaded binding.
2694 LOADED-BINDING to point to the newly loaded binding.
2695 2694
2696 `local_if_set' indicates that merely setting the variable creates a 2695 `local_if_set' indicates that merely setting the variable creates a
2697 local binding for the current buffer. Otherwise the latter, setting 2696 local binding for the current buffer. Otherwise the latter, setting
@@ -2707,14 +2706,14 @@ struct Lisp_Buffer_Local_Value
2707 bool_bf found : 1; 2706 bool_bf found : 1;
2708 /* If non-NULL, a forwarding to the C var where it should also be set. */ 2707 /* If non-NULL, a forwarding to the C var where it should also be set. */
2709 union Lisp_Fwd *fwd; /* Should never be (Buffer|Kboard)_Objfwd. */ 2708 union Lisp_Fwd *fwd; /* Should never be (Buffer|Kboard)_Objfwd. */
2710 /* The buffer or frame for which the loaded binding was found. */ 2709 /* The buffer for which the loaded binding was found. */
2711 Lisp_Object where; 2710 Lisp_Object where;
2712 /* A cons cell that holds the default value. It has the form 2711 /* A cons cell that holds the default value. It has the form
2713 (SYMBOL . DEFAULT-VALUE). */ 2712 (SYMBOL . DEFAULT-VALUE). */
2714 Lisp_Object defcell; 2713 Lisp_Object defcell;
2715 /* The cons cell from `where's parameter alist. 2714 /* The cons cell from `where's parameter alist.
2716 It always has the form (SYMBOL . VALUE) 2715 It always has the form (SYMBOL . VALUE)
2717 Note that if `forward' is non-nil, VALUE may be out of date. 2716 Note that if `fwd' is non-NULL, VALUE may be out of date.
2718 Also if the currently loaded binding is the default binding, then 2717 Also if the currently loaded binding is the default binding, then
2719 this is `eq'ual to defcell. */ 2718 this is `eq'ual to defcell. */
2720 Lisp_Object valcell; 2719 Lisp_Object valcell;