summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2016-03-11 13:32:13 -0800
committerJohn Wiegley <johnw@newartisans.com>2016-03-11 13:32:13 -0800
commita934bf445ffaa7920aa1dfea47fe08920bbbc94c (patch)
treedae27dd7ebeb733768ac5091c1c4d6b4749689e1 /lisp
parentb7ad5db04ba068ac9cbcfb9a02291e957d093a32 (diff)
parent620951fe22a6ecc2edc1f78d961f52566a7fe2b6 (diff)
downloademacs-a934bf445ffaa7920aa1dfea47fe08920bbbc94c.tar.gz
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
Diffstat (limited to 'lisp')
-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
6 files changed, 60 insertions, 26 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.