commit 4a6d39b395bda91a497f8e81afec4339ecf5b49f (HEAD, refs/remotes/origin/master) Author: Tino Calancha Date: Sat May 7 11:19:26 2016 +0300 Make 'backtab' work in table-mode on text terminals * lisp/textmodes/table.el (table-cell-bindings): Bind 'backtab' explicitly. (Bug#23456) diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index 653db83..3502adf 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el @@ -936,6 +936,7 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu ([(shift backtab)] . table-backward-cell) ; for HPUX console keyboard ([(shift iso-lefttab)] . table-backward-cell) ; shift-tab on a microsoft natural keyboard and redhat linux ([(shift tab)] . table-backward-cell) + ([backtab] . table-backward-cell) ; for terminals (e.g., xterm) ([return] . *table--cell-newline) ([(control m)] . *table--cell-newline) ([(control j)] . *table--cell-newline-and-indent) commit fa6a6edd1d670e2826186ee943ae7ca083771801 Author: Eli Zaretskii Date: Sat May 7 11:00:36 2016 +0300 Try to speed-up display of many all-blank lines * src/bidi.c (bidi_initialize): Use anchored regexps for paragraph start and paragraph separator sequences. (Bug#23457) diff --git a/src/bidi.c b/src/bidi.c index 573e513..6ea84d9 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -1107,15 +1107,9 @@ bidi_initialize (void) emacs_abort (); staticpro (&bidi_brackets_table); - DEFSYM (Qparagraph_start, "paragraph-start"); - paragraph_start_re = Fsymbol_value (Qparagraph_start); - if (!STRINGP (paragraph_start_re)) - paragraph_start_re = build_string ("\f\\|[ \t]*$"); + paragraph_start_re = build_string ("^\\(\f\\|[ \t]*\\)$"); staticpro (¶graph_start_re); - DEFSYM (Qparagraph_separate, "paragraph-separate"); - paragraph_separate_re = Fsymbol_value (Qparagraph_separate); - if (!STRINGP (paragraph_separate_re)) - paragraph_separate_re = build_string ("[ \t\f]*$"); + paragraph_separate_re = build_string ("^[ \t\f]*$"); staticpro (¶graph_separate_re); bidi_cache_sp = 0; commit 26171e02773b9b2383f412dd79d241385d2d20df Author: Alan Mackenzie Date: Fri May 6 18:58:49 2016 +0000 Correct hack-local-variables change from Thu May 5 11:05:49 2016 +0000 Prevent hack-local-variables being called from the fundamental-mode mode call early in normal-mode. This fixes bug #23460 and bug #23463. * lisp/files.el (normal-mode) Replace call to fundamental-mode with calls to the things it calls, with the exception of hack-local-variables. * etc/NEWS: Add an entry to note the calling of hack-local-variables at each major mode initialization. diff --git a/etc/NEWS b/etc/NEWS index 29559d1..1d5d0d6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -156,6 +156,11 @@ probability of data corruption due to techniques Emacs uses to recover in these situations. +++ +** File local and directory local variables are now initialized each +time the major mode is set, not just when the file is first visited. +These local variables will thus not vanish on setting a major mode. + ++++ ** A second dir-local file (.dir-locals-2.el) is now accepted. See the variable 'dir-locals-file-2' for more information. diff --git a/lisp/files.el b/lisp/files.el index d89b2f5..21f7bdc 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2316,7 +2316,10 @@ not set local variables (though we do notice a mode specified with -*-.) or from Lisp without specifying the optional argument FIND-FILE; in that case, this function acts as if `enable-local-variables' were t." (interactive) - (fundamental-mode) + (kill-all-local-variables) + (unless delay-mode-hooks + (run-hooks 'change-major-mode-after-body-hook + 'after-change-major-mode-hook)) (let ((enable-local-variables (or (not find-file) enable-local-variables))) ;; FIXME this is less efficient than it could be, since both ;; s-a-m and h-l-v may parse the same regions, looking for "mode:". commit 81204b276f849b577a0ccd0b6175353dfa9e2a07 Author: Paul Eggert Date: Fri May 6 10:09:13 2016 -0700 Port xref-tests to master branch Also, add a test to make this problem less likely in the future. * test/Makefile.in (check-no-automated-subdir): New rule. (check, check-expensive, check-maybe): Depend on it. * test/automated/data/xref/file1.txt: Rename to ... * test/data/xref/file1.txt: ... here. * test/automated/data/xref/file2.txt: Rename to ... * test/data/xref/file2.txt: ... here. * test/automated/xref-tests.el: Rename to ... * test/lisp/progmodes/xref-tests.el: ... here. (xref-tests-data-dir): Use EMACS_TEST_DIRECTORY. diff --git a/test/Makefile.in b/test/Makefile.in index 26d7e59..7ebc0de 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -148,18 +148,25 @@ endef $(foreach test,${TESTS},$(eval $(call test_template,${test}))) +## Check that there is no 'automated' subdirectory, which would +## indicate an incomplete merge from an older version of Emacs where +## the tests were arranged differently. +.PHONY: check-no-automated-subdir +check-no-automated-subdir: + test ! -d $(srcdir)/automated + ## Include dependencies between test files and the files they test. ## We could do this without the file and eval directly, but then we ## would have to run Emacs for every make invocation, and it might not ## be available during clean. -include make-test-deps.mk ## Rerun all default tests. -check: mostlyclean +check: mostlyclean check-no-automated-subdir @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" ## Rerun all default and expensive tests. .PHONY: check-expensive -check-expensive: mostlyclean +check-expensive: mostlyclean check-no-automated-subdir @${MAKE} check-doit SELECTOR="${SELECTOR_EXPENSIVE}" ## Re-run all tests which are outdated. A test is outdated if its @@ -168,7 +175,7 @@ check-expensive: mostlyclean ## determined by a heuristic and does not identify the full dependency ## graph. See make-test-deps.emacs-lisp for details. .PHONY: check-maybe -check-maybe: +check-maybe: check-no-automated-subdir @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" ## Run the tests. diff --git a/test/automated/data/xref/file1.txt b/test/automated/data/xref/file1.txt deleted file mode 100644 index 5d7cc54..0000000 --- a/test/automated/data/xref/file1.txt +++ /dev/null @@ -1,2 +0,0 @@ -foo foo -bar diff --git a/test/automated/data/xref/file2.txt b/test/automated/data/xref/file2.txt deleted file mode 100644 index 9f075f2..0000000 --- a/test/automated/data/xref/file2.txt +++ /dev/null @@ -1,2 +0,0 @@ - -bar diff --git a/test/automated/xref-tests.el b/test/automated/xref-tests.el deleted file mode 100644 index 079b196..0000000 --- a/test/automated/xref-tests.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; xref-tests.el --- tests for xref - -;; Copyright (C) 2016 Free Software Foundation, Inc. - -;; Author: Dmitry Gutov - -;; 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 'xref) -(require 'cl-lib) - -(defvar xref-tests-data-dir - (expand-file-name "data/xref/" - (file-name-directory (or load-file-name (buffer-file-name))))) - -(ert-deftest xref-collect-matches-finds-none-for-some-regexp () - (should (null (xref-collect-matches "zzz" "*" xref-tests-data-dir nil)))) - -(ert-deftest xref-collect-matches-finds-some-for-bar () - (let* ((matches (xref-collect-matches "bar" "*" xref-tests-data-dir nil)) - (locs (cl-sort (mapcar #'xref-item-location matches) - #'string< - :key #'xref-location-group))) - (should (= 2 (length matches))) - (should (string-match-p "file1\\.txt\\'" (xref-location-group (nth 0 locs)))) - (should (string-match-p "file2\\.txt\\'" (xref-location-group (nth 1 locs)))))) - -(ert-deftest xref-collect-matches-finds-two-matches-on-the-same-line () - (let* ((matches (xref-collect-matches "foo" "*" xref-tests-data-dir nil)) - (locs (mapcar #'xref-item-location matches))) - (should (= 2 (length matches))) - (should (string-match-p "file1\\.txt\\'" (xref-location-group (nth 0 locs)))) - (should (string-match-p "file1\\.txt\\'" (xref-location-group (nth 1 locs)))) - (should (equal 1 (xref-location-line (nth 0 locs)))) - (should (equal 1 (xref-location-line (nth 1 locs)))) - (should (equal 0 (xref-file-location-column (nth 0 locs)))) - (should (equal 4 (xref-file-location-column (nth 1 locs)))))) - -(ert-deftest xref-collect-matches-finds-an-empty-line-regexp-match () - (let* ((matches (xref-collect-matches "^$" "*" xref-tests-data-dir nil)) - (locs (mapcar #'xref-item-location matches))) - (should (= 1 (length matches))) - (should (string-match-p "file2\\.txt\\'" (xref-location-group (nth 0 locs)))) - (should (equal 1 (xref-location-line (nth 0 locs)))) - (should (equal 0 (xref-file-location-column (nth 0 locs)))))) - -(ert-deftest xref--buf-pairs-iterator-groups-markers-by-buffers-1 () - (let* ((xrefs (xref-collect-matches "foo" "*" xref-tests-data-dir nil)) - (iter (xref--buf-pairs-iterator xrefs)) - (cons (funcall iter :next))) - (should (null (funcall iter :next))) - (should (string-match "file1\\.txt\\'" (buffer-file-name (car cons)))) - (should (= 2 (length (cdr cons)))))) - -(ert-deftest xref--buf-pairs-iterator-groups-markers-by-buffers-2 () - (let* ((xrefs (xref-collect-matches "bar" "*" xref-tests-data-dir nil)) - (iter (xref--buf-pairs-iterator xrefs)) - (cons1 (funcall iter :next)) - (cons2 (funcall iter :next))) - (should (null (funcall iter :next))) - (should-not (equal (car cons1) (car cons2))) - (should (= 1 (length (cdr cons1)))) - (should (= 1 (length (cdr cons2)))))) - -(ert-deftest xref--buf-pairs-iterator-cleans-up-markers () - (let* ((xrefs (xref-collect-matches "bar" "*" xref-tests-data-dir nil)) - (iter (xref--buf-pairs-iterator xrefs)) - (cons1 (funcall iter :next)) - (cons2 (funcall iter :next))) - (funcall iter :cleanup) - (should (null (marker-position (car (nth 0 (cdr cons1)))))) - (should (null (marker-position (cdr (nth 0 (cdr cons1)))))) - (should (null (marker-position (car (nth 0 (cdr cons2)))))) - (should (null (marker-position (cdr (nth 0 (cdr cons2)))))))) diff --git a/test/data/xref/file1.txt b/test/data/xref/file1.txt new file mode 100644 index 0000000..5d7cc54 --- /dev/null +++ b/test/data/xref/file1.txt @@ -0,0 +1,2 @@ +foo foo +bar diff --git a/test/data/xref/file2.txt b/test/data/xref/file2.txt new file mode 100644 index 0000000..9f075f2 --- /dev/null +++ b/test/data/xref/file2.txt @@ -0,0 +1,2 @@ + +bar diff --git a/test/lisp/progmodes/xref-tests.el b/test/lisp/progmodes/xref-tests.el new file mode 100644 index 0000000..2b74581 --- /dev/null +++ b/test/lisp/progmodes/xref-tests.el @@ -0,0 +1,91 @@ +;;; xref-tests.el --- tests for xref + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Dmitry Gutov + +;; 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 'xref) +(require 'cl-lib) + +(defvar xref-tests-data-dir + (expand-file-name "data/xref/" + (getenv "EMACS_TEST_DIRECTORY"))) + +(ert-deftest xref-collect-matches-finds-none-for-some-regexp () + (should (null (xref-collect-matches "zzz" "*" xref-tests-data-dir nil)))) + +(ert-deftest xref-collect-matches-finds-some-for-bar () + (let* ((matches (xref-collect-matches "bar" "*" xref-tests-data-dir nil)) + (locs (cl-sort (mapcar #'xref-item-location matches) + #'string< + :key #'xref-location-group))) + (should (= 2 (length matches))) + (should (string-match-p "file1\\.txt\\'" (xref-location-group (nth 0 locs)))) + (should (string-match-p "file2\\.txt\\'" (xref-location-group (nth 1 locs)))))) + +(ert-deftest xref-collect-matches-finds-two-matches-on-the-same-line () + (let* ((matches (xref-collect-matches "foo" "*" xref-tests-data-dir nil)) + (locs (mapcar #'xref-item-location matches))) + (should (= 2 (length matches))) + (should (string-match-p "file1\\.txt\\'" (xref-location-group (nth 0 locs)))) + (should (string-match-p "file1\\.txt\\'" (xref-location-group (nth 1 locs)))) + (should (equal 1 (xref-location-line (nth 0 locs)))) + (should (equal 1 (xref-location-line (nth 1 locs)))) + (should (equal 0 (xref-file-location-column (nth 0 locs)))) + (should (equal 4 (xref-file-location-column (nth 1 locs)))))) + +(ert-deftest xref-collect-matches-finds-an-empty-line-regexp-match () + (let* ((matches (xref-collect-matches "^$" "*" xref-tests-data-dir nil)) + (locs (mapcar #'xref-item-location matches))) + (should (= 1 (length matches))) + (should (string-match-p "file2\\.txt\\'" (xref-location-group (nth 0 locs)))) + (should (equal 1 (xref-location-line (nth 0 locs)))) + (should (equal 0 (xref-file-location-column (nth 0 locs)))))) + +(ert-deftest xref--buf-pairs-iterator-groups-markers-by-buffers-1 () + (let* ((xrefs (xref-collect-matches "foo" "*" xref-tests-data-dir nil)) + (iter (xref--buf-pairs-iterator xrefs)) + (cons (funcall iter :next))) + (should (null (funcall iter :next))) + (should (string-match "file1\\.txt\\'" (buffer-file-name (car cons)))) + (should (= 2 (length (cdr cons)))))) + +(ert-deftest xref--buf-pairs-iterator-groups-markers-by-buffers-2 () + (let* ((xrefs (xref-collect-matches "bar" "*" xref-tests-data-dir nil)) + (iter (xref--buf-pairs-iterator xrefs)) + (cons1 (funcall iter :next)) + (cons2 (funcall iter :next))) + (should (null (funcall iter :next))) + (should-not (equal (car cons1) (car cons2))) + (should (= 1 (length (cdr cons1)))) + (should (= 1 (length (cdr cons2)))))) + +(ert-deftest xref--buf-pairs-iterator-cleans-up-markers () + (let* ((xrefs (xref-collect-matches "bar" "*" xref-tests-data-dir nil)) + (iter (xref--buf-pairs-iterator xrefs)) + (cons1 (funcall iter :next)) + (cons2 (funcall iter :next))) + (funcall iter :cleanup) + (should (null (marker-position (car (nth 0 (cdr cons1)))))) + (should (null (marker-position (cdr (nth 0 (cdr cons1)))))) + (should (null (marker-position (car (nth 0 (cdr cons2)))))) + (should (null (marker-position (cdr (nth 0 (cdr cons2))))))))