From: Paul Eggert Date: Sat, 25 Jun 2016 22:16:25 +0000 (+0200) Subject: Merge from origin/emacs-25 X-Git-Tag: emacs-26.0.90~1840^2~173 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fdcf46d33eebc59e56a35fcea186c61aad3c81d0;p=emacs.git Merge from origin/emacs-25 0377fe2 ; Spelling fixes f253695 Update docs for `customize-mode' 4395aaa Fix documentation of 'assoc-string' and 'compare-strings' ab0ebb9 ; Only load .elc file in tests. a98aa02 Error on multibyte characters in HTTP request ea512a7 * lisp/gnus/mm-decode.el (mm-convert-shr-links): Mask keys th... 8297331 ; Revert "Ensure undo-boundary after insert-file-contents." dc5e65b Unset GIT_DIR when calling Git commands 6cdd8f7 Ensure undo-boundary after insert-file-contents. 4793f5f Clarify documentation of 'line-spacing' and 'line-height' 5f37572 Fix removal of variables from process-environment e5e886d * admin/authors.el (authors-ignored-files, authors-valid-file... db0777b * admin/authors.el (authors-aliases, authors-fixed-case): Add... # Conflicts: # doc/lispref/modes.texi # lisp/gnus/mm-decode.el --- fdcf46d33eebc59e56a35fcea186c61aad3c81d0 diff --cc doc/lispref/modes.texi index 1285c1c69e6,32baa27147b..368d882a4b8 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@@ -799,19 -794,9 +799,18 @@@ if @var{parent} is @code{nil}. (Again @item :group If this is specified, the value should be the customization group for - this mode. (Not all major modes have one.) Only the (still - experimental and unadvertised) command @code{customize-mode} currently - uses this. @code{define-derived-mode} does @emph{not} automatically - define the specified customization group. + this mode. (Not all major modes have one.) The command + @code{customize-mode} uses this. @code{define-derived-mode} does + @emph{not} automatically define the specified customization group. + +@item :after-hook +This optional keyword specifies a single Lisp form to evaluate as the +final act of the mode function, after the mode hooks have been run. +It should not be quoted. Since the form might be evaluated after the +mode function has terminated, it should not access any element of the +mode function's local state. An @code{:after-hook} form is useful for +setting up aspects of the mode which depend on the user's settings, +which in turn may have been changed in a mode hook. @end table Here is a hypothetical example: diff --cc lisp/gnus/mm-decode.el index 744474ca113,bb8e2038d26..c653d735543 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@@ -1837,9 -1894,9 +1837,10 @@@ If RECURSIVE, search recursively. ,(point-max-marker)))))))) (defvar shr-map) +(defvar shr-image-map) (autoload 'widget-convert-button "wid-edit") + (defvar widget-keymap) (defun mm-convert-shr-links () (let ((start (point-min)) diff --cc test/lisp/emulation/viper-tests.el index 074dd637538,00000000000..0d6095b2c92 mode 100644,000000..100644 --- a/test/lisp/emulation/viper-tests.el +++ b/test/lisp/emulation/viper-tests.el @@@ -1,161 -1,0 +1,161 @@@ +;;; 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")) ++ (viper-custom-file-name (make-temp-file "viper-tests" nil ".elc")) + (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 everything off and restore the buffer. + (toggle-viper-mode) + (delete-file viper-custom-file-name) + (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