diff options
| author | Eli Zaretskii | 2021-01-27 17:15:46 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2021-01-27 17:19:16 +0200 |
| commit | e79e377a4e06d187e56dcad826fb761659abe3f3 (patch) | |
| tree | 3678db2c8d030261f83d89d817d8b09406c98b60 | |
| parent | 0340e9eccbb15492064b8dfda9313793b49de752 (diff) | |
| download | emacs-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.texi | 8 | ||||
| -rw-r--r-- | doc/emacs/maintaining.texi | 22 | ||||
| -rw-r--r-- | lisp/replace.el | 44 |
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}. | |||
| 1369 | The tab line is a line of tabs at the top of an Emacs window. | 1369 | The tab line is a line of tabs at the top of an Emacs window. |
| 1370 | Clicking on one of these tabs switches window buffers. @xref{Tab Line}. | 1370 | Clicking on one of these tabs switches window buffers. @xref{Tab Line}. |
| 1371 | 1371 | ||
| 1372 | @item Tag | ||
| 1373 | A 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 |
| 1374 | A tags table is a file that serves as an index to the function | 1377 | A tags table is a file that serves as an index to identifiers: definitions |
| 1375 | definitions in one or more other files. @xref{Tags Tables}. | 1378 | of 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 |
| 1378 | A termscript file contains a record of all characters sent by Emacs to | 1382 | A 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 |
| 1864 | program: a function, a subroutine, a method, a class, a data type, a | 1865 | program: a function, a subroutine, a method, a class, a data type, a |
| 1865 | macro, etc. In a programming language, each identifier is a symbol in | 1866 | macro, etc. In a programming language, each identifier is a symbol in |
| 1866 | the language's syntax. Program development and maintenance requires | 1867 | the language's syntax. Identifiers are also known as @dfn{tags}. |
| 1867 | capabilities to quickly find where each identifier was defined and | 1868 | |
| 1868 | referenced, to rename identifiers across the entire project, etc. | 1869 | Program development and maintenance requires capabilities to quickly |
| 1869 | 1870 | find where each identifier was defined and referenced, to rename | |
| 1870 | These capabilities are also useful for finding references in major | 1871 | identifiers across the entire project, etc. These capabilities are |
| 1871 | modes other than those defined to support programming languages. For | 1872 | also useful for finding references in major modes other than those |
| 1872 | example, chapters, sections, appendices, etc.@: of a text or a @TeX{} | 1873 | defined to support programming languages. For example, chapters, |
| 1873 | document can be treated as subunits as well, and their names can be | 1874 | sections, appendices, etc.@: of a text or a @TeX{} document can be |
| 1874 | used as identifiers. In this chapter, we use the term ``identifiers'' | 1875 | treated as subunits as well, and their names can be used as |
| 1875 | to collectively refer to the names of any kind of subunits, in program | 1876 | identifiers. In this chapter, we use the term ``identifiers'' to |
| 1877 | collectively refer to the names of any kind of subunits, in program | ||
| 1876 | source and in other kinds of text alike. | 1878 | source and in other kinds of text alike. |
| 1877 | 1879 | ||
| 1878 | Emacs provides a unified interface to these capabilities, called | 1880 | Emacs 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'. |
| 789 | By default, the list includes the \"tag\" at point (see Info | 789 | By default, the list includes the identifier (a.k.a. \"tag\") |
| 790 | node `(emacs) Identifier Search'), the last isearch regexp, the | 790 | at point (see Info node `(emacs) Identifier Search'), the last |
| 791 | last isearch string, and the last replacement regexp. | 791 | isearch regexp, the last isearch string, and the last |
| 792 | `read-regexp' appends the list returned by this function to the | 792 | replacement regexp. `read-regexp' appends the list returned |
| 793 | end of values available via | 793 | by 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 | |||
| 805 | optional whitespace), use it as-is. Otherwise, add \": \" to the end, | 805 | optional whitespace), use it as-is. Otherwise, add \": \" to the end, |
| 806 | possibly preceded by the default result (see below). | 806 | possibly preceded by the default result (see below). |
| 807 | 807 | ||
| 808 | The optional argument DEFAULTS can be either: nil, a string, a list | 808 | The optional argument DEFAULTS is used to construct the default |
| 809 | of strings, or a symbol. We use DEFAULTS to construct the default | 809 | return value in case of empty input. DEFAULTS can be nil, a string, |
| 810 | return value in case of empty input. | 810 | a list of strings, or a symbol. |
| 811 | 811 | ||
| 812 | If DEFAULTS is a string, we use it as-is. | 812 | If DEFAULTS is a string, the function uses it as-is. |
| 813 | 813 | ||
| 814 | If DEFAULTS is a list of strings, the first element is the | 814 | If DEFAULTS is a list of strings, the first element is the |
| 815 | default return value, but all the elements are accessible | 815 | default return value, but all the elements are accessible |
| 816 | using the history command \\<minibuffer-local-map>\\[next-history-element]. | 816 | using the history command \\<minibuffer-local-map>\\[next-history-element]. |
| 817 | 817 | ||
| 818 | DEFAULTS can be a symbol. If DEFAULTS is the symbol | 818 | If DEFAULTS is the symbol `regexp-history-last', the default return |
| 819 | `regexp-history-last', we use the first element of HISTORY (if | 819 | value will be the first element of HISTORY. If HISTORY is omitted or |
| 820 | specified) or `regexp-history'. If DEFAULTS is a symbol with a | 820 | nil, `regexp-history' is used instead. |
| 821 | function definition, we call it with no arguments and use what it | 821 | If DEFAULTS is a symbol with a function definition, it is called with |
| 822 | returns, which should be either nil, a string, or a list of | 822 | no arguments and should return either nil, a string, or a list of |
| 823 | strings. Other symbol values for DEFAULTS are ignored. If | 823 | strings, which will be used as above. |
| 824 | `read-regexp-defaults-function' is non-nil, its value is used | 824 | Other symbol values for DEFAULTS are ignored. |
| 825 | instead of DEFAULTS in the two cases described in this paragraph. | ||
| 826 | 825 | ||
| 827 | We append the standard values from `read-regexp-suggestions' to DEFAULTS | 826 | If `read-regexp-defaults-function' is non-nil, its value is used |
| 828 | before using it. | 827 | instead of DEFAULTS in the two cases described in the last paragraph. |
| 828 | |||
| 829 | Before using whatever value DEFAULTS yields, the function appends the | ||
| 830 | standard values from `read-regexp-suggestions' to that value. | ||
| 829 | 831 | ||
| 830 | If the first element of DEFAULTS is non-nil (and if PROMPT does not end | 832 | If the first element of DEFAULTS is non-nil (and if PROMPT does not end |
| 831 | in \":\", followed by optional whitespace), we add it to the prompt. | 833 | in \":\", followed by optional whitespace), DEFAULT is added to the prompt. |
| 832 | 834 | ||
| 833 | The optional argument HISTORY is a symbol to use for the history list. | 835 | The optional argument HISTORY is a symbol to use for the history list. |
| 834 | If nil, uses `regexp-history'." | 836 | If 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 |