summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2022-12-15 21:13:14 +0100
committerStefan Kangas <stefankangas@gmail.com>2022-12-15 21:13:14 +0100
commiteacdac3c6e43459104d25594cebc930b2a081f17 (patch)
treeee787af085e882b3f60b871b2816388c91fb0df1 /lisp/emacs-lisp
parent037889c4a9aca524d31c75614f5df06088ed9264 (diff)
parenta15cd55044c6bb4d4e9f9aec23b8b5b9cbcb38ac (diff)
downloademacs-eacdac3c6e43459104d25594cebc930b2a081f17.tar.gz
emacs-eacdac3c6e43459104d25594cebc930b2a081f17.tar.bz2
emacs-eacdac3c6e43459104d25594cebc930b2a081f17.zip
Merge from origin/emacs-29
a15cd55044c ; Don't quote nil in comments da39200c4be ; Checkdoc fixes in dired-aux.el fd403a5c5a8 Fix ruby-add-log-current-method after nested class defini... 2ca06aed7b3 Add indent rules to js/typescript/tsx-ts-mode (bug#60074) a54d5f500c1 Improve fontification in csharp-ts-mode (bug#59897) 3db2f560bb7 Revert "Add expression for generic_name in csharp-ts-mode" 1985762fbd7 Introduce support for TOML config-format 622838b957e Fix handling of % when searching in .tex or .dtx files 3b226b60248 Treat C++ classes as defuns in C Tree-sitter mode (bug#60... 480f41c7deb Add < and > to the syntax table in c++-ts-mode (bug#60049) fbf0d3b796a Improve fontifications in Typescript mode f93a5180a61 Update the documentation of overlays (bug#59996) d51b66ed540 ; Improve description of scoping and let-bindings 752f9dde631 ; Fix a typo in window.el 102a3e3b445 Don't send erc-sasl-user as USER command argument f0c90888781 Set erc-network to a "given" ID instead of failing 09c0c6b2ba3 Limit casemapping to appropriate ranges in ERC 44b04c0ac1c Actually accept non-symbols as IDs in erc-open 75f26646d4a ; Be nicer when updating browse-url var in erc-compat 0155fc67be3 Respect a nil erc-session-password when reconnecting 9ac80e8a6e4 Add dedicated auth-source section in ERC manual 2d96a18cd09 ; * lisp/emacs-lisp/shortdoc.el: fix mistakes in previous... 1d3cbba7dfa ; * lisp/progmodes/cmake-ts-mode.el (auto-mode-alist): $ ... 0cc199f1a61 Better shortdoc examples 931d97bf563 Shortdoc: read and evaluate strings after :eval be165f75332 Fix Tramp tests in eglot-tests, prefix tests uniquely 8c30cb90ba9 * lisp/vc/vc-git.el (vc-git-checkin): Use make-nearby-tem... 3efe4df1d20 Delete temp files after icalendar tests # Conflicts: # etc/NEWS
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/shortdoc.el154
-rw-r--r--lisp/emacs-lisp/subr-x.el2
2 files changed, 116 insertions, 40 deletions
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index 83283247150..6704db3cc57 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -251,18 +251,17 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
:eval (string-glyph-decompose "Å"))
"Predicates for Strings"
(string-equal
- :eval (string-equal "foo" "foo"))
+ :eval (string-equal "abc" "abc")
+ :eval (string-equal "abc" "ABC"))
(string-equal-ignore-case
:eval (string-equal-ignore-case "foo" "FOO"))
- (eq
- :eval (eq "foo" "foo"))
- (eql
- :eval (eql "foo" "foo"))
(equal
:eval (equal "foo" "foo"))
(cl-equalp
:eval (cl-equalp "Foo" "foo"))
(stringp
+ :eval (stringp "a")
+ :eval (stringp 'a)
:eval "(stringp ?a)")
(string-empty-p
:no-manual t
@@ -271,16 +270,16 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
:no-manual t
:eval (string-blank-p " \n"))
(string-lessp
- :eval (string-lessp "foo" "bar")
+ :eval (string-lessp "abc" "def")
:eval (string-lessp "pic4.png" "pic32.png")
- :eval (string-lessp "1.1" "1 2"))
+ :eval (string-lessp "1.1" "1.2"))
(string-greaterp
:eval (string-greaterp "foo" "bar"))
(string-version-lessp
:eval (string-version-lessp "pic4.png" "pic32.png")
- :eval (string-version-lessp "1.1" "1 2"))
+ :eval (string-version-lessp "1.9.3" "1.10.2"))
(string-collate-lessp
- :eval (string-collate-lessp "1.1" "1 2"))
+ :eval (string-collate-lessp "abc" "abd"))
(string-prefix-p
:eval (string-prefix-p "foo" "foobar"))
(string-suffix-p
@@ -297,7 +296,8 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
"Converting Strings"
(string-to-number
:eval (string-to-number "42")
- :eval (string-to-number "deadbeef" 16))
+ :eval (string-to-number "deadbeef" 16)
+ :eval (string-to-number "2.5e+03"))
(number-to-string
:eval (number-to-string 42))
"Data About Strings"
@@ -627,8 +627,7 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
(nconc
:eval (nconc (list 1) (list 2 3 4)))
(delq
- :eval (delq 2 (list 1 2 3 4))
- :eval (delq "a" (list "a" "b" "c" "d")))
+ :eval (delq 'a (list 'a 'b 'c 'd)))
(delete
:eval (delete 2 (list 1 2 3 4))
:eval (delete "a" (list "a" "b" "c" "d")))
@@ -670,29 +669,25 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
:eval (nlistp '(1 . 2)))
"Finding Elements"
(memq
- :eval (memq 2 '(1 2 3))
- :eval (memq 2.0 '(1.0 2.0 3.0))
- :eval (memq "b" '("a" "b" "c")))
+ :eval (memq 'b '(a b c)))
+ (memql
+ :eval (memql 2.0 '(1.0 2.0 3.0)))
(member
:eval (member 2 '(1 2 3))
:eval (member "b" '("a" "b" "c")))
(remq
- :eval (remq 2 '(1 2 3 2 4 2))
- :eval (remq "b" '("a" "b" "c")))
- (memql
- :eval (memql 2.0 '(1.0 2.0 3.0)))
+ :eval (remq 'b '(a b c)))
(member-ignore-case
:eval (member-ignore-case "foo" '("bar" "Foo" "zot")))
"Association Lists"
(assoc
- :eval (assoc 'b '((a 1) (b 2))))
+ :eval (assoc "b" '(("a" . 1) ("b" . 2))))
(rassoc
- :eval (rassoc '2 '((a . 1) (b . 2))))
+ :eval (rassoc "b" '((1 . "a") (2 . "b"))))
(assq
- :eval (assq 'b '((a 1) (b 2)))
- :eval (assq "a" '(("a" 1) ("b" 2))))
+ :eval (assq 'b '((a . 1) (b . 2))))
(rassq
- :eval (rassq '2 '((a . 1) (b . 2))))
+ :eval (rassq 'b '((1 . a) (2 . b))))
(assoc-string
:eval (assoc-string "foo" '(("a" 1) (foo 2))))
(alist-get
@@ -725,6 +720,88 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
(safe-length
:eval (safe-length '(a b c))))
+(define-short-documentation-group symbol
+ "Making symbols"
+ (intern
+ :eval (intern "abc"))
+ (intern-soft
+ :eval (intern-soft "Phooey!"))
+ (make-symbol
+ :eval (make-symbol "abc"))
+ "Comparing symbols"
+ (eq
+ :eval (eq 'abc 'abc)
+ :eval (eq 'abc 'abd))
+ (eql
+ :eval (eql 'abc 'abc))
+ (equal
+ :eval (equal 'abc 'abc))
+ "Name"
+ (symbol-name
+ :eval (symbol-name 'abc)))
+
+(define-short-documentation-group comparison
+ "General-purpose"
+ (eq
+ :eval (eq 'a 'a)
+ :eval "(eq ?A ?A)"
+ :eval (let ((x (list 'a "b" '(c) 4 5.0)))
+ (eq x x)))
+ (eql
+ :eval (eql 2 2)
+ :eval (eql 2.0 2.0)
+ :eval (eql 2.0 2))
+ (equal
+ :eval (equal "abc" "abc")
+ :eval (equal 2.0 2.0)
+ :eval (equal 2.0 2)
+ :eval (equal '(a "b" (c) 4.0) '(a "b" (c) 4.0)))
+ (cl-equalp
+ :eval (cl-equalp 2 2.0)
+ :eval (cl-equalp "ABC" "abc"))
+ "Numeric"
+ (=
+ :args (number &rest numbers)
+ :eval (= 2 2)
+ :eval (= 2.0 2.0)
+ :eval (= 2.0 2)
+ :eval (= 4 4 4 4))
+ (/=
+ :eval (/= 4 4))
+ (<
+ :args (number &rest numbers)
+ :eval (< 4 4)
+ :eval (< 1 2 3))
+ (<=
+ :args (number &rest numbers)
+ :eval (<= 4 4)
+ :eval (<= 1 2 2 3))
+ (>
+ :args (number &rest numbers)
+ :eval (> 4 4)
+ :eval (> 3 2 1))
+ (>=
+ :args (number &rest numbers)
+ :eval (>= 4 4)
+ :eval (>= 3 2 2 1))
+ "String"
+ (string-equal
+ :eval (string-equal "abc" "abc")
+ :eval (string-equal "abc" "ABC"))
+ (string-equal-ignore-case
+ :eval (string-equal-ignore-case "abc" "ABC"))
+ (string-lessp
+ :eval (string-lessp "abc" "abd")
+ :eval (string-lessp "abc" "abc")
+ :eval (string-lessp "pic4.png" "pic32.png"))
+ (string-greaterp
+ :eval (string-greaterp "abd" "abc")
+ :eval (string-greaterp "abc" "abc"))
+ (string-version-lessp
+ :eval (string-version-lessp "pic4.png" "pic32.png")
+ :eval (string-version-lessp "1.9.3" "1.10.2"))
+ (string-collate-lessp
+ :eval (string-collate-lessp "abc" "abd")))
(define-short-documentation-group vector
"Making Vectors"
@@ -1131,13 +1208,10 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
:args (number &rest numbers)
:eval (= 4 4)
:eval (= 4.0 4.0)
- :eval (= 4 5 6 7))
- (eq
- :eval (eq 4 4)
- :eval (eq 4.0 4.0))
+ :eval (= 4 4.0)
+ :eval (= 4 4 4 4))
(eql
:eval (eql 4 4)
- :eval (eql 4 "4")
:eval (eql 4.0 4.0))
(/=
:eval (/= 4 4))
@@ -1148,15 +1222,15 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
(<=
:args (number &rest numbers)
:eval (<= 4 4)
- :eval (<= 1 2 3))
+ :eval (<= 1 2 2 3))
(>
:args (number &rest numbers)
:eval (> 4 4)
- :eval (> 1 2 3))
+ :eval (> 3 2 1))
(>=
:args (number &rest numbers)
:eval (>= 4 4)
- :eval (>= 1 2 3))
+ :eval (>= 3 2 2 1))
(zerop
:eval (zerop 0))
(cl-plusp
@@ -1440,14 +1514,16 @@ function's documentation in the Info manual"))
do
(cl-case type
(:eval
+ (insert " ")
(if (stringp value)
- (insert " " value "\n")
- (insert " ")
- (prin1 value (current-buffer))
- (insert "\n")
- (insert " " double-arrow " ")
- (prin1 (eval value) (current-buffer))
- (insert "\n")))
+ (insert value)
+ (prin1 value (current-buffer)))
+ (insert "\n " double-arrow " ")
+ (let ((expr (if (stringp value)
+ (car (read-from-string value))
+ value)))
+ (prin1 (eval expr) (current-buffer)))
+ (insert "\n"))
(:no-eval*
(if (stringp value)
(insert " " value "\n")
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 0486baba83c..4896f4c2937 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -399,7 +399,7 @@ this defaults to the current buffer."
"Query the user for a process and return the process object."
;; Currently supports only the PROCESS argument.
;; Must either return a list containing a process, or signal an error.
- ;; (Returning `nil' would mean the current buffer's process.)
+ ;; (Returning nil would mean the current buffer's process.)
(unless (fboundp 'process-list)
(error "Asynchronous subprocesses are not supported on this system"))
;; Local function to return cons of a complete-able name, and the