diff options
author | John Wiegley <johnw@newartisans.com> | 2016-01-11 22:51:27 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2016-01-11 22:51:27 -0800 |
commit | c7bef6a4f033fa6b22906de0be6da54958d5b3c3 (patch) | |
tree | 3a0f34b340ad01de290f068530c27f35aba83724 | |
parent | f5d90b5fcf0251466055c7dbed6069c1850d802d (diff) | |
parent | 1f6898d0510cd15455f665c0f38451755a374243 (diff) |
Merge from origin/emacs-25
1f6898d test/automated/vc-hg.el: Support out-of-tree build
3adb56e Minor change in tramp-tests.el
2b535ba ; * etc/NEWS: Update the js.el entry.
76b518c * etc/HELLO: Add Armenian and Mongolian greetings.
b51f1ef Java Mode: Fontify identifiers in the presence of annotations.
36b9539 Avoid an infloop when we run out of memory
2006752 Avoid unnecessary failures of auto-saving after fatal error
eef6784 Simplify HAVE_MODULES use in mark_maybe_pointer
552694a Revert attempt to use 'noexcept' in typedef
6ad0d39 Update documentation of 'indirect-function'
c6a5314 ; * etc/NEWS: Move entry of 'inhibit-point-motion-hooks'.
303141a Update documentation for obsoleting 'syntax-begin-function'
4e6f61c ; * etc/NEWS: Mark documented and not-to-be-documented entries.
e667bbb Document new features if Eshell
9c4e4e0 ; * etc/NEWS: Update EUDC entries.
1089dc9 Handle too long commands in Tramp
684eb58 * .gitattributes: *.cur and *.pif are binary files too.
d2c7fda * src/alloc.c (mark_maybe_pointer): HAVE_MODULES may be undefined
bd3f53d * sh-script.el (sh-smie-sh-rules): Improve indentation inside $(...)
09b2b8a * src/alloc.c (mark_maybe_pointer): Also check wide-int's emacs_value
cca0f93 ; Account for spaces before the filename
c71e1e8 Use short date for 'hg annotate', and output the author
f50027b Spelling fix
c7dff67 ; * etc/NEWS: Fix the Xref entries that got separated.
cc140bc Document user-level functions in project.el
f8208b6 Document the user-level features of the Xref package
b131fb8 * loading.texi: Add `define-type' entry for load-history
db3c2a8 Improve doc strings and prompts in xref.el
f6117ef Allow the use of `font-lock-extend-region-multiline' in CC Mode.
90fd798 Fix coding system for Tramp on OS X.
e985a0e ; * etc/NEWS: Mark the 'check-expensive' entry not to be documented.
9dfcbf0 Update 'load-history' docs
207e191 Fix (error ...) error
457738f Correctly analyze brace arguments in templated C++ function declarations.
d57724a * lisp/cedet/mode-local.el (describe-function-orig-buffer): Declare.
2a9532d * lisp/ffap.el (ffap-latex-mode): Avoid free variable.
1a6b084 * lisp/play/dunnet.el (dun-fix-screen): Avoid `end-of-buffer`.
8be046f Respect fontification region calculated by major mode. Fixes bug #22316.
4b37cba Improve documentation of Delete Selection mode
a034dd3 Fix two project-find-file issues
30abf29 Clarify doc string of 'dired-current-directory'
e990bb2 Use the face of preceding text for displaying the ellipsis
5810ac3 Suppress Chinese file name test for OSX in tramp-tests.el
eeb710a ; * lisp/startup.el: Sentences end with two spaces.
428b3de * admin/admin.el (set-version): Also handle the NEWS file.
648de81 ; Add NEWS entry for project.el
671862f apropos-library: Skip obvious duplicates; don't error on generics
51668a5 ; Grammar fix
ed41d11 Add project-find-file and project-or-external-find-file
056da45 ; Improve commentary in 'setup_for_ellipsis'
269d008 ; Improve docstring for `inhibit-startup-echo-area-message'
50 files changed, 1181 insertions, 578 deletions
diff --git a/.gitattributes b/.gitattributes index 8f61c807d7..5ccf9a5eab 100644 --- a/.gitattributes +++ b/.gitattributes @@ -34,12 +34,14 @@ test/etags/html-src/algrthms.html whitespace=cr-at-eol doc/misc/texinfo.tex -whitespace=blank-at-eol # Some files should not be treated as text when diffing or merging. +*.cur binary *.gpg binary *.gz binary *.icns binary *.ico binary *.pbm binary *.pdf binary +*.pif binary *.png binary *.sig binary *.tiff binary diff --git a/admin/admin.el b/admin/admin.el index 7923f0bb46..fe807ff96f 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -96,13 +96,74 @@ Root must be the root of an Emacs source tree." (submatch (1+ (in "0-9.")))))) ;; Major version only. (when (string-match "\\([0-9]\\{2,\\}\\)" version) - (setq version (match-string 1 version)) - (set-version-in-file root "src/msdos.c" version - (rx (and "Vwindow_system_version" (1+ not-newline) - ?\( (submatch (1+ (in "0-9"))) ?\)))) - (set-version-in-file root "etc/refcards/ru-refcard.tex" version - "\\\\newcommand{\\\\versionemacs}\\[0\\]\ -{\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs")) + (let ((newmajor (match-string 1 version))) + (set-version-in-file root "src/msdos.c" newmajor + (rx (and "Vwindow_system_version" (1+ not-newline) + ?\( (submatch (1+ (in "0-9"))) ?\)))) + (set-version-in-file root "etc/refcards/ru-refcard.tex" newmajor + "\\\\newcommand{\\\\versionemacs}\\[0\\]\ +{\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs"))) + (let* ((oldversion + (with-temp-buffer + (insert-file-contents (expand-file-name "README" root)) + (if (re-search-forward "version \\([0-9.]*\\)" nil t) + (version-to-list (match-string 1))))) + (oldmajor (if oldversion (car oldversion))) + (newversion (version-to-list version)) + (newmajor (car newversion)) + (newshort (format "%s.%s" newmajor + (+ (cadr newversion) + (if (eq 2 (length newversion)) 0 1)))) + (majorbump (and oldversion (not (equal oldmajor newmajor)))) + (minorbump (and oldversion (not majorbump) + (not (equal (cadr oldversion) (cadr newversion))))) + (newsfile (expand-file-name "etc/NEWS" root)) + (oldnewsfile (expand-file-name (format "etc/NEWS.%s" oldmajor) root))) + (when (and majorbump + (not (file-exists-p oldnewsfile))) + (rename-file newsfile oldnewsfile) + (find-file oldnewsfile) ; to prompt you to commit it + (copy-file oldnewsfile newsfile) + (with-temp-buffer + (insert-file-contents newsfile) + (re-search-forward "is about changes in Emacs version \\([0-9]+\\)") + (replace-match (number-to-string newmajor) nil nil nil 1) + (re-search-forward "^See files \\(NEWS\\)") + (replace-match (format "NEWS.%s, NEWS" oldmajor) nil nil nil 1) + (let ((start (line-beginning-position))) + (search-forward "in older Emacs versions") + (or (equal start (line-beginning-position)) + (fill-region start (line-beginning-position 2)))) + (re-search-forward "^$") + (forward-line -1) + (let ((start (point))) + (goto-char (point-max)) + (re-search-backward "^$" nil nil 2) + (delete-region start (line-beginning-position 0))) + (write-region nil nil newsfile))) + (when (or majorbump minorbump) + (find-file newsfile) + (goto-char (point-min)) + (if (re-search-forward (format "^\\* .*in Emacs %s" newshort) nil t) + (progn + (kill-buffer) + (message "No need to update etc/NEWS")) + (goto-char (point-min)) + (re-search-forward "^$") + (forward-line -1) + (dolist (s '("Installation Changes" "Startup Changes" "Changes" + "Editing Changes" + "Changes in Specialized Modes and Packages" + "New Modes and Packages" + "Incompatible Lisp Changes" + "Lisp Changes")) + (insert (format "\n\n* %s in Emacs %s\n" s newshort))) + (insert (format "\n\n* Changes in Emacs %s on \ +Non-Free Operating Systems\n" newshort))) + ;; Because we skip "bump version" commits when merging between branches. + ;; Probably doesn't matter in practice, because NEWS changes + ;; will only happen on master anyway. + (message "Commit any NEWS changes separately"))) (message "Setting version numbers...done")) ;; Note this makes some assumptions about form of short copyright. diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 3a12795d2b..3fa89d9062 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -360,8 +360,8 @@ that specifies how to run @command{grep}. Use the same arguments you would give @command{grep} when running it normally: a @command{grep}-style regexp (usually in single-quotes to quote the shell's special characters) followed by file names, which may use wildcards. If you -specify a prefix argument for @kbd{M-x grep}, it finds the tag -(@pxref{Tags}) in the buffer around point, and puts that into the +specify a prefix argument for @kbd{M-x grep}, it finds the identifier +(@pxref{Xref}) in the buffer around point, and puts that into the default @command{grep} command. Your command need not simply run @command{grep}; you can use any shell diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index 119a10ccc0..92c1fd5a04 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi @@ -785,8 +785,8 @@ Search all the specified files for the regular expression @var{regexp} (@code{dired-do-search}). This command is a variant of @code{tags-search}. The search stops at -the first match it finds; use @kbd{M-,} to resume the search and find -the next match. @xref{Tags Search}. +the first match it finds; use @kbd{M-x tags-loop-continue} to resume +the search and find the next match. @xref{Identifier Search}. @kindex Q @r{(Dired)} @findex dired-do-query-replace-regexp @@ -797,8 +797,8 @@ replacing matches for @var{regexp} with the string @var{to} (@code{dired-do-query-replace-regexp}). This command is a variant of @code{tags-query-replace}. If you exit the -query replace loop, you can use @kbd{M-,} to resume the scan and replace -more matches. @xref{Tags Search}. +query replace loop, you can use @kbd{M-x tags-loop-continue} to resume +the scan and replace more matches. @xref{Identifier Search}. @end table @node Shell Commands in Dired diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 53b689fbfb..5ef938566d 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -788,8 +788,8 @@ Maintaining Large Programs * Version Control:: Using version control systems. * Change Log:: Maintaining a change history for your program. -* Tags:: Go directly to any function in your program in one - command. Tags remembers which file it is in. +* Xref:: Find definitions and references of any function, + method, struct, macro, @dots{} in your program. * EDE:: An integrated development environment for Emacs. @ifnottex * Emerge:: A convenient way of merging two versions of a program. @@ -861,15 +861,25 @@ Change Logs * Change Log Commands:: Commands for editing change log files. * Format of ChangeLog:: What the change log file looks like. +Xref + +* Find Identifiers:: Commands to find where an identifier is defined + or referenced, to list identifiers, etc. +* Tags Tables:: Tags table records which file defines a symbol. +* Select Tags Table:: How to visit a specific tags table. + +Find Identifiers + +* Looking Up Identifiers:: Commands to find the definition of a specific tag. +* Xref Commands:: Commands in the @file{*xref*} buffer. +* Identifier Search:: Searching and replacing identifiers. +* List Identifiers:: Listing identifiers and completing on them. + Tags Tables * Tag Syntax:: Tag syntax for various types of code and text files. * Create Tags Table:: Creating a tags table with @command{etags}. * Etags Regexps:: Create arbitrary tags using regular expressions. -* Select Tags Table:: How to visit a tags table. -* Find Tag:: Commands to find the definition of a specific tag. -* Tags Search:: Using a tags table for searching and replacing. -* List Tags:: Using tags for completion, and listing them. @ifnottex Merging Files with Emerge diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index a0489975c7..5fbe0fc577 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -416,9 +416,9 @@ Start composing a mail message in another frame. This runs @code{compose-mail-other-frame}. It is the other-frame variant of @kbd{C-x m}. @xref{Sending Mail}. @item C-x 5 . -Find a tag in the current tag table in another frame. This runs -@code{find-tag-other-frame}, the multiple-frame variant of @kbd{M-.}. -@xref{Tags}. +Find the definition of an identifier in another frame. This runs +@code{xref-find-definitions-other-frame}, the multiple-frame variant +of @kbd{M-.}. @xref{Xref}. @item C-x 5 r @var{filename} @key{RET} @kindex C-x 5 r @findex find-file-read-only-other-frame diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi index 4b9832f904..bce97dacee 100644 --- a/doc/emacs/glossary.texi +++ b/doc/emacs/glossary.texi @@ -1329,7 +1329,7 @@ indentation or completion. @anchor{Glossary---Tags Table} @item Tags Table A tags table is a file that serves as an index to the function -definitions in one or more other files. @xref{Tags}. +definitions in one or more other files. @xref{Tags Tables}. @item Termscript File 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 7b72e6650c..8842b8ea2f 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -5,17 +5,42 @@ @node Maintaining @chapter Maintaining Large Programs - This chapter describes Emacs features for maintaining large -programs. If you are maintaining a large Lisp program, then in -addition to the features described here, you may find -the Emacs Lisp Regression Testing (ERT) library useful -(@pxref{Top,,ERT,ert, Emacs Lisp Regression Testing}). + This chapter describes Emacs features for maintaining medium- to +large-size programs and packages. These features include: + +@itemize @minus +@item +Unified interface to Support for Version Control Systems +(@acronym{VCS}) that record the history of changes to source files. + +@item +A specialized mode for maintaining @file{ChangeLog} files that provide +a chronological log of program changes. + +@item +@acronym{Xref}, a set of commands for displaying definitions of +symbols (a.k.a.@: ``identifiers'') and their references. + +@item +@acronym{EDE}, the Emacs's own IDE. + +@ifnottex +@item +A mode for merging changes to program sources made on separate +branches of development. +@end ifnottex +@end itemize + +If you are maintaining a large Lisp program, then in addition to the +features described here, you may find the Emacs Lisp Regression +Testing (@acronym{ERT}) library useful (@pxref{Top,,ERT,ert, Emacs +Lisp Regression Testing}). @menu * Version Control:: Using version control systems. * Change Log:: Maintaining a change history for your program. -* Tags:: Go directly to any function in your program in one - command. Tags remembers which file it is in. +* Xref:: Find definitions and references of any function, + method, struct, macro, @dots{} in your program. * EDE:: An integrated development environment for Emacs. @ifnottex * Emerge:: A convenient way of merging two versions of a program. @@ -1660,16 +1685,370 @@ permitted provided the copyright notice and this notice are preserved. @noindent Of course, you should substitute the proper years and copyright holder. -@node Tags -@section Tags Tables -@cindex tags and tag tables +@node Xref +@section Find Identifier Definitions and References +@cindex xref + + An @dfn{identifier} is a syntactic elements of the program: a +function, a subroutine, a method, a class, a data type, a macro, etc. +In a programming language, each identifier is a symbol in the +language's syntax. Many program development tools provide +capabilities to extract references to identifiers from source files, +record them on specialized data bases, and then use those data bases +to quickly find where each identifier was defined and referenced. + +Emacs provides a unified user interface to these tools, called +@samp{xref}. The tools supported by @samp{xref} include: + +@enumerate a +@item +Some major modes provide built-in means for looking up the language +symbols. For example, Emacs Lisp symbols can be identified by +searching the package load history, maintained by the Emacs Lisp +interpreter, and by consulting the built-in documentation strings; the +Emacs Lisp mode uses these facilities to find definitions of symbols. + +@item +Etags, the command for tagging identifier definitions which is part of +the Emacs distribution. @xref{Create Tags Table}. + +@item +@acronym{GNU} GLOBAL, the source code tagging system, which provides +the @command{gtags} command and associated utilities. @xref{Command +Line, gtags, , global, GNU GLOBAL source code tag system}. + +@item +Cscope (@uref{http://cscope.sourceforge.net/}, a tool for browsing +source code. + +@item +@acronym{GNU} IDUtils, a package for generating databases of +identifier references and querying those databases. @xref{Top,,, +idutils, ID database utilities}. + +@item +Grep, the venerable program that searches files for lines matching +patterns. @xref{Invoking,,, grep, GNU Grep Manual}. +@end enumerate + +@noindent +Additional tools could be supported as they become available, or as +user extensions. Each such tool is used as a @dfn{backend} by +commands described in this section. Each command detects which +backends are available for the current major mode, and uses the most +capable of the available backends, with Grep generally serving as the +fall-back backend. + +@cindex tag +The commands described here are useful for finding references in major +modes other than those defined to support programming languages. For +example, chapters, sections, appendices, etc. of a text or a @TeX{} +document can be treated as identifiers as well. In this chapter, we +collectively refer to a reference that specifies the name of the file +where the corresponding subunit is defined, and the position of the +subunit's definition in that file, as a @dfn{tag}. We refer to the +backends used by @code{xref} as @dfn{tagging backends}. + +@menu +* Find Identifiers:: Commands to find where an identifier is defined + or referenced, to list identifiers, etc. +* Tags Tables:: Tags table records which file defines a symbol. +* Select Tags Table:: How to visit a specific tags table. +@end menu + +@node Find Identifiers +@subsection Find Identifiers + + This subsection describes the commands that use the tagging backends +in order to find definitions of identifiers, references to +identifiers, and perform various queries about identifiers. With most +backends, these definitions and references were recorded as tags in +the database created and maintained by the backend. + +@menu +* Looking Up Identifiers:: Commands to find the definition of a specific tag. +* Xref Commands:: Commands in the @file{*xref*} buffer. +* Identifier Search:: Searching and replacing identifiers. +* List Identifiers:: Listing identifiers and completing on them. +@end menu + +@node Looking Up Identifiers +@subsubsection Looking Up Identifiers +@cindex find definition of symbols +@cindex identifier, finding definition of +@cindex find references to symbols + + The most important thing that @code{xref} enables you to do is to find +the definition of a specific identifier. + +@table @kbd +@item M-.@: +Find definitions of an identifier (@code{xref-find-definitions}). +@item C-M-. @var{pattern} @key{RET} +Find all identifiers whose name matches @var{pattern} +(@code{xref-find-apropos}). +@item C-x 4 .@: @key{RET} +Find definitions of identifier, but display it in another window +(@code{xref-find-definitions-other-window}). +@item C-x 5 .@: @key{RET} +Find definition of identifier, and display it in a new frame +(@code{xref-find-definitions-other-frame}). +@item M-, +Pop back to where you previously invoked @kbd{M-.} and friends +(@code{xref-pop-marker-stack}). +@end table + +@kindex M-. +@findex xref-find-definitions + @kbd{M-.}@: (@code{xref-find-definitions}) shows the definitions of +the identifier at point. With a prefix argument, or if there's no +valid identifier at point, it prompts for the identifier. If the +identifier has only one definition, the command jumps to it. If the +identifier has more than one possible definition (e.g., in an +object-oriented language, or if there's a function and a variable by +the same name), the command shows the candidate definitions in a +@file{*xref*} buffer, together with the files in which these +definitions are found. Selecting one of these candidates by typing +@kbd{@key{RET}} or clicking @kbd{Mouse-2} will pop a buffer showing +the corresponding definition. + + When entering the identifier argument to @kbd{M-.}, the usual +minibuffer completion commands can be used (@pxref{Completion}), with +the known identifier names as completion candidates. - A @dfn{tag} is a reference to a subunit in a program or in a -document. In source code, tags reference syntactic elements of the -program: functions, subroutines, data types, macros, etc. In a -document, tags reference chapters, sections, appendices, etc. Each -tag specifies the name of the file where the corresponding subunit is -defined, and the position of the subunit's definition in that file. +@kindex C-x 4 . +@findex xref-find-definitions-other-window +@kindex C-x 5 . +@findex xref-find-definitions-other-frame + Like most commands that can switch buffers, +@code{xref-find-definitions} has a variant that displays the new +buffer in another window, and one that makes a new frame for it. The +former is @w{@kbd{C-x 4 .}} +(@code{xref-find-definitions-other-window}), and the latter is +@w{@kbd{C-x 5 .}} (@code{xref-find-definitions-other-frame}). + +@findex xref-find-apropos +@kindex C-M-. + The command @kbd{C-M-.} (@code{xref-find-apropos}) finds the +definitions of one or more identifiers that match a specified regular +expression. It is just like @kbd{M-.} except that it does regexp +matching of identifiers instead of symbol name matching. + + When any of the above commands finds more than one definition, it +presents the @file{*xref*} buffer showing the definition candidates. +In that buffer, you have several specialized commands, described in +@ref{Xref Commands}. + +@kindex M-, +@findex xref-pop-marker-stack +@vindex xref-marker-ring-length + To go back to places @emph{from where} you found the definition, +use @kbd{M-,} (@code{xref-pop-marker-stack}). It jumps back to the +point of the last invocation of @kbd{M-.}. Thus you can find and +examine the definition of something with @kbd{M-.} and then return to +where you were with @kbd{M-,}. @kbd{M-,} allows you to retrace your +steps to a depth determined by the variable +@code{xref-marker-ring-length}, which defaults to 16. + +@node Xref Commands +@subsubsection Commands Available in the @file{*xref*} Buffer +@cindex commands in @file{*xref*} buffers +@cindex XREF mode + + The following commands are provided in the @file{*xref*} buffer by +the special XREF mode: + +@table @kbd +@item @key{RET} +@itemx Mouse-2 +Display the reference on the current line and bury the @file{*xref*} +buffer. +@item n +@itemx . +@findex xref-next-line +Move to the next reference and display it in the other window +(@code{xref-next-line}). +@item p +@itemx , +@findex xref-prev-line +Move to the previous reference and display it in the other window +(@code{xref-prev-line}). +@item C-o +@findex xref-show-location-at-point +Display the reference on the current line in the other window +(@code{xref-show-location-at-point}). +@findex xref-query-replace +@item r @var{pattern} @key{RET} @var{replacement} @key{RET} +Perform interactive query-replace on references that match +@var{pattern} (@code{xref-query-replace}), replacing the match with +@var{replacement}. @xref{Identifier Search}. +@findex xref-quit +@item q +Quit the window showing the @file{*xref*} buffer (@code{xref-quit}). +@end table + +In addition, the usual navigation commands, such as the arrow keys, +@kbd{C-n}, and @kbd{C-p} are available for moving around the buffer +without displaying the references. + +@node Identifier Search +@subsubsection Searching and Replacing with Identifiers +@cindex search and replace in multiple files +@cindex multiple-file search and replace + + The commands in this section visit and search all the files listed +in the @code{xref} backend's database, one by one. For these +commands, the database serves only to specify a sequence of files to +search. These commands scan all the databases starting with the first +one (if any) that describes the current file, proceed from there to +the end of the list, and then scan from the beginning of the list +until they have covered all the databases in the list. + +@table @kbd +@item M-? +Find all the references for the identifier at point. +@item M-x xref-query-replace @key{RET} @var{regexp} @key{RET} @var{replacement} @key{RET} +Interactively replace @var{regexp} with @var{replacement} in the names +of all the identifiers shown in the @file{*xref*} buffer. +@item M-x tags-search @key{RET} @var{regexp} @key{RET} +Search for @var{regexp} through the files in the selected tags +table. +@item M-x tags-query-replace @key{RET} @var{regexp} @key{RET} @var{replacement} @key{RET} +Perform a @code{query-replace-regexp} on each file in the selected tags table. +@item M-x tags-loop-continue +Restart one of the last 2 commands above, from the current location of point. +@end table + +@kindex M-? +@findex xref-find-references + @kbd{M-?} finds all the references for the identifier at point. If +there's no valid identifier at point, or when invoked with a prefix +argument, the command prompts for the identifier, with completion. It +then presents a @file{*xref*} buffer with all the references to the +identifier, showing the file name and the line where the identifier is +referenced. The XREF mode commands are available in this buffer, see +@ref{Xref Commands}. + +@findex xref-query-replace + @kbd{M-x xref-query-replace} reads a regexp to match identifier +names and a string to replace with, just like ordinary @kbd{M-x +query-replace-regexp}. It then performs the specified replacement in +the names of the matching identifiers in all the places in all the +files where these identifiers are referenced. This is useful when you +rename your identifiers as part of refactoring. This command should +be invoked in the @file{*xref*} buffer generated by @code{M-?}. + +@findex tags-search + @kbd{M-x tags-search} reads a regexp using the minibuffer, then +searches for matches in all the files in the selected tags table, one +file at a time. It displays the name of the file being searched so +you can follow its progress. As soon as it finds an occurrence, +@code{tags-search} returns. This command works only with the etags +backend, and requires tags tables to be available (@pxref{Tags +Tables}). + +@findex tags-loop-continue + Having found one match, you probably want to find all the rest. +Type @kbd{M-x tags-loop-continue}) to resume the @code{tags-search}, +finding one more match. This searches the rest of the current buffer, +followed by the remaining files of the tags table. + +@findex tags-query-replace + @kbd{M-x tags-query-replace} performs a single +@code{query-replace-regexp} through all the files in the tags table. It +reads a regexp to search for and a string to replace with, just like +ordinary @kbd{M-x query-replace-regexp}. It searches much like @kbd{M-x +tags-search}, but repeatedly, processing matches according to your +input. @xref{Query Replace}, for more information on query replace. +This command works only with the etags backend. + +@vindex tags-case-fold-search +@cindex case-sensitivity and tags search + You can control the case-sensitivity of tags search commands by +customizing the value of the variable @code{tags-case-fold-search}. The +default is to use the same setting as the value of +@code{case-fold-search} (@pxref{Lax Search}). + + It is possible to get through all the files in the tags table with a +single invocation of @kbd{M-x tags-query-replace}. But often it is +useful to exit temporarily, which you can do with any input event that +has no special query replace meaning. You can resume the query +replace subsequently by typing @kbd{M-x tags-loop-continue}; this +command resumes the last tags search or replace command that you did. +For instance, to skip the rest of the current file, you can type +@kbd{M-> M-x tags-loop-continue}. + + The commands in this section carry out much broader searches than +the @code{xref-find-definitions} family. The +@code{xref-find-definitions} commands search only for definitions of +identifiers that match your string or regexp. The commands +@code{tags-search} and @code{tags-query-replace} find every occurrence +of the regexp, as ordinary search commands and replace commands do in +the current buffer. + + As an alternative to @code{tags-search}, you can run @command{grep} +as a subprocess and have Emacs show you the matching lines one by one. +@xref{Grep Searching}. + +@node List Identifiers +@subsubsection Identifier Inquiries + +@table @kbd +@item C-M-i +@itemx M-@key{TAB} +Perform completion on the text around point, using the @code{xref} +backend if one is available (@code{completion-at-point}). +@item M-x list-tags @key{RET} @var{file} @key{RET} +Display a list of the tags defined in the program file @var{file}. +@item M-x xref-find-apropos @key{RET} @var{regexp} @key{RET} +Display a list of all known identifiers matching @var{regexp}. +@end table + +@cindex completion (symbol names) + In most programming language modes, you can type @kbd{C-M-i} or +@kbd{M-@key{TAB}} (@code{completion-at-point}) to complete the symbol +at point. If there is an @code{xref} backend available, this command +can use it to generate completion candidates more intelligently. +@xref{Symbol Completion}. + +@findex list-tags + @kbd{M-x list-tags} reads the name of one of the files covered by +the selected tags table, and displays a list of tags defined in that +file. Do not include a directory as part of the file name unless the +file name recorded in the tags table includes a directory. This +command works only with the etags backend, and requires a tags table +for the project to be available. @xref{Tags Tables}. + +@c Sadly, the new-and-improved Xref feature doesn't provide anything +@c close to the described below features of the now-obsoleted +@c tags-apropos. I'm leaving this here to encourage enhancements to +@c xref.el. +@ignore +@findex tags-apropos +@vindex tags-apropos-verbose +@vindex tags-tag-face +@vindex tags-apropos-additional-actions + @kbd{M-x tags-apropos} is like @code{apropos} for tags +(@pxref{Apropos}). It displays a list of tags in the selected tags +table whose entries match @var{regexp}. If the variable +@code{tags-apropos-verbose} is non-@code{nil}, it displays the names +of the tags files together with the tag names. You can customize the +appearance of the output by setting the variable @code{tags-tag-face} +to a face. You can display additional output by customizing the +variable @code{tags-apropos-additional-actions}; see its documentation +for details. +@end ignore + +@findex next-file + @kbd{M-x next-file} visits files covered by the selected tags table. +The first time it is called, it visits the first file covered by the +table. Each subsequent call visits the next covered file, unless a +prefix argument is supplied, in which case it returns to the first +file. This command works only with the etags backend. + +@node Tags Tables +@subsection Tags Tables +@cindex tags and tag tables A @dfn{tags table} records the tags extracted by scanning the source code of a certain program or a certain document. Tags extracted from @@ -1685,12 +2064,14 @@ source files. on a document or the source code file. The @samp{etags} program writes the tags to a @dfn{tags table file}, or @dfn{tags file} in short. The conventional name for a tags file is @file{TAGS}@. -@xref{Create Tags Table}. +@xref{Create Tags Table}. (It is also possible to create a tags table +by using one of the commands from other packages that can produce such +tables in the same format.) - Emacs provides many commands for searching and replacing using the -information recorded in tags tables. For instance, the @kbd{M-.} -(@code{find-tag}) jumps to the location of a specified function -definition in its source file. @xref{Find Tag}. + Emacs uses the tags tables via the @code{etags} package as one of +the supported backends for @code{xref}. Because tags tables are +produced by the @command{etags} command that is part of an Emacs +distribution, we describe tags tables in more detail here. @cindex C++ class browser, tags @cindex tags, C++ @@ -1706,14 +2087,10 @@ use tags, separate from the @command{etags} facility. * Tag Syntax:: Tag syntax for various types of code and text files. * Create Tags Table:: Creating a tags table with @command{etags}. * Etags Regexps:: Create arbitrary tags using regular expressions. -* Select Tags Table:: How to visit a tags table. -* Find Tag:: Commands to find the definition of a specific tag. -* Tags Search:: Using a tags table for searching and replacing. -* List Tags:: Using tags for completion, and listing them. @end menu @node Tag Syntax -@subsection Source File Tag Syntax +@subsubsection Source File Tag Syntax Here is how tag syntax is defined for the most popular languages: @@ -1883,13 +2260,17 @@ line. @item In Python code, @code{def} or @code{class} at the beginning of a line generate a tag. + +@item +In Ruby code, @code{def} or @code{class} or @code{module} at the +beginning of a line generate a tag. @end itemize You can also generate tags based on regexp matching (@pxref{Etags Regexps}) to handle other formats and languages. @node Create Tags Table -@subsection Creating Tags Tables +@subsubsection Creating Tags Tables @cindex @command{etags} program The @command{etags} program is used to create a tags table file. It knows @@ -1946,7 +2327,7 @@ source files, and the tags file will still refer correctly to the source files. If the tags file is @file{-} or is in the @file{/dev} directory, however, the file names are made relative to the current working directory. This is useful, for -example, when writing the tags to @file{/dev/stdout}. +example, when writing the tags to the standard output. When using a relative file name, it should not be a symbolic link pointing to a tags file in a different directory, because this would @@ -1992,7 +2373,7 @@ options, it outputs detailed information about how tags are generated for @var{lang}. @node Etags Regexps -@subsection Etags Regexps +@subsubsection Etags Regexps The @samp{--regex} option to @command{etags} allows tags to be recognized by regular expression matching. You can intermix this @@ -2151,7 +2532,7 @@ etags --language=none \ @subsection Selecting a Tags Table @findex visit-tags-table - Emacs has at any time one @dfn{selected} tags table. All the + Emacs has at any time at most one @dfn{selected} tags table. All the commands for working with tags tables use the selected one. To select a tags table, type @kbd{M-x visit-tags-table}, which reads the tags table file name as an argument, with @file{TAGS} in the default @@ -2192,212 +2573,6 @@ table mentions that file, as explained above. Do not set both @code{tags-file-name} and @code{tags-table-list}. -@node Find Tag -@subsection Finding a Tag - - The most important thing that a tags table enables you to do is to find -the definition of a specific tag. - -@table @kbd -@item M-.@: @var{tag} @key{RET} -Find first definition of @var{tag} (@code{find-tag}). -@item C-u M-. -Find next alternate definition of last tag specified. -@item C-u - M-. -Go back to previous tag found. -@item C-M-. @var{pattern} @key{RET} -Find a tag whose name matches @var{pattern} (@code{find-tag-regexp}). -@item C-u C-M-. -Find the next tag whose name matches the last pattern used. -@item C-x 4 .@: @var{tag} @key{RET} -Find first definition of @var{tag}, but display it in another window -(@code{find-tag-other-window}). -@item C-x 5 .@: @var{tag} @key{RET} -Find first definition of @var{tag}, and create a new frame to select the -buffer (@code{find-tag-other-frame}). -@item M-* -Pop back to where you previously invoked @kbd{M-.} and friends. -@end table - -@kindex M-. -@findex find-tag - @kbd{M-.}@: (@code{find-tag}) prompts for a tag name and jumps to -its source definition. It works by searching through the tags table -for that tag's file and approximate character position, visiting that -file, and searching for the tag definition at ever-increasing -distances away from the recorded approximate position. - - When entering the tag argument to @kbd{M-.}, the usual minibuffer -completion commands can be used (@pxref{Completion}), with the tag -names in the selected tags table as completion candidates. If you -specify an empty argument, the balanced expression in the buffer -before or around point is the default argument. @xref{Expressions}. - - You don't need to give @kbd{M-.} the full name of the tag; a part -will do. @kbd{M-.} finds tags which contain that argument as a -substring. However, it prefers an exact match to a substring match. -To find other tags that match the same substring, give @code{find-tag} -a numeric argument, as in @kbd{C-u M-.} or @kbd{M-0 M-.}; this does -not read a tag name, but continues searching the tags table's text for -another tag containing the same substring last used. - -@kindex C-x 4 . -@findex find-tag-other-window -@kindex C-x 5 . -@findex find-tag-other-frame - Like most commands that can switch buffers, @code{find-tag} has a -variant that displays the new buffer in another window, and one that -makes a new frame for it. The former is @w{@kbd{C-x 4 .}} -(@code{find-tag-other-window}), and the latter is @w{@kbd{C-x 5 .}} -(@code{find-tag-other-frame}). - - To move back to previous tag definitions, use @kbd{C-u - M-.}; more -generally, @kbd{M-.} with a negative numeric argument. Similarly, -@w{@kbd{C-x 4 .}} with a negative argument finds the previous tag -location in another window. - -@kindex M-* -@findex pop-tag-mark -@vindex find-tag-marker-ring-length - As well as going back to places you've found tags recently, you can -go back to places @emph{from where} you found them, using @kbd{M-*} -(@code{pop-tag-mark}). Thus you can find and examine the definition -of something with @kbd{M-.} and then return to where you were with -@kbd{M-*}. - - Both @kbd{C-u - M-.} and @kbd{M-*} allow you to retrace your steps to -a depth determined by the variable @code{find-tag-marker-ring-length}. - -@findex find-tag-regexp -@kindex C-M-. - The command @kbd{C-M-.} (@code{find-tag-regexp}) visits the tags that -match a specified regular expression. It is just like @kbd{M-.} except -that it does regexp matching instead of substring matching. - -@node Tags Search -@subsection Searching and Replacing with Tags Tables -@cindex search and replace in multiple files -@cindex multiple-file search and replace - - The commands in this section visit and search all the files listed -in the selected tags table, one by one. For these commands, the tags -table serves only to specify a sequence of files to search. These -commands scan the list of tags tables starting with the first tags -table (if any) that describes the current file, proceed from there to -the end of the list, and then scan from the beginning of the list -until they have covered all the tables in the list. - -@table @kbd -@item M-x tags-search @key{RET} @var{regexp} @key{RET} -Search for @var{regexp} through the files in the selected tags -table. -@item M-x tags-query-replace @key{RET} @var{regexp} @key{RET} @var{replacement} @key{RET} -Perform a @code{query-replace-regexp} on each file in the selected tags table. -@item M-, -Restart one of the commands above, from the current location of point -(@code{tags-loop-continue}). -@end table - -@findex tags-search - @kbd{M-x tags-search} reads a regexp using the minibuffer, then -searches for matches in all the files in the selected tags table, one -file at a time. It displays the name of the file being searched so you -can follow its progress. As soon as it finds an occurrence, -@code{tags-search} returns. - -@kindex M-, -@findex tags-loop-continue - Having found one match, you probably want to find all the rest. -Type @kbd{M-,} (@code{tags-loop-continue}) to resume the -@code{tags-search}, finding one more match. This searches the rest of -the current buffer, followed by the remaining files of the tags table. - -@findex tags-query-replace - @kbd{M-x tags-query-replace} performs a single -@code{query-replace-regexp} through all the files in the tags table. It -reads a regexp to search for and a string to replace with, just like -ordinary @kbd{M-x query-replace-regexp}. It searches much like @kbd{M-x -tags-search}, but repeatedly, processing matches according to your -input. @xref{Query Replace}, for more information on query replace. - -@vindex tags-case-fold-search -@cindex case-sensitivity and tags search - You can control the case-sensitivity of tags search commands by -customizing the value of the variable @code{tags-case-fold-search}. The -default is to use the same setting as the value of -@code{case-fold-search} (@pxref{Lax Search}). - - It is possible to get through all the files in the tags table with a -single invocation of @kbd{M-x tags-query-replace}. But often it is -useful to exit temporarily, which you can do with any input event that -has no special query replace meaning. You can resume the query -replace subsequently by typing @kbd{M-,}; this command resumes the -last tags search or replace command that you did. For instance, to -skip the rest of the current file, you can type @kbd{M-> M-,}. - - The commands in this section carry out much broader searches than the -@code{find-tag} family. The @code{find-tag} commands search only for -definitions of tags that match your substring or regexp. The commands -@code{tags-search} and @code{tags-query-replace} find every occurrence -of the regexp, as ordinary search commands and replace commands do in -the current buffer. - - These commands create buffers only temporarily for the files that they -have to search (those which are not already visited in Emacs buffers). -Buffers in which no match is found are quickly killed; the others -continue to exist. - - As an alternative to @code{tags-search}, you can run @command{grep} -as a subprocess and have Emacs show you the matching lines one by one. -@xref{Grep Searching}. - -@node List Tags -@subsection Tags Table Inquiries - -@table @kbd -@item C-M-i -@itemx M-@key{TAB} -Perform completion on the text around point, using the selected tags -table if one is loaded (@code{completion-at-point}). -@item M-x list-tags @key{RET} @var{file} @key{RET} -Display a list of the tags defined in the program file @var{file}. -@item M-x tags-apropos @key{RET} @var{regexp} @key{RET} -Display a list of all tags matching @var{regexp}. -@end table - -@cindex completion (symbol names) - In most programming language modes, you can type @kbd{C-M-i} or -@kbd{M-@key{TAB}} (@code{completion-at-point}) to complete the symbol -at point. If there is a selected tags table, this command can use it -to generate completion candidates. @xref{Symbol Completion}. - -@findex list-tags - @kbd{M-x list-tags} reads the name of one of the files covered by -the selected tags table, and displays a list of tags defined in that -file. Do not include a directory as part of the file name unless the -file name recorded in the tags table includes a directory. - -@findex tags-apropos -@vindex tags-apropos-verbose -@vindex tags-tag-face -@vindex tags-apropos-additional-actions - @kbd{M-x tags-apropos} is like @code{apropos} for tags -(@pxref{Apropos}). It displays a list of tags in the selected tags -table whose entries match @var{regexp}. If the variable -@code{tags-apropos-verbose} is non-@code{nil}, it displays the names -of the tags files together with the tag names. You can customize the -appearance of the output by setting the variable @code{tags-tag-face} -to a face. You can display additional output by customizing the -variable @code{tags-apropos-additional-actions}; see its documentation -for details. - -@findex next-file - @kbd{M-x next-file} visits files covered by the selected tags table. -The first time it is called, it visits the first file covered by the -table. Each subsequent call visits the next covered file, unless a -prefix argument is supplied, in which case it returns to the first -file. - @node EDE @section Emacs Development Environment @cindex EDE (Emacs Development Environment) diff --git a/doc/emacs/mark.texi b/doc/emacs/mark.texi index 28b4e3ddae..98980d5fb3 100644 --- a/doc/emacs/mark.texi +++ b/doc/emacs/mark.texi @@ -288,7 +288,9 @@ instead signal an error if the mark is inactive. active---for example, typing @kbd{a} inserts the character @samp{a}, then deactivates the mark. If you enable Delete Selection mode, a minor mode, then inserting text while the mark is active causes the -text in the region to be deleted first. To toggle Delete Selection +text in the region to be deleted first. Also, commands that normally +delete just one character, such as @kbd{C-d} or @kbd{@key{DEL}}, will +delete the entire region instead. To toggle Delete Selection mode on or off, type @kbd{M-x delete-selection-mode}. @node Mark Ring diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 97c74a9ce8..e4bd85c0dd 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -271,7 +271,7 @@ bindings for that purpose. The Imenu facility offers a way to find the major definitions in a file by name. It is also useful in text formatter major modes, where it treats each chapter, section, etc., as a definition. -(@xref{Tags}, for a more powerful feature that handles multiple files +(@xref{Xref}, for a more powerful feature that handles multiple files together.) @findex imenu @@ -1358,7 +1358,7 @@ the @kbd{M-@key{TAB}} key is usually reserved by the window manager for switching graphical windows, so you should type @kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} instead. -@cindex tags-based completion +@cindex xref-based completion @findex completion-at-point @cindex Lisp symbol completion @cindex completion (Lisp symbols) @@ -1368,7 +1368,7 @@ which generates its completion list in a flexible way. If Semantic mode is enabled, it tries to use the Semantic parser data for completion (@pxref{Semantic}). If Semantic mode is not enabled or fails at performing completion, it tries to complete using the -selected tags table (@pxref{Tags}). If in Emacs Lisp mode, it +available @code{xref} backend (@pxref{Xref}). If in Emacs Lisp mode, it performs completion using the function, variable, or property names defined in the current Emacs session. diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index cc516ec2d4..bef74e3b2c 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -12,10 +12,10 @@ a string. Emacs also has commands to replace occurrences of a string with a different string. There are also commands that do the same thing, but search for patterns instead of fixed strings. - You can also search multiple files under the control of a tags table -(@pxref{Tags Search}) or through the Dired @kbd{A} command -(@pxref{Operating on Files}), or ask the @code{grep} program to do it -(@pxref{Grep Searching}). + You can also search multiple files under the control of an +@code{xref} backend (@pxref{Identifier Search}) or through the Dired +@kbd{A} command (@pxref{Operating on Files}), or ask the @code{grep} +program to do it (@pxref{Grep Searching}). @menu * Incremental Search:: Search happens as you type the string. diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index cd7d08dede..f99234b5c1 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi @@ -231,8 +231,9 @@ Mail}), but in another window (@code{compose-mail-other-window}). @findex find-tag-other-window @item C-x 4 . -Find a tag in the current tags table, similar to @kbd{M-.} -(@pxref{Tags}), but in another window (@code{find-tag-other-window}). +Find the definition of an identifier, similar to @kbd{M-.} +(@pxref{Xref}), but in another window +(@code{xref-find-definitions-other-window}). @item C-x 4 r @var{filename} @key{RET} Visit file @var{filename} read-only, and select its buffer in another window (@code{find-file-read-only-other-window}). @xref{Visiting}. diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index 28bf600576..d2a8ff56b6 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi @@ -328,13 +328,12 @@ This function returns the meaning of @var{function} as a function. If definition and starts over with that value. If @var{function} is not a symbol, then it returns @var{function} itself. -This function signals a @code{void-function} error if the final symbol -is unbound and optional argument @var{noerror} is @code{nil} or -omitted. Otherwise, if @var{noerror} is non-@code{nil}, it returns -@code{nil} if the final symbol is unbound. +This function returns @code{nil} if the final symbol is unbound. It +signals a @code{cyclic-function-indirection} error if there is a loop +in the chain of symbols. -It signals a @code{cyclic-function-indirection} error if there is a -loop in the chain of symbols. +The optional argument @var{noerror} is obsolete, kept for backward +compatibility, and has no effect. Here is how you could define @code{indirect-function} in Lisp: diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index 0a01162063..cb5c7012c1 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -965,6 +965,11 @@ The face @var{face} was defined. The feature @var{feature} was required. @item (provide . @var{feature}) The feature @var{feature} was provided. +@item (cl-defmethod @var{method} @var{specializers}) +The named @var{method} was defined by using @code{cl-defmethod}, with +@var{specializers} as its specializers. +@item (define-type . @var{type}) +The type @var{type} was defined. @end table The value of @code{load-history} may have one element whose @sc{car} is diff --git a/doc/lispref/markers.texi b/doc/lispref/markers.texi index d44085527a..bf18543138 100644 --- a/doc/lispref/markers.texi +++ b/doc/lispref/markers.texi @@ -659,6 +659,24 @@ more marks than this are pushed onto the @code{mark-ring}, @c There is also global-mark-ring-max, but this chapter explicitly @c does not talk about the global mark. +@cindex @code{delete-selection}, symbol property +@findex delete-selection-helper +@findex delete-selection-pre-hook +When Delete Selection mode (@pxref{Using Region, Delete Selection, , +emacs, The GNU Emacs Manual}) is enabled, commands that operate on the +active region (a.k.a.@: ``selection'') behave slightly differently. +This works by adding the function @code{delete-selection-pre-hook} to +the @code{pre-command-hook} (@pxref{Command Overview}). That function +calls @code{delete-selection-helper} to delete the selection as +appropriate for the command. If you want to adapt a command to Delete +Selection mode, put the @code{delete-selection} property on the +function's symbol (@pxref{Symbol Plists}); commands that don't have +this property on their symbol won't delete the selection. This +property can have one of several values to tailor the behavior to what +the command is supposed to do; see the doc strings of +@code{delete-selection-pre-hook} and @code{delete-selection-helper} +for the details. + @node The Region @section The Region @c The index entry must be just "region" to make it the first hit diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index af24b996c0..19782d0fbd 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi @@ -787,17 +787,6 @@ used on hooks such as @code{before-change-functions} (@pxref{Change Hooks}). @end defun - Major modes can make @code{syntax-ppss} run faster by specifying -where it needs to start parsing. - -@defvar syntax-begin-function -If this is non-@code{nil}, it should be a function that moves to an -earlier buffer position where the parser state is equivalent to -@code{nil}---in other words, a position outside of any comment, -string, or parenthesis. @code{syntax-ppss} uses it to further -optimize its computations, when the cache gives no help. -@end defvar - @node Parser State @subsection Parser State @cindex parser state diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index 9b14dcf8fd..f90c7d3e8f 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi @@ -84,7 +84,9 @@ such as @command{bash}, @command{zsh}, @command{rc}, or * Concept Index:: * Function and Variable Index:: * Command Index:: +@ignore * Key Index:: +@end ignore @end menu @node Introduction @@ -670,6 +672,12 @@ page long. If that occurs to you, search for configuration options for calling @samp{less} without the @samp{-F} option. For Git, you can do that using @samp{git config --global core.pager 'less -+F'}. +@vindex eshell-destroy-buffer-when-process-dies +If you want the buffers created by visual programs killed when the +program exits, customize the variable +@code{eshell-destroy-buffer-when-process-dies} to a non-@code{nil} +value; the default is @code{nil}. + @section Redirection Redirection is mostly the same in Eshell as it is in other command shells. The output redirection operators @code{>} and @code{>>} as @@ -682,6 +690,8 @@ The buffer redirection operator, @code{>>>}, expects a buffer object on the right-hand side, into which it inserts the output of the left-hand side. e.g., @samp{echo hello >>> #<buffer *scratch*>} inserts the string @code{"hello"} into the @file{*scratch*} buffer. +The convenience shorthand variant @samp{#<@var{buffer-name}>}, as in +@samp{#<*scratch*>}, is also accepted. @code{eshell-virtual-targets} is a list of mappings of virtual device names to functions. Eshell comes with two virtual devices: @@ -1241,8 +1251,13 @@ Since it keeps the cursor up where the command was invoked. @printindex cm +@c There are no @kindex entries in this manual; avoid generating an +@c empty menu. +@ignore @node Key Index @unnumbered Key Index @printindex ky +@end ignore + @bye @@ -19,6 +19,7 @@ LANGUAGE (NATIVE NAME) HELLO ---------------------- ----- Amharic ($,1O M[MmN{(B) $,1M`MKM](B Arabic ($,1-g.$-y-q-h.*.1-i(B) $,1-g.$-s.1.$-g.%(B $,1-y.$.*.#.%(B +Armenian ($,1+p+a+u+e, +e+v(B) $,1+2+a, ,'(B $,1+q+e+f(B Bengali ($,17,7>6b727>(B) $,17(7.787M6u7>70(B Braille $,2(3(1('('(5(B Burmese ($,1H9H\H4HZH9HL(B) $,1H9H$HZHYH"H<HLH5HK(B @@ -48,6 +49,7 @@ Lao ((1>RJRERG(B) (1JP:R-4U(B / (1"mcKib*!4U(B Malayalam ($,1@N@R@O@^@S@"(B) $,1@H@N@X@m@5@^@P@"(B Maltese (il-Malti) Bon,Cu(Bu / Sa,C11(Ba Mathematics $,1x (B p $,1x((B world $,1s"(B hello p $,2!a(B +Mongolian (,L\^]S^[(B ,Lem[(B) ,LAPY](B ,LQPY]P(B ,Lcc(B? Norwegian (norsk) Hei / God dag Oriya ($,1:s;\;?:f(B) $,1;6;A;#;?;,;G(B Polish (j,Bj(Bzyk polski) Dzie,Bq(B dobry! / Cze,B6f(B! @@ -148,6 +148,7 @@ so if you want to use it, you can always take a copy from an older Emacs. Various resolutions are available as etc/images/icons/hicolor/*/apps/emacs.png. The old Emacs logo icons are available as `emacs23.png' in the same location. +--- ** New make target `check-expensive' to run additional tests. This includes all tests which run via "make check", plus additional tests which take more time to perform. @@ -791,7 +792,10 @@ If the output of ERT tests in batch mode execution can be saved to a log file, then it can be passed as an argument to the above function to produce a neat summary. +--- ** New js.el option `js-indent-first-init'. +It was renamed from `js-indent-first-initialiser', to avoid issues +with American vs British spelling. ** Info @@ -1005,6 +1009,7 @@ New options `tildify-space-string', `tildify-pattern', and `tildify-ignored-environments-alist' variables (as well as a few helper functions) obsolete. ++++ ** New package Xref replaces Etags's front-end and UI The new package Xref provides a generic framework and new commands to @@ -1027,58 +1032,81 @@ As a result of this, the following commands are now obsolete: `find-tag-other-window', `find-tag-other-frame', `find-tag-regexp', `tags-apropos', and `tags-loop-continue'. -The framework's API is still experimental and can change in major, -backward-incompatible ways. - ++++ *** New variables `find-tag-marker-ring-length' is now an obsolete alias for `xref-marker-ring-length'. `find-tag-marker-ring' is now an obsolete alias for a private variable. `xref-push-marker-stack' and -`xref-pop-marker-stack' should be used to mutate it instead. +`xref-pop-marker-stack' should be used instead to manipulate the stack +of searches for definitions. --- *** `xref-find-definitions' and `describe-function' now display information about mode local overrides (defined by cedet/mode-local.el `define-overloadable-function' `define-mode-local-overrides'). +The framework's Lisp API is still experimental and can change in major, +backward-incompatible ways. + +--- +** New package Project + +The new package Project provides generic infrastructure for dealing +with projects. The main commands included in it are +`project-find-file' and `project-find-regexp'. + +The Lisp API of this package is still experimental. + ** EUDC EUDC's LDAP backend has been improved. ++++ *** EUDC supports LDAP-over-SSL URLs (ldaps://). +--- *** EUDC passes LDAP passwords through a pipe to the ldapsearch subprocess instead of on the command line. +--- *** EUDC handles LDAP wildcards automatically so the user shouldn't need to configure this manually anymore. ++++ *** The LDAP configuration section of EUDC's manual has been rewritten. There have also been customization changes. ++++ *** New custom variable `eudc-server-hotlist' to allow specifying multiple EUDC servers in init file. ++++ *** Custom variable `eudc-inline-query-format' defaults to completing on email and firstname instead of surname. +--- *** Custom variable `eudc-expansion-overwrites-query' defaults to nil to avoid interfering with the kill ring. ++++ *** Custom variable `eudc-inline-expansion-format' defaults to "Firstname Surname <mail-address>". ++++ *** Custom variable `eudc-options-file' defaults to "~/.emacs.d/eudc-options". +--- *** New custom variable `ldap-ldapsearch-password-prompt-regexp' to allow overriding the regular expression that recognizes the ldapsearch command line's password prompt. +--- EUDC's BBDB backend now supports BBDB 3. +--- EUDC's PH backend (eudcb-ph.el) is obsolete. ** Eshell @@ -1087,12 +1115,14 @@ EUDC's PH backend (eudcb-ph.el) is obsolete. *** The new built-in command `clear' can scroll window contents out of sight. If provided with an optional non-nil argument, the scrollback contents will be cleared. ++++ *** New buffer syntax '#<buffer-name>', which is equivalent to '#<buffer buffer-name>'. This shorthand makes interacting with buffers from eshell more convenient. Custom variable `eshell-buffer-shorthand', which has been broken for a while, has been removed. ++++ *** By default, eshell "visual" program buffers (created by `eshell-visual-commands' and similar custom vars) are no longer killed when their processes die. This fixes issues with short-lived commands @@ -1103,6 +1133,7 @@ make the new option `eshell-destroy-buffer-when-process-dies' non-nil. ** Browse-url +--- *** Support for the Conkeror web browser. --- @@ -1159,11 +1190,13 @@ few or no entries have changed. --- *** gulp.el +--- *** landmark.el (moved to elpa.gnu.org) * New Modes and Packages in Emacs 25.1 +--- ** pinentry.el allows GnuPG passphrase to be prompted through the minibuffer instead of a graphical dialog, depending on whether the gpg command is called from Emacs (i.e., INSIDE_EMACS environment variable @@ -1172,28 +1205,35 @@ later) and Pinentry (0.9.5 or later). ** cl-generic.el provides CLOS-style multiple-dispatch generic functions. +--- ** scss-mode (a minor variant of css-mode) +--- ** let-alist is a new macro (and a package) that allows one to easily let-bind the values stored in an alist. +--- ** `tildify-mode' allows to automatically insert hard spaces as one types the text. Breaking line after a single-character words is forbidden by Czech and Polish typography (and may be discouraged in other languages), so `auto-tildify-mode' makes it easier to create a typographically-correct documents. +--- ** The `seq' library adds sequence manipulation functions and macros that complement basic functions provided by subr.el. All functions are prefixed with `seq-' and work on lists, strings and vectors. +--- ** The `map' library provides map-manipulation functions that work on alists, hash-table and arrays. All functions are prefixed with `map-'. +--- ** The `thunk' library provides functions and macros to control the evaluation of forms. +--- ** js-jsx-mode (a minor variant of js-mode) provides indentation support for JSX, an XML-like syntax extension to ECMAScript. @@ -1206,6 +1246,7 @@ arguments. The earlier behavior of silently supplying a nil to the last variable when there was an odd number of arguments has been eliminated. ++++ ** `syntax-begin-function' is declared obsolete. Removed font-lock-beginning-of-syntax-function and the SYNTAX-BEGIN slot in font-lock-defaults. @@ -1217,12 +1258,11 @@ file and still expect it to be run after startup should set `package-enable-at-startup' to t after the call to `package-initialize'. +--- ** `:global' minor mode use `setq-default' rather than `setq'. This means that you can't use `make-local-variable' and expect them to "magically" become buffer-local. -** `inhibit-point-motion-hooks' now defaults to t and is obsolete. - +++ ** `track-mouse' no longer freezes the shape of the mouse pointer. The `track-mouse' form no longer refrains from changing the shape of @@ -1237,10 +1277,12 @@ to the special value `dragging' in the body of the form. has any effect. (This change was made in Emacs 24.4 but was not advertised at the time.) ++++ ** `indirect-function' does not signal `void-function' any more. This is mostly a bug-fix, since this change was missed back in 24.4 when symbol-function was changed not to signal `void-function' any more. ++++ *** As a consequence, the second arg of `indirect-function' is now obsolete. ** Comint, term, and compile do not set the EMACS env var any more. @@ -1272,10 +1314,12 @@ group ID instead of `t'. any reference to a buffer position. The 6th member of the mouse position list returned for such events is now nil. +--- ** Menu items in keymaps do not support the "key shortcut cache" any more. These slots used to hold key-shortcut data, but have been obsolete since Emacs-21. +--- ** Emacs no longer downcases the first letter of a system diagnostic when signaling a file error. For example, it now reports "Permission denied" instead of "permission denied". The old behavior was problematic @@ -1321,6 +1365,7 @@ use [:multibyte:] instead. ** The `diff' command uses the unified format now. To restore the old behavior, set `diff-switches' to `-c'. +--- ** `grep-template' and `grep-find-template' values don't include the --color argument anymore. It's added at the <C> place holder position dynamically. Any third-party code that changes these templates should @@ -1346,6 +1391,7 @@ that happen, `unhandled-file-name-directory' now defaults to calling +++ *** New vector QPattern. +--- ** syntax-propertize is now automatically called on-demand during forward parsing functions like `forward-sexp'. @@ -1366,10 +1412,14 @@ Replaced by properties `cursor-intangible' and `cursor-sensor-functions', implemented by the new `cursor-intangible-mode' and `cursor-sensor-mode' minor modes. +** `inhibit-point-motion-hooks' now defaults to t and is obsolete. + ++++ ** New process type `pipe', which can be used in combination with the `:stderr' keyword of make-process to handle standard error output of subprocess. ++++ ** New function `make-process' provides an alternative interface to `start-process'. It allows programs to set process parameters such as process filter, sentinel, etc., through keyword arguments (similar to @@ -1398,13 +1448,17 @@ buffers to allow certain parts of the text to be writable. ** `read-buffer' takes a new `predicate' argument. ++++ ** Emacs Lisp now supports generators. +See the "Generators" section of the ELisp manual for the details. -** New finalizer facility for running code when objects - become unreachable. ++++ +** New finalizer facility for running code when objects become unreachable. +See the "Finalizer Type" subsection in the ELisp manual for the +details. -** lexical closures can use (:documentation <form>) to build their docstring. -It should be placed right where the docstring would be, and <form> is then +** lexical closures can use (:documentation FORM) to build their docstring. +It should be placed right where the docstring would be, and FORM is then evaluated (and should return a string) when the closure is built. ** define-inline provides a new way to define inlinable functions. @@ -1475,6 +1529,7 @@ have side effects. ** New macro `with-file-modes', for evaluating expressions with default file permissions set to temporary values (e.g., for creating private files). ++++ ** You can access the slots of structures using `cl-struct-slot-value'. ** Function `sort' can deal with vectors. @@ -1487,6 +1542,7 @@ name. The variable `system-name' is now obsolete. +++ ** Function `write-region' no longer outputs "Wrote FILE" in batch mode. +--- ** If `pwd' is called with a prefix argument, insert the current default directory at point. @@ -1587,11 +1643,16 @@ a directory file name. It returns non-nil if the last character in the name is a directory separator character (forward slash on GNU and Unix systems, forward- or backslash on MS-Windows and MS-DOS). +--- ** ASCII approximations to curved quotes are put in standard-display-table if the terminal cannot display curved quotes. ++++ ** Standard output and error streams now transliterate characters via standard-display-table, and encode output using locale-coding-system. +To force a specific encoding, bind `coding-system-for-write' to the +coding-system of your choice when invoking functions like `prin1' and +`message'. +++ ** New var `truncate-string-ellipsis' to choose how to indicate truncation. @@ -1602,6 +1663,7 @@ This is used by Google's Native Client (NaCl). ** Miscellaneous name change +--- For consistency with the usual Emacs spelling, the Lisp variable `hfy-optimisations' has been renamed to `hfy-optimizations'. The old name should still work, as an obsolescent alias. @@ -1612,22 +1674,30 @@ The old name should still work, as an obsolescent alias. *** Emacs can now draw horizontal scroll bars on some platforms that provide toolkit scroll bars, namely Gtk+, Lucid, Motif and Windows. Horizontal scroll bars are turned off by default. + **** New function `horizontal-scroll-bars-available-p' telling whether horizontal scroll bars are available on the underlying system. + **** New mode `horizontal-scroll-bar-mode' to toggle horizontal scroll bars on all existing and future frames. + **** New function `toggle-horizontal-scroll-bar' to toggle horizontal scroll bars on the selected frame. + **** New frame parameters `horizontal-scroll-bars' and `scroll-bar-height' to set horizontal scroll bars and their height for individual frames and in `default-frame-alist'. + **** New functions `frame-scroll-bar-height' and `window-scroll-bar-height' return the height of horizontal scroll bars on a specific frame or window. + **** `set-window-scroll-bars' now accepts five parameters where the last two specify height and type of the window's horizontal scroll bar. + **** `window-scroll-bars' now returns type and sizes of horizontal scroll bars too. + **** New buffer-local variables `horizontal-scroll-bar' and `scroll-bar-height'. @@ -1694,6 +1764,7 @@ Those features have been deprecated in Gtk+ for a long time. ** Etags ++++ *** etags no longer qualifies class members by default. By default, `etags' will not qualify class members for C-like @@ -1709,11 +1780,13 @@ using -Q might make some class members become "unknown" to `M-.' (`xref-find-definitions'); if so, you can use `C-u M-.' to specify the qualified names by hand. ++++ *** New language Ruby Names of modules, classes, methods, and functions are tagged. Overloaded operators are also tagged. ++++ *** Improved support for Lua Etags now tags functions even if the "function" keyword follows some @@ -1737,6 +1810,7 @@ of Windows starting with Windows 9X. +++ ** Emacs running on MS-Windows now supports the daemon mode. +--- ** The byte counts in etags-generated TAGS files are now the same on MS-Windows as they are on other platforms. @@ -1744,8 +1818,10 @@ MS-Windows as they are on other platforms. ** On OS X, configure creates a Cocoa ("Nextstep") build by default. Pass '--without-ns' to configure to create an X11 build, the old default. +--- ** OS X 10.5 or older is no longer supported. +--- ** OS X on PowerPC is no longer supported. --- diff --git a/lisp/apropos.el b/lisp/apropos.el index 36a729a34a..3c1a4136fb 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -676,6 +676,10 @@ the output includes key-bindings of commands." ;; (autoload (push (cdr x) autoloads)) (`require (push (cdr x) requires)) (`provide (push (cdr x) provides)) + (`t nil) ; Skip "was an autoload" entries. + ;; FIXME: Print information about each individual method: both + ;; its docstring and specializers (bug#21422). + (`cl-defmethod (push (cadr x) provides)) (_ (push (or (cdr-safe x) x) symbols)))) (let ((apropos-pattern "")) ;Dummy binding for apropos-symbols-internal. (apropos-symbols-internal diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index c2b7cf50ac..30320b0094 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -633,6 +633,9 @@ SYMBOL is a function that can be overridden." ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE ))) +;; We are called from describe-function in help-fns.el, where this is defined. +(defvar describe-function-orig-buffer) + (defun describe-mode-local-overload (symbol) "For `help-fns-describe-function-functions'; add overloads for SYMBOL." (when (get symbol 'mode-local-overload) diff --git a/lisp/delsel.el b/lisp/delsel.el index 46eea973a7..6a819ebbf6 100644 --- a/lisp/delsel.el +++ b/lisp/delsel.el @@ -37,16 +37,26 @@ ;; the values: ;; `yank' ;; For commands which do a yank; ensures the region about to be -;; deleted isn't yanked. +;; deleted isn't immediately yanked back, which would make the +;; command a no-op. ;; `supersede' ;; Delete the active region and ignore the current command, -;; i.e. the command will just delete the region. +;; i.e. the command will just delete the region. This is for +;; commands that normally delete small amounts of text, like +;; a single character -- they will instead delete the whole +;; active region. +;; `kill' +;; `kill-region' is used on the selection, rather than +;; `delete-region'. (Text selected with the mouse will typically +;; be yankable anyhow.) ;; t ;; The normal case: delete the active region prior to executing ;; the command which will insert replacement text. -;; <function> +;; FUNCTION ;; For commands which need to dynamically determine this behavior. -;; The function should return one of the above values or nil. +;; FUNCTION should take no argument and return one of the above +;; values, or nil. In the latter case, FUNCTION should itself +;; do with the active region whatever is appropriate." ;;; Code: @@ -66,7 +76,11 @@ enable the mode if ARG is omitted or nil. When Delete Selection mode is enabled, typed text replaces the selection if the selection is active. Otherwise, typed text is just inserted at -point regardless of any selection." +point regardless of any selection. Also, commands that normally delete +just one character will delete the entire selection instead. + +See `delete-selection-helper' and `delete-selection-pre-hook' for +information on adapting behavior of commands in Delete Selection mode." :global t :group 'editing-basics (if (not delete-selection-mode) (remove-hook 'pre-command-hook 'delete-selection-pre-hook) @@ -147,10 +161,14 @@ With ARG, repeat that many times. `C-u' means until end of buffer." "Delete selection according to TYPE: `yank' For commands which do a yank; ensures the region about to be - deleted isn't yanked. + deleted isn't immediately yanked back, which would make the + command a no-op. `supersede' Delete the active region and ignore the current command, - i.e. the command will just delete the region. + i.e. the command will just delete the region. This is for + commands that normally delete small amounts of text, like + a single character -- they will instead delete the whole + active region. `kill' `kill-region' is used on the selection, rather than `delete-region'. (Text selected with the mouse will typically @@ -160,7 +178,9 @@ With ARG, repeat that many times. `C-u' means until end of buffer." the command which will insert replacement text. FUNCTION For commands which need to dynamically determine this behavior. - FUNCTION should take no argument and return one of the above values or nil." + FUNCTION should take no argument and return one of the above + values, or nil. In the latter case, FUNCTION should itself + do with the active region whatever is appropriate." (condition-case data (cond ((eq type 'kill) ;Deprecated, backward compatibility. (delete-active-region t) diff --git a/lisp/dired.el b/lisp/dired.el index 52386c9119..63124fce5e 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2810,7 +2810,9 @@ It runs the hook `dired-initial-position-hook'." (defun dired-current-directory (&optional localp) "Return the name of the subdirectory to which this line belongs. This returns a string with trailing slash, like `default-directory'. -Optional argument means return a file name relative to `default-directory'." +Optional argument means return a file name relative to `default-directory', +in which case the value could be an empty string if `default-directory' +is the directory where the file on this line resides." (let ((here (point)) (alist (or dired-subdir-alist ;; probably because called in a non-dired buffer diff --git a/lisp/ffap.el b/lisp/ffap.el index 6c7932b512..abf979f612 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -974,14 +974,14 @@ out of NAME." (push (cons "" (cdr (assoc (match-string 0) ; i.e. "(TeX-current-macro)" preferred-suffix-rules))) guess-rules)) - (setq kpsewhich-args (mapcar (lambda (rule) - (concat (car rule) name (cdr rule))) - guess-rules)) (with-temp-buffer (let ((process-environment (buffer-local-value 'process-environment curbuf)) (exec-path (buffer-local-value 'exec-path curbuf))) - (apply #'call-process "kpsewhich" nil t nil kpsewhich-args)) + (apply #'call-process "kpsewhich" nil t nil + (mapcar (lambda (rule) + (concat (car rule) name (cdr rule))) + guess-rules))) (when (< (point-min) (point-max)) (buffer-substring (goto-char (point-min)) (point-at-eol)))))))) diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 4a92069b12..3c1f01d588 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1302,15 +1302,18 @@ This function does 2 things: (point-min)))) (when (< end (point-max)) (setq end - (if (get-text-property end 'font-lock-multiline) - (or (text-property-any end (point-max) - 'font-lock-multiline nil) - (point-max)) + (cond + ((get-text-property end 'font-lock-multiline) + (or (text-property-any end (point-max) + 'font-lock-multiline nil) + (point-max))) + ;; If `end' has been set by the function above, don't corrupt it. + (font-lock-extend-after-change-region-function end) ;; Rounding up to a whole number of lines should include the ;; line right after `end'. Typical case: the first char of ;; the line was deleted. Or a \n was inserted in the middle ;; of a line. - (1+ end)))) + (t (1+ end))))) ;; Finally, pre-enlarge the region to a whole number of lines, to try ;; and anticipate what font-lock-default-fontify-region will do, so as to ;; avoid double-redisplay. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 1251a4e110..ecac0aeb13 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -831,7 +831,8 @@ styles for specific categories, such as files, buffers, etc." (defvar completion-category-defaults '((buffer (styles . (basic substring))) - (unicode-name (styles . (basic substring)))) + (unicode-name (styles . (basic substring))) + (project-file (styles . (basic substring)))) "Default settings for specific completion categories. Each entry has the shape (CATEGORY . ALIST) where ALIST is an association list that can specify properties such as: diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index c6de1837e9..44923aee89 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -56,6 +56,8 @@ (require 'custom) (require 'format-spec) (require 'shell) + ;; Introduced in Emacs 23.2. + (require 'ucs-normalize nil 'noerror) (require 'trampver) (require 'tramp-loaddefs) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ca0707f594..7ace8864f8 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1100,15 +1100,19 @@ target of the symlink differ." ;; Right, they are on the same host, regardless of user, method, ;; etc. We now make the link on the remote machine. This will ;; occur as the user that FILENAME belongs to. - (tramp-send-command-and-check - l - (format - "cd %s && %s -sf %s %s" - (tramp-shell-quote-argument cwd) - ln - (tramp-shell-quote-argument filename) - (tramp-shell-quote-argument l-localname)) - t)))) + (and (tramp-send-command-and-check + l (format "cd %s" (tramp-shell-quote-argument cwd))) + (tramp-send-command-and-check + l (format + "%s -sf %s %s" + ln + (tramp-shell-quote-argument filename) + ;; The command could exceed PATH_MAX, so we use + ;; relative file names. However, relative file names + ;; could start with "-". `tramp-shell-quote-argument' + ;; does not handle this, we must do it ourselves. + (tramp-shell-quote-argument + (concat "./" (file-name-nondirectory l-localname))))))))) (defun tramp-sh-handle-file-truename (filename) "Like `file-truename' for Tramp files." @@ -1266,100 +1270,108 @@ target of the symlink differ." res-inode res-filemodes res-numlinks res-uid res-gid res-size res-symlink-target) (tramp-message vec 5 "file attributes with ls: %s" localname) - (tramp-send-command - vec - (format "(%s %s || %s -h %s) && %s %s %s %s" - (tramp-get-file-exists-command vec) - (tramp-shell-quote-argument localname) - (tramp-get-test-command vec) - (tramp-shell-quote-argument localname) - (tramp-get-ls-command vec) - (if (eq id-format 'integer) "-ildn" "-ild") - ;; On systems which have no quoting style, file names - ;; with special characters could fail. - (cond - ((tramp-get-ls-command-with-quoting-style vec) - "--quoting-style=c") - ((tramp-get-ls-command-with-w-option vec) - "-w") - (t "")) - (tramp-shell-quote-argument localname))) - ;; Parse `ls -l' output ... - (with-current-buffer (tramp-get-buffer vec) - (when (> (buffer-size) 0) - (goto-char (point-min)) - ;; ... inode - (setq res-inode - (condition-case err - (read (current-buffer)) - (invalid-read-syntax - (when (and (equal (cadr err) - "Integer constant overflow in reader") - (string-match - "^[0-9]+\\([0-9][0-9][0-9][0-9][0-9]\\)\\'" - (car (cddr err)))) - (let* ((big (read (substring (car (cddr err)) 0 - (match-beginning 1)))) - (small (read (match-string 1 (car (cddr err))))) - (twiddle (/ small 65536))) - (cons (+ big twiddle) - (- small (* twiddle 65536)))))))) - ;; ... file mode flags - (setq res-filemodes (symbol-name (read (current-buffer)))) - ;; ... number links - (setq res-numlinks (read (current-buffer))) - ;; ... uid and gid - (setq res-uid (read (current-buffer))) - (setq res-gid (read (current-buffer))) - (if (eq id-format 'integer) + ;; We cannot send all three commands combined, it could exceed + ;; NAME_MAX or PATH_MAX. Happened on Mac OS X, for example. + (when (or (tramp-send-command-and-check + vec + (format "%s %s" + (tramp-get-file-exists-command vec) + (tramp-shell-quote-argument localname))) + (tramp-send-command-and-check + vec + (format "%s -h %s" + (tramp-get-test-command vec) + (tramp-shell-quote-argument localname)))) + (tramp-send-command + vec + (format "%s %s %s %s" + (tramp-get-ls-command vec) + (if (eq id-format 'integer) "-ildn" "-ild") + ;; On systems which have no quoting style, file names + ;; with special characters could fail. + (cond + ((tramp-get-ls-command-with-quoting-style vec) + "--quoting-style=c") + ((tramp-get-ls-command-with-w-option vec) + "-w") + (t "")) + (tramp-shell-quote-argument localname))) + ;; Parse `ls -l' output ... + (with-current-buffer (tramp-get-buffer vec) + (when (> (buffer-size) 0) + (goto-char (point-min)) + ;; ... inode + (setq res-inode + (condition-case err + (read (current-buffer)) + (invalid-read-syntax + (when (and (equal (cadr err) + "Integer constant overflow in reader") + (string-match + "^[0-9]+\\([0-9][0-9][0-9][0-9][0-9]\\)\\'" + (car (cddr err)))) + (let* ((big (read (substring (car (cddr err)) 0 + (match-beginning 1)))) + (small (read (match-string 1 (car (cddr err))))) + (twiddle (/ small 65536))) + (cons (+ big twiddle) + (- small (* twiddle 65536)))))))) + ;; ... file mode flags + (setq res-filemodes (symbol-name (read (current-buffer)))) + ;; ... number links + (setq res-numlinks (read (current-buffer))) + ;; ... uid and gid + (setq res-uid (read (current-buffer))) + (setq res-gid (read (current-buffer))) + (if (eq id-format 'integer) + (progn + (unless (numberp res-uid) (setq res-uid -1)) + (unless (numberp res-gid) (setq res-gid -1))) (progn - (unless (numberp res-uid) (setq res-uid -1)) - (unless (numberp res-gid) (setq res-gid -1))) - (progn - (unless (stringp res-uid) (setq res-uid (symbol-name res-uid))) - (unless (stringp res-gid) (setq res-gid (symbol-name res-gid))))) - ;; ... size - (setq res-size (read (current-buffer))) - ;; From the file modes, figure out other stuff. - (setq symlinkp (eq ?l (aref res-filemodes 0))) - (setq dirp (eq ?d (aref res-filemodes 0))) - ;; If symlink, find out file name pointed to. - (when symlinkp - (search-forward "-> ") - (setq res-symlink-target - (if (tramp-get-ls-command-with-quoting-style vec) - (read (current-buffer)) - (buffer-substring (point) (point-at-eol))))) - ;; Return data gathered. - (list - ;; 0. t for directory, string (name linked to) for symbolic - ;; link, or nil. - (or dirp res-symlink-target) - ;; 1. Number of links to file. - res-numlinks - ;; 2. File uid. - res-uid - ;; 3. File gid. - res-gid - ;; 4. Last access time, as a list of integers. Normally this - ;; would be in the same format as `current-time', but the - ;; subseconds part is not currently implemented, and (0 0) - ;; denotes an unknown time. - ;; 5. Last modification time, likewise. - ;; 6. Last status change time, likewise. - '(0 0) '(0 0) '(0 0) ;CCC how to find out? - ;; 7. Size in bytes (-1, if number is out of range). - res-size - ;; 8. File modes, as a string of ten letters or dashes as in ls -l. - res-filemodes - ;; 9. t if file's gid would change if file were deleted and - ;; recreated. Will be set in `tramp-convert-file-attributes'. - t - ;; 10. Inode number. - res-inode - ;; 11. Device number. Will be replaced by a virtual device number. - -1 - ))))) + (unless (stringp res-uid) (setq res-uid (symbol-name res-uid))) + (unless (stringp res-gid) (setq res-gid (symbol-name res-gid))))) + ;; ... size + (setq res-size (read (current-buffer))) + ;; From the file modes, figure out other stuff. + (setq symlinkp (eq ?l (aref res-filemodes 0))) + (setq dirp (eq ?d (aref res-filemodes 0))) + ;; If symlink, find out file name pointed to. + (when symlinkp + (search-forward "-> ") + (setq res-symlink-target + (if (tramp-get-ls-command-with-quoting-style vec) + (read (current-buffer)) + (buffer-substring (point) (point-at-eol))))) + ;; Return data gathered. + (list + ;; 0. t for directory, string (name linked to) for symbolic + ;; link, or nil. + (or dirp res-symlink-target) + ;; 1. Number of links to file. + res-numlinks + ;; 2. File uid. + res-uid + ;; 3. File gid. + res-gid + ;; 4. Last access time, as a list of integers. Normally + ;; this would be in the same format as `current-time', but + ;; the subseconds part is not currently implemented, and (0 + ;; 0) denotes an unknown time. + ;; 5. Last modification time, likewise. + ;; 6. Last status change time, likewise. + '(0 0) '(0 0) '(0 0) ;CCC how to find out? + ;; 7. Size in bytes (-1, if number is out of range). + res-size + ;; 8. File modes, as a string of ten letters or dashes as in ls -l. + res-filemodes + ;; 9. t if file's gid would change if file were deleted and + ;; recreated. Will be set in `tramp-convert-file-attributes'. + t + ;; 10. Inode number. + res-inode + ;; 11. Device number. Will be replaced by a virtual device number. + -1 + )))))) (defun tramp-do-file-attributes-with-perl (vec localname &optional id-format) @@ -4214,10 +4226,8 @@ process to set up. VEC specifies the connection." (cons 'undecided 'undecided))) cs-decode cs-encode) (when (symbolp cs) (setq cs (cons cs cs))) - (setq cs-decode (car cs)) - (setq cs-encode (cdr cs)) - (unless cs-decode (setq cs-decode 'undecided)) - (unless cs-encode (setq cs-encode 'undecided)) + (setq cs-decode (or (car cs) 'undecided) + cs-encode (or (cdr cs) 'undecided)) (setq cs-encode (tramp-compat-coding-system-change-eol-conversion cs-encode @@ -4229,7 +4239,13 @@ process to set up. VEC specifies the connection." (when (search-forward "\r" nil t) (setq cs-decode (tramp-compat-coding-system-change-eol-conversion cs-decode 'dos))) - (tramp-compat-funcall + ;; Special setting for Mac OS X. + (when (and (string-match + "^Darwin" (tramp-get-connection-property vec "uname" "")) + (memq 'utf-8-hfs (coding-system-list))) + (setq cs-decode 'utf-8-hfs + cs-encode 'utf-8-hfs)) + (tramp-compat-funcall 'set-buffer-process-coding-system cs-decode cs-encode) (tramp-message vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode)) diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 941f98ebb6..8ed0bb3bbb 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -1203,7 +1203,7 @@ for a moment, then straighten yourself up. (interactive) (forward-line (- 0 (- (window-height) 2 ))) (set-window-start (selected-window) (point)) - (end-of-buffer)) + (goto-char (point-max))) ;;; Insert something into the buffer, followed by newline. diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index c42fbe7e51..2056f3907b 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -656,23 +656,35 @@ right side of it." ;; Wrappers for common scan-lists cases, mainly because it's almost ;; impossible to get a feel for how that function works. -(defmacro c-go-list-forward () - "Move backward across one balanced group of parentheses. - -Return POINT when we succeed, NIL when we fail. In the latter case, leave -point unmoved." - `(c-safe (let ((endpos (scan-lists (point) 1 0))) - (goto-char endpos) - endpos))) - -(defmacro c-go-list-backward () - "Move backward across one balanced group of parentheses. - -Return POINT when we succeed, NIL when we fail. In the latter case, leave -point unmoved." - `(c-safe (let ((endpos (scan-lists (point) -1 0))) - (goto-char endpos) - endpos))) +(defmacro c-go-list-forward (&optional pos limit) + "Move forward across one balanced group of parentheses starting at POS or +point. Return POINT when we succeed, NIL when we fail. In the latter case, +leave point unmoved. + +A LIMIT for the search may be given. The start position is assumed to be +before it." + (let ((res `(c-safe (goto-char (scan-lists ,(or pos `(point)) 1 0)) (point)))) + (if limit + `(save-restriction + (if ,limit + (narrow-to-region (point-min) ,limit)) + ,res) + res))) + +(defmacro c-go-list-backward (&optional pos limit) + "Move backward across one balanced group of parentheses starting at POS or +point. Return POINT when we succeed, NIL when we fail. In the latter case, +leave point unmoved. + +A LIMIT for the search may be given. The start position is assumed to be +after it." + (let ((res `(c-safe (goto-char (scan-lists ,(or pos `(point)) -1 0)) (point)))) + (if limit + `(save-restriction + (if ,limit + (narrow-to-region ,limit (point-max))) + ,res) + res))) (defmacro c-up-list-forward (&optional pos limit) "Return the first position after the list sexp containing POS, diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 3301d41592..b08c555e34 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -5688,8 +5688,8 @@ comment at the start of cc-engine.el for more info." (c-backward-token-2) (setq c-restricted-<>-arglists (and (not (looking-at c-opt-<>-sexp-key)) - (progn (c-backward-syntactic-ws) ; to < or , - (and (memq (char-before) '(?< ?,)) + (progn (c-backward-syntactic-ws) ; to ( or , + (and (memq (char-before) '(?\( ?,)) ; what about <? (not (eq (c-get-char-property (point) 'c-type) 'c-decl-arg-start))))))) (or (c-forward-<>-arglist nil) @@ -6641,16 +6641,22 @@ comment at the start of cc-engine.el for more info." res)) (defun c-forward-annotation () - ;; Used for Java code only at the moment. Assumes point is on the - ;; @, moves forward an annotation. returns nil if there is no - ;; annotation at point. - (and (looking-at "@") - (progn (forward-char) t) - (c-forward-type) - (progn (c-forward-syntactic-ws) t) - (if (looking-at "(") - (c-go-list-forward) - t))) + ;; Used for Java code only at the moment. Assumes point is on the @, moves + ;; forward an annotation and returns t. Leaves point unmoved and returns + ;; nil if there is no annotation at point. + (let ((pos (point))) + (or + (and (looking-at "@") + (not (looking-at c-keywords-regexp)) + (progn (forward-char) t) + (looking-at c-symbol-key) + (progn (goto-char (match-end 0)) + (c-forward-syntactic-ws) + t) + (if (looking-at "(") + (c-go-list-forward) + t)) + (progn (goto-char pos) nil)))) (defmacro c-pull-open-brace (ps) ;; Pull the next open brace from PS (which has the form of paren-state), @@ -6959,9 +6965,8 @@ comment at the start of cc-engine.el for more info." (when (or (looking-at c-prefix-spec-kwds-re) ;FIXME!!! includes auto (and (c-major-mode-is 'java-mode) (looking-at "@[A-Za-z0-9]+"))) - (save-match-data - (if (looking-at c-typedef-key) - (setq at-typedef t))) + (if (save-match-data (looking-at c-typedef-key)) + (setq at-typedef t)) (setq kwd-sym (c-keyword-sym (match-string 1))) (save-excursion (c-forward-keyword-clause 1) @@ -9106,6 +9111,11 @@ comment at the start of cc-engine.el for more info." (goto-char containing-sexp) (if (or (save-excursion (c-backward-syntactic-ws lim) + (while (and (eq (char-before) ?>) + (c-get-char-property (1- (point)) + 'syntax-table) + (c-go-list-backward nil lim)) + (c-backward-syntactic-ws lim)) (and (> (point) (or lim (point-min))) (c-on-identifier))) (and c-special-brace-lists diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index f74e5cbf67..03e67a9951 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1157,15 +1157,6 @@ casts and declarations are fontified. Used on level 2 and higher." (setq pos (point)))))) ; acts to make the `while' form continue. nil) -(defconst c-font-lock-maybe-decl-faces - ;; List of faces that might be put at the start of a type when - ;; `c-font-lock-declarations' runs. This needs to be evaluated to - ;; ensure that face name aliases in Emacs are resolved. - (list nil - font-lock-type-face - c-reference-face-name - font-lock-keyword-face)) - (defun c-font-lock-declarations (limit) ;; Fontify all the declarations, casts and labels from the point to LIMIT. ;; Assumes that strings and comments have been fontified already. @@ -1256,7 +1247,7 @@ casts and declarations are fontified. Used on level 2 and higher." (c-find-decl-spots limit c-decl-start-re - c-font-lock-maybe-decl-faces + (eval c-maybe-decl-faces) (lambda (match-pos inside-macro) ;; Note to maintainers: don't use `limit' inside this lambda form; diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 08d84fbb62..b52da3f662 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -3251,6 +3251,19 @@ way." objc t) (c-lang-defvar c-type-decl-end-used (c-lang-const c-type-decl-end-used)) +(c-lang-defconst c-maybe-decl-faces + "List of faces that might be put at the start of a type when +`c-font-lock-declarations' runs. This must be evaluated (with `eval') at +runtime to get the actual list of faces. This ensures that face name +aliases in Emacs are resolved." + t '(list nil + font-lock-type-face + c-reference-face-name + font-lock-keyword-face) + java (append (c-lang-const c-maybe-decl-faces) + '(font-lock-preprocessor-face))) +(c-lang-defvar c-maybe-decl-faces (c-lang-const c-maybe-decl-faces)) + ;;; Wrap up the `c-lang-defvar' system. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 644065911d..738870b727 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1336,12 +1336,13 @@ This function is called from `c-common-init', once per mode initialization." . c-mark-function))) ;; Prevent `font-lock-default-fontify-region' extending the region it will - ;; fontify to whole lines by removing `font-lock-extend-region-whole-lines' - ;; (and, coincidentally, `font-lock-extend-region-multiline' (which we do - ;; not need)) from `font-lock-extend-region-functions'. (Emacs only). This - ;; fixes Emacs bug #19669. + ;; fontify to whole lines by removing `font-lock-extend-region-wholelines' + ;; from `font-lock-extend-region-functions'. (Emacs only). This fixes + ;; Emacs bug #19669. (when (boundp 'font-lock-extend-region-functions) - (setq font-lock-extend-region-functions nil)) + (setq font-lock-extend-region-functions + (delq 'font-lock-extend-region-wholelines + font-lock-extend-region-functions))) (make-local-variable 'font-lock-fontify-region-function) (setq font-lock-fontify-region-function 'c-font-lock-fontify-region) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index d77158761e..fe28ed776b 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -27,6 +27,11 @@ ;; current project, without having to know which package handles ;; detection of that project type, parsing its config files, etc. ;; +;; NOTE: The project API is still experimental and can change in major, +;; backward-incompatible ways. Everyone is encouraged to try it, and +;; report to us any problems or use cases we hadn't anticipated, by +;; sending an email to emacs-devel, or `M-x report-emacs-bug'. +;; ;; Infrastructure: ;; ;; Function `project-current', to determine the current project @@ -45,10 +50,12 @@ ;;; TODO: -;; * Commands `project-find-file' and `project-or-external-find-file'. -;; Currently blocked on adding a new completion style that would let -;; the user enter just the base file name (or a part of it), and get -;; it expanded to the absolute file name. +;; * Reliably cache the list of files in the project, probably using +;; filenotify.el (if supported) to invalidate. And avoiding caching +;; if it's not available (manual cache invalidation is not nice). +;; +;; * Allow the backend to override the file-listing logic? Maybe also +;; to delegate file name completion to an external tool. ;; ;; * Build tool related functionality. Start with a `project-build' ;; command, which should provide completions on tasks to run, and @@ -251,13 +258,15 @@ DIRS must contain directory names." (defun project--value-in-dir (var dir) (with-temp-buffer (setq default-directory dir) - (hack-dir-local-variables-non-file-buffer) + (let ((enable-local-variables :all)) + (hack-dir-local-variables-non-file-buffer)) (symbol-value var))) (declare-function grep-read-files "grep") (declare-function xref-collect-matches "xref") (declare-function xref--show-xrefs "xref") (declare-function xref-backend-identifier-at-point "xref") +(declare-function xref--find-ignores-arguments "xref") ;;;###autoload (defun project-find-regexp (regexp) @@ -302,5 +311,53 @@ pattern to search for." (user-error "No matches for: %s" regexp)) (xref--show-xrefs xrefs nil))) +;;;###autoload +(defun project-find-file () + "Visit a file in the current project's roots. + +This is like `find-file', but it limits the file-name completion +candidates to the files within the current project roots." + (interactive) + (let* ((pr (project-current t)) + (dirs (project-roots pr))) + (project--find-file-in dirs pr))) + +;;;###autoload +(defun project-or-external-find-file () + "Visit a file in the current project's roots or external roots. + +This is like `find-file', but it limits the file-name completion +candidates to the files within the current project roots and external roots." + (interactive) + (let* ((pr (project-current t)) + (dirs (append + (project-roots pr) + (project-external-roots pr)))) + (project--find-file-in dirs pr))) + +;; FIXME: Uniquely abbreviate the roots? +(defun project--find-file-in (dirs project) + (require 'xref) + (let* ((all-files + (cl-mapcan + (lambda (dir) + (let ((command + (format "%s %s %s -type f -print0" + find-program + dir + (xref--find-ignores-arguments + (project-ignores project dir) + (expand-file-name dir))))) + (split-string (shell-command-to-string command) "\0" t))) + dirs)) + (table (lambda (string pred action) + (cond + ((eq action 'metadata) + '(metadata . ((category . project-file)))) + (t + (complete-with-action action all-files string pred)))))) + (find-file + (completing-read "Find file: " table nil t)))) + (provide 'project) ;;; project.el ends here diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 02d329d794..7f89ab2762 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -2115,7 +2115,11 @@ May return nil if the line should not be treated as continued." ;; sh-indent-after-done: aligned completely differently. (`(:after . "in") (sh-var-value 'sh-indent-for-case-label)) ;; sh-indent-for-continuation: Line continuations are handled differently. - (`(:after . ,(or `"(" `"{" `"[")) (sh-var-value 'sh-indent-after-open)) + (`(:after . ,(or `"(" `"{" `"[")) + (if (not (looking-at ".[ \t]*[^\n \t#]")) + (sh-var-value 'sh-indent-after-open) + (goto-char (1- (match-end 0))) + `(column . ,(current-column)))) ;; sh-indent-after-function: we don't handle it differently. )) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index ae5ec61520..fe39122d24 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -208,7 +208,7 @@ LENGTH is the match length, in characters." (defvar xref-backend-functions nil "Special hook to find the xref backend for the current context. -Each functions on this hook is called in turn with no arguments +Each function on this hook is called in turn with no arguments, and should return either nil to mean that it is not applicable, or an xref backend, which is a value to be used to dispatch the generic functions.") @@ -502,10 +502,14 @@ WINDOW controls how the buffer is displayed: (xref--pop-to-location xref window))) (defun xref-query-replace (from to) - "Perform interactive replacement in all current matches." + "Perform interactive replacement of FROM with TO in all displayed xrefs. + +This command interactively replaces FROM with TO in the names of the +references displayed in the current *xref* buffer." (interactive - (list (read-regexp "Query replace regexp in matches" ".*") - (read-regexp "Replace with: "))) + (let ((fr (read-regexp "Xref query-replace (regexp)" ".*"))) + (list fr + (read-regexp (format "Xref query-replace (regexp) %s with: " fr))))) (let (pairs item) (unwind-protect (progn @@ -762,12 +766,10 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." With prefix argument or when there's no identifier at point, prompt for it. -If the backend has sufficient information to determine a unique -definition for IDENTIFIER, it returns only that definition. If -there are multiple possible definitions, it returns all of them. - -If the backend returns one definition, jump to it; otherwise, -display the list in a buffer." +If sufficient information is available to determine a unique +definition for IDENTIFIER, display it in the selected window. +Otherwise, display the list of the possible definitions in a +buffer where the user can select from the list." (interactive (list (xref--read-identifier "Find definitions of: "))) (xref--find-definitions identifier nil)) @@ -876,7 +878,9 @@ IGNORES is a list of glob patterns." grep-find-template t t)) (grep-highlight-matches nil) (command (xref--rgrep-command (xref--regexp-to-extended regexp) - files dir ignores)) + files + (expand-file-name dir) + ignores)) (orig-buffers (buffer-list)) (buf (get-buffer-create " *xref-grep*")) (grep-re (caar grep-regexp-alist)) @@ -912,23 +916,28 @@ IGNORES is a list of glob patterns." " " (shell-quote-argument ")")) dir - (concat - (shell-quote-argument "(") - " -path " - (mapconcat - (lambda (ignore) - (when (string-match-p "/\\'" ignore) - (setq ignore (concat ignore "*"))) - (if (string-match "\\`\\./" ignore) - (setq ignore (replace-match dir t t ignore)) - (unless (string-prefix-p "*" ignore) - (setq ignore (concat "*/" ignore)))) - (shell-quote-argument ignore)) - ignores - " -o -path ") - " " - (shell-quote-argument ")") - " -prune -o "))) + (xref--find-ignores-arguments ignores dir))) + +(defun xref--find-ignores-arguments (ignores dir) + ;; `shell-quote-argument' quotes the tilde as well. + (cl-assert (not (string-match-p "\\`~" dir))) + (concat + (shell-quote-argument "(") + " -path " + (mapconcat + (lambda (ignore) + (when (string-match-p "/\\'" ignore) + (setq ignore (concat ignore "*"))) + (if (string-match "\\`\\./" ignore) + (setq ignore (replace-match dir t t ignore)) + (unless (string-prefix-p "*" ignore) + (setq ignore (concat "*/" ignore)))) + (shell-quote-argument ignore)) + ignores + " -o -path ") + " " + (shell-quote-argument ")") + " -prune -o ")) (defun xref--regexp-to-extended (str) (replace-regexp-in-string diff --git a/lisp/startup.el b/lisp/startup.el index 61f6db74f2..15a79f6f5b 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -76,13 +76,24 @@ once you are familiar with the contents of the startup screen." (defvar startup-screen-inhibit-startup-screen nil) -;; FIXME? Why does this get such weirdly extreme treatment, when the -;; more important inhibit-startup-screen does not. +;; The mechanism used to ensure that only end users can disable this +;; message is not complex. Clearly, it is possible for a determined +;; system administrator to inhibit this message anyway, but at least +;; they will do so with knowledge of why the Emacs developers think +;; this is a bad idea. (defcustom inhibit-startup-echo-area-message nil "Non-nil inhibits the initial startup echo area message. -Setting this variable takes effect -only if you do it with the customization buffer -or if your init file contains a line of this form: + +The startup message is in the echo area as it provides information +about GNU Emacs and the GNU system in general, which we want all +users to see. As this is the least intrusive startup message, +this variable gets specialized treatment to prevent the message +from being disabled site-wide by systems administrators, while +still allowing individual users to do so. + +Setting this variable takes effect only if you do it with the +customization buffer or if your init file contains a line of this +form: (setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\") If your init file is byte-compiled, use the following form instead: diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el index a5fe9563af..45e863340a 100644 --- a/lisp/vc/add-log.el +++ b/lisp/vc/add-log.el @@ -481,9 +481,10 @@ try to visit the file for the change under `point' instead." (apply 'change-log-goto-source-1 (append change-log-find-head change-log-find-tail)) (error - "Cannot find more matches for tag `%s' in file `%s'" - (car change-log-find-head) - (nth 2 change-log-find-head)))) + (format-message + "Cannot find more matches for tag `%s' in file `%s'" + (car change-log-find-head) + (nth 2 change-log-find-head))))) (save-excursion (let* ((at (point)) (tag-at (change-log-search-tag-name)) @@ -515,8 +516,9 @@ try to visit the file for the change under `point' instead." (condition-case nil (setq change-log-find-tail (apply 'change-log-goto-source-1 change-log-find-head)) - (error "Cannot find matches for tag `%s' in file `%s'" - tag file)))))))) + (error + (format-message "Cannot find matches for tag `%s' in file `%s'" + tag file))))))))) (defun change-log-next-error (&optional argp reset) "Move to the Nth (default 1) next match in a ChangeLog buffer. diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 8a0a9f91a4..8cb3547b13 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -131,7 +131,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." :version "23.1" :group 'vc-hg) -(defcustom vc-hg-annotate-switches nil +(defcustom vc-hg-annotate-switches '("-u" "--follow") "String or list of strings specifying switches for hg annotate under VC. If nil, use the value of `vc-annotate-switches'. If t, use no switches." @@ -380,36 +380,44 @@ If LIMIT is non-nil, show no more than this many entries." (defun vc-hg-annotate-command (file buffer &optional revision) "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER. Optional arg REVISION is a revision to annotate from." - (apply #'vc-hg-command buffer 0 file "annotate" "-d" "-n" "--follow" + (apply #'vc-hg-command buffer 0 file "annotate" "-dq" "-n" (append (vc-switches 'hg 'annotate) (if revision (list (concat "-r" revision)))))) (declare-function vc-annotate-convert-time "vc-annotate" (&optional time)) -;; The format for one line output by "hg annotate -d -n" looks like this: -;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS -;; i.e: VERSION_NUMBER DATE: CONTENTS -;; If the user has set the "--follow" option, the output looks like: -;;215 Wed Jun 20 21:22:58 2007 -0700 foo.c: CONTENTS -;; i.e. VERSION_NUMBER DATE FILENAME: CONTENTS +;; One line printed by "hg annotate -dq -n -u --follow" looks like this: +;; b56girard 114590 2012-03-13 CLOBBER: Lorem ipsum dolor sit +;; i.e. AUTHOR REVISION DATE FILENAME: CONTENTS +;; The user can omit options "-u" and/or "--follow". Then it'll look like: +;; 114590 2012-03-13 CLOBBER: +;; or +;; b56girard 114590 2012-03-13: (defconst vc-hg-annotate-re - "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\)\\(?:\\(: \\)\\|\\(?: +\\([^:\n]+\\(?::\\(?:[^: \n][^:\n]*\\)?\\)*\\): \\)\\)") + (concat + "^\\(?: *[^ ]+ +\\)?\\([0-9]+\\) " ;User and revision. + "\\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\\)" ;Date. + "\\(?: +\\([^:]+\\)\\)?:")) ;Filename. (defun vc-hg-annotate-time () (when (looking-at vc-hg-annotate-re) (goto-char (match-end 0)) (vc-annotate-convert-time - (date-to-time (match-string-no-properties 2))))) + (let ((str (match-string-no-properties 2))) + (encode-time 0 0 0 + (string-to-number (substring str 6 8)) + (string-to-number (substring str 4 6)) + (string-to-number (substring str 0 4))))))) (defun vc-hg-annotate-extract-revision-at-line () (save-excursion (beginning-of-line) (when (looking-at vc-hg-annotate-re) (if (match-beginning 3) - (match-string-no-properties 1) - (cons (match-string-no-properties 1) - (expand-file-name (match-string-no-properties 4) - (vc-hg-root default-directory))))))) + (cons (match-string-no-properties 1) + (expand-file-name (match-string-no-properties 3) + (vc-hg-root default-directory))) + (match-string-no-properties 1))))) ;;; Tag system diff --git a/src/alloc.c b/src/alloc.c index 9ec44b8a2c..03dacc77c6 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3732,7 +3732,7 @@ make_event_array (ptrdiff_t nargs, Lisp_Object *args) #ifdef HAVE_MODULES /* Create a new module user ptr object. */ Lisp_Object -make_user_ptr (void (*finalizer) (void*), void *p) +make_user_ptr (void (*finalizer) (void *), void *p) { Lisp_Object obj; struct Lisp_User_Ptr *uptr; @@ -4594,6 +4594,10 @@ maybe_lisp_pointer (void *p) return (uintptr_t) p % GCALIGNMENT == 0; } +#ifndef HAVE_MODULES +enum { HAVE_MODULES = false }; +#endif + /* If P points to Lisp data, mark that as live if it isn't already marked. */ @@ -4607,8 +4611,17 @@ mark_maybe_pointer (void *p) VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p)); #endif - if (!maybe_lisp_pointer (p)) - return; + if (sizeof (Lisp_Object) == sizeof (void *) || !HAVE_MODULES) + { + if (!maybe_lisp_pointer (p)) + return; + } + else + { + /* For the wide-int case, also mark emacs_value tagged pointers, + which can be generated by emacs-module.c's value_to_lisp. */ + p = (void *) ((uintptr_t) p & ~(GCALIGNMENT - 1)); + } m = mem_find (p); if (m != MEM_NIL) @@ -4685,8 +4698,7 @@ mark_maybe_pointer (void *p) static void ATTRIBUTE_NO_SANITIZE_ADDRESS mark_memory (void *start, void *end) { - void **pp; - int i; + char *pp; /* Make START the pointer to the start of the memory region, if it isn't already. */ @@ -4697,6 +4709,8 @@ mark_memory (void *start, void *end) end = tem; } + eassert (((uintptr_t) start) % GC_POINTER_ALIGNMENT == 0); + /* Mark Lisp data pointed to. This is necessary because, in some situations, the C compiler optimizes Lisp objects away, so that only a pointer to them remains. Example: @@ -4715,13 +4729,11 @@ mark_memory (void *start, void *end) away. The only reference to the life string is through the pointer `s'. */ - for (pp = start; (void *) pp < end; pp++) - for (i = 0; i < sizeof *pp; i += GC_POINTER_ALIGNMENT) - { - void *p = *(void **) ((char *) pp + i); - mark_maybe_pointer (p); - mark_maybe_object (XIL ((intptr_t) p)); - } + for (pp = start; (void *) pp < end; pp += GC_POINTER_ALIGNMENT) + { + mark_maybe_pointer (*(void **) pp); + mark_maybe_object (*(Lisp_Object *) pp); + } } #if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS @@ -5513,9 +5525,16 @@ garbage_collect_1 (void *end) don't let that cause a recursive GC. */ consing_since_gc = 0; - /* Save what's currently displayed in the echo area. */ - message_p = push_message (); - record_unwind_protect_void (pop_message_unwind); + /* Save what's currently displayed in the echo area. Don't do that + if we are GC'ing because we've run out of memory, since + push_message will cons, and we might have no memory for that. */ + if (NILP (Vmemory_full)) + { + message_p = push_message (); + record_unwind_protect_void (pop_message_unwind); + } + else + message_p = false; /* Save a copy of the contents of the stack, for debugging. */ #if MAX_SAVE_STACK > 0 @@ -5646,7 +5665,7 @@ garbage_collect_1 (void *end) } } - if (garbage_collection_messages) + if (garbage_collection_messages && NILP (Vmemory_full)) { if (message_p || minibuf_level > 0) restore_message (); diff --git a/src/emacs-module.c b/src/emacs-module.c index 2fec7e5d0f..b5e044e758 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -65,6 +65,12 @@ enum && INTPTR_MAX == EMACS_INT_MAX) }; +/* Function prototype for module user-pointer finalizers. These + should not throw C++ exceptions, so emacs-module.h declares the + corresponding interfaces with EMACS_NOEXCEPT. There is only C code + in this module, though, so this constraint is not enforced here. */ +typedef void (*emacs_finalizer_function) (void *); + /* Private runtime and environment members. */ diff --git a/src/emacs-module.h b/src/emacs-module.h index 3efea349d7..575966ea7b 100644 --- a/src/emacs-module.h +++ b/src/emacs-module.h @@ -26,19 +26,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #if defined __cplusplus && __cplusplus >= 201103L # define EMACS_NOEXCEPT noexcept - -/* Function prototype for module user-pointer finalizers. - - NOTE: C++11 15.4: An exception-specification shall not appear in a - typedef declaration or alias-declaration. - -*/ -void emacs_dummy_finalizer_function (void *) noexcept; -typedef decltype(emacs_dummy_finalizer_function) *emacs_finalizer_function; - #else # define EMACS_NOEXCEPT -typedef void (*emacs_finalizer_function) (void *); #endif #ifdef __cplusplus @@ -184,17 +173,17 @@ struct emacs_env_25 /* Embedded pointer type. */ emacs_value (*make_user_ptr) (emacs_env *env, - emacs_finalizer_function fin, + void (*fin) (void *) EMACS_NOEXCEPT, void *ptr); void *(*get_user_ptr) (emacs_env *env, emacs_value uptr); void (*set_user_ptr) (emacs_env *env, emacs_value uptr, void *ptr); - emacs_finalizer_function (*get_user_finalizer) (emacs_env *env, - emacs_value uptr); + void (*(*get_user_finalizer) (emacs_env *env, emacs_value uptr)) + (void *) EMACS_NOEXCEPT; void (*set_user_finalizer) (emacs_env *env, emacs_value uptr, - emacs_finalizer_function fin); + void (*fin) (void *) EMACS_NOEXCEPT); /* Vector functions. */ emacs_value (*vec_get) (emacs_env *env, emacs_value vec, ptrdiff_t i); diff --git a/src/lisp.h b/src/lisp.h index 90a0c1272c..02b8078a9f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3927,7 +3927,7 @@ extern bool let_shadows_global_binding_p (Lisp_Object symbol); #ifdef HAVE_MODULES /* Defined in alloc.c. */ -extern Lisp_Object make_user_ptr (void (*finalizer) (void*), void *p); +extern Lisp_Object make_user_ptr (void (*finalizer) (void *), void *p); /* Defined in emacs-module.c. */ extern void module_init (void); diff --git a/src/lread.c b/src/lread.c index e9f3d7da96..25e3ff01d4 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3720,7 +3720,11 @@ static size_t oblookup_last_bucket_number; Lisp_Object check_obarray (Lisp_Object obarray) { - if (!VECTORP (obarray) || ASIZE (obarray) == 0) + /* We don't want to signal a wrong-type-argument error when we are + shutting down due to a fatal error, and we don't want to hit + assertions in VECTORP and ASIZE if the fatal error was during GC. */ + if (!fatal_error_in_progress + && (!VECTORP (obarray) || ASIZE (obarray) == 0)) { /* If Vobarray is now invalid, force it to be valid. */ if (EQ (Vobarray, obarray)) Vobarray = initial_obarray; @@ -3210,7 +3210,8 @@ map_w32_filename (const char * name, const char ** pPath) return shortname; } - if (is_fat_volume (name, (const char **)&path)) /* truncate to 8.3 */ + if (!fatal_error_in_progress /* disable fancy processing during crash */ + && is_fat_volume (name, (const char **)&path)) /* truncate to 8.3 */ { register int left = 8; /* maximum number of chars in part */ register int extn = 0; /* extension added? */ diff --git a/src/xdisp.c b/src/xdisp.c index ee748bd868..d730a0bf1b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4583,11 +4583,15 @@ setup_for_ellipsis (struct it *it, int len) it->current.dpvec_index = 0; it->dpvec_face_id = -1; - /* Remember the current face id in case glyphs specify faces. - IT's face is restored in set_iterator_to_next. - saved_face_id was set to preceding char's face in handle_stop. */ - if (it->saved_face_id < 0 || it->saved_face_id != it->face_id) - it->saved_face_id = it->face_id = DEFAULT_FACE_ID; + /* Use IT->saved_face_id for the ellipsis, so that it has the same + face as the preceding text. IT->saved_face_id was set in + handle_stop to the face of the preceding character, and will be + different from IT->face_id only if the invisible text skipped in + handle_invisible_prop has some non-default face on its first + character. We thus ignore the face of the invisible text when we + display the ellipsis. IT's face is restored in set_iterator_to_next. */ + if (it->saved_face_id >= 0) + it->face_id = it->saved_face_id; /* If the ellipsis represents buffer text, it means we advanced in the buffer, so we should no longer ignore overlay strings. */ diff --git a/test/automated/vc-hg.el b/test/automated/vc-hg.el new file mode 100644 index 0000000000..ba966598c4 --- /dev/null +++ b/test/automated/vc-hg.el @@ -0,0 +1,58 @@ +;;; vc-hg.el --- tests for vc/vc-hg.el + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Dmitry Gutov <dgutov@yandex.ru> +;; Maintainer: emacs-devel@gnu.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'vc-hg) +(require 'vc-annotate) + +(ert-deftest vc-hg-annotate-extract-revision-at-line-with-filename () + ;; with filename + (with-temp-buffer + (save-excursion (insert "215 2007-06-20 CONTENTS:")) + (should (equal (vc-hg-annotate-extract-revision-at-line) + (cons + "215" + (expand-file-name "CONTENTS")))))) + +(ert-deftest vc-hg-annotate-extract-revision-at-line-with-user () + (with-temp-buffer + (save-excursion (insert " gerv 107217 2012-09-17:")) + (should (equal (vc-hg-annotate-extract-revision-at-line) + "107217")))) + +(ert-deftest vc-hg-annotate-extract-revision-at-line-with-both () + (with-temp-buffer + (save-excursion (insert "philringnalda 218075 2014-11-28 CLOBBER:")) + (should (equal (vc-hg-annotate-extract-revision-at-line) + (cons + "218075" + (expand-file-name "CLOBBER")))))) + +(ert-deftest vc-hg-annotate-time () + (with-temp-buffer + (save-excursion (insert "philringnalda 218075 2014-11-28 CLOBBER:")) + (should (floatp (vc-hg-annotate-time))))) + +;;; vc-hg.el ends here diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index f072584769..305ca9d677 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -44,6 +44,7 @@ (require 'vc-git) (require 'vc-hg) +(autoload 'dired-uncache "dired") (declare-function tramp-find-executable "tramp-sh") (declare-function tramp-get-remote-path "tramp-sh") (declare-function tramp-get-remote-stat "tramp-sh") @@ -1654,6 +1655,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (vc-register nil (list (car vc-handled-backends) (list (file-name-nondirectory tmp-name2)))))) + ;; vc-git uses an own process sentinel, Tramp's sentinel + ;; for flushing the cache isn't used. + (dired-uncache (concat (file-remote-p default-directory) "/")) (should (vc-registered (file-name-nondirectory tmp-name2))))) ;; Cleanup. @@ -1777,14 +1781,6 @@ Several special characters do not work properly there." (file-truename tramp-test-temporary-file-directory) nil (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) -(defun tramp--test-darwin-p () - "Check, whether the remote host runs Mac OS X. -Several special characters do not work properly there." - ;; We must refill the cache. `file-truename' does it. - (with-parsed-tramp-file-name - (file-truename tramp-test-temporary-file-directory) nil - (string-match "^Darwin" (tramp-get-connection-property v "uname" "")))) - (defun tramp--test-check-files (&rest files) "Run a simple but comprehensive test over every file in FILES." ;; We must use `file-truename' for the temporary directory, because @@ -2030,16 +2026,15 @@ Use the `ls' command." (defun tramp--test-utf8 () "Perform the test in `tramp-test32-utf8*'." - (tramp--instrument-test-case 10 (let ((coding-system-for-read 'utf-8) (coding-system-for-write 'utf-8) (file-name-coding-system 'utf-8)) (tramp--test-check-files (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ") - (unless (or (tramp--test-hpux-p) (tramp--test-darwin-p)) + (unless (tramp--test-hpux-p) "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت") "银河系漫游指南系列" - "Автостопом по гала́ктике")))) + "Автостопом по гала́ктике"))) (ert-deftest tramp-test32-utf8 () "Check UTF8 encoding in file names and file contents." diff --git a/test/manual/indent/shell.sh b/test/manual/indent/shell.sh index b0f69bd972..dc184ea0d7 100755 --- a/test/manual/indent/shell.sh +++ b/test/manual/indent/shell.sh @@ -3,6 +3,9 @@ setlock -n /tmp/getmail.lock && echo getmail isn\'t running +toto=$(grep hello foo | + wc) + # adsgsdg if foo; then |