aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/calc/calc-units.el17
-rw-r--r--lisp/dabbrev.el8
-rw-r--r--lisp/isearch.el4
-rw-r--r--lisp/progmodes/xref.el1
-rw-r--r--lisp/window.el47
-rw-r--r--lisp/xml.el9
-rw-r--r--test/automated/dabbrev-tests.el42
-rw-r--r--test/lisp/xml-tests.el7
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."
565(defun calc-convert-temperature (&optional old-units new-units) 565(defun calc-convert-temperature (&optional old-units new-units)
566 (interactive) 566 (interactive)
567 (calc-slow-wrapper 567 (calc-slow-wrapper
568 (let ((expr (calc-top-n 1)) 568 (let ((tempunits (delq nil
569 (mapcar
570 (lambda (x)
571 (if (nth 3 x) (car x)))
572 math-standard-units)))
573 (expr (calc-top-n 1))
569 (uold nil) 574 (uold nil)
570 (uoldname nil) 575 (uoldname nil)
571 unew 576 unew
@@ -580,15 +585,16 @@ If COMP or STD is non-nil, put that in the units table instead."
580 (car units))))) 585 (car units)))))
581 (error "Not a pure temperature expression")) 586 (error "Not a pure temperature expression"))
582 (math-read-expr 587 (math-read-expr
583 (setq uoldname (read-string 588 (setq uoldname (completing-read
584 "Old temperature units: "))))))) 589 "Old temperature units: "
590 tempunits)))))))
585 (when (eq (car-safe uold) 'error) 591 (when (eq (car-safe uold) 'error)
586 (error "Bad format in units expression: %s" (nth 2 uold))) 592 (error "Bad format in units expression: %s" (nth 2 uold)))
587 (or (math-units-in-expr-p expr nil) 593 (or (math-units-in-expr-p expr nil)
588 (setq expr (math-mul expr uold))) 594 (setq expr (math-mul expr uold)))
589 (setq defunits (math-get-default-units expr)) 595 (setq defunits (math-get-default-units expr))
590 (setq unew (or new-units 596 (setq unew (or new-units
591 (read-string 597 (completing-read
592 (concat 598 (concat
593 (if uoldname 599 (if uoldname
594 (concat "Old temperature units: " 600 (concat "Old temperature units: "
@@ -599,7 +605,8 @@ If COMP or STD is non-nil, put that in the units table instead."
599 (concat " (default " 605 (concat " (default "
600 defunits 606 defunits
601 "): ") 607 "): ")
602 ": "))))) 608 ": "))
609 tempunits)))
603 (setq unew (math-read-expr (if (string= unew "") defunits unew))) 610 (setq unew (math-read-expr (if (string= unew "") defunits unew)))
604 (when (eq (car-safe unew) 'error) 611 (when (eq (car-safe unew) 'error)
605 (error "Bad format in units expression: %s" (nth 2 unew))) 612 (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]."
546 (copy-marker dabbrev--last-expansion-location))) 546 (copy-marker dabbrev--last-expansion-location)))
547 ;; Success: stick it in and return. 547 ;; Success: stick it in and return.
548 (setq buffer-undo-list (cons orig-point buffer-undo-list)) 548 (setq buffer-undo-list (cons orig-point buffer-undo-list))
549 (dabbrev--substitute-expansion old abbrev expansion 549 (setq expansion (dabbrev--substitute-expansion old abbrev expansion
550 record-case-pattern) 550 record-case-pattern))
551 551
552 ;; Save state for re-expand. 552 ;; Save state for re-expand.
553 (setq dabbrev--last-expansion expansion) 553 (setq dabbrev--last-expansion expansion)
@@ -902,7 +902,9 @@ to record whether we upcased the expansion, downcased it, or did neither."
902 ;; and (2) the replacement itself is all lower case. 902 ;; and (2) the replacement itself is all lower case.
903 (dabbrev--safe-replace-match expansion 903 (dabbrev--safe-replace-match expansion
904 (not use-case-replace) 904 (not use-case-replace)
905 t))) 905 t))
906 ;; Return the expansion actually used.
907 expansion)
906 908
907 909
908;;;---------------------------------------------------------------- 910;;;----------------------------------------------------------------
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."
1528 (if docstring (concat "\n" docstring) "")) 1528 (if docstring (concat "\n" docstring) ""))
1529 (interactive) 1529 (interactive)
1530 ,@(when function 1530 ,@(when function
1531 `((setq isearch-regexp-function #',function) 1531 `((setq isearch-regexp-function
1532 (unless (eq isearch-regexp-function #',function)
1533 #',function))
1532 (setq isearch-regexp nil))) 1534 (setq isearch-regexp nil)))
1533 ,@body 1535 ,@body
1534 (setq isearch-success t isearch-adjusted t) 1536 (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."
861 (let* ((ede-minor-mode nil) 861 (let* ((ede-minor-mode nil)
862 (default-directory dir) 862 (default-directory dir)
863 (semantic-symref-tool 'detect) 863 (semantic-symref-tool 'detect)
864 (case-fold-search nil)
864 (res (semantic-symref-find-references-by-name symbol 'subdirs)) 865 (res (semantic-symref-find-references-by-name symbol 'subdirs))
865 (hits (and res (oref res hit-lines))) 866 (hits (and res (oref res hit-lines)))
866 (orig-buffers (buffer-list))) 867 (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."
2473 (when (window-right window) 2473 (when (window-right window)
2474 (window--resize-reset-1 (window-right window) horizontal))) 2474 (window--resize-reset-1 (window-right window) horizontal)))
2475 2475
2476;; The following routine is used to manually resize the minibuffer
2477;; window and is currently used, for example, by ispell.el.
2478(defun window--resize-mini-window (window delta) 2476(defun window--resize-mini-window (window delta)
2479 "Resize minibuffer window WINDOW by DELTA pixels. 2477 "Resize minibuffer window WINDOW by DELTA pixels.
2480If WINDOW cannot be resized by DELTA pixels make it as large (or 2478If 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."
3338 (cond 3336 (cond
3339 ((zerop delta)) 3337 ((zerop delta))
3340 ((window-size-fixed-p nil horizontal) 3338 ((window-size-fixed-p nil horizontal)
3341 (error "Selected window has fixed size")) 3339 (user-error "Selected window has fixed size"))
3342 ((window-minibuffer-p) 3340 ((window-minibuffer-p)
3343 (if horizontal 3341 (if horizontal
3344 (error "Cannot resize minibuffer window horizontally") 3342 (user-error "Cannot resize minibuffer window horizontally")
3345 (window--resize-mini-window (selected-window) delta))) 3343 (window--resize-mini-window
3344 (selected-window) (* delta (frame-char-height)))))
3346 ((and (not horizontal) 3345 ((and (not horizontal)
3347 (window-full-height-p) 3346 (window-full-height-p)
3348 (eq (window-frame minibuffer-window) (selected-frame)) 3347 (eq (window-frame minibuffer-window) (selected-frame))
3349 (not resize-mini-windows)) 3348 (not resize-mini-windows))
3350 ;; If the selected window is full height and `resize-mini-windows' 3349 ;; If the selected window is full height and `resize-mini-windows'
3351 ;; is nil, resize the minibuffer window. 3350 ;; is nil, resize the minibuffer window.
3352 (window--resize-mini-window minibuffer-window (- delta))) 3351 (window--resize-mini-window
3352 minibuffer-window (* (- delta) (frame-char-height))))
3353 ((window--resizable-p nil delta horizontal) 3353 ((window--resizable-p nil delta horizontal)
3354 (window-resize nil delta horizontal)) 3354 (window-resize nil delta horizontal))
3355 ((window--resizable-p nil delta horizontal 'preserved) 3355 ((window--resizable-p nil delta horizontal 'preserved)
3356 (window-resize nil delta horizontal 'preserved)) 3356 (window-resize nil delta horizontal 'preserved))
3357 ((eq this-command 'enlarge-window) 3357 ((eq this-command
3358 (if horizontal 'enlarge-window-horizontally 'enlarge-window))
3359 ;; For backward compatibility don't signal an error unless this
3360 ;; command is `enlarge-window(-horizontally)'.
3358 (user-error "Cannot enlarge selected window")) 3361 (user-error "Cannot enlarge selected window"))
3359 (t 3362 (t
3360 (error "Cannot enlarge selected window"))))) 3363 (window-resize
3364 nil (if (> delta 0)
3365 (window-max-delta nil horizontal)
3366 (- (window-min-delta nil horizontal)))
3367 horizontal)))))
3361 3368
3362(defun shrink-window (delta &optional horizontal) 3369(defun shrink-window (delta &optional horizontal)
3363 "Make the selected window DELTA lines smaller. 3370 "Make the selected window DELTA lines smaller.
3364Interactively, if no argument is given, make the selected window 3371Interactively, if no argument is given, make the selected window
3365one line smaller. If optional argument HORIZONTAL is non-nil, 3372one line smaller. If optional argument HORIZONTAL is non-nil,
3366make selected window narrower by DELTA columns. If DELTA is 3373make selected window narrower by DELTA columns. If DELTA is
3367negative, enlarge selected window by -DELTA lines or columns. 3374negative, enlarge selected window by -DELTA lines or columns."
3368Also see the `window-min-height' variable."
3369 (interactive "p") 3375 (interactive "p")
3370 (let ((minibuffer-window (minibuffer-window))) 3376 (let ((minibuffer-window (minibuffer-window)))
3371 (when (window-preserved-size nil horizontal) 3377 (when (window-preserved-size nil horizontal)
@@ -3373,26 +3379,35 @@ Also see the `window-min-height' variable."
3373 (cond 3379 (cond
3374 ((zerop delta)) 3380 ((zerop delta))
3375 ((window-size-fixed-p nil horizontal) 3381 ((window-size-fixed-p nil horizontal)
3376 (error "Selected window has fixed size")) 3382 (user-error "Selected window has fixed size"))
3377 ((window-minibuffer-p) 3383 ((window-minibuffer-p)
3378 (if horizontal 3384 (if horizontal
3379 (error "Cannot resize minibuffer window horizontally") 3385 (user-error "Cannot resize minibuffer window horizontally")
3380 (window--resize-mini-window (selected-window) (- delta)))) 3386 (window--resize-mini-window
3387 (selected-window) (* (- delta) (frame-char-height)))))
3381 ((and (not horizontal) 3388 ((and (not horizontal)
3382 (window-full-height-p) 3389 (window-full-height-p)
3383 (eq (window-frame minibuffer-window) (selected-frame)) 3390 (eq (window-frame minibuffer-window) (selected-frame))
3384 (not resize-mini-windows)) 3391 (not resize-mini-windows))
3385 ;; If the selected window is full height and `resize-mini-windows' 3392 ;; If the selected window is full height and `resize-mini-windows'
3386 ;; is nil, resize the minibuffer window. 3393 ;; is nil, resize the minibuffer window.
3387 (window--resize-mini-window minibuffer-window delta)) 3394 (window--resize-mini-window
3395 minibuffer-window (* delta (frame-char-height))))
3388 ((window--resizable-p nil (- delta) horizontal) 3396 ((window--resizable-p nil (- delta) horizontal)
3389 (window-resize nil (- delta) horizontal)) 3397 (window-resize nil (- delta) horizontal))
3390 ((window--resizable-p nil (- delta) horizontal 'preserved) 3398 ((window--resizable-p nil (- delta) horizontal 'preserved)
3391 (window-resize nil (- delta) horizontal 'preserved)) 3399 (window-resize nil (- delta) horizontal 'preserved))
3392 ((eq this-command 'shrink-window) 3400 ((eq this-command
3401 (if horizontal 'shrink-window-horizontally 'shrink-window))
3402 ;; For backward compatibility don't signal an error unless this
3403 ;; command is `shrink-window(-horizontally)'.
3393 (user-error "Cannot shrink selected window")) 3404 (user-error "Cannot shrink selected window"))
3394 (t 3405 (t
3395 (error "Cannot shrink selected window"))))) 3406 (window-resize
3407 nil (if (> delta 0)
3408 (- (window-min-delta nil horizontal))
3409 (window-max-delta nil horizontal))
3410 horizontal)))))
3396 3411
3397(defun maximize-window (&optional window) 3412(defun maximize-window (&optional window)
3398 "Maximize WINDOW. 3413 "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:
579 (error "XML: (Well-Formed) Invalid character")) 579 (error "XML: (Well-Formed) Invalid character"))
580 ;; However, if we're parsing incrementally, then we need to deal 580 ;; However, if we're parsing incrementally, then we need to deal
581 ;; with stray CDATA. 581 ;; with stray CDATA.
582 (xml-parse-string))))) 582 (let ((s (xml-parse-string)))
583 (when (string-empty-p s)
584 ;; We haven't consumed any input! We must throw an error in
585 ;; order to prevent looping forever.
586 (error "XML: (Not Well-Formed) Could not parse: %s"
587 (buffer-substring-no-properties
588 (point) (min (+ (point) 10) (point-max)))))
589 s)))))
583 590
584(defun xml-parse-string () 591(defun xml-parse-string ()
585 "Parse character data at point, and return it as a string. 592 "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 @@
1;;; dabbrev-tests.el --- Test suite for dabbrev.
2
3;; Copyright (C) 2016 Free Software Foundation, Inc.
4
5;; Author: Alan Third <alan@idiocy.org>
6;; Keywords: dabbrev
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;;; Code:
26
27(require 'ert)
28(require 'dabbrev)
29
30(ert-deftest dabbrev-expand-test ()
31 "Test for bug#1948.
32When DABBREV-ELIMINATE-NEWLINES is non-nil (the default),
33repeated calls to DABBREV-EXPAND can result in the source of
34first expansion being replaced rather than the destination."
35 (with-temp-buffer
36 (insert "ab x\na\nab y")
37 (goto-char 8)
38 (save-window-excursion
39 (set-window-buffer nil (current-buffer))
40 ;; M-/ SPC M-/ M-/
41 (execute-kbd-macro "\257 \257\257"))
42 (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 @@
72 ;; Invalid XML names 72 ;; Invalid XML names
73 "<0foo>abc</0foo>" 73 "<0foo>abc</0foo>"
74 "<‿foo>abc</‿foo>" 74 "<‿foo>abc</‿foo>"
75 "<f¿>abc</f¿>") 75 "<f¿>abc</f¿>"
76 ;; Two root tags
77 "<a/><b></b>"
78 ;; Bug#16344
79 "<!----><x>< /x>"
80 "<a>< b/></a>")
76 "List of XML strings that should signal an error in the parser") 81 "List of XML strings that should signal an error in the parser")
77 82
78(defvar xml-parse-tests--qnames 83(defvar xml-parse-tests--qnames