diff options
author | John Wiegley <johnw@newartisans.com> | 2016-03-11 13:32:13 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2016-03-11 13:32:13 -0800 |
commit | a934bf445ffaa7920aa1dfea47fe08920bbbc94c (patch) | |
tree | dae27dd7ebeb733768ac5091c1c4d6b4749689e1 | |
parent | b7ad5db04ba068ac9cbcfb9a02291e957d093a32 (diff) | |
parent | 620951fe22a6ecc2edc1f78d961f52566a7fe2b6 (diff) | |
download | emacs-a934bf445ffaa7920aa1dfea47fe08920bbbc94c.tar.gz emacs-a934bf445ffaa7920aa1dfea47fe08920bbbc94c.tar.bz2 emacs-a934bf445ffaa7920aa1dfea47fe08920bbbc94c.zip |
Merge from origin/emacs-25
620951f Fix previous fix of enlarge-/shrink-window
2e78353 * lisp/isearch.el (isearch-define-mode-toggle): Fix toggling logic
66d2717 Complete temperature units in calc-convert-temperature
dbb02bf Make sure to use case-sensitive search
8b01e69 Prevent infinite loop on not-well-formed xml. (Bug#16344)
100346a Add the missing test case for the previous patch
5aba61e Use the correct dabbrev expansion
-rw-r--r-- | lisp/calc/calc-units.el | 17 | ||||
-rw-r--r-- | lisp/dabbrev.el | 8 | ||||
-rw-r--r-- | lisp/isearch.el | 4 | ||||
-rw-r--r-- | lisp/progmodes/xref.el | 1 | ||||
-rw-r--r-- | lisp/window.el | 47 | ||||
-rw-r--r-- | lisp/xml.el | 9 | ||||
-rw-r--r-- | test/automated/dabbrev-tests.el | 42 | ||||
-rw-r--r-- | test/lisp/xml-tests.el | 7 |
8 files changed, 108 insertions, 27 deletions
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index 07d9ac90d85..525e3e247d5 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -565,7 +565,12 @@ If COMP or STD is non-nil, put that in the units table instead." (defun calc-convert-temperature (&optional old-units new-units) (interactive) (calc-slow-wrapper - (let ((expr (calc-top-n 1)) + (let ((tempunits (delq nil + (mapcar + (lambda (x) + (if (nth 3 x) (car x))) + math-standard-units))) + (expr (calc-top-n 1)) (uold nil) (uoldname nil) unew @@ -580,15 +585,16 @@ If COMP or STD is non-nil, put that in the units table instead." (car units))))) (error "Not a pure temperature expression")) (math-read-expr - (setq uoldname (read-string - "Old temperature units: "))))))) + (setq uoldname (completing-read + "Old temperature units: " + tempunits))))))) (when (eq (car-safe uold) 'error) (error "Bad format in units expression: %s" (nth 2 uold))) (or (math-units-in-expr-p expr nil) (setq expr (math-mul expr uold))) (setq defunits (math-get-default-units expr)) (setq unew (or new-units - (read-string + (completing-read (concat (if uoldname (concat "Old temperature units: " @@ -599,7 +605,8 @@ If COMP or STD is non-nil, put that in the units table instead." (concat " (default " defunits "): ") - ": "))))) + ": ")) + tempunits))) (setq unew (math-read-expr (if (string= unew "") defunits unew))) (when (eq (car-safe unew) 'error) (error "Bad format in units expression: %s" (nth 2 unew))) diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index 3557041f51c..d9f36b15290 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el @@ -546,8 +546,8 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]." (copy-marker dabbrev--last-expansion-location))) ;; Success: stick it in and return. (setq buffer-undo-list (cons orig-point buffer-undo-list)) - (dabbrev--substitute-expansion old abbrev expansion - record-case-pattern) + (setq expansion (dabbrev--substitute-expansion old abbrev expansion + record-case-pattern)) ;; Save state for re-expand. (setq dabbrev--last-expansion expansion) @@ -902,7 +902,9 @@ to record whether we upcased the expansion, downcased it, or did neither." ;; and (2) the replacement itself is all lower case. (dabbrev--safe-replace-match expansion (not use-case-replace) - t))) + t)) + ;; Return the expansion actually used. + expansion) ;;;---------------------------------------------------------------- diff --git a/lisp/isearch.el b/lisp/isearch.el index 2efa4c7e8ef..c91ccfad27d 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1528,7 +1528,9 @@ The command then executes BODY and updates the isearch prompt." (if docstring (concat "\n" docstring) "")) (interactive) ,@(when function - `((setq isearch-regexp-function #',function) + `((setq isearch-regexp-function + (unless (eq isearch-regexp-function #',function) + #',function)) (setq isearch-regexp nil))) ,@body (setq isearch-success t isearch-adjusted t) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 1e6a69fc3be..69e6a154ae5 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -861,6 +861,7 @@ tools are used, and when." (let* ((ede-minor-mode nil) (default-directory dir) (semantic-symref-tool 'detect) + (case-fold-search nil) (res (semantic-symref-find-references-by-name symbol 'subdirs)) (hits (and res (oref res hit-lines))) (orig-buffers (buffer-list))) diff --git a/lisp/window.el b/lisp/window.el index 28632a31eee..1d41d821dc4 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2473,8 +2473,6 @@ windows." (when (window-right window) (window--resize-reset-1 (window-right window) horizontal))) -;; The following routine is used to manually resize the minibuffer -;; window and is currently used, for example, by ispell.el. (defun window--resize-mini-window (window delta) "Resize minibuffer window WINDOW by DELTA pixels. If WINDOW cannot be resized by DELTA pixels make it as large (or @@ -3338,34 +3336,42 @@ negative, shrink selected window by -DELTA lines or columns." (cond ((zerop delta)) ((window-size-fixed-p nil horizontal) - (error "Selected window has fixed size")) + (user-error "Selected window has fixed size")) ((window-minibuffer-p) (if horizontal - (error "Cannot resize minibuffer window horizontally") - (window--resize-mini-window (selected-window) delta))) + (user-error "Cannot resize minibuffer window horizontally") + (window--resize-mini-window + (selected-window) (* delta (frame-char-height))))) ((and (not horizontal) (window-full-height-p) (eq (window-frame minibuffer-window) (selected-frame)) (not resize-mini-windows)) ;; If the selected window is full height and `resize-mini-windows' ;; is nil, resize the minibuffer window. - (window--resize-mini-window minibuffer-window (- delta))) + (window--resize-mini-window + minibuffer-window (* (- delta) (frame-char-height)))) ((window--resizable-p nil delta horizontal) (window-resize nil delta horizontal)) ((window--resizable-p nil delta horizontal 'preserved) (window-resize nil delta horizontal 'preserved)) - ((eq this-command 'enlarge-window) + ((eq this-command + (if horizontal 'enlarge-window-horizontally 'enlarge-window)) + ;; For backward compatibility don't signal an error unless this + ;; command is `enlarge-window(-horizontally)'. (user-error "Cannot enlarge selected window")) (t - (error "Cannot enlarge selected window"))))) + (window-resize + nil (if (> delta 0) + (window-max-delta nil horizontal) + (- (window-min-delta nil horizontal))) + horizontal))))) (defun shrink-window (delta &optional horizontal) "Make the selected window DELTA lines smaller. Interactively, if no argument is given, make the selected window one line smaller. If optional argument HORIZONTAL is non-nil, make selected window narrower by DELTA columns. If DELTA is -negative, enlarge selected window by -DELTA lines or columns. -Also see the `window-min-height' variable." +negative, enlarge selected window by -DELTA lines or columns." (interactive "p") (let ((minibuffer-window (minibuffer-window))) (when (window-preserved-size nil horizontal) @@ -3373,26 +3379,35 @@ Also see the `window-min-height' variable." (cond ((zerop delta)) ((window-size-fixed-p nil horizontal) - (error "Selected window has fixed size")) + (user-error "Selected window has fixed size")) ((window-minibuffer-p) (if horizontal - (error "Cannot resize minibuffer window horizontally") - (window--resize-mini-window (selected-window) (- delta)))) + (user-error "Cannot resize minibuffer window horizontally") + (window--resize-mini-window + (selected-window) (* (- delta) (frame-char-height))))) ((and (not horizontal) (window-full-height-p) (eq (window-frame minibuffer-window) (selected-frame)) (not resize-mini-windows)) ;; If the selected window is full height and `resize-mini-windows' ;; is nil, resize the minibuffer window. - (window--resize-mini-window minibuffer-window delta)) + (window--resize-mini-window + minibuffer-window (* delta (frame-char-height)))) ((window--resizable-p nil (- delta) horizontal) (window-resize nil (- delta) horizontal)) ((window--resizable-p nil (- delta) horizontal 'preserved) (window-resize nil (- delta) horizontal 'preserved)) - ((eq this-command 'shrink-window) + ((eq this-command + (if horizontal 'shrink-window-horizontally 'shrink-window)) + ;; For backward compatibility don't signal an error unless this + ;; command is `shrink-window(-horizontally)'. (user-error "Cannot shrink selected window")) (t - (error "Cannot shrink selected window"))))) + (window-resize + nil (if (> delta 0) + (- (window-min-delta nil horizontal)) + (window-max-delta nil horizontal)) + horizontal))))) (defun maximize-window (&optional window) "Maximize WINDOW. diff --git a/lisp/xml.el b/lisp/xml.el index 2c3b6a49f61..1802d04dfaf 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -579,7 +579,14 @@ Return one of: (error "XML: (Well-Formed) Invalid character")) ;; However, if we're parsing incrementally, then we need to deal ;; with stray CDATA. - (xml-parse-string))))) + (let ((s (xml-parse-string))) + (when (string-empty-p s) + ;; We haven't consumed any input! We must throw an error in + ;; order to prevent looping forever. + (error "XML: (Not Well-Formed) Could not parse: %s" + (buffer-substring-no-properties + (point) (min (+ (point) 10) (point-max))))) + s))))) (defun xml-parse-string () "Parse character data at point, and return it as a string. diff --git a/test/automated/dabbrev-tests.el b/test/automated/dabbrev-tests.el new file mode 100644 index 00000000000..9c7a8385535 --- /dev/null +++ b/test/automated/dabbrev-tests.el @@ -0,0 +1,42 @@ +;;; dabbrev-tests.el --- Test suite for dabbrev. + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Alan Third <alan@idiocy.org> +;; Keywords: dabbrev + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'dabbrev) + +(ert-deftest dabbrev-expand-test () + "Test for bug#1948. +When DABBREV-ELIMINATE-NEWLINES is non-nil (the default), +repeated calls to DABBREV-EXPAND can result in the source of +first expansion being replaced rather than the destination." + (with-temp-buffer + (insert "ab x\na\nab y") + (goto-char 8) + (save-window-excursion + (set-window-buffer nil (current-buffer)) + ;; M-/ SPC M-/ M-/ + (execute-kbd-macro "\257 \257\257")) + (should (string= (buffer-string) "ab x\nab y\nab y")))) diff --git a/test/lisp/xml-tests.el b/test/lisp/xml-tests.el index 763febb9b69..488d2c6f920 100644 --- a/test/lisp/xml-tests.el +++ b/test/lisp/xml-tests.el @@ -72,7 +72,12 @@ ;; Invalid XML names "<0foo>abc</0foo>" "<‿foo>abc</‿foo>" - "<f¿>abc</f¿>") + "<f¿>abc</f¿>" + ;; Two root tags + "<a/><b></b>" + ;; Bug#16344 + "<!----><x>< /x>" + "<a>< b/></a>") "List of XML strings that should signal an error in the parser") (defvar xml-parse-tests--qnames |