aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJoakim Verona2012-06-19 19:19:07 +0200
committerJoakim Verona2012-06-19 19:19:07 +0200
commitabef2047941f87ae4baa34b3a8675de4d0068b7a (patch)
tree63042e6c3037100412816200e03c04affc7fe071 /lisp
parent58a90697e8f15a2722100ac489df200ad31d3086 (diff)
parent68f12411893785de1cfc2c24ec36059e49af5d55 (diff)
downloademacs-abef2047941f87ae4baa34b3a8675de4d0068b7a.tar.gz
emacs-abef2047941f87ae4baa34b3a8675de4d0068b7a.zip
upstream
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog38
-rw-r--r--lisp/emacs-lisp/byte-run.el4
-rw-r--r--lisp/emacs-lisp/pcase.el32
-rw-r--r--lisp/emulation/edt.el24
-rw-r--r--lisp/gnus/ChangeLog4
-rw-r--r--lisp/gnus/gnus-win.el4
-rw-r--r--lisp/minibuffer.el5
-rw-r--r--lisp/progmodes/python.el42
-rw-r--r--lisp/subr.el27
-rw-r--r--lisp/window.el22
10 files changed, 145 insertions, 57 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2bd92de45e7..5eac93fa444 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,41 @@
12012-06-19 Glenn Morris <rgm@gnu.org>
2
3 * progmodes/python.el (python-mode): Derive from prog-mode.
4
52012-06-19 Kevin Gallagher <Kevin.Gallagher@boeing.com>
6
7 * emulation/edt.el (edt-default-menu-bar-update-buffers)
8 (edt-user-menu-bar-update-buffers): New functions.
9 (edt-default-emulation-setup, edt-user-emulation-setup): Use them.
10
112012-06-19 Chong Yidong <cyd@gnu.org>
12
13 * subr.el (with-selected-window): Preserve the selected window's
14 terminal's top-frame (Bug#4702).
15
16 * window.el (save-selected-window): Likewise.
17
182012-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
19
20 * progmodes/python.el (python-rx-constituents): Move backquote.
21 (python-skeleton-define, python-define-auxiliary-skeleton):
22 Use `declare'.
23
242012-06-18 Michael Albinus <michael.albinus@gmx.de>
25
26 * minibuffer.el (read-file-name-default): Revert the patch from
27 2012-06-17.
28
292012-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
30
31 * emacs-lisp/pcase.el (pcase--expand): Warn for unused pattern.
32 (pcase--u1, pcase--q1): Don't use apply-partially.
33
342012-06-18 Glenn Morris <rgm@gnu.org>
35
36 * progmodes/python.el (python-proc, python-buffer)
37 (python-send-receive, python-send-string): Fix obsolete versions.
38
12012-06-18 Martin Rudalics <rudalics@gmx.at> 392012-06-18 Martin Rudalics <rudalics@gmx.at>
2 40
3 * window.el (special-display-p): Completely remove stringp 41 * window.el (special-display-p): Completely remove stringp
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 635eef93d96..925d275386f 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -123,7 +123,8 @@ the list ARGS... as it appears in the expression,
123and the result should be a form to be evaluated instead of the original. 123and the result should be a form to be evaluated instead of the original.
124DECL is a declaration, optional, of the form (declare DECLS...) where 124DECL is a declaration, optional, of the form (declare DECLS...) where
125DECLS is a list of elements of the form (PROP . VALUES). These are 125DECLS is a list of elements of the form (PROP . VALUES). These are
126interpreted according to `macro-declarations-alist'." 126interpreted according to `macro-declarations-alist'.
127The return value is undefined."
127 (if (stringp docstring) nil 128 (if (stringp docstring) nil
128 (if decl (setq body (cons decl body))) 129 (if decl (setq body (cons decl body)))
129 (setq decl docstring) 130 (setq decl docstring)
@@ -158,6 +159,7 @@ See also the function `interactive'.
158DECL is a declaration, optional, of the form (declare DECLS...) where 159DECL is a declaration, optional, of the form (declare DECLS...) where
159DECLS is a list of elements of the form (PROP . VALUES). These are 160DECLS is a list of elements of the form (PROP . VALUES). These are
160interpreted according to `defun-declarations-alist'. 161interpreted according to `defun-declarations-alist'.
162The return value is undefined.
161 163
162\(fn NAME ARGLIST &optional DOCSTRING DECL &rest BODY)" 164\(fn NAME ARGLIST &optional DOCSTRING DECL &rest BODY)"
163 ;; We can't just have `decl' as an &optional argument, because we need 165 ;; We can't just have `decl' as an &optional argument, because we need
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 81cffae04bf..f91a1645e21 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -237,7 +237,8 @@ of the form (UPAT EXP)."
237 ;; the branch to a separate function. 237 ;; the branch to a separate function.
238 (let ((bsym 238 (let ((bsym
239 (make-symbol (format "pcase-%d" (length defs))))) 239 (make-symbol (format "pcase-%d" (length defs)))))
240 (push `(,bsym (lambda ,(mapcar #'car prevvars) ,@code)) defs) 240 (push `(,bsym (lambda ,(mapcar #'car prevvars) ,@code))
241 defs)
241 (setcar res 'funcall) 242 (setcar res 'funcall)
242 (setcdr res (cons bsym (mapcar #'cdr prevvars))) 243 (setcdr res (cons bsym (mapcar #'cdr prevvars)))
243 (setcar (cddr prev) bsym) 244 (setcar (cddr prev) bsym)
@@ -255,17 +256,26 @@ of the form (UPAT EXP)."
255 ;; FIXME: But if some of `prevvars' are not in `vars' we 256 ;; FIXME: But if some of `prevvars' are not in `vars' we
256 ;; should remove them from `prevvars'! 257 ;; should remove them from `prevvars'!
257 `(funcall ,res ,@args))))))) 258 `(funcall ,res ,@args)))))))
259 (used-cases ())
258 (main 260 (main
259 (pcase--u 261 (pcase--u
260 (mapcar (lambda (case) 262 (mapcar (lambda (case)
261 `((match ,val . ,(car case)) 263 `((match ,val . ,(car case))
262 ,(apply-partially 264 ,(lambda (vars)
263 (if (pcase--small-branch-p (cdr case)) 265 (unless (memq case used-cases)
264 ;; Don't bother sharing multiple 266 ;; Keep track of the cases that are used.
265 ;; occurrences of this leaf since it's small. 267 (push case used-cases))
266 #'pcase-codegen codegen) 268 (funcall
267 (cdr case)))) 269 (if (pcase--small-branch-p (cdr case))
270 ;; Don't bother sharing multiple
271 ;; occurrences of this leaf since it's small.
272 #'pcase-codegen codegen)
273 (cdr case)
274 vars))))
268 cases)))) 275 cases))))
276 (dolist (case cases)
277 (unless (or (memq case used-cases) (eq (car case) 'dontcare))
278 (message "Redundant pcase pattern: %S" (car case))))
269 (macroexp-let* defs main)))) 279 (macroexp-let* defs main))))
270 280
271(defun pcase-codegen (code vars) 281(defun pcase-codegen (code vars)
@@ -566,7 +576,7 @@ Otherwise, it defers to REST which is a list of branches of the form
566 (if (eq (car upat) 'pred) (put sym 'pcase-used t)) 576 (if (eq (car upat) 'pred) (put sym 'pcase-used t))
567 (let* ((splitrest 577 (let* ((splitrest
568 (pcase--split-rest 578 (pcase--split-rest
569 sym (apply-partially #'pcase--split-pred upat) rest)) 579 sym (lambda (pat) (pcase--split-pred upat pat)) rest))
570 (then-rest (car splitrest)) 580 (then-rest (car splitrest))
571 (else-rest (cdr splitrest))) 581 (else-rest (cdr splitrest)))
572 (pcase--if (if (and (eq (car upat) 'pred) (symbolp (cadr upat))) 582 (pcase--if (if (and (eq (car upat) 'pred) (symbolp (cadr upat)))
@@ -636,7 +646,7 @@ Otherwise, it defers to REST which is a list of branches of the form
636 (let* ((elems (mapcar 'cadr (cdr upat))) 646 (let* ((elems (mapcar 'cadr (cdr upat)))
637 (splitrest 647 (splitrest
638 (pcase--split-rest 648 (pcase--split-rest
639 sym (apply-partially #'pcase--split-member elems) rest)) 649 sym (lambda (pat) (pcase--split-member elems pat)) rest))
640 (then-rest (car splitrest)) 650 (then-rest (car splitrest))
641 (else-rest (cdr splitrest))) 651 (else-rest (cdr splitrest)))
642 (put sym 'pcase-used t) 652 (put sym 'pcase-used t)
@@ -693,7 +703,7 @@ Otherwise, it defers to REST which is a list of branches of the form
693 (symd (make-symbol "xcdr")) 703 (symd (make-symbol "xcdr"))
694 (splitrest (pcase--split-rest 704 (splitrest (pcase--split-rest
695 sym 705 sym
696 (apply-partially #'pcase--split-consp syma symd) 706 (lambda (pat) (pcase--split-consp syma symd pat))
697 rest)) 707 rest))
698 (then-rest (car splitrest)) 708 (then-rest (car splitrest))
699 (else-rest (cdr splitrest)) 709 (else-rest (cdr splitrest))
@@ -716,7 +726,7 @@ Otherwise, it defers to REST which is a list of branches of the form
716 (pcase--u else-rest)))) 726 (pcase--u else-rest))))
717 ((or (integerp qpat) (symbolp qpat) (stringp qpat)) 727 ((or (integerp qpat) (symbolp qpat) (stringp qpat))
718 (let* ((splitrest (pcase--split-rest 728 (let* ((splitrest (pcase--split-rest
719 sym (apply-partially 'pcase--split-equal qpat) rest)) 729 sym (lambda (pat) (pcase--split-equal qpat pat)) rest))
720 (then-rest (car splitrest)) 730 (then-rest (car splitrest))
721 (else-rest (cdr splitrest))) 731 (else-rest (cdr splitrest)))
722 (pcase--if (cond 732 (pcase--if (cond
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el
index fbb2359ca1f..dbd13a01a8b 100644
--- a/lisp/emulation/edt.el
+++ b/lisp/emulation/edt.el
@@ -2071,6 +2071,20 @@ created."
2071 (setq transient-mark-mode edt-orig-transient-mark-mode)) 2071 (setq transient-mark-mode edt-orig-transient-mark-mode))
2072 (message "Original key bindings restored; EDT Emulation disabled")) 2072 (message "Original key bindings restored; EDT Emulation disabled"))
2073 2073
2074(defun edt-default-menu-bar-update-buffers ()
2075 ;; Update edt-default-global-map with latest copy of
2076 ;; `global-buffers-menu-map' each time `menu-bar-update-buffers'
2077 ;; updates global-map.
2078 (define-key edt-default-global-map [menu-bar buffer]
2079 (cons "Buffers" global-buffers-menu-map)))
2080
2081(defun edt-user-menu-bar-update-buffers ()
2082 ;; We need to update edt-user-global-map with latest copy of
2083 ;; `global-buffers-menu-map' each time `menu-bar-update-buffers'
2084 ;; updates global-map.
2085 (define-key edt-user-global-map [menu-bar buffer]
2086 (cons "Buffers" global-buffers-menu-map)))
2087
2074(defun edt-default-emulation-setup (&optional user-setup) 2088(defun edt-default-emulation-setup (&optional user-setup)
2075 "Setup emulation of DEC's EDT editor. 2089 "Setup emulation of DEC's EDT editor.
2076Optional argument USER-SETUP non-nil means called from function 2090Optional argument USER-SETUP non-nil means called from function
@@ -2110,10 +2124,8 @@ Optional argument USER-SETUP non-nil means called from function
2110 (progn 2124 (progn
2111 (fset 'edt-emulation-on (symbol-function 'edt-select-default-global-map)) 2125 (fset 'edt-emulation-on (symbol-function 'edt-select-default-global-map))
2112 (edt-select-default-global-map))) 2126 (edt-select-default-global-map)))
2113 ;; We need to share `global-buffers-menu-map' with the saved global 2127 ;; Keep the menu bar Buffers menu up-to-date in edt-default-global-map.
2114 ;; keymap, because `menu-bar-update-buffers' directly changes it. 2128 (add-hook 'menu-bar-update-hook 'edt-default-menu-bar-update-buffers))
2115 (define-key (current-global-map) [menu-bar buffer]
2116 (cons "Buffers" global-buffers-menu-map)))
2117 2129
2118(defun edt-user-emulation-setup () 2130(defun edt-user-emulation-setup ()
2119 "Setup user custom emulation of DEC's EDT editor." 2131 "Setup user custom emulation of DEC's EDT editor."
@@ -2134,7 +2146,9 @@ Optional argument USER-SETUP non-nil means called from function
2134 ;; See Info node `edt' for more details, and sample edt-user.el file. 2146 ;; See Info node `edt' for more details, and sample edt-user.el file.
2135 (if (fboundp 'edt-setup-user-bindings) 2147 (if (fboundp 'edt-setup-user-bindings)
2136 (edt-setup-user-bindings)) 2148 (edt-setup-user-bindings))
2137 (edt-select-user-global-map)) 2149 (edt-select-user-global-map)
2150 ;; Keep the menu bar Buffers menu up-to-date in edt-user-global-map.
2151 (add-hook 'menu-bar-update-hook 'edt-user-menu-bar-update-buffers))
2138 2152
2139(defun edt-select-default-global-map() 2153(defun edt-select-default-global-map()
2140 "Select default EDT emulation key bindings." 2154 "Select default EDT emulation key bindings."
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 9d9a86ca406..0923ed4db96 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,7 @@
12012-06-18 Nelson Ferreira <nelson.ferreira@ieee.org> (tiny change)
2
3 * gnus-win.el (gnus-configure-frame): Pass an arg to window-dedicated-p.
4
12012-06-17 Toke Høiland-Jørgensen <toke@toke.dk> (tiny change) 52012-06-17 Toke Høiland-Jørgensen <toke@toke.dk> (tiny change)
2 6
3 * nnmaildir.el (nnmaildir-request-expire-articles): Ensure that `time' 7 * nnmaildir.el (nnmaildir-request-expire-articles): Ensure that `time'
diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el
index efe2a319854..bd9ea10fdc4 100644
--- a/lisp/gnus/gnus-win.el
+++ b/lisp/gnus/gnus-win.el
@@ -273,7 +273,9 @@ See the Gnus manual for an explanation of the syntax used.")
273 (cond 273 (cond
274 ((eq buf (window-buffer (selected-window))) 274 ((eq buf (window-buffer (selected-window)))
275 (set-buffer buf)) 275 (set-buffer buf))
276 ((eq t (window-dedicated-p)) 276 ((eq t (window-dedicated-p
277 ;; XEmacs version of `window-dedicated-p' requires it.
278 (selected-window)))
277 ;; If the window is hard-dedicated, we have a problem because 279 ;; If the window is hard-dedicated, we have a problem because
278 ;; we just can't do what we're asked. But signaling an error, 280 ;; we just can't do what we're asked. But signaling an error,
279 ;; like `switch-to-buffer' would do, is not an option because 281 ;; like `switch-to-buffer' would do, is not an option because
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index e4453afe046..a084ed9fb4d 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -461,7 +461,7 @@ for use at QPOS."
461 (last (last completions))) 461 (last (last completions)))
462 (when (consp last) (setcdr last nil)) 462 (when (consp last) (setcdr last nil))
463 completions)) 463 completions))
464 464
465 ((eq action 'completion--unquote) 465 ((eq action 'completion--unquote)
466 (let ((ustring (funcall unquote string)) 466 (let ((ustring (funcall unquote string))
467 (uprefix (funcall unquote (substring string 0 pred)))) 467 (uprefix (funcall unquote (substring string 0 pred))))
@@ -2335,8 +2335,7 @@ See `read-file-name' for the meaning of the arguments."
2335 (if (consp default-filename) 2335 (if (consp default-filename)
2336 (mapcar 'abbreviate-file-name default-filename) 2336 (mapcar 'abbreviate-file-name default-filename)
2337 (abbreviate-file-name default-filename)))) 2337 (abbreviate-file-name default-filename))))
2338 (let ((non-essential t) 2338 (let ((insdef (cond
2339 (insdef (cond
2340 ((and insert-default-directory (stringp dir)) 2339 ((and insert-default-directory (stringp dir))
2341 (if initial 2340 (if initial
2342 (cons (minibuffer--double-dollars (concat dir initial)) 2341 (cons (minibuffer--double-dollars (concat dir initial))
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index dfa72a3084a..a43dc1eb1d3 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1,4 +1,4 @@
1;;; python.el --- Python's flying circus support for Emacs 1;;; python.el --- Python's flying circus support for Emacs -*- coding: utf-8 -*-
2 2
3;; Copyright (C) 2003-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2003-2012 Free Software Foundation, Inc.
4 4
@@ -308,29 +308,31 @@
308 308
309(eval-when-compile 309(eval-when-compile
310 (defconst python-rx-constituents 310 (defconst python-rx-constituents
311 (list 311 `((block-start . ,(rx symbol-start
312 `(block-start . ,(rx symbol-start
313 (or "def" "class" "if" "elif" "else" "try" 312 (or "def" "class" "if" "elif" "else" "try"
314 "except" "finally" "for" "while" "with") 313 "except" "finally" "for" "while" "with")
315 symbol-end)) 314 symbol-end))
316 `(decorator . ,(rx line-start (* space) ?@ (any letter ?_) 315 (decorator . ,(rx line-start (* space) ?@ (any letter ?_)
317 (* (any word ?_)))) 316 (* (any word ?_))))
318 `(defun . ,(rx symbol-start (or "def" "class") symbol-end)) 317 (defun . ,(rx symbol-start (or "def" "class") symbol-end))
319 `(if-name-main . ,(rx line-start "if" (+ space) "__name__" 318 (if-name-main . ,(rx line-start "if" (+ space) "__name__"
320 (+ space) "==" (+ space) 319 (+ space) "==" (+ space)
321 (any ?' ?\") "__main__" (any ?' ?\") 320 (any ?' ?\") "__main__" (any ?' ?\")
322 (* space) ?:)) 321 (* space) ?:))
323 `(symbol-name . ,(rx (any letter ?_) (* (any word ?_)))) 322 (symbol-name . ,(rx (any letter ?_) (* (any word ?_))))
324 `(open-paren . ,(rx (or "{" "[" "("))) 323 (open-paren . ,(rx (or "{" "[" "(")))
325 `(close-paren . ,(rx (or "}" "]" ")"))) 324 (close-paren . ,(rx (or "}" "]" ")")))
326 `(simple-operator . ,(rx (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%))) 325 (simple-operator . ,(rx (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)))
327 `(not-simple-operator . ,(rx 326 ;; FIXME: rx should support (not simple-operator).
327 (not-simple-operator . ,(rx
328 (not 328 (not
329 (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)))) 329 (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%))))
330 `(operator . ,(rx (or "+" "-" "/" "&" "^" "~" "|" "*" "<" ">" 330 ;; FIXME: Use regexp-opt.
331 (operator . ,(rx (or "+" "-" "/" "&" "^" "~" "|" "*" "<" ">"
331 "=" "%" "**" "//" "<<" ">>" "<=" "!=" 332 "=" "%" "**" "//" "<<" ">>" "<=" "!="
332 "==" ">=" "is" "not"))) 333 "==" ">=" "is" "not")))
333 `(assignment-operator . ,(rx (or "=" "+=" "-=" "*=" "/=" "//=" "%=" "**=" 334 ;; FIXME: Use regexp-opt.
335 (assignment-operator . ,(rx (or "=" "+=" "-=" "*=" "/=" "//=" "%=" "**="
334 ">>=" "<<=" "&=" "^=" "|=")))) 336 ">>=" "<<=" "&=" "^=" "|="))))
335 "Additional Python specific sexps for `python-rx'")) 337 "Additional Python specific sexps for `python-rx'"))
336 338
@@ -1569,10 +1571,10 @@ there for compatibility with CEDET.")
1569 (get-buffer-process proc-buffer-name))) 1571 (get-buffer-process proc-buffer-name)))
1570 1572
1571(define-obsolete-function-alias 1573(define-obsolete-function-alias
1572 'python-proc 'python-shell-internal-get-or-create-process "23.3") 1574 'python-proc 'python-shell-internal-get-or-create-process "24.2")
1573 1575
1574(define-obsolete-variable-alias 1576(define-obsolete-variable-alias
1575 'python-buffer 'python-shell-internal-buffer "23.3") 1577 'python-buffer 'python-shell-internal-buffer "24.2")
1576 1578
1577(defun python-shell-send-string (string &optional process msg) 1579(defun python-shell-send-string (string &optional process msg)
1578 "Send STRING to inferior Python PROCESS. 1580 "Send STRING to inferior Python PROCESS.
@@ -1627,10 +1629,10 @@ Returns the output. See `python-shell-send-string-no-output'."
1627 (python-shell-internal-get-or-create-process) nil)) 1629 (python-shell-internal-get-or-create-process) nil))
1628 1630
1629(define-obsolete-function-alias 1631(define-obsolete-function-alias
1630 'python-send-receive 'python-shell-internal-send-string "23.3") 1632 'python-send-receive 'python-shell-internal-send-string "24.2")
1631 1633
1632(define-obsolete-function-alias 1634(define-obsolete-function-alias
1633 'python-send-string 'python-shell-internal-send-string "23.3") 1635 'python-send-string 'python-shell-internal-send-string "24.2")
1634 1636
1635(defun python-shell-send-region (start end) 1637(defun python-shell-send-region (start end)
1636 "Send the region delimited by START and END to inferior Python process." 1638 "Send the region delimited by START and END to inferior Python process."
@@ -2146,6 +2148,7 @@ the if condition."
2146 "Define a `python-mode' skeleton using NAME DOC and SKEL. 2148 "Define a `python-mode' skeleton using NAME DOC and SKEL.
2147The skeleton will be bound to python-skeleton-NAME and will 2149The skeleton will be bound to python-skeleton-NAME and will
2148be added to `python-mode-abbrev-table'." 2150be added to `python-mode-abbrev-table'."
2151 (declare (indent 2))
2149 (let* ((name (symbol-name name)) 2152 (let* ((name (symbol-name name))
2150 (function-name (intern (concat "python-skeleton-" name)))) 2153 (function-name (intern (concat "python-skeleton-" name))))
2151 `(progn 2154 `(progn
@@ -2156,11 +2159,11 @@ be added to `python-mode-abbrev-table'."
2156 ,(or doc 2159 ,(or doc
2157 (format "Insert %s statement." name)) 2160 (format "Insert %s statement." name))
2158 ,@skel)))) 2161 ,@skel))))
2159(put 'python-skeleton-define 'lisp-indent-function 2)
2160 2162
2161(defmacro python-define-auxiliary-skeleton (name doc &optional &rest skel) 2163(defmacro python-define-auxiliary-skeleton (name doc &optional &rest skel)
2162 "Define a `python-mode' auxiliary skeleton using NAME DOC and SKEL. 2164 "Define a `python-mode' auxiliary skeleton using NAME DOC and SKEL.
2163The skeleton will be bound to python-skeleton-NAME." 2165The skeleton will be bound to python-skeleton-NAME."
2166 (declare (indent 2))
2164 (let* ((name (symbol-name name)) 2167 (let* ((name (symbol-name name))
2165 (function-name (intern (concat "python-skeleton--" name))) 2168 (function-name (intern (concat "python-skeleton--" name)))
2166 (msg (format 2169 (msg (format
@@ -2176,7 +2179,6 @@ The skeleton will be bound to python-skeleton-NAME."
2176 (unless (y-or-n-p ,msg) 2179 (unless (y-or-n-p ,msg)
2177 (signal 'quit t)) 2180 (signal 'quit t))
2178 ,@skel))) 2181 ,@skel)))
2179(put 'python-define-auxiliary-skeleton 'lisp-indent-function 2)
2180 2182
2181(python-define-auxiliary-skeleton else nil) 2183(python-define-auxiliary-skeleton else nil)
2182 2184
@@ -2800,7 +2802,7 @@ Optional argument DIRECTION defines the direction to move to."
2800 2802
2801 2803
2802;;;###autoload 2804;;;###autoload
2803(define-derived-mode python-mode fundamental-mode "Python" 2805(define-derived-mode python-mode prog-mode "Python"
2804 "Major mode for editing Python files. 2806 "Major mode for editing Python files.
2805 2807
2806\\{python-mode-map} 2808\\{python-mode-map}
diff --git a/lisp/subr.el b/lisp/subr.el
index 473cc3efddd..ba9b06d495b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3011,24 +3011,29 @@ the buffer list ordering."
3011 (declare (indent 1) (debug t)) 3011 (declare (indent 1) (debug t))
3012 ;; Most of this code is a copy of save-selected-window. 3012 ;; Most of this code is a copy of save-selected-window.
3013 `(let* ((save-selected-window-destination ,window) 3013 `(let* ((save-selected-window-destination ,window)
3014 (save-selected-window-frame
3015 (window-frame save-selected-window-destination))
3014 (save-selected-window-window (selected-window)) 3016 (save-selected-window-window (selected-window))
3015 ;; Selecting a window on another frame changes not only the 3017 ;; Selecting a window on another frame also changes that
3016 ;; selected-window but also the frame-selected-window of the 3018 ;; frame's frame-selected-window. We must save&restore it.
3017 ;; destination frame. So we need to save&restore it.
3018 (save-selected-window-other-frame 3019 (save-selected-window-other-frame
3019 (unless (eq (selected-frame) 3020 (unless (eq (selected-frame) save-selected-window-frame)
3020 (window-frame save-selected-window-destination)) 3021 (frame-selected-window save-selected-window-frame)))
3021 (frame-selected-window 3022 (save-selected-window-top-frame
3022 (window-frame save-selected-window-destination))))) 3023 (unless (eq (selected-frame) save-selected-window-frame)
3024 (tty-top-frame save-selected-window-frame))))
3023 (save-current-buffer 3025 (save-current-buffer
3024 (unwind-protect 3026 (unwind-protect
3025 (progn (select-window save-selected-window-destination 'norecord) 3027 (progn (select-window save-selected-window-destination 'norecord)
3026 ,@body) 3028 ,@body)
3027 ;; First reset frame-selected-window. 3029 ;; First reset frame-selected-window.
3028 (if (window-live-p save-selected-window-other-frame) 3030 (when (window-live-p save-selected-window-other-frame)
3029 ;; We don't use set-frame-selected-window because it does not 3031 ;; We don't use set-frame-selected-window because it does not
3030 ;; pass the `norecord' argument to Fselect_window. 3032 ;; pass the `norecord' argument to Fselect_window.
3031 (select-window save-selected-window-other-frame 'norecord)) 3033 (select-window save-selected-window-other-frame 'norecord)
3034 (and (frame-live-p save-selected-window-top-frame)
3035 (not (eq (tty-top-frame) save-selected-window-top-frame))
3036 (select-frame save-selected-window-top-frame 'norecord)))
3032 ;; Then reset the actual selected-window. 3037 ;; Then reset the actual selected-window.
3033 (when (window-live-p save-selected-window-window) 3038 (when (window-live-p save-selected-window-window)
3034 (select-window save-selected-window-window 'norecord)))))) 3039 (select-window save-selected-window-window 'norecord))))))
diff --git a/lisp/window.el b/lisp/window.el
index 6ea882d1ea2..7c3fe1a082f 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -47,12 +47,24 @@ order of recently selected windows and the buffer list ordering
47are not altered by this macro (unless they are altered in BODY)." 47are not altered by this macro (unless they are altered in BODY)."
48 (declare (indent 0) (debug t)) 48 (declare (indent 0) (debug t))
49 `(let ((save-selected-window-window (selected-window)) 49 `(let ((save-selected-window-window (selected-window))
50 ;; It is necessary to save all of these, because calling 50 ;; We save and restore all frames' selected windows, because
51 ;; select-window changes frame-selected-window for whatever 51 ;; `select-window' can change the frame-selected-window of
52 ;; frame that window is in. 52 ;; whatever frame that window is in. Each text terminal's
53 ;; top-frame is preserved by putting it last in the list.
53 (save-selected-window-alist 54 (save-selected-window-alist
54 (mapcar (lambda (frame) (cons frame (frame-selected-window frame))) 55 (apply 'append
55 (frame-list)))) 56 (mapcar (lambda (terminal)
57 (let ((frames (frames-on-display-list terminal))
58 (top-frame (tty-top-frame terminal))
59 alist)
60 (if top-frame
61 (setq frames
62 (cons top-frame
63 (delq top-frame frames))))
64 (dolist (f frames)
65 (push (cons f (frame-selected-window f))
66 alist))))
67 (terminal-list)))))
56 (save-current-buffer 68 (save-current-buffer
57 (unwind-protect 69 (unwind-protect
58 (progn ,@body) 70 (progn ,@body)