aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2021-01-27 17:15:46 +0200
committerEli Zaretskii2021-01-27 17:19:16 +0200
commite79e377a4e06d187e56dcad826fb761659abe3f3 (patch)
tree3678db2c8d030261f83d89d817d8b09406c98b60
parent0340e9eccbb15492064b8dfda9313793b49de752 (diff)
downloademacs-e79e377a4e06d187e56dcad826fb761659abe3f3.tar.gz
emacs-e79e377a4e06d187e56dcad826fb761659abe3f3.zip
Improve documentation of 'read-regexp' and friends
* doc/emacs/glossary.texi (Glossary): Add "Tag" to the Glossary. * doc/emacs/maintaining.texi (Xref): Mention that identifiers are also known as "tags". * lisp/replace.el (read-regexp, read-regexp-suggestions): Improve wording of doc strings. (Bug#46088) (Bug#46089) (cherry picked from commit 49eb03d6c8a181fd46adbbcf1f0a976d0a9efa87)
-rw-r--r--doc/emacs/glossary.texi8
-rw-r--r--doc/emacs/maintaining.texi22
-rw-r--r--lisp/replace.el44
3 files changed, 41 insertions, 33 deletions
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi
index 35df06591eb..4f971eb1e01 100644
--- a/doc/emacs/glossary.texi
+++ b/doc/emacs/glossary.texi
@@ -1369,10 +1369,14 @@ configurations. @xref{Tab Bars}.
1369The tab line is a line of tabs at the top of an Emacs window. 1369The tab line is a line of tabs at the top of an Emacs window.
1370Clicking on one of these tabs switches window buffers. @xref{Tab Line}. 1370Clicking on one of these tabs switches window buffers. @xref{Tab Line}.
1371 1371
1372@item Tag
1373A tag is an identifier in a program source. @xref{Xref}.
1374
1372@anchor{Glossary---Tags Table} 1375@anchor{Glossary---Tags Table}
1373@item Tags Table 1376@item Tags Table
1374A tags table is a file that serves as an index to the function 1377A tags table is a file that serves as an index to identifiers: definitions
1375definitions in one or more other files. @xref{Tags Tables}. 1378of functions, macros, data structures, etc., in one or more other files.
1379@xref{Tags Tables}.
1376 1380
1377@item Termscript File 1381@item Termscript File
1378A termscript file contains a record of all characters sent by Emacs to 1382A termscript file contains a record of all characters sent by Emacs to
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 14911d30e99..9bb3378c3f3 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1860,19 +1860,21 @@ Of course, you should substitute the proper years and copyright holder.
1860@section Find Identifier References 1860@section Find Identifier References
1861@cindex xref 1861@cindex xref
1862 1862
1863@cindex tag
1863 An @dfn{identifier} is a name of a syntactical subunit of the 1864 An @dfn{identifier} is a name of a syntactical subunit of the
1864program: a function, a subroutine, a method, a class, a data type, a 1865program: a function, a subroutine, a method, a class, a data type, a
1865macro, etc. In a programming language, each identifier is a symbol in 1866macro, etc. In a programming language, each identifier is a symbol in
1866the language's syntax. Program development and maintenance requires 1867the language's syntax. Identifiers are also known as @dfn{tags}.
1867capabilities to quickly find where each identifier was defined and 1868
1868referenced, to rename identifiers across the entire project, etc. 1869Program development and maintenance requires capabilities to quickly
1869 1870find where each identifier was defined and referenced, to rename
1870These capabilities are also useful for finding references in major 1871identifiers across the entire project, etc. These capabilities are
1871modes other than those defined to support programming languages. For 1872also useful for finding references in major modes other than those
1872example, chapters, sections, appendices, etc.@: of a text or a @TeX{} 1873defined to support programming languages. For example, chapters,
1873document can be treated as subunits as well, and their names can be 1874sections, appendices, etc.@: of a text or a @TeX{} document can be
1874used as identifiers. In this chapter, we use the term ``identifiers'' 1875treated as subunits as well, and their names can be used as
1875to collectively refer to the names of any kind of subunits, in program 1876identifiers. In this chapter, we use the term ``identifiers'' to
1877collectively refer to the names of any kind of subunits, in program
1876source and in other kinds of text alike. 1878source and in other kinds of text alike.
1877 1879
1878Emacs provides a unified interface to these capabilities, called 1880Emacs provides a unified interface to these capabilities, called
diff --git a/lisp/replace.el b/lisp/replace.el
index d1618a485ed..416d9f1d1ec 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -786,11 +786,11 @@ the function that you set this to can check `this-command'."
786 786
787(defun read-regexp-suggestions () 787(defun read-regexp-suggestions ()
788 "Return a list of standard suggestions for `read-regexp'. 788 "Return a list of standard suggestions for `read-regexp'.
789By default, the list includes the \"tag\" at point (see Info 789By default, the list includes the identifier (a.k.a. \"tag\")
790node `(emacs) Identifier Search'), the last isearch regexp, the 790at point (see Info node `(emacs) Identifier Search'), the last
791last isearch string, and the last replacement regexp. 791isearch regexp, the last isearch string, and the last
792`read-regexp' appends the list returned by this function to the 792replacement regexp. `read-regexp' appends the list returned
793end of values available via 793by this function to the end of values available via
794\\<minibuffer-local-map>\\[next-history-element]." 794\\<minibuffer-local-map>\\[next-history-element]."
795 (list 795 (list
796 (find-tag-default-as-regexp) 796 (find-tag-default-as-regexp)
@@ -805,33 +805,35 @@ Prompt with the string PROMPT. If PROMPT ends in \":\" (followed by
805optional whitespace), use it as-is. Otherwise, add \": \" to the end, 805optional whitespace), use it as-is. Otherwise, add \": \" to the end,
806possibly preceded by the default result (see below). 806possibly preceded by the default result (see below).
807 807
808The optional argument DEFAULTS can be either: nil, a string, a list 808The optional argument DEFAULTS is used to construct the default
809of strings, or a symbol. We use DEFAULTS to construct the default 809return value in case of empty input. DEFAULTS can be nil, a string,
810return value in case of empty input. 810a list of strings, or a symbol.
811 811
812If DEFAULTS is a string, we use it as-is. 812If DEFAULTS is a string, the function uses it as-is.
813 813
814If DEFAULTS is a list of strings, the first element is the 814If DEFAULTS is a list of strings, the first element is the
815default return value, but all the elements are accessible 815default return value, but all the elements are accessible
816using the history command \\<minibuffer-local-map>\\[next-history-element]. 816using the history command \\<minibuffer-local-map>\\[next-history-element].
817 817
818DEFAULTS can be a symbol. If DEFAULTS is the symbol 818If DEFAULTS is the symbol `regexp-history-last', the default return
819`regexp-history-last', we use the first element of HISTORY (if 819value will be the first element of HISTORY. If HISTORY is omitted or
820specified) or `regexp-history'. If DEFAULTS is a symbol with a 820nil, `regexp-history' is used instead.
821function definition, we call it with no arguments and use what it 821If DEFAULTS is a symbol with a function definition, it is called with
822returns, which should be either nil, a string, or a list of 822no arguments and should return either nil, a string, or a list of
823strings. Other symbol values for DEFAULTS are ignored. If 823strings, which will be used as above.
824`read-regexp-defaults-function' is non-nil, its value is used 824Other symbol values for DEFAULTS are ignored.
825instead of DEFAULTS in the two cases described in this paragraph.
826 825
827We append the standard values from `read-regexp-suggestions' to DEFAULTS 826If `read-regexp-defaults-function' is non-nil, its value is used
828before using it. 827instead of DEFAULTS in the two cases described in the last paragraph.
828
829Before using whatever value DEFAULTS yields, the function appends the
830standard values from `read-regexp-suggestions' to that value.
829 831
830If the first element of DEFAULTS is non-nil (and if PROMPT does not end 832If the first element of DEFAULTS is non-nil (and if PROMPT does not end
831in \":\", followed by optional whitespace), we add it to the prompt. 833in \":\", followed by optional whitespace), DEFAULT is added to the prompt.
832 834
833The optional argument HISTORY is a symbol to use for the history list. 835The optional argument HISTORY is a symbol to use for the history list.
834If nil, uses `regexp-history'." 836If nil, use `regexp-history'."
835 (let* ((defaults 837 (let* ((defaults
836 (if (and defaults (symbolp defaults)) 838 (if (and defaults (symbolp defaults))
837 (cond 839 (cond