aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2024-05-02 19:30:40 +0300
committerEli Zaretskii2024-05-02 19:30:40 +0300
commit12e3ffcc97af739f0134959ce4a5ff2f23ffa971 (patch)
tree98bf0c6d66b8ea69fbf28c6636740ce323398de1
parentda8b06bd6181bc56fb0f133d17cae7eff44a83e8 (diff)
downloademacs-12e3ffcc97af739f0134959ce4a5ff2f23ffa971.tar.gz
emacs-12e3ffcc97af739f0134959ce4a5ff2f23ffa971.zip
; Fix last change
* etc/NEWS: Fix wording of a recently-added item. * doc/lispref/functions.texi (Declare Form): Fix markup.
-rw-r--r--doc/lispref/functions.texi11
-rw-r--r--etc/NEWS6
2 files changed, 8 insertions, 9 deletions
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index d88f5d05339..a77bf6e233d 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -2725,22 +2725,22 @@ Here's an example of using @code{type} inside @code{declare} to declare
2725a function @code{positive-p} that takes an argument of type @var{number} 2725a function @code{positive-p} that takes an argument of type @var{number}
2726and return a @var{boolean}: 2726and return a @var{boolean}:
2727 2727
2728@group
2729@lisp 2728@lisp
2729@group
2730(defun positive-p (x) 2730(defun positive-p (x)
2731 (declare (type (function (number) boolean))) 2731 (declare (type (function (number) boolean)))
2732 (when (> x 0) 2732 (when (> x 0)
2733 t)) 2733 t))
2734@end lisp
2735@end group 2734@end group
2735@end lisp
2736 2736
2737Similarly this declares a function @code{cons-or-number} that: expects a 2737Similarly this declares a function @code{cons-or-number} that: expects a
2738first argument being a @var{cons} or a @var{number}, a second optional 2738first argument being a @var{cons} or a @var{number}, a second optional
2739argument of type @var{string} and return one of the symbols 2739argument of type @var{string} and return one of the symbols
2740@code{is-cons} or @code{is-number}: 2740@code{is-cons} or @code{is-number}:
2741 2741
2742@group
2743@lisp 2742@lisp
2743@group
2744(defun cons-or-number (x &optional err-msg) 2744(defun cons-or-number (x &optional err-msg)
2745 (declare (type (function ((or cons number) &optional string) 2745 (declare (type (function ((or cons number) &optional string)
2746 (member is-cons is-number)))) 2746 (member is-cons is-number))))
@@ -2749,11 +2749,10 @@ argument of type @var{string} and return one of the symbols
2749 (if (numberp x) 2749 (if (numberp x)
2750 'is-number 2750 'is-number
2751 (error (or err-msg "Unexpected input"))))) 2751 (error (or err-msg "Unexpected input")))))
2752@end lisp
2753@end group 2752@end group
2753@end lisp
2754 2754
2755More types are described in the Lisp Data Types chapter (@ref{Lisp Data 2755For description of additional types, see @ref{Lisp Data Types}).
2756Types}).
2757 2756
2758Declaring a function with an incorrect type produces undefined behavior 2757Declaring a function with an incorrect type produces undefined behavior
2759and could lead to unexpected results or might even crash Emacs when code 2758and could lead to unexpected results or might even crash Emacs when code
diff --git a/etc/NEWS b/etc/NEWS
index 8477a1eed58..b55ee02e0bd 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1940,9 +1940,9 @@ unibyte string.
1940* Lisp Changes in Emacs 30.1 1940* Lisp Changes in Emacs 30.1
1941 1941
1942+++ 1942+++
1943** Function type declaration 1943** Function type declaration.
1944It is now possible, using the 'declare' macro, to declare expected types 1944It is now possible to declare the expected type of a function's
1945of function arguments and return type. 1945arguments and its return type using the 'declare' macro.
1946 1946
1947** New types 'closure' and 'interpreted-function'. 1947** New types 'closure' and 'interpreted-function'.
1948'interpreted-function' is the new type used for interpreted functions, 1948'interpreted-function' is the new type used for interpreted functions,