diff options
| author | Eli Zaretskii | 2021-01-27 17:15:46 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2021-01-27 17:15:46 +0200 |
| commit | 49eb03d6c8a181fd46adbbcf1f0a976d0a9efa87 (patch) | |
| tree | 7972e6e78e4ea78ff02d035d6a323a6b987901f7 | |
| parent | 08574a7f40f27ad29efb8f7d975012ecc9111717 (diff) | |
| download | emacs-49eb03d6c8a181fd46adbbcf1f0a976d0a9efa87.tar.gz emacs-49eb03d6c8a181fd46adbbcf1f0a976d0a9efa87.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)
| -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 415815473e5..bc276c49046 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi | |||
| @@ -1994,19 +1994,21 @@ Of course, you should substitute the proper years and copyright holder. | |||
| 1994 | @section Find Identifier References | 1994 | @section Find Identifier References |
| 1995 | @cindex xref | 1995 | @cindex xref |
| 1996 | 1996 | ||
| 1997 | @cindex tag | ||
| 1997 | An @dfn{identifier} is a name of a syntactical subunit of the | 1998 | An @dfn{identifier} is a name of a syntactical subunit of the |
| 1998 | program: a function, a subroutine, a method, a class, a data type, a | 1999 | program: a function, a subroutine, a method, a class, a data type, a |
| 1999 | macro, etc. In a programming language, each identifier is a symbol in | 2000 | macro, etc. In a programming language, each identifier is a symbol in |
| 2000 | the language's syntax. Program development and maintenance requires | 2001 | the language's syntax. Identifiers are also known as @dfn{tags}. |
| 2001 | capabilities to quickly find where each identifier was defined and | 2002 | |
| 2002 | referenced, to rename identifiers across the entire project, etc. | 2003 | Program development and maintenance requires capabilities to quickly |
| 2003 | 2004 | find where each identifier was defined and referenced, to rename | |
| 2004 | These capabilities are also useful for finding references in major | 2005 | identifiers across the entire project, etc. These capabilities are |
| 2005 | modes other than those defined to support programming languages. For | 2006 | also useful for finding references in major modes other than those |
| 2006 | example, chapters, sections, appendices, etc.@: of a text or a @TeX{} | 2007 | defined to support programming languages. For example, chapters, |
| 2007 | document can be treated as subunits as well, and their names can be | 2008 | sections, appendices, etc.@: of a text or a @TeX{} document can be |
| 2008 | used as identifiers. In this chapter, we use the term ``identifiers'' | 2009 | treated as subunits as well, and their names can be used as |
| 2009 | to collectively refer to the names of any kind of subunits, in program | 2010 | identifiers. In this chapter, we use the term ``identifiers'' to |
| 2011 | collectively refer to the names of any kind of subunits, in program | ||
| 2010 | source and in other kinds of text alike. | 2012 | source and in other kinds of text alike. |
| 2011 | 2013 | ||
| 2012 | Emacs provides a unified interface to these capabilities, called | 2014 | Emacs provides a unified interface to these capabilities, called |
diff --git a/lisp/replace.el b/lisp/replace.el index 32fbc24064c..4483d7f7800 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -808,11 +808,11 @@ the function that you set this to can check `this-command'." | |||
| 808 | 808 | ||
| 809 | (defun read-regexp-suggestions () | 809 | (defun read-regexp-suggestions () |
| 810 | "Return a list of standard suggestions for `read-regexp'. | 810 | "Return a list of standard suggestions for `read-regexp'. |
| 811 | By default, the list includes the \"tag\" at point (see Info | 811 | By default, the list includes the identifier (a.k.a. \"tag\") |
| 812 | node `(emacs) Identifier Search'), the last isearch regexp, the | 812 | at point (see Info node `(emacs) Identifier Search'), the last |
| 813 | last isearch string, and the last replacement regexp. | 813 | isearch regexp, the last isearch string, and the last |
| 814 | `read-regexp' appends the list returned by this function to the | 814 | replacement regexp. `read-regexp' appends the list returned |
| 815 | end of values available via | 815 | by this function to the end of values available via |
| 816 | \\<minibuffer-local-map>\\[next-history-element]." | 816 | \\<minibuffer-local-map>\\[next-history-element]." |
| 817 | (list | 817 | (list |
| 818 | (find-tag-default-as-regexp) | 818 | (find-tag-default-as-regexp) |
| @@ -827,33 +827,35 @@ Prompt with the string PROMPT. If PROMPT ends in \":\" (followed by | |||
| 827 | optional whitespace), use it as-is. Otherwise, add \": \" to the end, | 827 | optional whitespace), use it as-is. Otherwise, add \": \" to the end, |
| 828 | possibly preceded by the default result (see below). | 828 | possibly preceded by the default result (see below). |
| 829 | 829 | ||
| 830 | The optional argument DEFAULTS can be either: nil, a string, a list | 830 | The optional argument DEFAULTS is used to construct the default |
| 831 | of strings, or a symbol. We use DEFAULTS to construct the default | 831 | return value in case of empty input. DEFAULTS can be nil, a string, |
| 832 | return value in case of empty input. | 832 | a list of strings, or a symbol. |
| 833 | 833 | ||
| 834 | If DEFAULTS is a string, we use it as-is. | 834 | If DEFAULTS is a string, the function uses it as-is. |
| 835 | 835 | ||
| 836 | If DEFAULTS is a list of strings, the first element is the | 836 | If DEFAULTS is a list of strings, the first element is the |
| 837 | default return value, but all the elements are accessible | 837 | default return value, but all the elements are accessible |
| 838 | using the history command \\<minibuffer-local-map>\\[next-history-element]. | 838 | using the history command \\<minibuffer-local-map>\\[next-history-element]. |
| 839 | 839 | ||
| 840 | DEFAULTS can be a symbol. If DEFAULTS is the symbol | 840 | If DEFAULTS is the symbol `regexp-history-last', the default return |
| 841 | `regexp-history-last', we use the first element of HISTORY (if | 841 | value will be the first element of HISTORY. If HISTORY is omitted or |
| 842 | specified) or `regexp-history'. If DEFAULTS is a symbol with a | 842 | nil, `regexp-history' is used instead. |
| 843 | function definition, we call it with no arguments and use what it | 843 | If DEFAULTS is a symbol with a function definition, it is called with |
| 844 | returns, which should be either nil, a string, or a list of | 844 | no arguments and should return either nil, a string, or a list of |
| 845 | strings. Other symbol values for DEFAULTS are ignored. If | 845 | strings, which will be used as above. |
| 846 | `read-regexp-defaults-function' is non-nil, its value is used | 846 | Other symbol values for DEFAULTS are ignored. |
| 847 | instead of DEFAULTS in the two cases described in this paragraph. | ||
| 848 | 847 | ||
| 849 | We append the standard values from `read-regexp-suggestions' to DEFAULTS | 848 | If `read-regexp-defaults-function' is non-nil, its value is used |
| 850 | before using it. | 849 | instead of DEFAULTS in the two cases described in the last paragraph. |
| 850 | |||
| 851 | Before using whatever value DEFAULTS yields, the function appends the | ||
| 852 | standard values from `read-regexp-suggestions' to that value. | ||
| 851 | 853 | ||
| 852 | If the first element of DEFAULTS is non-nil (and if PROMPT does not end | 854 | If the first element of DEFAULTS is non-nil (and if PROMPT does not end |
| 853 | in \":\", followed by optional whitespace), we add it to the prompt. | 855 | in \":\", followed by optional whitespace), DEFAULT is added to the prompt. |
| 854 | 856 | ||
| 855 | The optional argument HISTORY is a symbol to use for the history list. | 857 | The optional argument HISTORY is a symbol to use for the history list. |
| 856 | If nil, uses `regexp-history'." | 858 | If nil, use `regexp-history'." |
| 857 | (let* ((defaults | 859 | (let* ((defaults |
| 858 | (if (and defaults (symbolp defaults)) | 860 | (if (and defaults (symbolp defaults)) |
| 859 | (cond | 861 | (cond |