diff options
| author | Stefan Monnier | 2018-03-23 11:01:31 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2018-03-23 11:01:31 -0400 |
| commit | 6695c1be51bd8a1e208ae02505b2a6fa64c85e68 (patch) | |
| tree | 5b98a40ea7c74b7e9c24d1187c9ed6f332e5b2f2 | |
| parent | 8e5ab342aac11ccc54fdcdc9593e989b562f7ae7 (diff) | |
| parent | b8ebf5fb64dbf261315bfdb281a8b0a119e7cc2b (diff) | |
| download | emacs-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.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/anti.texi | 7 | ||||
| -rw-r--r-- | doc/lispref/buffers.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/compile.texi | 3 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 39 | ||||
| -rw-r--r-- | lisp/org/ob-lisp.el | 2 | ||||
| -rw-r--r-- | src/lisp.h | 17 |
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 |
| 599 | and to report it in a way which is useful. What is most useful is an | 598 | and to report it in a way which is useful. What is most useful is an |
| 600 | exact description of what commands you type, starting with the shell | 599 | exact description of what commands you type, starting with the shell |
| @@ -717,6 +716,7 @@ should include all these things: | |||
| 717 | The version number of Emacs. Without this, we won't know whether there is any | 716 | The version number of Emacs. Without this, we won't know whether there is any |
| 718 | point in looking for the bug in the current version of GNU Emacs. | 717 | point 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, |
| 721 | but if you are not using that command for your report you can get the | 721 | but if you are not using that command for your report you can get the |
| 722 | version number by typing @kbd{M-x emacs-version @key{RET}}. If that | 722 | version 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 |
| 166 | The function @code{read-multiple-choice} is also gone, in recognition | 166 | The function @code{read-multiple-choice} is also gone, in recognition |
| 167 | of the fact that nothing makes Emacs Lisp hacker rejoice more than the | 167 | of the fact that nothing makes Emacs Lisp hackers rejoice more than |
| 168 | need to sit down and write yet another interactive question-and-answer | 168 | the need to sit down and write yet another interactive |
| 169 | function, and make it optimal for each specific case. | 169 | question-and-answer function, and make it optimal for each specific |
| 170 | case. | ||
| 170 | 171 | ||
| 171 | @item | 172 | @item |
| 172 | The function @code{add-variable-watcher} and the corresponding | 173 | The 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 | |||
| 891 | well as the fundamental buffer list; therefore, the buffer that you bury | 891 | well as the fundamental buffer list; therefore, the buffer that you bury |
| 892 | will come last in the value of @code{(buffer-list @var{frame})} and in | 892 | will come last in the value of @code{(buffer-list @var{frame})} and in |
| 893 | the value of @code{(buffer-list)}. In addition, it also puts the buffer | 893 | the value of @code{(buffer-list)}. In addition, it also puts the buffer |
| 894 | at the end of the list of buffer of the selected window (@pxref{Window | 894 | at the end of the list of buffers of the selected window (@pxref{Window |
| 895 | History}) provided it is shown in that window. | 895 | History}) provided it is shown in that window. |
| 896 | 896 | ||
| 897 | If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the | 897 | If @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 |
| 501 | Likewise, you can tell the compiler that a variable is defined using | 501 | Likewise, 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 |
| 503 | variable as special, i.e.@: dynamically bound.) @xref{Defining | 503 | variable as special, i.e.@: dynamically bound, but only within the |
| 504 | current lexical scope, or file if at top-level.) @xref{Defining | ||
| 504 | Variables}. | 505 | Variables}. |
| 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 | |||
| 443 | evaluated and @var{symbol} is set to the result. But if @var{symbol} | 443 | evaluated and @var{symbol} is set to the result. But if @var{symbol} |
| 444 | is not void, @var{value} is not evaluated, and @var{symbol}'s value is | 444 | is not void, @var{value} is not evaluated, and @var{symbol}'s value is |
| 445 | left unchanged. If @var{value} is omitted, the value of @var{symbol} | 445 | left unchanged. If @var{value} is omitted, the value of @var{symbol} |
| 446 | is not changed in any case. Using @code{defvar} with no value is one | 446 | is not changed in any case. |
| 447 | method of suppressing byte compilation warnings, see @ref{Compiler | 447 | |
| 448 | Errors}. | 448 | Note that specifying a value, even @code{nil}, marks the variable as |
| 449 | special permanently. Whereas if @var{value} is omitted then the | ||
| 450 | variable is only marked special locally (i.e.@: within the current | ||
| 451 | lexical scope, or file if at the top-level). This can be useful for | ||
| 452 | suppressing byte compilation warnings, see @ref{Compiler Errors}. | ||
| 449 | 453 | ||
| 450 | If @var{symbol} has a buffer-local binding in the current buffer, | 454 | If @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 | ||
| 490 | The @code{defvar} form returns @var{symbol}, but it is normally used | 494 | The @code{defvar} form returns @var{symbol}, but it is normally used |
| 491 | at top level in a file where its value does not matter. | 495 | at top level in a file where its value does not matter. |
| 496 | |||
| 497 | For a more elaborate example of using @code{defvar} without a value, | ||
| 498 | see @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 |
| 1166 | lexical binding. | 1173 | lexical binding. |
| 1167 | 1174 | ||
| 1175 | @anchor{Local defvar example} | ||
| 1176 | Using @code{defvar} without a value, it is possible to bind a variable | ||
| 1177 | dynamically just in one file, or in just one part of a file while | ||
| 1178 | still 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 |
| 1169 | This function returns non-@code{nil} if @var{symbol} is a special | 1202 | This function returns non-@code{nil} if @var{symbol} is a special |
| 1170 | variable (i.e., it has a @code{defvar}, @code{defcustom}, or | 1203 | variable (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; |