From: Paul Eggert Date: Thu, 26 May 2016 20:20:29 +0000 (-0700) Subject: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/9a834970e822db10bc887db343fd8561a3639a66?hp=01d70ef7e620c7e8331f41d2a1e17d2c5a000c82 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs --- diff --git a/CONTRIBUTE b/CONTRIBUTE index e39c665f21..9d5d775a5e 100644 --- a/CONTRIBUTE +++ b/CONTRIBUTE @@ -183,7 +183,7 @@ intended for more-conservative changes such as bug fixes. Typically, collective development is active on the master branch and possibly on the current release branch. Periodically, the current release branch is merged into the master, using the gitmerge function described in -admin/notes-git-workflow. +admin/notes/git-workflow. If you are fixing a bug that exists in the current release, be sure to commit it to the release branch; it will be merged to the master diff --git a/admin/admin.el b/admin/admin.el index fe807ff96f..4af1ff9003 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -30,6 +30,7 @@ (defun add-release-logs (root version &optional date) "Add \"Version VERSION released.\" change log entries in ROOT. +Also update the etc/HISTORY file. Root must be the root of an Emacs source tree. Optional argument DATE is the release date, default today." (interactive (list (read-directory-name "Emacs root directory: ") @@ -42,6 +43,19 @@ Optional argument DATE is the release date, default today." (setq root (expand-file-name root)) (unless (file-exists-p (expand-file-name "src/emacs.c" root)) (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) + (let ((clog (expand-file-name "ChangeLog" root))) + (if (file-exists-p clog) + ;; Basic check that a ChangeLog that exists is not your personal one. + ;; TODO Perhaps we should move any existing file and unconditionally + ;; call make ChangeLog? Or make ChangeLog CHANGELOG=temp and compare + ;; with the existing? + (with-temp-buffer + (insert-file-contents clog) + (or (re-search-forward "^[ \t]*Copyright.*Free Software" nil t) + (user-error "ChangeLog looks like a personal one - remove it?"))) + (or + (zerop (call-process "make" nil nil nil "-C" root "ChangeLog")) + (error "Problem generating ChangeLog")))) (require 'add-log) (or date (setq date (funcall add-log-time-format nil t))) (let* ((logs (process-lines "find" root "-name" "ChangeLog")) @@ -53,7 +67,14 @@ Optional argument DATE is the release date, default today." (dolist (log logs) (find-file log) (goto-char (point-min)) - (insert entry)))) + (insert entry))) + (let ((histfile (expand-file-name "etc/HISTORY" root))) + (unless (file-exists-p histfile) + (error "%s not present" histfile)) + (find-file histfile) + (goto-char (point-max)) + (search-backward " ") + (insert (format "GNU Emacs %s (%s) emacs-%s\n\n" version date version)))) (defun set-version-in-file (root file version rx) "Subroutine of `set-version' and `set-copyright'." diff --git a/admin/authors.el b/admin/authors.el index f1aa2fa442..b93c9b251c 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -1361,24 +1361,36 @@ and changed by AUTHOR." (cons (list author wrote-list cowrote-list changed-list) authors-author-list))))) -(defun authors (root) +(defun authors (root &optional nologupdate) "Extract author information from change logs and Lisp source files. -ROOT is the root directory under which to find the files. If called -interactively, ROOT is read from the minibuffer. -Result is a buffer *Authors* containing authorship information, and a -buffer *Authors Errors* containing references to unknown files." - (interactive "DEmacs source directory: ") +ROOT is the root directory under which to find the files. +Interactively, read ROOT from the minibuffer. +Accurate author information requires up-to-date change logs, so this +first updates them, unless optional prefix argument NOLOGUPDATE is non-nil. +The result is a buffer *Authors* containing authorship information, +and a buffer *Authors Errors* containing references to unknown files." + (interactive "DEmacs source directory: \nP") (setq root (expand-file-name root)) + (unless (file-exists-p (expand-file-name "src/emacs.c" root)) + (unless (y-or-n-p + (format "Not the root directory of Emacs: %s, continue? " root)) + (user-error "Not the root directory"))) + ;; May contain your personal entries. + (or (not (file-exists-p (expand-file-name "ChangeLog" root))) + (y-or-n-p "Unversioned ChangeLog present, continue?") + (user-error "Unversioned ChangeLog may have irrelevant entries")) + (or nologupdate + ;; There are likely to be things that need fixing, so we update + ;; the versioned ChangeLog.N rather than the unversioned ChangeLog. + (zerop (call-process "make" nil nil nil + "-C" root "change-history-nocommit")) + (error "Problem updating ChangeLog")) (let ((logs (process-lines find-program root "-name" "ChangeLog*")) (table (make-hash-table :test 'equal)) (buffer-name "*Authors*") authors-checked-files-alist authors-invalid-file-names) (authors-add-fixed-entries table) - (unless (file-exists-p (expand-file-name "src/emacs.c" root)) - (unless (y-or-n-p - (format "Not the root directory of Emacs: %s, continue? " root)) - (error "Not the root directory"))) (dolist (log logs) (when (string-match "ChangeLog\\(.[0-9]+\\)?$" log) (message "Scanning %s..." log) diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt index 030ad4cee6..77486cc639 100644 --- a/admin/make-tarball.txt +++ b/admin/make-tarball.txt @@ -37,38 +37,38 @@ General steps (for each step, check for possible errors): M-: (require 'authors) RET M-x authors RET + (This first updates the current versioned ChangeLog.N) + If there is an "*Authors Errors*" buffer, address the issues. - If there was a ChangeLog typo, run "make change-history" and then - fix the newest ChangeLog history file. If a file was deleted or - renamed, consider adding an appropriate entry to - authors-ignored-files, authors-valid-file-names, or + If there was a ChangeLog typo, fix the relevant entry. + If a file was deleted or renamed, consider adding an appropriate + entry to authors-ignored-files, authors-valid-file-names, or authors-renamed-files-alist. - If necessary, repeat M-x authors after making those changes. + If necessary, repeat 'C-u M-x authors' after making those changes. Save the "*Authors*" buffer as etc/AUTHORS. Check the diff looks reasonable. Maybe add entries to authors-ambiguous-files or authors-aliases, and repeat. Commit any fixes to authors.el. 3. Set the version number (M-x load-file RET admin/admin.el RET, then - M-x set-version RET). For a release, add released ChangeLog - entries (create a ChangeLog symlink a la vc-dwim, then run M-x - add-release-logs RET, then run the shell command 'vc-dwim --commit'). - - For a pretest, start at version .90. After .99, use .990 (so that - it sorts). + M-x set-version RET). For a pretest, start at version .90. After + .99, use .990 (so that it sorts). The final pretest should be a release candidate. Set the version number to that of the actual release. Pick a date about a week - from now when you intend to make the release. Use vc-dwim and - M-x add-release-logs as described above to add commit messages - that will appear in the tarball's automatically-generated ChangeLog - file as entries for that date. + from now when you intend to make the release. Use M-x + add-release-logs to add entries to etc/HISTORY and the ChangeLog + file. It's best not to commit these files until the release is + actually made. Merge the entries from (unversioned) ChangeLog + into the top of the current versioned ChangeLog.N and commit that + along with etc/HISTORY. Then you can tag that commit as the + release. Name the tar file as emacs-XX.Y-rc1.tar. If all goes well in the following week, you can simply rename the file and use it for the actual release. If you need another release candidate, remember - to adjust the ChangeLog entries. + to adjust the ChangeLog and etc/HISTORY entries. If you need to change only a file(s) that cannot possibly affect the build (README, ChangeLog, NEWS, etc.) then rather than doing @@ -86,8 +86,8 @@ General steps (for each step, check for possible errors): 5. Copy lisp/loaddefs.el to lisp/ldefs-boot.el. - Commit etc/AUTHORS, lisp/ldefs-boot.el, and the files changed - by M-x set-version. + Commit ChangeLog.N, etc/AUTHORS, lisp/ldefs-boot.el, and the + files changed by M-x set-version. If someone else made a commit between step 1 and now, you need to repeat from step 4 onwards. (You can commit the files diff --git a/admin/release-process b/admin/release-process index 2668ea3b44..28f2307846 100644 --- a/admin/release-process +++ b/admin/release-process @@ -7,7 +7,7 @@ Each release cycle will be split into two periods. ** Phase one: development The first phase of the release schedule is the "heads-down" working -period for new features, on the 'master' branch and several feature +period for new features, on the 'master' branch and any needed feature branches. ** Phase two: fixing and stabilizing the release branch @@ -29,47 +29,60 @@ command to do that, then commit the changes it made and push to 'master'. For major releases, also update the value of 'customize-changed-options-previous-release'. -The 2 main manuals, the User Manual and the Emacs Lisp Manual, need to -be proofread, preferably by at least 2 different persons, and any -uncovered problems fixed. This is a lot of work, so it is advisable -to divide the job between several people (see the checklist near the -end of this file). +Each chapter of the two main manuals, the User Manual and the Emacs +Lisp Manual, should be proofread, preferably by at least two people. +This job is so big that it should be considered a collective +responsibility, not fobbed off on just a few people. After each +chapter is checked, mark off the name(s) of those who checked it in +the checklist near the end of this file. In parallel to this phase, 'master' can receive new features, to be released in the next release cycle. From time to time, the master branches merges bugfix commits from the "emacs-NN" branch. +See admin/gitmerge.el. * RELEASE-CRITICAL BUGS -Emacs uses the "blocking bug(s)" feature of Debbugs for bugs need to -be addressed in the next release. +Emacs uses the "blocking" feature of Debbugs for bugs that need to be +addressed in the next release. Currently, bug#19759 is the tracking bug for release of 25.1 and bug#21966 is the tracking bug for release of 25.2. Say bug#123 needs +bug#21966 is the tracking bug for the next release. Say bug#123 needs to be fixed for Emacs 25.1. Send a message to control@debbugs.gnu.org that says: block 19759 by 123 -Change "block" to "unblock" to unblock the bug. +Change "block" to "unblock" to remove a bug from the list. Closed +bugs are not listed as blockers, so you do not need to explicitly +unblock one that has been closed. You may need to force an update of +the tracking bug with ctrl-f5/shift-reload to see the latest version. + * TO BE DONE SHORTLY BEFORE RELEASE -** Make sure the Copyright date reflects the current year in the source -files. See 'admin/notes/years' for information about maintaining -copyright years for GNU Emacs. +See 'admin/make-tarball.txt' for the details of making a release or pretest. + +** Make sure the Copyright date reflects the current year in all source files. +(This should be done each January anyway, regardless of releases.) +See admin/update-copyright and admin.el's set-copyright. +For more details, see 'admin/notes/years'. ** Make sure the necessary sources and scripts for any generated files are included in the source tarball. (They don't need to be installed, -so e.g. admin/ is fine.) - -** Regenerate AUTHORS by using admin/authors.el -(The instructions are at the beginning of that file.) +so e.g. admin/ is fine.) This is important for legal compliance. ** Remove temporary +++/--- lines in NEWS. But first make sure there are no unmarked entries, and update the -documentation (or decide no updates are necessary) for those that -aren't. +documentation (or decide no updates are necessary) for those that aren't. + +** Try to reorder NEWS: most important things first, related items together. + +** For a major release, add a "New in Emacs XX" section to faq.texi. + +** cusver-check from admin.el can help find new defcustoms missing +:version tags. ** Manuals Check for node names using problematic characters: @@ -85,8 +98,7 @@ For major releases, rewrite the "Antinews" appendix of the User Manual previous version. The way to do that is read NEWS, pick up the more significant changes and new features in the upcoming release, then describe the "benefits" from losing those features. Be funny, use -humor. The text written for the previous major release can serve as -good example. +humor. The text written for the previous releases can serve as an example. Check cross-references between the manuals (e.g. from emacs to elisp) are correct. You can use something like the following in the info @@ -147,10 +159,6 @@ size that the GNU Press are going to use when they print the manuals. I think this is different to what you get if you just use e.g. 'make emacs.pdf' (e.g., enable "smallbook"). -** Try to reorder NEWS: most important things first, related items together. - -** For a major release, add a "New in Emacs XX" section to faq.texi. - ** Check the keybindings in the refcards are correct, and add any new ones. What paper size are the English versions supposed to be on? On Debian testing, the packages texlive-lang-czechslovak and @@ -172,11 +180,6 @@ pt-br Rodrigo Real ru Alex Ott sk Miroslav Vaško -** cusver-check from admin.el can help find new defcustoms missing -:version tags. - -** Add a line to etc/HISTORY for the release version number and date. - * BUGS ** Check for modes which bind M-s that conflicts with a new global binding M-s diff --git a/build-aux/gitlog-to-emacslog b/build-aux/gitlog-to-emacslog index 6b9cfc145b..085d2c2512 100755 --- a/build-aux/gitlog-to-emacslog +++ b/build-aux/gitlog-to-emacslog @@ -81,7 +81,7 @@ test -e .git || { --ignore-line='^; ' --format='%B' \ "$gen_origin..$new_origin" >"ChangeLog.tmp" || exit -if test -s "ChangeLog.tmp"; then +if test -e "ChangeLog.tmp"; then # Fix up bug references. # This would be better as eg a --transform option to gitlog-to-changelog, @@ -99,7 +99,7 @@ if test -s "ChangeLog.tmp"; then ` start_year= end_year= - for year in $years; do + for year in ${years:-`date +%Y`}; do : ${start_year:=$year} end_year=$year done @@ -110,13 +110,19 @@ if test -s "ChangeLog.tmp"; then year_range=$start_year-$end_year fi - # Update gen_origin and append a proper copyright notice. - sed -n ' - 1i\ + # Update gen_origin + if test "$gen_origin" != "$new_origin"; then + sed -n ' + 1i\ + + /^This file records repository revisions/p + s/^commit [0-9a-f]* (exclusive)/commit '"$gen_origin"' (exclusive)/p + s/^commit [0-9a-f]* (inclusive)/commit '"$new_origin"' (inclusive)/p + ' >"ChangeLog.tmp" || exit + fi - /^This file records repository revisions/p - s/^commit [0-9a-f]* (exclusive)/commit '"$gen_origin"' (exclusive)/p - s/^commit [0-9a-f]* (inclusive)/commit '"$new_origin"' (inclusive)/p + # Append a proper copyright notice. + sed -n ' /^See ChangeLog.[0-9]* for earlier/,${ s/ChangeLog\.[0-9]*/ChangeLog.'$nmax'/ s/\(Copyright[ (C)]*\)[0-9]*-[0-9]*/\1'"$year_range"'/ diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index af9d4d5030..ec227e9c2c 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1281,7 +1281,7 @@ The value of @code{diff-switches} should be a string; the default is @c Note that the actual name of the info file is diffutils.info, @c but it adds a dir entry for diff too. @c On older systems, only "info diff" works, not "info diffutils". -@xref{Top,, Diff, diff, Comparing and Merging Files}, for more +@xref{Top,, Diff, diffutils, Comparing and Merging Files}, for more information about the @command{diff} program. The output of the @code{diff} command is shown using a major mode diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 5786bc4070..b614ed221a 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1634,10 +1634,17 @@ variable to @samp{emacsclient +%d %s}.} You can run multiple Emacs servers on the same machine by giving each one a unique @dfn{server name}, using the variable @code{server-name}. For example, @kbd{M-x set-variable @key{RET} -server-name @key{RET} foo @key{RET}} sets the server name to +server-name @key{RET} "foo" @key{RET}} sets the server name to @samp{foo}. The @code{emacsclient} program can specify a server by name, using the @samp{-s} option (@pxref{emacsclient Options}). + If you want to run multiple Emacs daemons (@pxref{Initial Options}), +you can give each daemon its own server name like this: + +@example + emacs --eval "(setq server-name \"foo\")" --daemon +@end example + @findex server-eval-at If you have defined a server by a unique server name, it is possible to connect to the server from another Emacs instance and evaluate Lisp diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 7958a4a2bf..d841934c85 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -1264,13 +1264,13 @@ but match under character folding are known as @dfn{equivalent character sequences}. @kindex M-s ' @r{(Incremental Search)} -@findex isearch-toggle-character-fold +@findex isearch-toggle-char-fold Generally, search commands in Emacs do not by default perform character folding in order to match equivalent character sequences. You can enable this behavior by customizing the variable -@code{search-default-mode} to @code{character-fold-to-regexp}. +@code{search-default-mode} to @code{char-fold-to-regexp}. @xref{Search Customizations}. Within an incremental search, typing -@kbd{M-s '} (@code{isearch-toggle-character-fold}) toggles character +@kbd{M-s '} (@code{isearch-toggle-char-fold}) toggles character folding, but only for that search. (Replace commands have a different default, controlled by a separate option; see @ref{Replacement and Lax Matches}.) @@ -1481,7 +1481,7 @@ replacement is done without case conversion. (@pxref{Lax Search, character folding}) when looking for the text to replace. To enable character folding for matching in @code{query-replace} and @code{replace-string}, set the variable -@code{replace-character-fold} to a non-@code{nil} value. (This +@code{replace-char-fold} to a non-@code{nil} value. (This setting does not affect the replacement text, only how Emacs finds the text to replace. It also doesn't affect @code{replace-regexp}.) diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index f4e3393ea9..25f296e52c 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -1178,7 +1178,7 @@ see @url{http://www.gnu.org/prep/standards/html_node/Change-Log-Concepts.html}, @end ifset @xref{Change Log Concepts, Change Log Concepts, -Change Log Concepts, gnu-coding-standards, GNU Coding Standards}. +Change Log Concepts, standards, GNU Coding Standards}. @item When you write the fix, keep in mind that we can't install a change that diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index eea46af6b1..10162b3546 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -584,7 +584,6 @@ Regular Expression Searches * re-search-forward:: Very similar to @code{search-forward}. * forward-sentence:: A straightforward example of regexp search. * forward-paragraph:: A somewhat complex example. -* etags:: How to create your own @file{TAGS} table. * Regexp Review:: * re-search Exercises:: @@ -4583,54 +4582,21 @@ definition. @end ignore More generally, if you want to see a function in its original source -file, you can use the @code{find-tag} function to jump to it. -@code{find-tag} works with a wide variety of languages, not just -Lisp, and C, and it works with non-programming text as well. For -example, @code{find-tag} will jump to the various nodes in the -Texinfo source file of this document. -The @code{find-tag} function depends on @dfn{tags tables} that record -the locations of the functions, variables, and other items to which -@code{find-tag} jumps. - -To use the @code{find-tag} command, type @kbd{M-.} (i.e., press the -period key while holding down the @key{META} key, or else type the -@key{ESC} key and then type the period key), and then, at the prompt, -type in the name of the function whose source code you want to see, -such as @code{mark-whole-buffer}, and then type @key{RET}. Emacs will -switch buffers and display the source code for the function on your -screen. To switch back to your current buffer, type @kbd{C-x b -@key{RET}}. (On some keyboards, the @key{META} key is labeled -@key{ALT}.) - -@c !!! 22.1.1 tags table location in this paragraph -@cindex TAGS table, specifying -@findex find-tag -Depending on how the initial default values of your copy of Emacs are -set, you may also need to specify the location of your tags table, -which is a file called @file{TAGS}. For example, if you are -interested in Emacs sources, the tags table you will most likely want, -if it has already been created for you, will be in a subdirectory of -the @file{/usr/local/share/emacs/} directory; thus you would use the -@code{M-x visit-tags-table} command and specify a pathname such as -@file{/usr/local/share/emacs/22.1.1/lisp/TAGS}. If the tags table -has not already been created, you will have to create it yourself. It -will be in a file such as @file{/usr/local/src/emacs/src/TAGS}. - -@need 1250 -To create a @file{TAGS} file in a specific directory, switch to that -directory in Emacs using @kbd{M-x cd} command, or list the directory -with @kbd{C-x d} (@code{dired}). Then run the compile command, with -@w{@code{etags *.el}} as the command to execute: - -@smallexample -M-x compile RET etags *.el RET -@end smallexample - -For more information, see @ref{etags, , Create Your Own @file{TAGS} File}. - -After you become more familiar with Emacs Lisp, you will find that you will -frequently use @code{find-tag} to navigate your way around source code; -and you will create your own @file{TAGS} tables. +file, you can use the @code{xref-find-definitions} function to jump to +it. @code{xref-find-definitions} works with a wide variety of +languages, not just Lisp, and C, and it works with non-programming +text as well. For example, @code{xref-find-definitions} will jump to +the various nodes in the Texinfo source file of this document. + +To use the @code{xref-find-definitions} command, type @kbd{M-.} +(i.e., press the period key while holding down the @key{META} key, or +else type the @key{ESC} key and then type the period key), and then, +at the prompt, type in the name of the function whose source code you +want to see, such as @code{mark-whole-buffer}, and then type +@key{RET}. Emacs will switch buffers and display the source code for +the function on your screen. To switch back to your current buffer, +type @kbd{C-x b @key{RET}}. (On some keyboards, the @key{META} key is +labeled @key{ALT}.) @cindex Library, as term for ``file'' Incidentally, the files that contain Lisp code are conventionally @@ -12142,7 +12108,6 @@ introduces several new features. * re-search-forward:: Very similar to @code{search-forward}. * forward-sentence:: A straightforward example of regexp search. * forward-paragraph:: A somewhat complex example. -* etags:: How to create your own @file{TAGS} table. * Regexp Review:: * re-search Exercises:: @end menu @@ -13294,130 +13259,6 @@ key; you will be taken directly to the source. (Be sure to install your sources! Without them, you are like a person who tries to drive a car with his eyes shut!) -@node etags -@section Create Your Own @file{TAGS} File -@findex etags -@cindex @file{TAGS} file, create own - -Besides @kbd{C-h f} (@code{describe-function}), another way to see the -source of a function is to type @kbd{M-.} (@code{find-tag}) and the -name of the function when prompted for it. This is a good habit to -get into. The @kbd{M-.} (@code{find-tag}) command takes you directly -to the source for a function, variable, or node. The function depends -on tags tables to tell it where to go. - -If the @code{find-tag} function first asks you for the name of a -@file{TAGS} table, give it the name of a @file{TAGS} file such as -@file{/usr/local/src/emacs/src/TAGS}. (The exact path to your -@file{TAGS} file depends on how your copy of Emacs was installed. I -just told you the location that provides both my C and my Emacs Lisp -sources.) - -You can also create your own @file{TAGS} file for directories that -lack one. - -You often need to build and install tags tables yourself. They are -not built automatically. A tags table is called a @file{TAGS} file; -the name is in upper case letters. - -You can create a @file{TAGS} file by calling the @code{etags} program -that comes as a part of the Emacs distribution. Usually, @code{etags} -is compiled and installed when Emacs is built. (@code{etags} is not -an Emacs Lisp function or a part of Emacs; it is a C program.) - -@need 1250 -To create a @file{TAGS} file, first switch to the directory in which -you want to create the file. In Emacs you can do this with the -@kbd{M-x cd} command, or by visiting a file in the directory, or by -listing the directory with @kbd{C-x d} (@code{dired}). Then run the -compile command, with @w{@code{etags *.el}} as the command to execute - -@smallexample -M-x compile RET etags *.el RET -@end smallexample - -@noindent -to create a @file{TAGS} file for Emacs Lisp. - -For example, if you have a large number of files in your -@file{~/emacs} directory, as I do---I have 137 @file{.el} files in it, -of which I load 12---you can create a @file{TAGS} file for the Emacs -Lisp files in that directory. - -@need 1250 -The @code{etags} program takes all the usual shell wildcards. For -example, if you have two directories for which you want a single -@file{TAGS} file, type @w{@code{etags *.el ../elisp/*.el}}, where -@file{../elisp/} is the second directory: - -@smallexample -M-x compile RET etags *.el ../elisp/*.el RET -@end smallexample - -@need 1250 -Type - -@smallexample -M-x compile RET etags --help RET -@end smallexample - -@noindent -to see a list of the options accepted by @code{etags} as well as a -list of supported languages. - -The @code{etags} program handles more than 20 languages, including -Emacs Lisp, Common Lisp, Scheme, C, C++, Ada, Fortran, HTML, Java, -LaTeX, Pascal, Perl, PostScript, Python, TeX, Texinfo, makefiles, and -most assemblers. The program has no switches for specifying the -language; it recognizes the language in an input file according to its -file name and contents. - -@file{etags} is very helpful when you are writing code yourself and -want to refer back to functions you have already written. Just run -@code{etags} again at intervals as you write new functions, so they -become part of the @file{TAGS} file. - -If you think an appropriate @file{TAGS} file already exists for what -you want, but do not know where it is, you can use the @code{locate} -program to attempt to find it. - -Type @w{@kbd{M-x locate @key{RET} TAGS @key{RET}}} and Emacs will list -for you the full path names of all your @file{TAGS} files. On my -system, this command lists 34 @file{TAGS} files. On the other hand, a -plain vanilla system I recently installed did not contain any -@file{TAGS} files. - -If the tags table you want has been created, you can use the @code{M-x -visit-tags-table} command to specify it. Otherwise, you will need to -create the tag table yourself and then use @code{M-x -visit-tags-table}. - -@subsubheading Building Tags in the Emacs sources -@cindex Building Tags in the Emacs sources -@cindex Tags in the Emacs sources -@findex make tags - -The GNU Emacs sources come with a @file{Makefile} that contains a -sophisticated @code{etags} command that creates, collects, and merges -tags tables from all over the Emacs sources and puts the information -into one @file{TAGS} file in the @file{src/} directory. (The -@file{src/} directory is below the top level of your Emacs directory.) - -@need 1250 -To build this @file{TAGS} file, go to the top level of your Emacs -source directory and run the compile command @code{make tags}: - -@smallexample -M-x compile RET make tags RET -@end smallexample - -@noindent -(The @code{make tags} command works well with the GNU Emacs sources, -as well as with some other source packages.) - -For more information, see @ref{Tags, , Tag Tables, emacs, The GNU Emacs -Manual}. - @node Regexp Review @section Review diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index fd4fd4f379..8eee9e1d86 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -2290,7 +2290,7 @@ is actually typical for regexp syntax.) @cindex Recursive search/replace operations Dired mode (@kbd{M-x dired @key{RET}}, or @kbd{C-x d}) supports the -command @code{dired-do-query-replace-regexp} (@kbd{Q}), which allows +command @code{dired-do-find-regexp-and-replace} (@kbd{Q}), which allows users to replace regular expressions in multiple files. You can use this command to perform search/replace operations on @@ -2315,7 +2315,7 @@ To accept all replacements in each file, hit @kbd{!}. Another way to do the same thing is to use the ``tags'' feature of Emacs: it includes the command @code{tags-query-replace} which performs a query-replace across all the files mentioned in the @file{TAGS} file. -@xref{Tags Search,,, emacs, The GNU Emacs Manual}. +@xref{Identifier Search,,, emacs, The GNU Emacs Manual}. @node Documentation for etags @section Where is the documentation for @code{etags}? diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index f15e2f2518..81f97a9db8 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -261,7 +261,7 @@ variables @code{shr-color-visible-distance-min} and In addition to maintaining the history at run-time, EWW will also save the partial state of its buffers (the URIs and the titles of the pages visited) in the desktop file if one is used. @xref{Saving Emacs -Sessions, , emacs, The GNU Emacs Manual}. +Sessions,,, emacs, The GNU Emacs Manual}. @vindex eww-desktop-remove-duplicates EWW history may sensibly contain multiple entries for the same page diff --git a/doc/misc/sem-user.texi b/doc/misc/sem-user.texi index a8684a40b3..fd88c88c7e 100644 --- a/doc/misc/sem-user.texi +++ b/doc/misc/sem-user.texi @@ -874,9 +874,9 @@ command, like this: @end example @end defun -These commands are often more accurate than the @code{find-tag} -command (@pxref{Tags,,,emacs,Emacs manual}), because the Semantic -Analyzer is context-sensitive. +These commands are often more accurate than the @code{xref-find-definitions} +command (@pxref{Looking Up Identifiers,,,emacs,Emacs manual}), because +the Semantic Analyzer is context-sensitive. You can also use @kbd{C-c , j} (@code{semantic-complete-jump-local}) and @kbd{C-c , J} (@code{semantic-complete-jump}) to navigate tags. diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 314063cafe..37e2de896e 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2016-05-07.20} +\def\texinfoversion{2016-04-14.07} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -67,10 +67,6 @@ \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} -% LaTeX's \typeout. This ensures that the messages it is used for -% are identical in format to the corresponding ones from latex/pdflatex. -\def\typeout{\immediate\write17}% - \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. @@ -1538,6 +1534,7 @@ output) for that.)} % % PDF outline support % + \pdfmakepagedesttrue \relax % Emulate the primitive of pdfTeX \def\pdfdest name#1 xyz{% \special{pdf:dest (name#1) [@thispage /XYZ @xpos @ypos]}% @@ -3273,8 +3270,8 @@ end % @{ @} @lbracechar{} @rbracechar{} all generate brace characters. % Unless we're in typewriter, use \ecfont because the CM text fonts do % not have braces, and we don't want to switch into math. -\def\mylbrace{{\ifmonospace\char123\else\ensuremath\lbrace\fi}} -\def\myrbrace{{\ifmonospace\char125\else\ensuremath\rbrace\fi}} +\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} +\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} \let\{=\mylbrace \let\lbracechar=\{ \let\}=\myrbrace \let\rbracechar=\} \begingroup @@ -4756,7 +4753,7 @@ end \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx} \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}} -% Used when writing an index entry out to an index file to prevent +% Used when writing an index entry out to an index file, to prevent % expansion of Texinfo commands that can appear in an index entry. % \def\indexdummies{% @@ -4892,9 +4889,12 @@ end % % We want to disable all macros so that they are not expanded by \write. \macrolist - \definedummyword\value % \normalturnoffactive + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable } % \commondummiesnofonts: common to \commondummies and \indexnofonts. @@ -5159,10 +5159,9 @@ end \ifx\suffix\indexisfl\def\suffix{f1}\fi % Open the file \immediate\openout\csname#1indfile\endcsname \jobname.\suffix - % Using \immediate above here prevents an object entering into the current - % box, which could confound checks such as those in \safewhatsit for - % preceding skips. - \typeout{Writing index file \jobname.\suffix}% + % Using \immediate here prevents an object entering into the current box, + % which could confound checks such as those in \safewhatsit for preceding + % skips. \fi} \def\indexisfl{fl} @@ -5370,7 +5369,6 @@ end % index. The easiest way to prevent this problem is to make sure % there is some text. \putwordIndexNonexistent - \typeout{No file \jobname.\indexname s.}% \else \catcode`\\ = 0 % @@ -6684,14 +6682,7 @@ end % 1 and 2 (the page numbers aren't printed), and so are the first % two pages of the document. Thus, we'd have two destinations named % `1', and two named `2'. - \ifpdf - \global\pdfmakepagedesttrue - \else - \ifx\XeTeXrevision\thisisundefined - \else - \global\pdfmakepagedesttrue - \fi - \fi + \ifpdf \global\pdfmakepagedesttrue \fi } @@ -8871,7 +8862,6 @@ end % include an _ in the xref name, etc. \indexnofonts \turnoffactive - \def\value##1{##1}% \expandafter\global\expandafter\let\expandafter\Xthisreftitle \csname XR#1-title\endcsname }% @@ -9012,14 +9002,14 @@ end \fi\fi\fi } -% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX -% is output afterwards if non-empty. +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% \def\refx#1#2{% \requireauxfile {% \indexnofonts \otherbackslash - \def\value##1{##1}% \expandafter\global\expandafter\let\expandafter\thisrefX \csname XR#1\endcsname }% @@ -9044,18 +9034,16 @@ end #2% Output the suffix in any case. } -% This is the macro invoked by entries in the aux file. Define a control -% sequence for a cross-reference target (we prepend XR to the control sequence -% name to avoid collisions). The value is the page number. If this is a float -% type, we have more work to do. +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. % \def\xrdef#1#2{% - {% Expand the node or anchor name to remove control sequences. - % \turnoffactive stops 8-bit characters being changed to commands - % like @'e. \refx does the same to retrieve the value in the definition. + {% The node name might contain 8-bit characters, which in our current + % implementation are changed to commands like @'e. Don't let these + % mess up the control sequence name. \indexnofonts \turnoffactive - \def\value##1{##1}% \xdef\safexrefname{#1}% }% % diff --git a/doc/misc/url.texi b/doc/misc/url.texi index 097f626e71..06d2e559c3 100644 --- a/doc/misc/url.texi +++ b/doc/misc/url.texi @@ -828,12 +828,12 @@ The file transfer protocol. @xref{file/ftp}. @item ssh @cindex ssh -The secure shell protocol. @xref{Inline Methods,,, tramp, The Tramp +The secure shell protocol. @xref{Inline methods,,, tramp, The Tramp Manual}. @item scp @cindex scp -The secure file copy protocol. @xref{External Methods,,, tramp, The +The secure file copy protocol. @xref{External methods,,, tramp, The Tramp Manual}. @item rsync diff --git a/doc/misc/vhdl-mode.texi b/doc/misc/vhdl-mode.texi index ec83b7e62e..e26ec5277c 100644 --- a/doc/misc/vhdl-mode.texi +++ b/doc/misc/vhdl-mode.texi @@ -65,7 +65,7 @@ modify this GNU manual.'' * Syntactic Symbols:: * Frequently Asked Questions:: * Getting the latest VHDL Mode release:: -* Sample .emacs File:: +* Sample Init File:: * Limitations and Known Bugs:: * Mailing Lists and Submitting Bug Reports:: * GNU Free Documentation License:: The license for this documentation. @@ -484,7 +484,7 @@ Here's a simplified example of what you can add to your @file{.emacs} file to make the changes described in the previous section (@ref{Interactive Customization}) more permanent. See the Emacs manuals for more information on customizing Emacs via hooks. -@xref{Sample .emacs File}, for a more complete sample @file{.emacs} file. +@xref{Sample Init File}, for a more complete sample @file{.emacs} file. @example @group @@ -600,7 +600,7 @@ optional third argument, which if non-@code{nil}, automatically institutes the new style in the current buffer. The sample @file{.emacs} file provides a concrete example of how a new -style can be added and automatically set. @xref{Sample .emacs File}. +style can be added and automatically set. @xref{Sample Init File}. @node File Styles @subsection File Styles @@ -874,7 +874,7 @@ simply add the following to the top of your @file{.emacs} file: @end example -See the sample @file{.emacs} file @ref{Sample .emacs File} for +See the sample @file{.emacs} file @ref{Sample Init File} for details. @end quotation @@ -894,9 +894,9 @@ either of these lists. The official Emacs VHDL Mode Home Page can be found at @uref{http://www.iis.ee.ethz.ch/~zimmi/emacs/vhdl-mode.html}. -@node Sample .emacs File -@chapter Sample @file{.emacs} file -@cindex Sample @file{.emacs} file +@node Sample Init File +@chapter Sample Init File +@cindex Sample init file Most customizations can be done using the ``Customize'' entry in the VHDL Mode menu, which requires no editing of the .emacs file. diff --git a/doc/misc/viper.texi b/doc/misc/viper.texi index 6b169f3c8e..6b82653c62 100644 --- a/doc/misc/viper.texi +++ b/doc/misc/viper.texi @@ -2568,7 +2568,7 @@ above block should be commented out. Even though these commands are sometimes useful, they are no substitute for the powerful @emph{tag table} facility of Emacs. Viper's @kbd{:tag} command -in a primitive interface to Emacs tags. @xref{Tags,Tags,Tags,emacs, +in a primitive interface to Emacs tags. @xref{Tags Tables,,,emacs, The GNU Emacs Manual}, for more information on tags. The following two commands are normally bound to a mouse click and are part diff --git a/etc/AUTHORS b/etc/AUTHORS index 14e4fd39f3..760d7354ba 100644 --- a/etc/AUTHORS +++ b/etc/AUTHORS @@ -1161,6 +1161,7 @@ Dmitry Dzhus: changed gdb-mi.el gud.el fadr.el all.xpm building.texi Dmitry Gorbik: changed org.el Dmitry Gutov: wrote elisp-mode-tests.el json-tests.el vc-hg.el + xref-tests.el and changed ruby-mode.el xref.el elisp-mode.el etags.el project.el ruby-mode-tests.el vc-git.el ruby.rb package.el vc.el js.el log-edit.el menu-bar.el vc-svn.el minibuffer.el package-test.el progmodes/grep.el @@ -3480,7 +3481,7 @@ and co-wrote cal-dst.el and changed lisp.h configure.ac alloc.c process.c xdisp.c fileio.c sysdep.c keyboard.c image.c editfns.c emacs.c xterm.c lread.c data.c callproc.c fns.c Makefile.in eval.c buffer.c dispnew.c gnulib.mk - and 1472 other files + and 1473 other files Paul Fisher: changed fns.c diff --git a/etc/NEWS b/etc/NEWS index 4e8567e2fd..d1eadd56a2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1110,11 +1110,11 @@ as many other symbols like U+249C (PARENTHESIZED LATIN SMALL LETTER A). Character folding is enabled by customizing 'search-default-mode' to -the value 'character-fold-to-regexp'. You can also toggle character +the value 'char-fold-to-regexp'. You can also toggle character folding in the middle of a search by typing 'M-s ''. 'query-replace' honors character folding if the new variable -'replace-character-fold' is customized to a non-nil value. +'replace-char-fold' is customized to a non-nil value. +++ *** New user option 'search-default-mode'. @@ -1124,9 +1124,9 @@ value, nil specifies that Isearch does literal searches (however, as in previous Emacs versions). +++ -*** New function 'character-fold-to-regexp' can be used +*** New function 'char-fold-to-regexp' can be used by searching commands to produce a regexp matching anything that -character-folds into STRING. +char-folds into STRING. +++ *** The new 'M-s M-w' key binding uses eww to search the web for the diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 49dada970b..bc814169b7 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -718,6 +718,20 @@ the following variables: tex-font-script-display (how much to lower/raise); tex-suscript-height-ratio (how much smaller than normal); tex-suscript-height-minimum (minimum height). +** Screen refresh is slow when there are special characters for which no suitable font is available + +If the display is too slow in refreshing when you scroll to a new +region, or when you edit the buffer, it might be due to the fact that +some characters cannot be displayed in the default font, and Emacs is +spending too much time in looking for a suitable font to display them. + +You can suspect this if you have several characters that are displayed +as small rectangles containing a hexadecimal code inside. + +The solution is to install the appropriate fonts on your machine. For +instance if you are editing a text with a lot of math symbols, then +installing a font like 'Symbola' should solve this problem. + * Internationalization problems ** M-{ does not work on a Spanish PC keyboard. @@ -909,6 +923,21 @@ into Meta. This is because of the great importance of Meta in Emacs. ** Window-manager and toolkit-related problems +*** Emacs built with GTK+ toolkit produces corrupted display on HiDPI screen + +This can happen if you set GDK_SCALE=2 in the environment or in your +'.xinitrc' file. (This setting is usually accompanied by +GDK_DPI_SCALE=0.5.) Emacs can not support these settings correctly, +as it doesn't use GTK+ exclusively. The result is that sometimes +widgets like the scroll bar are displayed incorrectly, and frames +could be displayed "cropped" to only part of the stuff that should be +displayed. + +The workaround is to explicitly disable these settings when invoking +Emacs, for example (from a Posix shell prompt): + + $ GDK_SCALE=1 GDK_DPI_SCALE=1 emacs + *** Metacity: Resizing Emacs or ALT-Tab causes X to be unresponsive. This happens sometimes when using Metacity. Resizing Emacs or ALT-Tab:bing @@ -2561,51 +2590,70 @@ See , . ** Dumping -*** Segfault during 'make bootstrap' under the Linux kernel. +*** Segfault during 'make' -In Red Hat Linux kernels, "Exec-shield" functionality is enabled by -default, which creates a different memory layout that can break the -emacs dumper. Emacs tries to handle this at build time, but if this -fails, the following instructions may be useful. +If Emacs segfaults when 'make' executes one of these commands: -Exec-shield is enabled on your system if + LC_ALL=C ./temacs -batch -l loadup bootstrap + LC_ALL=C ./temacs -batch -l loadup dump - cat /proc/sys/kernel/exec-shield +the problem may be due to inadequate workarounds for address space +layout randomization (ASLR), an operating system feature that +randomizes the virtual address space of a process. ASLR is commonly +enabled in Linux and NetBSD kernels, and is intended to deter exploits +of pointer-related bugs in applications. If ASLR is enabled, the +command: -prints a value other than 0. (Please read your system documentation -for more details on Exec-shield and associated commands.) + cat /proc/sys/kernel/randomize_va_space # GNU/Linux + sysctl security.pax.aslr.global # NetBSD -Additionally, Linux kernel versions since 2.6.12 randomize the virtual -address space of a process by default. If this feature is enabled on -your system, then +outputs a nonzero value. - cat /proc/sys/kernel/randomize_va_space +These segfaults should not occur on most modern systems, because the +Emacs build procedure uses the command 'setfattr' or 'paxctl' to mark +the Emacs executable as requiring non-randomized address space, and +Emacs uses the 'personality' system call to disable address space +randomization when dumping. However, older kernels may not support +'setfattr', 'paxctl', or 'personality', and newer Linux kernels have a +secure computing mode (seccomp) that can be configured to disable the +'personality' call. -prints a value other than 0. +It may be possible to work around the 'personality' problem in a newer +Linux kernel by configuring seccomp to allow the 'personality' call. +For example, if you are building Emacs under Docker, you can run the +Docker container with a security profile that allows 'personality' by +using Docker's --security-opt option with an appropriate profile; see +. -When these features are enabled, building Emacs may segfault during -the execution of this command: +To work around the ASLR problem in either an older or a newer kernel, +you can temporarily disable the feature while building Emacs. On +GNU/Linux you can do so using the following command (as root). - ./temacs --batch --load loadup [dump|bootstrap] + echo 0 > /proc/sys/kernel/randomize_va_space -To work around this problem, you can temporarily disable these -features while building Emacs. You can do so using the following -commands (as root). Remember to re-enable them when you are done, -by echoing the original values back to the files. +You can re-enable the feature when you are done, by echoing the +original value back to the file. NetBSD uses a different command, +e.g., 'sysctl -w security.pax.aslr.global=0'. - echo 0 > /proc/sys/kernel/exec-shield - echo 0 > /proc/sys/kernel/randomize_va_space +Alternatively, you can try using the 'setarch' command when building +temacs like this, where -R disables address space randomization: -Or, on x86, you can try using the 'setarch' command when running -temacs, like this: + setarch $(uname -m) -R make - setarch i386 -R ./temacs --batch --load loadup [dump|bootstrap] +ASLR is not the only problem that can break Emacs dumping. Another +issue is that in Red Hat Linux kernels, Exec-shield is enabled by +default, and this creates a different memory layout. Emacs should +handle this at build time, but if this fails the following +instructions may be useful. Exec-shield is enabled on your system if -or + cat /proc/sys/kernel/exec-shield + +prints a nonzero value. You can temporarily disable it as follows: - setarch i386 -R make + echo 0 > /proc/sys/kernel/exec-shield -(The -R option disables address space randomization.) +As with randomize_va_space, you can re-enable Exec-shield when you are +done, by echoing the original value back to the file. *** temacs prints "Pure Lisp storage exhausted". diff --git a/lisp/character-fold.el b/lisp/char-fold.el similarity index 85% rename from lisp/character-fold.el rename to lisp/char-fold.el index 2d3a8c67fa..68bea29ea4 100644 --- a/lisp/character-fold.el +++ b/lisp/char-fold.el @@ -1,4 +1,4 @@ -;;; character-fold.el --- match unicode to similar ASCII -*- lexical-binding: t; -*- +;;; char-fold.el --- match unicode to similar ASCII -*- lexical-binding: t; -*- ;; Copyright (C) 2015-2016 Free Software Foundation, Inc. @@ -22,12 +22,12 @@ ;;; Code: -(eval-and-compile (put 'character-fold-table 'char-table-extra-slots 1)) +(eval-and-compile (put 'char-fold-table 'char-table-extra-slots 1)) -(defconst character-fold-table +(defconst char-fold-table (eval-when-compile - (let ((equiv (make-char-table 'character-fold-table)) - (equiv-multi (make-char-table 'character-fold-table)) + (let ((equiv (make-char-table 'char-fold-table)) + (equiv-multi (make-char-table 'char-fold-table)) (table (unicode-property-table-internal 'decomposition))) (set-char-table-extra-slot equiv 0 equiv-multi) @@ -115,7 +115,7 @@ equiv) equiv)) "Used for folding characters of the same group during search. -This is a char-table with the `character-fold-table' subtype. +This is a char-table with the `char-fold-table' subtype. Let us refer to the character in question by char-x. Each entry is either nil (meaning char-x only matches literally) @@ -136,18 +136,18 @@ For instance, the default alist for ?f includes: Exceptionally for the space character (32), ALIST is ignored.") -(defun character-fold--make-space-string (n) +(defun char-fold--make-space-string (n) "Return a string that matches N spaces." (format "\\(?:%s\\|%s\\)" (make-string n ?\s) (apply #'concat - (make-list n (or (aref character-fold-table ?\s) " "))))) + (make-list n (or (aref char-fold-table ?\s) " "))))) ;;;###autoload -(defun character-fold-to-regexp (string &optional _lax from) - "Return a regexp matching anything that character-folds into STRING. +(defun char-fold-to-regexp (string &optional _lax from) + "Return a regexp matching anything that char-folds into STRING. Any character in STRING that has an entry in -`character-fold-table' is replaced with that entry (which is a +`char-fold-table' is replaced with that entry (which is a regexp) and other characters are `regexp-quote'd. If the resulting regexp would be too long for Emacs to handle, @@ -156,7 +156,7 @@ just return the result of calling `regexp-quote' on STRING. FROM is for internal use. It specifies an index in the STRING from which to start." (let* ((spaces 0) - (multi-char-table (char-table-extra-slot character-fold-table 0)) + (multi-char-table (char-table-extra-slot char-fold-table 0)) (i (or from 0)) (end (length string)) (out nil)) @@ -172,9 +172,9 @@ from which to start." (pcase (aref string i) (`?\s (setq spaces (1+ spaces))) (c (when (> spaces 0) - (push (character-fold--make-space-string spaces) out) + (push (char-fold--make-space-string spaces) out) (setq spaces 0)) - (let ((regexp (or (aref character-fold-table c) + (let ((regexp (or (aref char-fold-table c) (regexp-quote (string c)))) ;; Long string. The regexp would probably be too long. (alist (unless (> end 50) @@ -206,13 +206,13 @@ from which to start." (let ((length (car entry)) (suffix-regexp (cdr entry))) (concat suffix-regexp - (character-fold-to-regexp subs nil length)))) + (char-fold-to-regexp subs nil length)))) `((0 . ,regexp) . ,matched-entries) "\\|") "\\)")))) out)))) (setq i (1+ i))) (when (> spaces 0) - (push (character-fold--make-space-string spaces) out)) + (push (char-fold--make-space-string spaces) out)) (let ((regexp (apply #'concat (nreverse out)))) ;; Limited by `MAX_BUF_SIZE' in `regex.c'. (if (> (length regexp) 5000) @@ -221,22 +221,22 @@ from which to start." ;;; Commands provided for completeness. -(defun character-fold-search-forward (string &optional bound noerror count) - "Search forward for a character-folded version of STRING. -STRING is converted to a regexp with `character-fold-to-regexp', +(defun char-fold-search-forward (string &optional bound noerror count) + "Search forward for a char-folded version of STRING. +STRING is converted to a regexp with `char-fold-to-regexp', which is searched for with `re-search-forward'. BOUND NOERROR COUNT are passed to `re-search-forward'." (interactive "sSearch: ") - (re-search-forward (character-fold-to-regexp string) bound noerror count)) + (re-search-forward (char-fold-to-regexp string) bound noerror count)) -(defun character-fold-search-backward (string &optional bound noerror count) - "Search backward for a character-folded version of STRING. -STRING is converted to a regexp with `character-fold-to-regexp', +(defun char-fold-search-backward (string &optional bound noerror count) + "Search backward for a char-folded version of STRING. +STRING is converted to a regexp with `char-fold-to-regexp', which is searched for with `re-search-backward'. BOUND NOERROR COUNT are passed to `re-search-backward'." (interactive "sSearch: ") - (re-search-backward (character-fold-to-regexp string) bound noerror count)) + (re-search-backward (char-fold-to-regexp string) bound noerror count)) -(provide 'character-fold) +(provide 'char-fold) -;;; character-fold.el ends here +;;; char-fold.el ends here diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 5f1a430434..528820876e 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el @@ -806,9 +806,16 @@ relevant to POS." 'describe-char-unidata-list)) 'follow-link t) (insert "\n") - (dolist (elt (if (eq describe-char-unidata-list t) - (nreverse (mapcar 'car char-code-property-alist)) - describe-char-unidata-list)) + (dolist (elt + (cond ((eq describe-char-unidata-list t) + (nreverse (mapcar 'car char-code-property-alist))) + ((< char 32) + ;; Temporary fix (2016-05-22): The + ;; decomposition item for \n corrupts the + ;; display on a Linux virtual terminal. + ;; (Bug #23594). + (remq 'decomposition describe-char-unidata-list)) + (t describe-char-unidata-list))) (let ((val (get-char-code-property char elt)) description) (when val diff --git a/lisp/desktop.el b/lisp/desktop.el index 822db050e1..dba3277c09 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -1163,7 +1163,7 @@ This function also sets `desktop-dirname' to nil." "Restore the state of a set of frames. This function depends on the value of `desktop-saved-frameset' being set (usually, by reading it from the desktop)." - (when (desktop-restoring-frameset-p) + (when (and (display-graphic-p) (desktop-restoring-frameset-p)) (frameset-restore desktop-saved-frameset :reuse-frames (eq desktop-restore-reuses-frames t) :cleanup-frames (not (eq desktop-restore-reuses-frames 'keep)) @@ -1634,15 +1634,8 @@ If there are no buffers left to create, kill the timer." (setq command-line-args (delete key command-line-args)) (desktop-save-mode 0))) (when desktop-save-mode - ;; People don't expect emacs -nw, or --daemon, - ;; to create graphical frames (bug#17693). - ;; TODO perhaps there should be a separate value - ;; for desktop-restore-frames to control this startup behavior? - (let ((desktop-restore-frames (and desktop-restore-frames - initial-window-system - (not (daemonp))))) - (desktop-read) - (setq inhibit-startup-screen t))))) + (desktop-read) + (setq inhibit-startup-screen t)))) (provide 'desktop) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 8afe18f8d9..4e3dab4bb3 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -302,10 +302,12 @@ contrast, `package-user-dir' contains packages for personal use." :risky t :version "24.1") -(defvar epg-gpg-program) +(declare-function epg-find-configuration "epg-config" + (protocol &optional force)) (defcustom package-check-signature - (if (progn (require 'epg-config) (executable-find epg-gpg-program)) + (if (and (require 'epg-config) + (epg-find-configuration 'OpenPGP)) 'allow-unsigned) "Non-nil means to check package signatures when installing. The value `allow-unsigned' means to still install a package even if @@ -1159,38 +1161,43 @@ errors signaled by ERROR-FORM or by BODY). (setq body (cdr (cdr body)))) (macroexp-let2* nil ((url-1 url) (noerror-1 noerror)) - `(cl-macrolet ((unless-error (body-2 &rest before-body) - (let ((err (make-symbol "err"))) - `(with-temp-buffer - (when (condition-case ,err - (progn ,@before-body t) - ,(list 'error ',error-form - (list 'unless ',noerror-1 - `(signal (car ,err) (cdr ,err))))) - ,@body-2))))) - (if (string-match-p "\\`https?:" ,url-1) - (let* ((url (concat ,url-1 ,file)) - (callback (lambda (status) - (let ((b (current-buffer))) - (require 'url-handlers) - (unless-error ,body - (when-let ((er (plist-get status :error))) - (error "Error retrieving: %s %S" url er)) - (with-current-buffer b - (goto-char (point-min)) - (unless (search-forward-regexp "^\r?\n\r?" nil 'noerror) - (error "Error retrieving: %s %S" url "incomprehensible buffer"))) - (url-insert-buffer-contents b url) - (kill-buffer b) - (goto-char (point-min))))))) - (if ,async - (unless-error nil (url-retrieve url callback nil 'silent)) - (unless-error ,body (url-insert-file-contents url)))) - (unless-error ,body - (let ((url (expand-file-name ,file ,url-1))) - (unless (file-name-absolute-p url) - (error "Location %s is not a url nor an absolute file name" url)) - (insert-file-contents url))))))) + (let ((url-sym (make-symbol "url")) + (b-sym (make-symbol "b-sym"))) + `(cl-macrolet ((unless-error (body-2 &rest before-body) + (let ((err (make-symbol "err"))) + `(with-temp-buffer + (when (condition-case ,err + (progn ,@before-body t) + ,(list 'error ',error-form + (list 'unless ',noerror-1 + `(signal (car ,err) (cdr ,err))))) + ,@body-2))))) + (if (string-match-p "\\`https?:" ,url-1) + (let ((,url-sym (concat ,url-1 ,file))) + (if ,async + (unless-error nil + (url-retrieve ,url-sym + (lambda (status) + (let ((,b-sym (current-buffer))) + (require 'url-handlers) + (unless-error ,body + (when-let ((er (plist-get status :error))) + (error "Error retrieving: %s %S" ,url-sym er)) + (with-current-buffer ,b-sym + (goto-char (point-min)) + (unless (search-forward-regexp "^\r?\n\r?" nil 'noerror) + (error "Error retrieving: %s %S" ,url-sym "incomprehensible buffer"))) + (url-insert-buffer-contents ,b-sym ,url-sym) + (kill-buffer ,b-sym) + (goto-char (point-min))))) + nil + 'silent)) + (unless-error ,body (url-insert-file-contents ,url-sym)))) + (unless-error ,body + (let ((url (expand-file-name ,file ,url-1))) + (unless (file-name-absolute-p url) + (error "Location %s is not a url nor an absolute file name" url)) + (insert-file-contents url)))))))) (define-error 'bad-signature "Failed to verify signature") @@ -1460,8 +1467,6 @@ taken care of by `package-initialize'." (defvar package--downloads-in-progress nil "List of in-progress asynchronous downloads.") -(declare-function epg-find-configuration "epg-config" - (protocol &optional force)) (declare-function epg-import-keys-from-file "epg" (context keys)) ;;;###autoload @@ -1561,12 +1566,6 @@ downloads in the background." (let ((default-keyring (expand-file-name "package-keyring.gpg" data-directory)) (inhibit-message async)) - (if (get 'package-check-signature 'saved-value) - (when package-check-signature - (epg-find-configuration 'OpenPGP)) - (setq package-check-signature - (if (epg-find-configuration 'OpenPGP) - 'allow-unsigned))) (when (and package-check-signature (file-exists-p default-keyring)) (condition-case-unless-debug error (package-import-keyring default-keyring) @@ -1874,6 +1873,7 @@ add a call to it along with some explanatory comments." (file-readable-p user-init-file) (file-writable-p user-init-file)) (let* ((buffer (find-buffer-visiting user-init-file)) + buffer-name (contains-init (if buffer (with-current-buffer buffer @@ -1889,8 +1889,12 @@ add a call to it along with some explanatory comments." (re-search-forward "(package-initialize\\_>" nil 'noerror))))) (unless contains-init (with-current-buffer (or buffer - (let ((delay-mode-hooks t)) + (let ((delay-mode-hooks t) + (find-file-visit-truename t)) (find-file-noselect user-init-file))) + (when buffer + (setq buffer-name (buffer-file-name)) + (set-visited-file-name (file-chase-links user-init-file))) (save-excursion (save-restriction (widen) @@ -1909,7 +1913,10 @@ add a call to it along with some explanatory comments." (insert "\n")) (let ((file-precious-flag t)) (save-buffer)) - (unless buffer + (if buffer + (progn + (set-visited-file-name buffer-name) + (set-buffer-modified-p nil)) (kill-buffer (current-buffer))))))))) (setq package--init-file-ensured t)) diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 6951dbb708..72fc89817a 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -631,7 +631,7 @@ (viper-over-whitespace-line)) (indent-to-left-margin)) (viper-add-newline-at-eob-if-necessary) - (viper-adjust-undo) + (viper-complete-complex-command-for-undo) (if (eq viper-current-state 'emacs-state) (viper-restore-cursor-color 'after-emacs-mode) @@ -1570,7 +1570,7 @@ If the prefix argument ARG is non-nil, it is used instead of `val'." (if (and (eolp) (not (bolp))) (backward-char 1)) )) - (viper-adjust-undo) ; take care of undo + (viper-complete-complex-command-for-undo) ; take care of undo ;; If the prev cmd was rotating the command ring, this means that `.' has ;; just executed a command from that ring. So, push it on the ring again. ;; If we are just executing previous command , then don't push viper-d-com @@ -1670,6 +1670,7 @@ invokes the command before that, etc." (undo-start) (undo-more 2) + (viper-complete-complex-command-for-undo) ;;(setq undo-beg-posn (or undo-beg-posn (point)) ;; undo-end-posn (or undo-end-posn (point))) ;;(setq undo-beg-posn (or undo-beg-posn before-undo-pt) @@ -1709,37 +1710,17 @@ invokes the command before that, etc." ;; The following two functions are used to set up undo properly. ;; In VI, unlike Emacs, if you open a line, say, and add a bunch of lines, ;; they are undone all at once. -(defun viper-adjust-undo () - (if viper-undo-needs-adjustment - (let ((inhibit-quit t) - tmp tmp2) - (setq viper-undo-needs-adjustment nil) - (if (listp buffer-undo-list) - (if (setq tmp (memq viper-buffer-undo-list-mark buffer-undo-list)) - (progn - (setq tmp2 (cdr tmp)) ; the part after mark - - ;; cut tail from buffer-undo-list temporarily by direct - ;; manipulation with pointers in buffer-undo-list - (setcdr tmp nil) - - (setq buffer-undo-list (delq nil buffer-undo-list)) - (setq buffer-undo-list - (delq viper-buffer-undo-list-mark buffer-undo-list)) - ;; restore tail of buffer-undo-list - (setq buffer-undo-list (nconc buffer-undo-list tmp2))) - (setq buffer-undo-list (delq nil buffer-undo-list))))) - )) +(defun viper-complete-complex-command-for-undo () + (setq undo-auto-disable-boundaries nil) + (setq viper-undo-in-complex-command nil) + (undo-boundary)) (defun viper-set-complex-command-for-undo () - (if (listp buffer-undo-list) - (if (not viper-undo-needs-adjustment) - (let ((inhibit-quit t)) - (setq buffer-undo-list - (cons viper-buffer-undo-list-mark buffer-undo-list)) - (setq viper-undo-needs-adjustment t))))) - + (when (not viper-undo-in-complex-command) + (setq undo-auto-disable-boundaries t) + (setq viper-undo-in-complex-command t) + (undo-boundary))) ;;; Viper's destructive Command ring utilities @@ -2607,7 +2588,7 @@ These keys are ESC, RET, and LineFeed." (delete-char 1 t) (insert char)) - (viper-adjust-undo) + (viper-complete-complex-command-for-undo) (backward-char arg) )) diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index 104245b757..c1e7662947 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -370,13 +370,8 @@ Use `\\[viper-set-expert-level]' to change this.") ;; VI-style Undo ;; Used to 'undo' complex commands, such as replace and insert commands. -(viper-deflocalvar viper-undo-needs-adjustment nil) -(put 'viper-undo-needs-adjustment 'permanent-local t) - -;; A mark that Viper puts on buffer-undo-list. Marks the beginning of a -;; complex command that must be undone atomically. If inserted, it is -;; erased by viper-change-state-to-vi and viper-repeat. -(defconst viper-buffer-undo-list-mark 'viper) +(viper-deflocalvar viper-undo-in-complex-command nil) +(put 'viper-undo-in-complex-command 'permanent-local t) (defcustom viper-keep-point-on-undo nil "Non-nil means not to move point while undoing commands. diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index f2bb8e2569..28eec4f0df 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2733,8 +2733,8 @@ See also `locale-charset-language-names', `locale-language-names', ;; Default to A4 paper if we're not in a C, POSIX or US locale. ;; (See comments in Flocale_info.) (unless frame - (let ((locale locale) - (paper (locale-info 'paper))) + (let ((paper (locale-info 'paper)) + locale) (if paper ;; This will always be null at the time of writing. (cond diff --git a/lisp/isearch.el b/lisp/isearch.el index 418d9ea273..7360a0b374 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -222,7 +222,7 @@ It is nil if none yet.") Default value, nil, means edit the string instead." :type 'boolean) -(autoload 'character-fold-to-regexp "character-fold") +(autoload 'char-fold-to-regexp "char-fold") (defcustom search-default-mode nil "Default mode to use when starting isearch. @@ -236,7 +236,7 @@ isearch). If a function, use that function as an `isearch-regexp-function'. Example functions (and the keys to toggle them during isearch) are `word-search-regexp' \(`\\[isearch-toggle-word]'), `isearch-symbol-regexp' -\(`\\[isearch-toggle-symbol]'), and `character-fold-to-regexp' \(`\\[isearch-toggle-character-fold]')." +\(`\\[isearch-toggle-symbol]'), and `char-fold-to-regexp' \(`\\[isearch-toggle-char-fold]')." ;; :type is set below by `isearch-define-mode-toggle'. :type '(choice (const :tag "Literal search" nil) (const :tag "Regexp search" t) @@ -510,6 +510,7 @@ This is like `describe-bindings', but displays only Isearch keys." ;; People expect to be able to paste with the mouse. (define-key map [mouse-2] #'isearch-mouse-2) (define-key map [down-mouse-2] nil) + (define-key map [xterm-paste] #'isearch-xterm-paste) ;; Some bindings you may want to put in your isearch-mode-hook. ;; Suggest some alternates... @@ -718,7 +719,7 @@ Type \\[isearch-toggle-invisible] to toggle search in invisible text. Type \\[isearch-toggle-regexp] to toggle regular-expression mode. Type \\[isearch-toggle-word] to toggle word mode. Type \\[isearch-toggle-symbol] to toggle symbol mode. -Type \\[isearch-toggle-character-fold] to toggle character folding. +Type \\[isearch-toggle-char-fold] to toggle character folding. Type \\[isearch-toggle-lax-whitespace] to toggle whitespace matching. In incremental searches, a space or spaces normally matches any whitespace @@ -1546,9 +1547,9 @@ The command then executes BODY and updates the isearch prompt." Turning on word search turns off regexp mode.") (isearch-define-mode-toggle symbol "_" isearch-symbol-regexp "\ Turning on symbol search turns off regexp mode.") -(isearch-define-mode-toggle character-fold "'" character-fold-to-regexp "\ +(isearch-define-mode-toggle char-fold "'" char-fold-to-regexp "\ Turning on character-folding turns off regexp mode.") -(put 'character-fold-to-regexp 'isearch-message-prefix "char-fold ") +(put 'char-fold-to-regexp 'isearch-message-prefix "char-fold ") (isearch-define-mode-toggle regexp "r" nil nil (setq isearch-regexp (not isearch-regexp)) @@ -2001,6 +2002,13 @@ is bound to outside of Isearch." (when (functionp binding) (call-interactively binding))))) +(declare-function xterm--pasted-text "term/xterm" ()) + +(defun isearch-xterm-paste () + "Pull terminal paste into search string." + (interactive) + (isearch-yank-string (xterm--pasted-text))) + (defun isearch-yank-internal (jumpform) "Pull the text from point to the point reached by JUMPFORM. JUMPFORM is a lambda expression that takes no arguments and returns diff --git a/lisp/leim/quail/czech.el b/lisp/leim/quail/czech.el index 365c3c5105..ddb4af53db 100644 --- a/lisp/leim/quail/czech.el +++ b/lisp/leim/quail/czech.el @@ -142,18 +142,7 @@ ("=[" ?\[) ("=]" ?\]) ("={" ?{) - ("=}" ?}) - ([kp-1] ?1) - ([kp-2] ?2) - ([kp-3] ?3) - ([kp-4] ?4) - ([kp-5] ?5) - ([kp-6] ?6) - ([kp-7] ?7) - ([kp-8] ?8) - ([kp-9] ?9) - ([kp-0] ?0) - ([kp-add] ?+)) + ("=}" ?})) (quail-define-package "czech-qwerty" "Czech" "CZ" t @@ -260,18 +249,7 @@ ("=[" ?\[) ("=]" ?\]) ("={" ?{) - ("=}" ?}) - ([kp-1] ?1) - ([kp-2] ?2) - ([kp-3] ?3) - ([kp-4] ?4) - ([kp-5] ?5) - ([kp-6] ?6) - ([kp-7] ?7) - ([kp-8] ?8) - ([kp-9] ?9) - ([kp-0] ?0) - ([kp-add] ?+)) + ("=}" ?})) (quail-define-package "czech-prog-1" "Czech" "CZ" t @@ -350,18 +328,7 @@ All other keys are the same as on standard US keyboard." ("++U" ?Ů) ("+++U" ?Ü) ("+Y" ?Ý) - ("+Z" ?Ž) - ([kp-1] ?1) - ([kp-2] ?2) - ([kp-3] ?3) - ([kp-4] ?4) - ([kp-5] ?5) - ([kp-6] ?6) - ([kp-7] ?7) - ([kp-8] ?8) - ([kp-9] ?9) - ([kp-0] ?0) - ([kp-add] ?+)) + ("+Z" ?Ž)) (quail-define-package "czech-prog-2" "Czech" "CZ" t @@ -440,18 +407,7 @@ All other keys are the same as on standard US keyboard." ("++U" ?Ů) ("+++U" ?Ü) ("+Y" ?Ý) - ("+Z" ?Ž) - ([kp-1] ?1) - ([kp-2] ?2) - ([kp-3] ?3) - ([kp-4] ?4) - ([kp-5] ?5) - ([kp-6] ?6) - ([kp-7] ?7) - ([kp-8] ?8) - ([kp-9] ?9) - ([kp-0] ?0) - ([kp-add] ?+)) + ("+Z" ?Ž)) (quail-define-package "czech-prog-3" "Czech" "CZ" t @@ -552,17 +508,6 @@ All other keys are the same as on standard US keyboard." ("+u" ?ů) ("+=u" ?ü) ("=y" ?ý) - ("+z" ?ž) - ([kp-1] ?1) - ([kp-2] ?2) - ([kp-3] ?3) - ([kp-4] ?4) - ([kp-5] ?5) - ([kp-6] ?6) - ([kp-7] ?7) - ([kp-8] ?8) - ([kp-9] ?9) - ([kp-0] ?0) - ([kp-add] ?+)) + ("+z" ?ž)) ;;; czech.el ends here diff --git a/lisp/leim/quail/slovak.el b/lisp/leim/quail/slovak.el index 4294fd7613..e00f03fa1f 100644 --- a/lisp/leim/quail/slovak.el +++ b/lisp/leim/quail/slovak.el @@ -151,18 +151,7 @@ ("+7" ?&) ("+8" ?*) ("+9" ?\() - ("+0" ?\)) - ([kp-1] ?1) - ([kp-2] ?2) - ([kp-3] ?3) - ([kp-4] ?4) - ([kp-5] ?5) - ([kp-6] ?6) - ([kp-7] ?7) - ([kp-8] ?8) - ([kp-9] ?9) - ([kp-0] ?0) - ([kp-add] ?+)) + ("+0" ?\))) (quail-define-package @@ -245,18 +234,7 @@ All other keys are the same as on standard US keyboard." ("[[[U" ?Ü) ("[Y" ?Ý) ("[Z" ?Ž) - ("[[Z" ?Ž) - ([kp-1] ?1) - ([kp-2] ?2) - ([kp-3] ?3) - ([kp-4] ?4) - ([kp-5] ?5) - ([kp-6] ?6) - ([kp-7] ?7) - ([kp-8] ?8) - ([kp-9] ?9) - ([kp-0] ?0) - ([kp-add] ?+)) + ("[[Z" ?Ž)) (quail-define-package @@ -347,18 +325,7 @@ All other keys are the same as on standard US keyboard." ("+U" ?Ů) ("+=U" ?Ü) ("=Y" ?Ý) - ("+Z" ?Ž) - ([kp-1] ?1) - ([kp-2] ?2) - ([kp-3] ?3) - ([kp-4] ?4) - ([kp-5] ?5) - ([kp-6] ?6) - ([kp-7] ?7) - ([kp-8] ?8) - ([kp-9] ?9) - ([kp-0] ?0) - ([kp-add] ?+)) + ("+Z" ?Ž)) (quail-define-package @@ -463,17 +430,6 @@ All other keys are the same as on standard US keyboard." ("[Y" ?Ý) ("[Z" ?Ž) ("[[Z" ?Ž) - ("]Z" ?Ž) - ([kp-1] ?1) - ([kp-2] ?2) - ([kp-3] ?3) - ([kp-4] ?4) - ([kp-5] ?5) - ([kp-6] ?6) - ([kp-7] ?7) - ([kp-8] ?8) - ([kp-9] ?9) - ([kp-0] ?0) - ([kp-add] ?+)) + ("]Z" ?Ž)) ;;; slovak.el ends here diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 933e2d22f6..a6541182e2 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1263,7 +1263,7 @@ mail status in mode line")) (defvar menu-bar-search-options-menu (let ((menu (make-sparse-keymap "Search Options"))) - (dolist (x '((character-fold-to-regexp "Fold Characters" "Character folding") + (dolist (x '((char-fold-to-regexp "Fold Characters" "Character folding") (isearch-symbol-regexp "Whole Symbols" "Whole symbol") (word-search-regexp "Whole Words" "Whole word"))) (bindings--define-key menu (vector (nth 0 x)) diff --git a/lisp/printing.el b/lisp/printing.el index 3bd5a67298..d9cc2a3614 100644 --- a/lisp/printing.el +++ b/lisp/printing.el @@ -5673,7 +5673,7 @@ If menu binding was not done, calls `pr-menu-bind'." (or (listp switches) (error "%S should have a list of strings" mess)) (lpr-flatten-list ; dynamic evaluation - (mapcar 'ps-eval-switch switches))) + (mapcar #'lpr-eval-switch switches))) (defun pr-ps-preview (kind n-up filename mess) diff --git a/lisp/replace.el b/lisp/replace.el index 0b25200be5..9e2d521baf 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -33,7 +33,7 @@ :type 'boolean :group 'matching) -(defcustom replace-character-fold nil +(defcustom replace-char-fold nil "Non-nil means replacement commands should do character folding in matches. This means, for instance, that \\=' will match a large variety of unicode quotes. @@ -324,7 +324,7 @@ If `replace-lax-whitespace' is non-nil, a space or spaces in the string to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. -If `replace-character-fold' is non-nil, matching uses character folding, +If `replace-char-fold' is non-nil, matching uses character folding, i.e. it ignores diacritics and other differences between equivalent character strings. @@ -383,7 +383,7 @@ If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. -This function is not affected by `replace-character-fold'. +This function is not affected by `replace-char-fold'. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. A negative prefix arg means @@ -474,7 +474,7 @@ If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. -This function is not affected by `replace-character-fold'. +This function is not affected by `replace-char-fold'. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches that are surrounded by word boundaries. @@ -568,7 +568,7 @@ If `replace-lax-whitespace' is non-nil, a space or spaces in the string to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. -If `replace-character-fold' is non-nil, matching uses character folding, +If `replace-char-fold' is non-nil, matching uses character folding, i.e. it ignores diacritics and other differences between equivalent character strings. @@ -623,7 +623,7 @@ If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. -This function is not affected by `replace-character-fold' +This function is not affected by `replace-char-fold' In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer's @@ -2055,9 +2055,9 @@ It is called with three arguments, as if it were ;; used after `recursive-edit' might override them. (let* ((isearch-regexp regexp-flag) (isearch-regexp-function (or delimited-flag - (and replace-character-fold + (and replace-char-fold (not regexp-flag) - #'character-fold-to-regexp))) + #'char-fold-to-regexp))) (isearch-lax-whitespace replace-lax-whitespace) (isearch-regexp-lax-whitespace diff --git a/lisp/ses.el b/lisp/ses.el index a87386e173..b2fd2bbe9a 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -3455,9 +3455,18 @@ highlighted range in the spreadsheet." (setq cell (or cell (ses-get-cell row col)) old-name (ses-cell-symbol cell) new-rowcol (ses-decode-cell-symbol (symbol-name new-name))) + ;; when ses-rename-cell is called interactively, then 'sym' is the + ;; 'cursor-intangible' property of text at cursor position, while + ;; 'old-name' is the symbol stored in array cell at coordinate + ;; 'rowcol' corresponding to 'ses-cell' property of symbol + ;; 'sym'. Both must be the same. + (unless (eq sym old-name) + (error "Spreadsheet is broken, both symbols %S and %S refering to cell (%d,%d)" sym old-name row col)) (if new-rowcol + ;; the new name is of A1 type, so we test that the coordinate + ;; inferred from new name (if (equal new-rowcol rowcol) - (put new-name 'ses-cell rowcol) + (put new-name 'ses-cell rowcol) (error "Not a valid name for this cell location")) (setq ses--named-cell-hashmap (or ses--named-cell-hashmap (make-hash-table :test 'eq))) @@ -3471,7 +3480,7 @@ highlighted range in the spreadsheet." (setf (ses-cell-formula xcell) (ses-replace-name-in-formula (ses-cell-formula xcell) - sym + old-name new-name)))) ;; Replace name by new name in reference list of cells to which renamed ;; cell refers to. @@ -3479,11 +3488,14 @@ highlighted range in the spreadsheet." (let* ((x (ses-sym-rowcol ref)) (xcell (ses-get-cell (car x) (cdr x)))) (setf (ses-cell-references xcell) - (cons new-name (delq sym + (cons new-name (delq old-name (ses-cell-references xcell)))))) (set (make-local-variable new-name) (symbol-value sym)) (setf (ses-cell--symbol cell) new-name) - (makunbound sym) + ;; Unbind old name + (if (eq (get old-name 'ses-cell) :ses-named) + (ses--unbind-cell-name old-name) + (kill-local-variable old-name)) (and curcell (setq ses--curcell new-name)) (save-excursion (or curcell (ses-goto-print row col)) diff --git a/lisp/simple.el b/lisp/simple.el index 65664c9366..affc403dcd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2848,6 +2848,18 @@ buffers that were changed during the last command.") If set to non-nil, this will effectively disable the timer.") +(defvar-local undo-auto-disable-boundaries nil + "Disable the automatic addition of boundaries. + +If set to non-nil, `undo-boundary' will not be called +automatically in a buffer either at the end of a command, or as a +result of `undo-auto-current-boundary-timer'. + +When this is set to non-nil, it is important to ensure that +`undo-boundary' is called frequently enough. Failure to do so +will result in user-visible warnings that the situation is +probably a bug.") + (defvar undo-auto--this-command-amalgamating nil "Non-nil if `this-command' should be amalgamated. This variable is set to nil by `undo-auto--boundaries' and is set @@ -2887,7 +2899,8 @@ REASON describes the reason that the boundary is being added; see (dolist (b undo-auto--undoably-changed-buffers) (when (buffer-live-p b) (with-current-buffer b - (undo-auto--ensure-boundary cause)))) + (unless undo-auto-disable-boundaries + (undo-auto--ensure-boundary cause))))) (setq undo-auto--undoably-changed-buffers nil)) (defun undo-auto--boundary-timer () @@ -2914,10 +2927,10 @@ See also `undo-auto--buffer-undoably-changed'.") "Add an `undo-boundary' in appropriate buffers." (undo-auto--boundaries (let ((amal undo-auto--this-command-amalgamating)) - (setq undo-auto--this-command-amalgamating nil) - (if amal - 'amalgamate - 'command)))) + (setq undo-auto--this-command-amalgamating nil) + (if amal + 'amalgamate + 'command)))) (defun undo-auto-amalgamate () "Amalgamate undo if necessary. diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 5a38ebe8e4..01c01130e7 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -71,28 +71,29 @@ string bytes that can be copied is 3/4 of this value." (defconst xterm-paste-ending-sequence "\e[201~" "Characters send by the terminal to end a bracketed paste.") +(defun xterm--pasted-text () + "Handle the rest of a terminal paste operation. +Return the pasted text as a string." + (let ((end-marker-length (length xterm-paste-ending-sequence))) + (with-temp-buffer + (set-buffer-multibyte nil) + (while (not (search-backward xterm-paste-ending-sequence + (- (point) end-marker-length) t)) + (let ((event (read-event nil nil + ;; Use finite timeout to avoid glomming the + ;; event onto this-command-keys. + most-positive-fixnum))) + (when (eql event ?\r) + (setf event ?\n)) + (insert event))) + (let ((last-coding-system-used)) + (decode-coding-region (point-min) (point) (keyboard-coding-system) + t))))) + (defun xterm-paste () "Handle the start of a terminal paste operation." (interactive) - (let* ((end-marker-length (length xterm-paste-ending-sequence)) - (pasted-text (with-temp-buffer - (set-buffer-multibyte nil) - (while (not (search-backward - xterm-paste-ending-sequence - (- (point) end-marker-length) t)) - (let ((event (read-event - nil nil - ;; Use finite timeout to avoid - ;; glomming the event onto - ;; this-command-keys. - most-positive-fixnum))) - (when (eql event ?\r) - (setf event ?\n)) - (insert event))) - (let ((last-coding-system-used)) - (decode-coding-region - (point-min) (point) - (keyboard-coding-system) t)))) + (let* ((pasted-text (xterm--pasted-text)) (interprogram-paste-function (lambda () pasted-text))) (yank))) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index dfe6b293e9..50198713b4 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -127,7 +127,7 @@ This is only meaningful if you don't use the implicit checkout model :version "21.1" :group 'vc-cvs) -(defcustom vc-stay-local 'only-file +(defcustom vc-cvs-stay-local 'only-file "Non-nil means use local operations when possible for remote repositories. This avoids slow queries over the network and instead uses heuristics and past information to determine the current status of a file. @@ -137,11 +137,11 @@ server, but heuristics will be used to determine the status for all other VC operations. The value can also be a regular expression or list of regular -expressions to match against the host name of a repository; then VC -only stays local for hosts that match it. Alternatively, the value -can be a list of regular expressions where the first element is the -symbol `except'; then VC always stays local except for hosts matched -by these regular expressions." +expressions to match against the host name of a repository; then +vc-cvs only stays local for hosts that match it. Alternatively, +the value can be a list of regular expressions where the first +element is the symbol `except'; then vc-cvs always stays local +except for hosts matched by these regular expressions." :type '(choice (const :tag "Always stay local" t) (const :tag "Only for file operations" only-file) (const :tag "Don't stay local" nil) @@ -795,8 +795,7 @@ If FILE is a list of files, return non-nil if any of them individually should stay local." (if (listp file) (delq nil (mapcar (lambda (arg) (vc-cvs-stay-local-p arg)) file)) - (let* ((sym (vc-make-backend-sym 'CVS 'stay-local)) - (stay-local (if (boundp sym) (symbol-value sym) vc-stay-local))) + (let ((stay-local vc-cvs-stay-local)) (if (symbolp stay-local) stay-local (let ((dirname (if (file-directory-p file) (directory-file-name file) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 25b41e34e6..af875e8990 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -552,7 +552,7 @@ ;; argument, since on no system since RCS has setting the initial ;; revision been even possible, let alone sane. ;; -;; INCOMPATIBLE CHANGE: In older versions of the API, vc-diff did +;; - INCOMPATIBLE CHANGE: In older versions of the API, vc-diff did ;; not take an async-mode flag as a fourth optional argument. (This ;; change eliminated a particularly ugly global.) ;; @@ -563,12 +563,12 @@ ;; SVN.) ;; ;; - INCOMPATIBLE CHANGE: The old fourth 'default-state' argument of -;; vc-dir-status-files is gone; none of the back ends actually used it. +;; dir-status-files is gone; none of the back ends actually used it. ;; -;; - vc-dir-status is no longer a public method; it has been replaced -;; by vc-dir-status-files. +;; - dir-status is no longer a public method; it has been replaced by +;; dir-status-files. ;; -;; - vc-state-heuristic is no longer a public method (the CVS backend +;; - state-heuristic is no longer a public method (the CVS backend ;; retains it as a private one). ;; ;; - the vc-mistrust-permissions configuration variable is gone; the @@ -577,8 +577,8 @@ ;; only affected back ends were SCCS and RCS. ;; ;; - vc-stay-local-p and repository-hostname are no longer part -;; of the public API. The vc-stay-local configuration variable -;; remains but only affects the CVS back end. +;; of the public API. The vc-cvs-stay-local configuration variable +;; remains and only affects the CVS back end. ;; ;; - The init-revision function and the default-initial-revision ;; variable are gone. These have't made sense on anything shipped diff --git a/src/nsterm.m b/src/nsterm.m index d79e4f4017..f2b0d90177 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1612,7 +1612,12 @@ x_iconify_frame (struct frame *f) [[view window] orderOut: NSApp]; [[view window] setFrame: t display: NO]; } + + /* Processing input while Emacs is being minimized can cause a + crash, so block it for the duration. */ + block_input(); [[view window] miniaturize: NSApp]; + unblock_input(); } /* Free X resources of frame F. */ diff --git a/src/xfaces.c b/src/xfaces.c index 93d1c47140..3ced1d483c 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2677,9 +2677,10 @@ FRAME 0 means change the face on all frames, and change the default { if (NILP (frame)) frame = selected_frame; - f = XFRAME (frame); CHECK_LIVE_FRAME (frame); + f = XFRAME (frame); + lface = lface_from_face_name (f, face, false); /* If a frame-local face doesn't exist yet, create one. */ diff --git a/src/xftfont.c b/src/xftfont.c index 7926325419..34c6f7d3e4 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -395,6 +395,24 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size) font->ascent = xftfont->ascent; font->descent = xftfont->descent; + /* The following workaround is unnecessary on most systems, and + causes annoying differences in glyph height between regular and + bold fonts (see bug#22383). However, with some fonts, such as + monaco, removing the workaround results in overlapping vertical + space of a line, see bug#23360. As long as the way to reconcile + these opposites is not known, we provide a user option to work + around the problem. */ + if (pixel_size >= 5 + && xft_font_ascent_descent_override) + { + /* The above condition is a dirty workaround because + XftTextExtents8 behaves strangely for some fonts + (e.g. "Dejavu Sans Mono") when pixel_size is less than 5. */ + if (font->ascent < extents.y) + font->ascent = extents.y; + if (font->descent < extents.height - extents.y) + font->descent = extents.height - extents.y; + } font->height = font->ascent + font->descent; if (XINT (AREF (entity, FONT_SIZE_INDEX)) == 0) @@ -733,6 +751,12 @@ syms_of_xftfont (void) DEFSYM (QCembolden, ":embolden"); DEFSYM (QClcdfilter, ":lcdfilter"); + DEFVAR_BOOL ("xft-font-ascent-descent-override", + xft_font_ascent_descent_override, + doc: /* Non-nil means override the ascent and descent values for Xft font driver. +This is needed with some fonts to correct vertical overlap of glyphs. */); + xft_font_ascent_descent_override = 0; + ascii_printable[0] = 0; xftfont_driver = ftfont_driver; diff --git a/test/lisp/character-fold-tests.el b/test/lisp/char-fold-tests.el similarity index 50% rename from test/lisp/character-fold-tests.el rename to test/lisp/char-fold-tests.el index dc7e927055..485254aa6c 100644 --- a/test/lisp/character-fold-tests.el +++ b/test/lisp/char-fold-tests.el @@ -1,4 +1,4 @@ -;;; character-fold-tests.el --- Tests for character-fold.el -*- lexical-binding: t; -*- +;;; char-fold-tests.el --- Tests for char-fold.el -*- lexical-binding: t; -*- ;; Copyright (C) 2013-2016 Free Software Foundation, Inc. @@ -20,42 +20,42 @@ ;;; Code: (require 'ert) -(require 'character-fold) +(require 'char-fold) -(defun character-fold--random-word (n) +(defun char-fold--random-word (n) (mapconcat (lambda (_) (string (+ 9 (random 117)))) (make-list n nil) "")) -(defun character-fold--test-search-with-contents (contents string) +(defun char-fold--test-search-with-contents (contents string) (with-temp-buffer (insert contents) (goto-char (point-min)) - (should (search-forward-regexp (character-fold-to-regexp string) nil 'noerror)) + (should (search-forward-regexp (char-fold-to-regexp string) nil 'noerror)) (goto-char (point-min)) - (should (character-fold-search-forward string nil 'noerror)) - (should (character-fold-search-backward string nil 'noerror)))) + (should (char-fold-search-forward string nil 'noerror)) + (should (char-fold-search-backward string nil 'noerror)))) -(ert-deftest character-fold--test-consistency () +(ert-deftest char-fold--test-consistency () (dotimes (n 30) - (let ((w (character-fold--random-word n))) + (let ((w (char-fold--random-word n))) ;; A folded string should always match the original string. - (character-fold--test-search-with-contents w w)))) + (char-fold--test-search-with-contents w w)))) -(ert-deftest character-fold--test-lax-whitespace () +(ert-deftest char-fold--test-lax-whitespace () (dotimes (n 40) - (let ((w1 (character-fold--random-word n)) - (w2 (character-fold--random-word n)) + (let ((w1 (char-fold--random-word n)) + (w2 (char-fold--random-word n)) (search-spaces-regexp "\\s-+")) - (character-fold--test-search-with-contents + (char-fold--test-search-with-contents (concat w1 "\s\n\s\t\f\t\n\r\t" w2) (concat w1 " " w2)) - (character-fold--test-search-with-contents + (char-fold--test-search-with-contents (concat w1 "\s\n\s\t\f\t\n\r\t" w2) (concat w1 (make-string 10 ?\s) w2))))) -(defun character-fold--test-match-exactly (string &rest strings-to-match) - (let ((re (concat "\\`" (character-fold-to-regexp string) "\\'"))) +(defun char-fold--test-match-exactly (string &rest strings-to-match) + (let ((re (concat "\\`" (char-fold-to-regexp string) "\\'"))) (dolist (it strings-to-match) (should (string-match re it))) ;; Case folding @@ -64,59 +64,61 @@ (should (string-match (upcase re) (downcase it))) (should (string-match (downcase re) (upcase it))))))) -(ert-deftest character-fold--test-some-defaults () +(ert-deftest char-fold--test-some-defaults () (dolist (it '(("ffl" . "ffl") ("ffi" . "ffi") ("fi" . "fi") ("ff" . "ff") ("ä" . "ä"))) - (character-fold--test-search-with-contents (cdr it) (car it)) - (let ((multi (char-table-extra-slot character-fold-table 0)) - (character-fold-table (make-char-table 'character-fold-table))) - (set-char-table-extra-slot character-fold-table 0 multi) - (character-fold--test-match-exactly (car it) (cdr it))))) - -(ert-deftest character-fold--test-fold-to-regexp () - (let ((character-fold-table (make-char-table 'character-fold-table)) - (multi (make-char-table 'character-fold-table))) - (set-char-table-extra-slot character-fold-table 0 multi) - (aset character-fold-table ?a "xx") - (aset character-fold-table ?1 "44") - (aset character-fold-table ?\s "-!-") - (character-fold--test-match-exactly "a1a1" "xx44xx44") - (character-fold--test-match-exactly "a1 a 1" "xx44-!--!-xx-!-44") + (char-fold--test-search-with-contents (cdr it) (car it)) + (let ((multi (char-table-extra-slot char-fold-table 0)) + (char-fold-table (make-char-table 'char-fold-table))) + (set-char-table-extra-slot char-fold-table 0 multi) + (char-fold--test-match-exactly (car it) (cdr it))))) + +(ert-deftest char-fold--test-fold-to-regexp () + (let ((char-fold-table (make-char-table 'char-fold-table)) + (multi (make-char-table 'char-fold-table))) + (set-char-table-extra-slot char-fold-table 0 multi) + (aset char-fold-table ?a "xx") + (aset char-fold-table ?1 "44") + (aset char-fold-table ?\s "-!-") + (char-fold--test-match-exactly "a1a1" "xx44xx44") + (char-fold--test-match-exactly "a1 a 1" "xx44-!--!-xx-!-44") (aset multi ?a '(("1" . "99") ("2" . "88") ("12" . "77"))) - (character-fold--test-match-exactly "a" "xx") - (character-fold--test-match-exactly "a1" "xx44" "99") - (character-fold--test-match-exactly "a12" "77" "xx442" "992") - (character-fold--test-match-exactly "a2" "88") + (char-fold--test-match-exactly "a" "xx") + (char-fold--test-match-exactly "a1" "xx44" "99") + (char-fold--test-match-exactly "a12" "77" "xx442" "992") + (char-fold--test-match-exactly "a2" "88") (aset multi ?1 '(("2" . "yy"))) - (character-fold--test-match-exactly "a1" "xx44" "99") - (character-fold--test-match-exactly "a12" "77" "xx442" "992") + (char-fold--test-match-exactly "a1" "xx44" "99") + (char-fold--test-match-exactly "a12" "77" "xx442" "992") ;; Support for this case is disabled. See function definition or: ;; https://lists.gnu.org/archive/html/emacs-devel/2015-11/msg02562.html - ;; (character-fold--test-match-exactly "a12" "xxyy") + ;; (char-fold--test-match-exactly "a12" "xxyy") )) -(ert-deftest character-fold--speed-test () +(ert-deftest char-fold--speed-test () (dolist (string (append '("tty-set-up-initial-frame-face" "tty-set-up-initial-frame-face-frame-faceframe-faceframe-faceframe-face") - (mapcar #'character-fold--random-word '(10 50 100 + (mapcar #'char-fold--random-word '(10 50 100 50 100)))) (message "Testing %s" string) ;; Make sure we didn't just fallback on the trivial search. (should-not (string= (regexp-quote string) - (character-fold-to-regexp string))) + (char-fold-to-regexp string))) (with-temp-buffer (save-excursion (insert string)) - (let ((time (float-time))) + (let ((time (time-to-seconds (current-time)))) ;; Our initial implementation of case-folding in char-folding ;; created a lot of redundant paths in the regexp. Because of ;; that, if a really long string "almost" matches, the regexp ;; engine took a long time to realize that it doesn't match. - (should-not (character-fold-search-forward (concat string "c") nil 'noerror)) + (should-not (char-fold-search-forward (concat string "c") nil 'noerror)) ;; Ensure it took less than a second. - (should (< (- (float-time) time) 1)))))) + (should (< (- (time-to-seconds (current-time)) + time) + 1)))))) -(provide 'character-fold-tests) -;;; character-fold-tests.el ends here +(provide 'char-fold-tests) +;;; char-fold-tests.el ends here diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 70e129cc4f..c7a5cc7af2 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -475,8 +475,15 @@ Must called from within a `tar-mode' buffer." (package-initialize) (package-import-keyring keyring) (package-refresh-contents) - (should (package-install 'signed-good)) - (should-error (package-install 'signed-bad)) + (let ((package-check-signature 'allow-unsigned)) + (should (package-install 'signed-good)) + (should-error (package-install 'signed-bad))) + (let ((package-check-signature t)) + (should (package-install 'signed-good)) + (should-error (package-install 'signed-bad))) + (let ((package-check-signature nil)) + (should (package-install 'signed-good)) + (should (package-install 'signed-bad))) ;; Check if the installed package status is updated. (let ((buf (package-list-packages))) (package-menu-refresh) diff --git a/test/lisp/emulation/viper-tests.el b/test/lisp/emulation/viper-tests.el new file mode 100644 index 0000000000..8b30f05093 --- /dev/null +++ b/test/lisp/emulation/viper-tests.el @@ -0,0 +1,160 @@ +;;; viper-tests.el --- tests for viper. + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; 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 . + +;;; Commentary: + +;;; Code: + + +(require 'viper) + +(defun viper-test-undo-kmacro (kmacro) + "In a clean viper buffer, run KMACRO and return `buffer-string'. + +This function makes as many attempts as possible to clean up +after itself, although it will leave a buffer called +*viper-test-buffer* if it fails (this is deliberate!)." + (let ( + ;; Viper just turns itself off during batch use. + (noninteractive nil) + ;; Switch off start up message or it will chew the key presses + (viper-inhibit-startup-message 't) + ;; Select an expert-level for the same reason. + (viper-expert-level 5) + ;; viper loads this even with -q so make sure it's empty! + (viper-custom-file-name (make-temp-file "viper-tests")) + (before-buffer (current-buffer))) + (unwind-protect + (progn + ;; viper-mode is essentially global, so set it here + (viper-mode) + ;; We must switch to buffer because we are using a keyboard macro + ;; which appears to not go to the current-buffer but what ever is + ;; currently taking keyboard events. We use a named buffer because + ;; then we can see what it in it if it all goes wrong. + (switch-to-buffer + (get-buffer-create + "*viper-test-buffer*")) + (erase-buffer) + ;; The new buffer fails to enter vi state so set it. + (viper-change-state-to-vi) + ;; Run the macro + (execute-kbd-macro kmacro) + (let ((rtn + (buffer-substring-no-properties + (point-min) + (point-max)))) + ;; Kill the buffer iff the macro succeeds + (kill-buffer) + rtn)) + ;; switch everthing off and restore the buffer + (toggle-viper-mode) + (switch-to-buffer before-buffer)))) + +(ert-deftest viper-test-go () + "Test that this file is running." + (should t)) + +(ert-deftest viper-test-fix () + "Test that the viper kmacro fixture is working." + (should + (viper-test-undo-kmacro []))) + +(ert-deftest viper-test-undo-1 () + "Test for VI like undo behaviour. + +Insert 1, then 2 on consecutive lines, followed by undo. This +should leave just 1 in the buffer. + +Test for Bug #22295" + (should + (equal + "1\n" + (viper-test-undo-kmacro + [ + ?a + ?1 + escape + ?o + ?2 + escape + ?u + ] + )))) + +(ert-deftest viper-test-undo-2 () + "Test for VI like undo behaviour. + +Insert \"1 2 3 4 5\" then delete the 2, then the 4, and undo. +Should restore the 4, but leave the 2 deleted. + +Test for Bug #22295" + (should + (equal + "1 3 4 5\n" + (viper-test-undo-kmacro + [ + ?i + ?1 ? ?2 ? ?3 ? ?4 ? ?5 + escape + ?F ?2 ?d ?w + ?w ?d ?w + ?u + ])))) + +(ert-deftest viper-test-undo-3 () + "Test for VI like undo behaviour. + +Insert \"1 2 3 4 5 6\", delete the 2, then the 3 4 and 5. +Should restore the 3 4 and 5 but not the 2. + +Test for Bug #22295" + (should + (equal + "1 3 4 5 6\n" + (viper-test-undo-kmacro + [ + ;; Insert this lot. + ?i ?1 ? ?2 ? ?3 ? ?4 ? ?5 ? ?6 + escape + ;; Start of line. + ?0 + ;; Move to 2, delete + ?w ?d ?w + ;; Delete 3 4 5 + ?. ?. ?. + ;; Undo del 5, then + ?u ?. ?. + ])))) + + +(ert-deftest viper-test-undo-4() + (should + (equal + "" + (viper-test-undo-kmacro + [ + ?i ?1 escape + ?o ?2 escape + ?o ?3 escape + ?u ?. ?. + ]) + ))) + +;;; viper-tests.el ends here diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 9ca5ac5333..0a292336f3 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -4,18 +4,18 @@ ;; This file is part of GNU Emacs. -;; This program 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. -;; -;; This program 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. -;; +;; 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 this program. If not, see `http://www.gnu.org/licenses/'. +;; along with GNU Emacs. If not, see . ;;; Commentary: