aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2013-08-05 18:26:57 +0400
committerDmitry Antipov2013-08-05 18:26:57 +0400
commit290d5b5890c5c8d096bd846eb48552d4608d5ed6 (patch)
tree2c1e39b6b5f1e82f179ee764eab34d012376076e
parentb27a1bd53ac62bad378cbafcfb594ac37357bbc6 (diff)
downloademacs-290d5b5890c5c8d096bd846eb48552d4608d5ed6.tar.gz
emacs-290d5b5890c5c8d096bd846eb48552d4608d5ed6.zip
Do not call to `selected-window' where it is assumed by default.
Affected functions are `window-minibuffer-p', `window-dedicated-p', `window-hscroll', `window-width', `window-height', `window-buffer', `window-frame', `window-start', `window-point', `next-window' and `window-display-table'. * abbrev.el (abbrev--default-expand): * bs.el (bs--show-with-configuration): * buff-menu.el (Buffer-menu-mouse-select): * calc/calc.el (calc): * calendar/calendar.el (calendar-generate-window): * calendar/diary-lib.el (diary-simple-display, diary-show-all-entries) (diary-make-entry): * comint.el (send-invisible, comint-dynamic-complete-filename) (comint-dynamic-simple-complete, comint-dynamic-list-completions): * completion.el (complete): * dabbrev.el (dabbrev-expand, dabbrev--make-friend-buffer-list): * disp-table.el (describe-current-display-table): * doc-view.el (doc-view-insert-image): * ebuff-menu.el (Electric-buffer-menu-mouse-select): * ehelp.el (with-electric-help): * emacs-lisp/easy-mmode.el (easy-mmode-define-navigation): * emacs-lisp/edebug.el (edebug-two-window-p, edebug-pop-to-buffer): * emacs-lisp/helper.el (Helper-help-scroller): * emulation/cua-base.el (cua--post-command-handler-1): * eshell/esh-mode.el (eshell-output-filter): * ffap.el (ffap-gnus-wrapper): * help-macro.el (make-help-screen): * hilit-chg.el (highlight-compare-buffers): * hippie-exp.el (hippie-expand, try-expand-dabbrev-visible): * hl-line.el (global-hl-line-highlight): * icomplete.el (icomplete-simple-completing-p): * isearch.el (isearch-done): * jit-lock.el (jit-lock-stealth-fontify): * mail/rmailsum.el (rmail-summary-scroll-msg-up): * lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling): * mpc.el (mpc-tagbrowser, mpc): * net/rcirc.el (rcirc-any-buffer): * play/gomoku.el (gomoku-max-width, gomoku-max-height): * play/landmark.el (landmark-max-width, landmark-max-height): * play/zone.el (zone): * progmodes/compile.el (compilation-goto-locus): * progmodes/ebrowse.el (ebrowse-view/find-file-and-search-pattern): * progmodes/etags.el (find-tag-other-window): * progmodes/fortran.el (fortran-column-ruler): * progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe): * progmodes/verilog-mode.el (verilog-point-text): * reposition.el (reposition-window): * rot13.el (toggle-rot13-mode): * server.el (server-switch-buffer): * shell.el (shell-dynamic-complete-command) (shell-dynamic-complete-environment-variable): * simple.el (insert-buffer, set-selective-display) (delete-completion-window): * speedbar.el (speedbar-timer-fn, speedbar-center-buffer-smartly) (speedbar-recenter): * startup.el (fancy-splash-head): * textmodes/ispell.el (ispell-command-loop): * textmodes/makeinfo.el (makeinfo-compilation-sentinel-region): * tutorial.el (help-with-tutorial): * vc/add-log.el (add-change-log-entry): * vc/compare-w.el (compare-windows): * vc/ediff-help.el (ediff-indent-help-message): * vc/ediff-util.el (ediff-setup-control-buffer, ediff-position-region): * vc/ediff-wind.el (ediff-skip-unsuitable-frames) (ediff-setup-control-frame): * vc/emerge.el (emerge-position-region): * vc/pcvs-util.el (cvs-bury-buffer): * window.el (walk-windows, mouse-autoselect-window-select): * winner.el (winner-set-conf, winner-undo): Related users changed.
-rw-r--r--lisp/ChangeLog72
-rw-r--r--lisp/abbrev.el2
-rw-r--r--lisp/bs.el2
-rw-r--r--lisp/buff-menu.el2
-rw-r--r--lisp/calc/calc.el2
-rw-r--r--lisp/calendar/calendar.el2
-rw-r--r--lisp/calendar/diary-lib.el9
-rw-r--r--lisp/comint.el8
-rw-r--r--lisp/completion.el2
-rw-r--r--lisp/dabbrev.el4
-rw-r--r--lisp/disp-table.el2
-rw-r--r--lisp/doc-view.el2
-rw-r--r--lisp/ebuff-menu.el2
-rw-r--r--lisp/ehelp.el2
-rw-r--r--lisp/emacs-lisp/easy-mmode.el2
-rw-r--r--lisp/emacs-lisp/edebug.el4
-rw-r--r--lisp/emacs-lisp/helper.el2
-rw-r--r--lisp/emulation/cua-base.el2
-rw-r--r--lisp/eshell/esh-mode.el2
-rw-r--r--lisp/ffap.el2
-rw-r--r--lisp/help-macro.el4
-rw-r--r--lisp/hilit-chg.el2
-rw-r--r--lisp/hippie-exp.el6
-rw-r--r--lisp/hl-line.el2
-rw-r--r--lisp/icomplete.el2
-rw-r--r--lisp/isearch.el2
-rw-r--r--lisp/jit-lock.el2
-rw-r--r--lisp/mail/rmail.el4
-rw-r--r--lisp/mail/rmailsum.el2
-rw-r--r--lisp/mouse-drag.el2
-rw-r--r--lisp/mpc.el5
-rw-r--r--lisp/net/rcirc.el2
-rw-r--r--lisp/play/gomoku.el4
-rw-r--r--lisp/play/landmark.el4
-rw-r--r--lisp/play/zone.el2
-rw-r--r--lisp/progmodes/compile.el2
-rw-r--r--lisp/progmodes/ebrowse.el2
-rw-r--r--lisp/progmodes/etags.el2
-rw-r--r--lisp/progmodes/fortran.el3
-rw-r--r--lisp/progmodes/gdb-mi.el2
-rw-r--r--lisp/progmodes/verilog-mode.el2
-rw-r--r--lisp/reposition.el2
-rw-r--r--lisp/rot13.el4
-rw-r--r--lisp/server.el8
-rw-r--r--lisp/shell.el4
-rw-r--r--lisp/simple.el9
-rw-r--r--lisp/speedbar.el16
-rw-r--r--lisp/startup.el2
-rw-r--r--lisp/textmodes/ispell.el2
-rw-r--r--lisp/textmodes/makeinfo.el2
-rw-r--r--lisp/tutorial.el2
-rw-r--r--lisp/vc/add-log.el6
-rw-r--r--lisp/vc/compare-w.el2
-rw-r--r--lisp/vc/ediff-help.el2
-rw-r--r--lisp/vc/ediff-util.el4
-rw-r--r--lisp/vc/ediff-wind.el6
-rw-r--r--lisp/vc/emerge.el2
-rw-r--r--lisp/vc/pcvs-util.el6
-rw-r--r--lisp/window.el6
-rw-r--r--lisp/winner.el5
60 files changed, 169 insertions, 106 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b1ff3080b4d..8bc39097187 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,75 @@
12013-08-05 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Do not call to `selected-window' where it is assumed by default.
4 Affected functions are `window-minibuffer-p', `window-dedicated-p',
5 `window-hscroll', `window-width', `window-height', `window-buffer',
6 `window-frame', `window-start', `window-point', `next-window'
7 and `window-display-table'.
8 * abbrev.el (abbrev--default-expand):
9 * bs.el (bs--show-with-configuration):
10 * buff-menu.el (Buffer-menu-mouse-select):
11 * calc/calc.el (calc):
12 * calendar/calendar.el (calendar-generate-window):
13 * calendar/diary-lib.el (diary-simple-display, diary-show-all-entries)
14 (diary-make-entry):
15 * comint.el (send-invisible, comint-dynamic-complete-filename)
16 (comint-dynamic-simple-complete, comint-dynamic-list-completions):
17 * completion.el (complete):
18 * dabbrev.el (dabbrev-expand, dabbrev--make-friend-buffer-list):
19 * disp-table.el (describe-current-display-table):
20 * doc-view.el (doc-view-insert-image):
21 * ebuff-menu.el (Electric-buffer-menu-mouse-select):
22 * ehelp.el (with-electric-help):
23 * emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
24 * emacs-lisp/edebug.el (edebug-two-window-p, edebug-pop-to-buffer):
25 * emacs-lisp/helper.el (Helper-help-scroller):
26 * emulation/cua-base.el (cua--post-command-handler-1):
27 * eshell/esh-mode.el (eshell-output-filter):
28 * ffap.el (ffap-gnus-wrapper):
29 * help-macro.el (make-help-screen):
30 * hilit-chg.el (highlight-compare-buffers):
31 * hippie-exp.el (hippie-expand, try-expand-dabbrev-visible):
32 * hl-line.el (global-hl-line-highlight):
33 * icomplete.el (icomplete-simple-completing-p):
34 * isearch.el (isearch-done):
35 * jit-lock.el (jit-lock-stealth-fontify):
36 * mail/rmailsum.el (rmail-summary-scroll-msg-up):
37 * lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
38 * mpc.el (mpc-tagbrowser, mpc):
39 * net/rcirc.el (rcirc-any-buffer):
40 * play/gomoku.el (gomoku-max-width, gomoku-max-height):
41 * play/landmark.el (landmark-max-width, landmark-max-height):
42 * play/zone.el (zone):
43 * progmodes/compile.el (compilation-goto-locus):
44 * progmodes/ebrowse.el (ebrowse-view/find-file-and-search-pattern):
45 * progmodes/etags.el (find-tag-other-window):
46 * progmodes/fortran.el (fortran-column-ruler):
47 * progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
48 * progmodes/verilog-mode.el (verilog-point-text):
49 * reposition.el (reposition-window):
50 * rot13.el (toggle-rot13-mode):
51 * server.el (server-switch-buffer):
52 * shell.el (shell-dynamic-complete-command)
53 (shell-dynamic-complete-environment-variable):
54 * simple.el (insert-buffer, set-selective-display)
55 (delete-completion-window):
56 * speedbar.el (speedbar-timer-fn, speedbar-center-buffer-smartly)
57 (speedbar-recenter):
58 * startup.el (fancy-splash-head):
59 * textmodes/ispell.el (ispell-command-loop):
60 * textmodes/makeinfo.el (makeinfo-compilation-sentinel-region):
61 * tutorial.el (help-with-tutorial):
62 * vc/add-log.el (add-change-log-entry):
63 * vc/compare-w.el (compare-windows):
64 * vc/ediff-help.el (ediff-indent-help-message):
65 * vc/ediff-util.el (ediff-setup-control-buffer, ediff-position-region):
66 * vc/ediff-wind.el (ediff-skip-unsuitable-frames)
67 (ediff-setup-control-frame):
68 * vc/emerge.el (emerge-position-region):
69 * vc/pcvs-util.el (cvs-bury-buffer):
70 * window.el (walk-windows, mouse-autoselect-window-select):
71 * winner.el (winner-set-conf, winner-undo): Related users changed.
72
12013-08-05 Juanma Barranquero <lekktu@gmail.com> 732013-08-05 Juanma Barranquero <lekktu@gmail.com>
2 74
3 * frameset.el (frameset--set-id): Doc fix. 75 * frameset.el (frameset--set-id): Doc fix.
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 27cd7089a07..d82e2eabd84 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -856,7 +856,7 @@ return value is that of `abbrev-insert'.)"
856 (endmark (copy-marker wordend t))) 856 (endmark (copy-marker wordend t)))
857 (unless (or ;; executing-kbd-macro 857 (unless (or ;; executing-kbd-macro
858 noninteractive 858 noninteractive
859 (window-minibuffer-p (selected-window))) 859 (window-minibuffer-p))
860 ;; Add an undo boundary, in case we are doing this for 860 ;; Add an undo boundary, in case we are doing this for
861 ;; a self-inserting command which has avoided making one so far. 861 ;; a self-inserting command which has avoided making one so far.
862 (undo-boundary)) 862 (undo-boundary))
diff --git a/lisp/bs.el b/lisp/bs.el
index af213333a79..6871a7eeb83 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -1406,7 +1406,7 @@ for buffer selection."
1406 (select-window active-window) 1406 (select-window active-window)
1407 (bs--restore-window-config) 1407 (bs--restore-window-config)
1408 (setq bs--window-config-coming-from (current-window-configuration)) 1408 (setq bs--window-config-coming-from (current-window-configuration))
1409 (when (> (window-height (selected-window)) 7) 1409 (when (> (window-height) 7)
1410 ;; Errors would mess with the window configuration (bug#10882). 1410 ;; Errors would mess with the window configuration (bug#10882).
1411 (ignore-errors (select-window (split-window-below))))) 1411 (ignore-errors (select-window (split-window-below)))))
1412 (bs-show-in-buffer liste) 1412 (bs-show-in-buffer liste)
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 1db9b7229f3..58fde695b39 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -591,7 +591,7 @@ means list those buffers and no others."
591 (select-window (posn-window (event-end event))) 591 (select-window (posn-window (event-end event)))
592 (let ((buffer (tabulated-list-get-id (posn-point (event-end event))))) 592 (let ((buffer (tabulated-list-get-id (posn-point (event-end event)))))
593 (when (buffer-live-p buffer) 593 (when (buffer-live-p buffer)
594 (if (and (window-dedicated-p (selected-window)) 594 (if (and (window-dedicated-p)
595 (eq (selected-window) (frame-root-window))) 595 (eq (selected-window) (frame-root-window)))
596 (switch-to-buffer-other-frame buffer) 596 (switch-to-buffer-other-frame buffer)
597 (switch-to-buffer buffer))))) 597 (switch-to-buffer buffer)))))
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 8a17ad7ce30..e72d0aacd5d 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1441,7 +1441,7 @@ commands given here will actually operate on the *Calculator* stack."
1441 (calc-keypad)))) 1441 (calc-keypad))))
1442 (when (get-buffer-window "*Calc Keypad*") 1442 (when (get-buffer-window "*Calc Keypad*")
1443 (calc-keypad) 1443 (calc-keypad)
1444 (set-buffer (window-buffer (selected-window)))) 1444 (set-buffer (window-buffer)))
1445 (if (eq major-mode 'calc-mode) 1445 (if (eq major-mode 'calc-mode)
1446 (calc-quit) 1446 (calc-quit)
1447 (let ((oldbuf (current-buffer))) 1447 (let ((oldbuf (current-buffer)))
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index d7e6ea68efa..40dcb25bc30 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1422,7 +1422,7 @@ Optional integers MON and YR are used instead of today's date."
1422 (year (calendar-extract-year today)) 1422 (year (calendar-extract-year today))
1423 (today-visible (or (not mon) 1423 (today-visible (or (not mon)
1424 (<= (abs (calendar-interval mon yr month year)) 1))) 1424 (<= (abs (calendar-interval mon yr month year)) 1)))
1425 (in-calendar-window (eq (window-buffer (selected-window)) 1425 (in-calendar-window (eq (window-buffer)
1426 (get-buffer calendar-buffer)))) 1426 (get-buffer calendar-buffer))))
1427 (calendar-generate (or mon month) (or yr year)) 1427 (calendar-generate (or mon month) (or yr year))
1428 (calendar-update-mode-line) 1428 (calendar-update-mode-line)
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 7bdb3cd49f6..6b89677554f 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -1011,8 +1011,7 @@ Entries that do not apply are made invisible. Holidays are shown
1011in the mode line. This is an option for `diary-display-function'." 1011in the mode line. This is an option for `diary-display-function'."
1012 ;; If selected window is dedicated (to the calendar), need a new one 1012 ;; If selected window is dedicated (to the calendar), need a new one
1013 ;; to display the diary. 1013 ;; to display the diary.
1014 (let* ((pop-up-frames (or pop-up-frames 1014 (let* ((pop-up-frames (or pop-up-frames (window-dedicated-p)))
1015 (window-dedicated-p (selected-window))))
1016 (dbuff (find-buffer-visiting diary-file)) 1015 (dbuff (find-buffer-visiting diary-file))
1017 (empty (diary-display-no-entries))) 1016 (empty (diary-display-no-entries)))
1018 ;; This may be too wide, but when simple diary is used there is 1017 ;; This may be too wide, but when simple diary is used there is
@@ -1216,8 +1215,7 @@ all entries, not just some, are visible. If there is no diary buffer, one
1216is created." 1215is created."
1217 (interactive) 1216 (interactive)
1218 (let* ((d-file (diary-check-diary-file)) 1217 (let* ((d-file (diary-check-diary-file))
1219 (pop-up-frames (or pop-up-frames 1218 (pop-up-frames (or pop-up-frames (window-dedicated-p)))
1220 (window-dedicated-p (selected-window))))
1221 (win (selected-window)) 1219 (win (selected-window))
1222 (height (window-height))) 1220 (height (window-height)))
1223 (with-current-buffer (or (find-buffer-visiting d-file) 1221 (with-current-buffer (or (find-buffer-visiting d-file)
@@ -2116,8 +2114,7 @@ calendar."
2116 "Insert a diary entry STRING which may be NONMARKING in FILE. 2114 "Insert a diary entry STRING which may be NONMARKING in FILE.
2117If omitted, NONMARKING defaults to nil and FILE defaults to 2115If omitted, NONMARKING defaults to nil and FILE defaults to
2118`diary-file'." 2116`diary-file'."
2119 (let ((pop-up-frames (or pop-up-frames 2117 (let ((pop-up-frames (or pop-up-frames (window-dedicated-p))))
2120 (window-dedicated-p (selected-window)))))
2121 (find-file-other-window (or file diary-file))) 2118 (find-file-other-window (or file diary-file)))
2122 (when (eq major-mode (default-value 'major-mode)) (diary-mode)) 2119 (when (eq major-mode (default-value 'major-mode)) (diary-mode))
2123 (widen) 2120 (widen)
diff --git a/lisp/comint.el b/lisp/comint.el
index 217bd4e8b6d..c2b69a42a8b 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2296,7 +2296,7 @@ Security bug: your string can still be temporarily recovered with
2296 (interactive "P") ; Defeat snooping via C-x ESC ESC 2296 (interactive "P") ; Defeat snooping via C-x ESC ESC
2297 (let ((proc (get-buffer-process (current-buffer))) 2297 (let ((proc (get-buffer-process (current-buffer)))
2298 (prefix 2298 (prefix
2299 (if (eq (window-buffer (selected-window)) (current-buffer)) 2299 (if (eq (window-buffer) (current-buffer))
2300 "" 2300 ""
2301 (format "(In buffer %s) " 2301 (format "(In buffer %s) "
2302 (current-buffer))))) 2302 (current-buffer)))))
@@ -3108,7 +3108,7 @@ completions listing is dependent on the value of `comint-completion-autolist'.
3108Returns t if successful." 3108Returns t if successful."
3109 (interactive) 3109 (interactive)
3110 (when (comint--match-partial-filename) 3110 (when (comint--match-partial-filename)
3111 (unless (window-minibuffer-p (selected-window)) 3111 (unless (window-minibuffer-p)
3112 (message "Completing file name...")) 3112 (message "Completing file name..."))
3113 (let ((data (comint--complete-file-name-data))) 3113 (let ((data (comint--complete-file-name-data)))
3114 (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data))))) 3114 (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)))))
@@ -3211,7 +3211,7 @@ Return `listed' if a completion listing was shown.
3211See also `comint-dynamic-complete-filename'." 3211See also `comint-dynamic-complete-filename'."
3212 (declare (obsolete completion-in-region "24.1")) 3212 (declare (obsolete completion-in-region "24.1"))
3213 (let* ((completion-ignore-case (memq system-type '(ms-dos windows-nt cygwin))) 3213 (let* ((completion-ignore-case (memq system-type '(ms-dos windows-nt cygwin)))
3214 (minibuffer-p (window-minibuffer-p (selected-window))) 3214 (minibuffer-p (window-minibuffer-p))
3215 (suffix (cond ((not comint-completion-addsuffix) "") 3215 (suffix (cond ((not comint-completion-addsuffix) "")
3216 ((not (consp comint-completion-addsuffix)) " ") 3216 ((not (consp comint-completion-addsuffix)) " ")
3217 (t (cdr comint-completion-addsuffix)))) 3217 (t (cdr comint-completion-addsuffix))))
@@ -3308,7 +3308,7 @@ Typing SPC flushes the completions buffer."
3308 (current-window-configuration)) 3308 (current-window-configuration))
3309 (with-output-to-temp-buffer "*Completions*" 3309 (with-output-to-temp-buffer "*Completions*"
3310 (display-completion-list completions common-substring)) 3310 (display-completion-list completions common-substring))
3311 (if (window-minibuffer-p (selected-window)) 3311 (if (window-minibuffer-p)
3312 (minibuffer-message "Type space to flush; repeat completion command to scroll") 3312 (minibuffer-message "Type space to flush; repeat completion command to scroll")
3313 (message "Type space to flush; repeat completion command to scroll"))) 3313 (message "Type space to flush; repeat completion command to scroll")))
3314 3314
diff --git a/lisp/completion.el b/lisp/completion.el
index 3fbc3c05fb4..dbddc6f5b87 100644
--- a/lisp/completion.el
+++ b/lisp/completion.el
@@ -1626,7 +1626,7 @@ Prefix args ::
1626 ;; Get the next completion 1626 ;; Get the next completion
1627 (let* ((print-status-p 1627 (let* ((print-status-p
1628 (and (>= baud-rate completion-prompt-speed-threshold) 1628 (and (>= baud-rate completion-prompt-speed-threshold)
1629 (not (window-minibuffer-p (selected-window))))) 1629 (not (window-minibuffer-p))))
1630 (insert-point (point)) 1630 (insert-point (point))
1631 (entry (completion-search-next cmpl-current-index)) 1631 (entry (completion-search-next cmpl-current-index))
1632 string) 1632 string)
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index d1bdd3f52be..e2aeb4ea19b 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -457,7 +457,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
457 (markerp dabbrev--last-abbrev-location) 457 (markerp dabbrev--last-abbrev-location)
458 (marker-position dabbrev--last-abbrev-location) 458 (marker-position dabbrev--last-abbrev-location)
459 (or (eq last-command this-command) 459 (or (eq last-command this-command)
460 (and (window-minibuffer-p (selected-window)) 460 (and (window-minibuffer-p)
461 (= dabbrev--last-abbrev-location 461 (= dabbrev--last-abbrev-location
462 (point))))) 462 (point)))))
463 ;; Find a different expansion for the same abbrev as last time. 463 ;; Find a different expansion for the same abbrev as last time.
@@ -793,7 +793,7 @@ of the start of the occurrence."
793 ;; In a minibuffer, search the buffer it was activated from, 793 ;; In a minibuffer, search the buffer it was activated from,
794 ;; first after the minibuffer itself. Unless we aren't supposed 794 ;; first after the minibuffer itself. Unless we aren't supposed
795 ;; to search the current buffer either. 795 ;; to search the current buffer either.
796 (if (and (window-minibuffer-p (selected-window)) 796 (if (and (window-minibuffer-p)
797 (not dabbrev-search-these-buffers-only)) 797 (not dabbrev-search-these-buffers-only))
798 (setq list 798 (setq list
799 (cons (dabbrev--minibuffer-origin) 799 (cons (dabbrev--minibuffer-origin)
diff --git a/lisp/disp-table.el b/lisp/disp-table.el
index 423648f70b5..7c75b38c9d4 100644
--- a/lisp/disp-table.el
+++ b/lisp/disp-table.el
@@ -119,7 +119,7 @@ Valid symbols are `truncation', `wrap', `escape', `control',
119(defun describe-current-display-table () 119(defun describe-current-display-table ()
120 "Describe the display table in use in the selected window and buffer." 120 "Describe the display table in use in the selected window and buffer."
121 (interactive) 121 (interactive)
122 (let ((disptab (or (window-display-table (selected-window)) 122 (let ((disptab (or (window-display-table)
123 buffer-display-table 123 buffer-display-table
124 standard-display-table))) 124 standard-display-table)))
125 (if disptab 125 (if disptab
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 10968f7f8dd..589a57b64c2 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -1262,7 +1262,7 @@ ARGS is a list of image descriptors."
1262 (car (image-size image 'pixels))) 1262 (car (image-size image 'pixels)))
1263 img-width) 1263 img-width)
1264 img-width)) 1264 img-width))
1265 (window-width (window-width (selected-window)))) 1265 (window-width (window-width)))
1266 (setf (doc-view-current-image) image) 1266 (setf (doc-view-current-image) image)
1267 (move-overlay ol (point-min) (point-max)) 1267 (move-overlay ol (point-min) (point-max))
1268 ;; In case the window is wider than the image, center the image 1268 ;; In case the window is wider than the image, center the image
diff --git a/lisp/ebuff-menu.el b/lisp/ebuff-menu.el
index 10d8e025067..9ac62b68272 100644
--- a/lisp/ebuff-menu.el
+++ b/lisp/ebuff-menu.el
@@ -227,7 +227,7 @@ Select buffer at point and display buffers marked \">\" in other windows."
227(defun Electric-buffer-menu-mouse-select (event) 227(defun Electric-buffer-menu-mouse-select (event)
228 (interactive "e") 228 (interactive "e")
229 (select-window (posn-window (event-end event))) 229 (select-window (posn-window (event-end event)))
230 (set-buffer (window-buffer (selected-window))) 230 (set-buffer (window-buffer))
231 (goto-char (posn-point (event-end event))) 231 (goto-char (posn-point (event-end event)))
232 (throw 'electric-buffer-menu-select (point))) 232 (throw 'electric-buffer-menu-select (point)))
233 233
diff --git a/lisp/ehelp.el b/lisp/ehelp.el
index 88fc87b5b7a..b2007909209 100644
--- a/lisp/ehelp.el
+++ b/lisp/ehelp.el
@@ -146,7 +146,7 @@ BUFFER is put back into its original major mode."
146 (unwind-protect 146 (unwind-protect
147 (save-excursion 147 (save-excursion
148 (when one 148 (when one
149 (goto-char (window-start (selected-window)))) 149 (goto-char (window-start)))
150 (let ((pop-up-windows t)) 150 (let ((pop-up-windows t))
151 (pop-to-buffer buffer)) 151 (pop-to-buffer buffer))
152 (with-current-buffer buffer 152 (with-current-buffer buffer
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index f8fb65be4d3..1301b70bb85 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -604,7 +604,7 @@ BODY is executed after moving to the destination location."
604 (goto-char (or ,(if endfun `(funcall #',endfun)) (point-max))) 604 (goto-char (or ,(if endfun `(funcall #',endfun)) (point-max)))
605 (user-error "No next %s" ,name)) 605 (user-error "No next %s" ,name))
606 (goto-char (match-beginning 0)) 606 (goto-char (match-beginning 0))
607 (when (and (eq (current-buffer) (window-buffer (selected-window))) 607 (when (and (eq (current-buffer) (window-buffer))
608 (called-interactively-p 'interactive)) 608 (called-interactively-p 'interactive))
609 (let ((endpt (or (save-excursion 609 (let ((endpt (or (save-excursion
610 ,(if endfun `(funcall #',endfun) 610 ,(if endfun `(funcall #',endfun)
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index ac7e5f12a18..928d49f85ba 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -293,7 +293,7 @@ A lambda list keyword is a symbol that starts with `&'."
293 "Return t if there are two windows." 293 "Return t if there are two windows."
294 (and (not (one-window-p)) 294 (and (not (one-window-p))
295 (eq (selected-window) 295 (eq (selected-window)
296 (next-window (next-window (selected-window)))))) 296 (next-window (next-window)))))
297 297
298(defun edebug-sort-alist (alist function) 298(defun edebug-sort-alist (alist function)
299 ;; Return the ALIST sorted with comparison function FUNCTION. 299 ;; Return the ALIST sorted with comparison function FUNCTION.
@@ -334,7 +334,7 @@ Return the result of the last expression in BODY."
334 ((and (edebug-window-live-p window) 334 ((and (edebug-window-live-p window)
335 (eq (window-buffer window) buffer)) 335 (eq (window-buffer window) buffer))
336 window) 336 window)
337 ((eq (window-buffer (selected-window)) buffer) 337 ((eq (window-buffer) buffer)
338 ;; Selected window already displays BUFFER. 338 ;; Selected window already displays BUFFER.
339 (selected-window)) 339 (selected-window))
340 ((get-buffer-window buffer 0)) 340 ((get-buffer-window buffer 0))
diff --git a/lisp/emacs-lisp/helper.el b/lisp/emacs-lisp/helper.el
index f3b7de521cf..5bef0b06fd4 100644
--- a/lisp/emacs-lisp/helper.el
+++ b/lisp/emacs-lisp/helper.el
@@ -59,7 +59,7 @@
59 Helper-return-blurb) 59 Helper-return-blurb)
60 "return"))) 60 "return")))
61 (save-window-excursion 61 (save-window-excursion
62 (goto-char (window-start (selected-window))) 62 (goto-char (window-start))
63 (if (get-buffer-window "*Help*") 63 (if (get-buffer-window "*Help*")
64 (pop-to-buffer "*Help*") 64 (pop-to-buffer "*Help*")
65 (switch-to-buffer "*Help*")) 65 (switch-to-buffer "*Help*"))
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 973768b50ef..292fd401a56 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -1298,7 +1298,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1298 (mark t) (point) cua--explicit-region-start)))) 1298 (mark t) (point) cua--explicit-region-start))))
1299 1299
1300 ;; Disable transient-mark-mode if rectangle active in current buffer. 1300 ;; Disable transient-mark-mode if rectangle active in current buffer.
1301 (if (not (window-minibuffer-p (selected-window))) 1301 (if (not (window-minibuffer-p))
1302 (setq transient-mark-mode (and (not cua--rectangle) 1302 (setq transient-mark-mode (and (not cua--rectangle)
1303 (if cua-highlight-region-shift-only 1303 (if cua-highlight-region-shift-only
1304 (not cua--explicit-region-start) 1304 (not cua--explicit-region-start)
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 5346bd16fd2..ed5fecf09ff 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -740,7 +740,7 @@ This is done after all necessary filtering has been done."
740 (if (<= (point) oend) 740 (if (<= (point) oend)
741 (setq oend (+ oend nchars))) 741 (setq oend (+ oend nchars)))
742 (insert-before-markers string) 742 (insert-before-markers string)
743 (if (= (window-start (selected-window)) (point)) 743 (if (= (window-start) (point))
744 (set-window-start (selected-window) 744 (set-window-start (selected-window)
745 (- (point) nchars))) 745 (- (point) nchars)))
746 (if (= (point) eshell-last-input-end) 746 (if (= (point) eshell-last-input-end)
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 70096248e19..ee0b87e8f87 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1736,7 +1736,7 @@ Only intended for interactive use."
1736 ;; Preserve selected buffer, but do not do save-window-excursion, 1736 ;; Preserve selected buffer, but do not do save-window-excursion,
1737 ;; since we want to see any window created by the form. Temporarily 1737 ;; since we want to see any window created by the form. Temporarily
1738 ;; select the article buffer, so we can see any point movement. 1738 ;; select the article buffer, so we can see any point movement.
1739 (let ((sb (window-buffer (selected-window)))) 1739 (let ((sb (window-buffer)))
1740 (gnus-configure-windows 'article) 1740 (gnus-configure-windows 'article)
1741 (pop-to-buffer gnus-article-buffer) 1741 (pop-to-buffer gnus-article-buffer)
1742 (widen) 1742 (widen)
diff --git a/lisp/help-macro.el b/lisp/help-macro.el
index 566f1597596..f0fda357705 100644
--- a/lisp/help-macro.el
+++ b/lisp/help-macro.el
@@ -136,9 +136,9 @@ and then returns."
136 (setq config (current-window-configuration)) 136 (setq config (current-window-configuration))
137 (pop-to-buffer " *Metahelp*" nil t) 137 (pop-to-buffer " *Metahelp*" nil t)
138 (and (fboundp 'make-frame) 138 (and (fboundp 'make-frame)
139 (not (eq (window-frame (selected-window)) 139 (not (eq (window-frame)
140 prev-frame)) 140 prev-frame))
141 (setq new-frame (window-frame (selected-window)) 141 (setq new-frame (window-frame)
142 config nil)) 142 config nil))
143 (setq buffer-read-only nil) 143 (setq buffer-read-only nil)
144 (let ((inhibit-read-only t)) 144 (let ((inhibit-read-only t))
diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el
index 17b91245d60..1da3d68e131 100644
--- a/lisp/hilit-chg.el
+++ b/lisp/hilit-chg.el
@@ -860,7 +860,7 @@ changes are made, so \\[highlight-changes-next-change] and
860 (get-buffer (read-buffer "buffer-a " (current-buffer) t)) 860 (get-buffer (read-buffer "buffer-a " (current-buffer) t))
861 (get-buffer 861 (get-buffer
862 (read-buffer "buffer-b " 862 (read-buffer "buffer-b "
863 (window-buffer (next-window (selected-window))) t)))) 863 (window-buffer (next-window)) t))))
864 (let ((file-a (buffer-file-name buf-a)) 864 (let ((file-a (buffer-file-name buf-a))
865 (file-b (buffer-file-name buf-b))) 865 (file-b (buffer-file-name buf-b)))
866 (highlight-markup-buffers buf-a file-a buf-b file-b) 866 (highlight-markup-buffers buf-a file-a buf-b file-b)
diff --git a/lisp/hippie-exp.el b/lisp/hippie-exp.el
index 7d14d780e2e..ad233b2a507 100644
--- a/lisp/hippie-exp.el
+++ b/lisp/hippie-exp.el
@@ -296,7 +296,7 @@ undoes the expansion."
296 (message "No further expansions found")) 296 (message "No further expansions found"))
297 (ding)) 297 (ding))
298 (if (and hippie-expand-verbose 298 (if (and hippie-expand-verbose
299 (not (window-minibuffer-p (selected-window)))) 299 (not (window-minibuffer-p)))
300 (message "Using %s" 300 (message "Using %s"
301 (nth he-num hippie-expand-try-functions-list))))) 301 (nth he-num hippie-expand-try-functions-list)))))
302 (if (and (>= he-num 0) 302 (if (and (>= he-num 0)
@@ -305,7 +305,7 @@ undoes the expansion."
305 (setq he-num -1) 305 (setq he-num -1)
306 (he-reset-string) 306 (he-reset-string)
307 (if (and hippie-expand-verbose 307 (if (and hippie-expand-verbose
308 (not (window-minibuffer-p (selected-window)))) 308 (not (window-minibuffer-p)))
309 (message "Undoing expansions")))))) 309 (message "Undoing expansions"))))))
310 310
311;; Initializes the region to expand (to between BEG and END). 311;; Initializes the region to expand (to between BEG and END).
@@ -978,7 +978,7 @@ The argument OLD has to be nil the first call of this function, and t
978for subsequent calls (for further possible expansions of the same 978for subsequent calls (for further possible expansions of the same
979string). It returns t if a new expansion is found, nil otherwise." 979string). It returns t if a new expansion is found, nil otherwise."
980 (let ((expansion ()) 980 (let ((expansion ())
981 (flag (if (frame-visible-p (window-frame (selected-window))) 981 (flag (if (frame-visible-p (window-frame))
982 'visible t))) 982 'visible t)))
983 (unless old 983 (unless old
984 (he-init-string (he-dabbrev-beg) (point)) 984 (he-init-string (he-dabbrev-beg) (point))
diff --git a/lisp/hl-line.el b/lisp/hl-line.el
index 1ed17b4cd8e..e2171a27f5c 100644
--- a/lisp/hl-line.el
+++ b/lisp/hl-line.el
@@ -198,7 +198,7 @@ Global-Hl-Line mode uses the functions `global-hl-line-unhighlight' and
198(defun global-hl-line-highlight () 198(defun global-hl-line-highlight ()
199 "Highlight the current line in the current window." 199 "Highlight the current line in the current window."
200 (when global-hl-line-mode ; Might be changed outside the mode function. 200 (when global-hl-line-mode ; Might be changed outside the mode function.
201 (unless (window-minibuffer-p (selected-window)) 201 (unless (window-minibuffer-p)
202 (unless global-hl-line-overlay 202 (unless global-hl-line-overlay
203 (setq global-hl-line-overlay (make-overlay 1 1)) ; to be moved 203 (setq global-hl-line-overlay (make-overlay 1 1)) ; to be moved
204 (overlay-put global-hl-line-overlay 'face hl-line-face)) 204 (overlay-put global-hl-line-overlay 'face hl-line-face))
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 73049df097d..104e3363831 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -221,7 +221,7 @@ Conditions are:
221 indicate some non-standard, non-simple completion mechanism, 221 indicate some non-standard, non-simple completion mechanism,
222 like file-name and other custom-func completions)." 222 like file-name and other custom-func completions)."
223 223
224 (and (window-minibuffer-p (selected-window)) 224 (and (window-minibuffer-p)
225 (not executing-kbd-macro) 225 (not executing-kbd-macro)
226 minibuffer-completion-table 226 minibuffer-completion-table
227 (or (not (functionp minibuffer-completion-table)) 227 (or (not (functionp minibuffer-completion-table))
diff --git a/lisp/isearch.el b/lisp/isearch.el
index ec4f32aecca..a591f8b4291 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1015,7 +1015,7 @@ NOPUSH is t and EDIT is t."
1015 (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout) 1015 (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout)
1016 (isearch-dehighlight) 1016 (isearch-dehighlight)
1017 (lazy-highlight-cleanup lazy-highlight-cleanup) 1017 (lazy-highlight-cleanup lazy-highlight-cleanup)
1018 (let ((found-start (window-start (selected-window))) 1018 (let ((found-start (window-start))
1019 (found-point (point))) 1019 (found-point (point)))
1020 (when isearch-window-configuration 1020 (when isearch-window-configuration
1021 (set-window-configuration isearch-window-configuration) 1021 (set-window-configuration isearch-window-configuration)
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 9d700a5ed82..d0e88309daf 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -482,7 +482,7 @@ non-nil in a repeated invocation of this function."
482 (cancel-timer jit-lock-stealth-repeat-timer)) 482 (cancel-timer jit-lock-stealth-repeat-timer))
483 (unless (or executing-kbd-macro 483 (unless (or executing-kbd-macro
484 memory-full 484 memory-full
485 (window-minibuffer-p (selected-window)) 485 (window-minibuffer-p)
486 ;; For first invocation set up `jit-lock-stealth-buffers'. 486 ;; For first invocation set up `jit-lock-stealth-buffers'.
487 ;; In repeated invocations it's already been set up. 487 ;; In repeated invocations it's already been set up.
488 (null (if repeat 488 (null (if repeat
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 8eeb0991653..aa244ddae81 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -4768,9 +4768,7 @@ If prefix argument REVERSE is non-nil, sorts in reverse order.
4768 4768
4769;;;*** 4769;;;***
4770 4770
4771;;;### (autoloads (rmail-summary-by-senders rmail-summary-by-topic 4771;;;### (autoloads nil "rmailsum" "rmailsum.el" "a9b3bbd9b82dd566524a1209b5cdb7dd")
4772;;;;;; rmail-summary-by-regexp rmail-summary-by-recipients rmail-summary-by-labels
4773;;;;;; rmail-summary) "rmailsum" "rmailsum.el" "61e7ad0931be1e07034dd57825ff326a")
4774;;; Generated autoloads from rmailsum.el 4772;;; Generated autoloads from rmailsum.el
4775 4773
4776(autoload 'rmail-summary "rmailsum" "\ 4774(autoload 'rmail-summary "rmailsum" "\
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 8dd4120d179..3a0a7824ad8 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -1288,7 +1288,7 @@ advance to the next message."
1288 (prog1 1288 (prog1
1289 ;; Is EOB visible in the buffer? 1289 ;; Is EOB visible in the buffer?
1290 (save-excursion 1290 (save-excursion
1291 (let ((ht (window-height (selected-window)))) 1291 (let ((ht (window-height)))
1292 (move-to-window-line (- ht 2)) 1292 (move-to-window-line (- ht 2))
1293 (end-of-line) 1293 (end-of-line)
1294 (eobp))) 1294 (eobp)))
diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index 3a29e05c8b1..009cc2efe1a 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -156,7 +156,7 @@ Keep the cursor on the screen as needed."
156 "Determine if it's wise to enable col-scrolling for the current window. 156 "Determine if it's wise to enable col-scrolling for the current window.
157Basically, we check for existing horizontal scrolling." 157Basically, we check for existing horizontal scrolling."
158 (or truncate-lines 158 (or truncate-lines
159 (> (window-hscroll (selected-window)) 0) 159 (> (window-hscroll) 0)
160 (not (window-full-width-p)) 160 (not (window-full-width-p))
161 (and 161 (and
162 mouse-drag-electric-col-scrolling 162 mouse-drag-electric-col-scrolling
diff --git a/lisp/mpc.el b/lisp/mpc.el
index ad7381bb4b7..0800af1bd36 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -1513,7 +1513,7 @@ when constructing the set of constraints."
1513 (let* ((newbuf (mpc-tagbrowser-buf tag)) 1513 (let* ((newbuf (mpc-tagbrowser-buf tag))
1514 (win (get-buffer-window newbuf 0))) 1514 (win (get-buffer-window newbuf 0)))
1515 (if win (select-window win) 1515 (if win (select-window win)
1516 (if (with-current-buffer (window-buffer (selected-window)) 1516 (if (with-current-buffer (window-buffer)
1517 (derived-mode-p 'mpc-tagbrowser-mode)) 1517 (derived-mode-p 'mpc-tagbrowser-mode))
1518 (setq win (selected-window)) 1518 (setq win (selected-window))
1519 ;; Find a tagbrowser-mode buffer. 1519 ;; Find a tagbrowser-mode buffer.
@@ -2618,8 +2618,7 @@ This is used so that they can be compared with `eq', which is needed for
2618 (song-win (get-buffer-window song-buf 0))) 2618 (song-win (get-buffer-window song-buf 0)))
2619 (if song-win 2619 (if song-win
2620 (select-window song-win) 2620 (select-window song-win)
2621 (if (or (window-dedicated-p (selected-window)) 2621 (if (or (window-dedicated-p) (window-minibuffer-p))
2622 (window-minibuffer-p))
2623 (ignore-errors (select-frame (make-frame mpc-frame-alist))) 2622 (ignore-errors (select-frame (make-frame mpc-frame-alist)))
2624 (with-current-buffer song-buf 2623 (with-current-buffer song-buf
2625 (setq-local mpc-previous-window-config 2624 (setq-local mpc-previous-window-config
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 7c70ded3eaa..2d8da415295 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -1331,7 +1331,7 @@ if ARG is omitted or nil."
1331 "Return a buffer for PROCESS, either the one selected or the process buffer." 1331 "Return a buffer for PROCESS, either the one selected or the process buffer."
1332 (if rcirc-always-use-server-buffer-flag 1332 (if rcirc-always-use-server-buffer-flag
1333 (process-buffer process) 1333 (process-buffer process)
1334 (let ((buffer (window-buffer (selected-window)))) 1334 (let ((buffer (window-buffer)))
1335 (if (and buffer 1335 (if (and buffer
1336 (with-current-buffer buffer 1336 (with-current-buffer buffer
1337 (and (eq major-mode 'rcirc-mode) 1337 (and (eq major-mode 'rcirc-mode)
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el
index f2abc00e3f5..609585c9522 100644
--- a/lisp/play/gomoku.el
+++ b/lisp/play/gomoku.el
@@ -948,13 +948,13 @@ If the game is finished, this command requests for another game."
948 948
949(defun gomoku-max-width () 949(defun gomoku-max-width ()
950 "Largest possible board width for the current window." 950 "Largest possible board width for the current window."
951 (1+ (/ (- (window-width (selected-window)) 951 (1+ (/ (- (window-width)
952 gomoku-x-offset gomoku-x-offset 1) 952 gomoku-x-offset gomoku-x-offset 1)
953 gomoku-square-width))) 953 gomoku-square-width)))
954 954
955(defun gomoku-max-height () 955(defun gomoku-max-height ()
956 "Largest possible board height for the current window." 956 "Largest possible board height for the current window."
957 (1+ (/ (- (window-height (selected-window)) 957 (1+ (/ (- (window-height)
958 gomoku-y-offset gomoku-y-offset 2) 958 gomoku-y-offset gomoku-y-offset 2)
959 ;; 2 instead of 1 because WINDOW-HEIGHT includes the mode line ! 959 ;; 2 instead of 1 because WINDOW-HEIGHT includes the mode line !
960 gomoku-square-height))) 960 gomoku-square-height)))
diff --git a/lisp/play/landmark.el b/lisp/play/landmark.el
index 0845ea2c300..cf86d7a9de5 100644
--- a/lisp/play/landmark.el
+++ b/lisp/play/landmark.el
@@ -843,13 +843,13 @@ If the game is finished, this command requests for another game."
843 843
844(defun landmark-max-width () 844(defun landmark-max-width ()
845 "Largest possible board width for the current window." 845 "Largest possible board width for the current window."
846 (1+ (/ (- (window-width (selected-window)) 846 (1+ (/ (- (window-width)
847 landmark-x-offset landmark-x-offset 1) 847 landmark-x-offset landmark-x-offset 1)
848 landmark-square-width))) 848 landmark-square-width)))
849 849
850(defun landmark-max-height () 850(defun landmark-max-height ()
851 "Largest possible board height for the current window." 851 "Largest possible board height for the current window."
852 (1+ (/ (- (window-height (selected-window)) 852 (1+ (/ (- (window-height)
853 landmark-y-offset landmark-y-offset 2) 853 landmark-y-offset landmark-y-offset 2)
854 ;; 2 instead of 1 because WINDOW-HEIGHT includes the mode line ! 854 ;; 2 instead of 1 because WINDOW-HEIGHT includes the mode line !
855 landmark-square-height))) 855 landmark-square-height)))
diff --git a/lisp/play/zone.el b/lisp/play/zone.el
index 1724ebdf198..0f333392b9a 100644
--- a/lisp/play/zone.el
+++ b/lisp/play/zone.el
@@ -110,7 +110,7 @@ If the element is a function or a list of a function and a number,
110 (let ((f (selected-frame)) 110 (let ((f (selected-frame))
111 (outbuf (get-buffer-create "*zone*")) 111 (outbuf (get-buffer-create "*zone*"))
112 (text (buffer-substring (window-start) (window-end))) 112 (text (buffer-substring (window-start) (window-end)))
113 (wp (1+ (- (window-point (selected-window)) 113 (wp (1+ (- (window-point)
114 (window-start))))) 114 (window-start)))))
115 (put 'zone 'orig-buffer (current-buffer)) 115 (put 'zone 'orig-buffer (current-buffer))
116 (switch-to-buffer outbuf) 116 (switch-to-buffer outbuf)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index d9c482330cc..e909f1a5e5b 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2492,7 +2492,7 @@ displays at the top of the window; there is no arrow."
2492All arguments are markers. If END-MK is non-nil, mark is set there 2492All arguments are markers. If END-MK is non-nil, mark is set there
2493and overlay is highlighted between MK and END-MK." 2493and overlay is highlighted between MK and END-MK."
2494 ;; Show compilation buffer in other window, scrolled to this error. 2494 ;; Show compilation buffer in other window, scrolled to this error.
2495 (let* ((from-compilation-buffer (eq (window-buffer (selected-window)) 2495 (let* ((from-compilation-buffer (eq (window-buffer)
2496 (marker-buffer msg))) 2496 (marker-buffer msg)))
2497 ;; Use an existing window if it is in a visible frame. 2497 ;; Use an existing window if it is in a visible frame.
2498 (pre-existing (get-buffer-window (marker-buffer msg) 0)) 2498 (pre-existing (get-buffer-window (marker-buffer msg) 0))
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index 6a71ab330a8..865211d109c 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -1605,7 +1605,7 @@ specifies where to find/view the result."
1605 ;; Get the source file to view or find. 1605 ;; Get the source file to view or find.
1606 (setf file (ebrowse-find-source-file file tags-file)) 1606 (setf file (ebrowse-find-source-file file tags-file))
1607 ;; If current window is dedicated, use another frame. 1607 ;; If current window is dedicated, use another frame.
1608 (when (window-dedicated-p (selected-window)) 1608 (when (window-dedicated-p)
1609 (setf where 'other-window)) 1609 (setf where 'other-window))
1610 (cond (view 1610 (cond (view
1611 (setf ebrowse-temp-position-to-view struc 1611 (setf ebrowse-temp-position-to-view struc
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index ff6321d74c3..a7b7e630bb9 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -982,7 +982,7 @@ See documentation of variable `tags-file-name'."
982 ;; selected window's buffer; without the hair, point is moved in both 982 ;; selected window's buffer; without the hair, point is moved in both
983 ;; windows. To prevent this, we save the selected window's point before 983 ;; windows. To prevent this, we save the selected window's point before
984 ;; doing find-tag-noselect, and restore it after. 984 ;; doing find-tag-noselect, and restore it after.
985 (let* ((window-point (window-point (selected-window))) 985 (let* ((window-point (window-point))
986 (tagbuf (find-tag-noselect tagname next-p regexp-p)) 986 (tagbuf (find-tag-noselect tagname next-p regexp-p))
987 (tagpoint (progn (set-buffer tagbuf) (point)))) 987 (tagpoint (progn (set-buffer tagbuf) (point))))
988 (set-window-point (prog1 988 (set-window-point (prog1
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index ff667f80f9d..0fc805aae81 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -1080,8 +1080,7 @@ The next key typed is executed unless it is SPC."
1080 fortran-column-ruler-fixed) 1080 fortran-column-ruler-fixed)
1081 (save-excursion 1081 (save-excursion
1082 (beginning-of-line) 1082 (beginning-of-line)
1083 (if (eq (window-start (selected-window)) 1083 (if (eq (window-start) (window-point))
1084 (window-point (selected-window)))
1085 (line-beginning-position 2) 1084 (line-beginning-position 2)
1086 (point))) 1085 (point)))
1087 nil "Type SPC or any command to erase ruler.")) 1086 nil "Type SPC or any command to erase ruler."))
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 4b51a5e7835..2017636435c 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -2951,7 +2951,7 @@ If not in a source or disassembly buffer just set point."
2951 obj) 2951 obj)
2952 (when (numberp pos) 2952 (when (numberp pos)
2953 (with-selected-window (posn-window posn) 2953 (with-selected-window (posn-window posn)
2954 (with-current-buffer (window-buffer (selected-window)) 2954 (with-current-buffer (window-buffer)
2955 (goto-char pos) 2955 (goto-char pos)
2956 (dolist (overlay (overlays-in pos pos)) 2956 (dolist (overlay (overlays-in pos pos))
2957 (when (overlay-get overlay 'put-break) 2957 (when (overlay-get overlay 'put-break)
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index ed911fcbba2..03364bddd9f 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -3256,7 +3256,7 @@ inserted using a single call to `verilog-insert'."
3256(defun verilog-point-text (&optional pointnum) 3256(defun verilog-point-text (&optional pointnum)
3257 "Return text describing where POINTNUM or current point is (for errors). 3257 "Return text describing where POINTNUM or current point is (for errors).
3258Use filename, if current buffer being edited shorten to just buffer name." 3258Use filename, if current buffer being edited shorten to just buffer name."
3259 (concat (or (and (equal (window-buffer (selected-window)) (current-buffer)) 3259 (concat (or (and (equal (window-buffer) (current-buffer))
3260 (buffer-name)) 3260 (buffer-name))
3261 buffer-file-name 3261 buffer-file-name
3262 (buffer-name)) 3262 (buffer-name))
diff --git a/lisp/reposition.el b/lisp/reposition.el
index 0bd27654065..c67200f9550 100644
--- a/lisp/reposition.el
+++ b/lisp/reposition.el
@@ -61,7 +61,7 @@ first comment line visible (if point is in a comment)."
61 (here (point)) 61 (here (point))
62 ;; change this name once I've gotten rid of references to ht. 62 ;; change this name once I've gotten rid of references to ht.
63 ;; this is actually the number of the last screen line 63 ;; this is actually the number of the last screen line
64 (ht (- (window-height (selected-window)) 2)) 64 (ht (- (window-height) 2))
65 (line (repos-count-screen-lines (window-start) (point))) 65 (line (repos-count-screen-lines (window-start) (point)))
66 (comment-height 66 (comment-height
67 ;; The call to max deals with the case of cursor between defuns. 67 ;; The call to max deals with the case of cursor between defuns.
diff --git a/lisp/rot13.el b/lisp/rot13.el
index 03beed3a85b..1b61855f2dc 100644
--- a/lisp/rot13.el
+++ b/lisp/rot13.el
@@ -101,9 +101,9 @@ See also `toggle-rot13-mode'."
101(defun toggle-rot13-mode () 101(defun toggle-rot13-mode ()
102 "Toggle the use of ROT13 encoding for the current window." 102 "Toggle the use of ROT13 encoding for the current window."
103 (interactive) 103 (interactive)
104 (if (eq (window-display-table (selected-window)) rot13-display-table) 104 (if (eq (window-display-table) rot13-display-table)
105 (set-window-display-table (selected-window) nil) 105 (set-window-display-table (selected-window) nil)
106 (if (null (window-display-table (selected-window))) 106 (if (null (window-display-table))
107 (set-window-display-table (selected-window) rot13-display-table)))) 107 (set-window-display-table (selected-window) rot13-display-table))))
108 108
109(provide 'rot13) 109(provide 'rot13)
diff --git a/lisp/server.el b/lisp/server.el
index 8208e0b44d8..a76b2d4ce5f 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1557,7 +1557,7 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
1557 (setq next-buffer (car (process-get proc 'buffers)))) 1557 (setq next-buffer (car (process-get proc 'buffers))))
1558 (setq rest (cdr rest))))) 1558 (setq rest (cdr rest)))))
1559 (and next-buffer (server-switch-buffer next-buffer killed-one)) 1559 (and next-buffer (server-switch-buffer next-buffer killed-one))
1560 (unless (or next-buffer killed-one (window-dedicated-p (selected-window))) 1560 (unless (or next-buffer killed-one (window-dedicated-p))
1561 ;; (switch-to-buffer (other-buffer)) 1561 ;; (switch-to-buffer (other-buffer))
1562 (message "No server buffers remain to edit"))) 1562 (message "No server buffers remain to edit")))
1563 (if (not (buffer-live-p next-buffer)) 1563 (if (not (buffer-live-p next-buffer))
@@ -1584,10 +1584,10 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
1584 (unless (frame-live-p server-window) 1584 (unless (frame-live-p server-window)
1585 (setq server-window (make-frame))) 1585 (setq server-window (make-frame)))
1586 (select-window (frame-selected-window server-window)))) 1586 (select-window (frame-selected-window server-window))))
1587 (when (window-minibuffer-p (selected-window)) 1587 (when (window-minibuffer-p)
1588 (select-window (next-window nil 'nomini 0))) 1588 (select-window (next-window nil 'nomini 0)))
1589 ;; Move to a non-dedicated window, if we have one. 1589 ;; Move to a non-dedicated window, if we have one.
1590 (when (window-dedicated-p (selected-window)) 1590 (when (window-dedicated-p)
1591 (select-window 1591 (select-window
1592 (get-window-with-predicate 1592 (get-window-with-predicate
1593 (lambda (w) 1593 (lambda (w)
@@ -1601,7 +1601,7 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
1601 ;; a minibuffer/dedicated-window (if there's no other). 1601 ;; a minibuffer/dedicated-window (if there's no other).
1602 (error (pop-to-buffer next-buffer))))))) 1602 (error (pop-to-buffer next-buffer)))))))
1603 (when server-raise-frame 1603 (when server-raise-frame
1604 (select-frame-set-input-focus (window-frame (selected-window)))))) 1604 (select-frame-set-input-focus (window-frame)))))
1605 1605
1606;;;###autoload 1606;;;###autoload
1607(defun server-save-buffers-kill-terminal (arg) 1607(defun server-save-buffers-kill-terminal (arg)
diff --git a/lisp/shell.el b/lisp/shell.el
index a78ab7f81ab..3ca2564b65c 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -1122,7 +1122,7 @@ Returns t if successful."
1122 (interactive) 1122 (interactive)
1123 (let ((data (shell-command-completion))) 1123 (let ((data (shell-command-completion)))
1124 (if data 1124 (if data
1125 (prog2 (unless (window-minibuffer-p (selected-window)) 1125 (prog2 (unless (window-minibuffer-p)
1126 (message "Completing command name...")) 1126 (message "Completing command name..."))
1127 (apply #'completion-in-region data))))) 1127 (apply #'completion-in-region data)))))
1128 1128
@@ -1232,7 +1232,7 @@ Returns non-nil if successful."
1232 (interactive) 1232 (interactive)
1233 (let ((data (shell-environment-variable-completion))) 1233 (let ((data (shell-environment-variable-completion)))
1234 (if data 1234 (if data
1235 (prog2 (unless (window-minibuffer-p (selected-window)) 1235 (prog2 (unless (window-minibuffer-p)
1236 (message "Completing variable name...")) 1236 (message "Completing variable name..."))
1237 (apply #'completion-in-region data))))) 1237 (apply #'completion-in-region data)))))
1238 1238
diff --git a/lisp/simple.el b/lisp/simple.el
index 6bb05c14a58..d64c0c9ac74 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4098,9 +4098,9 @@ Don't call it from programs: use `insert-buffer-substring' instead!"
4098 (progn 4098 (progn
4099 (barf-if-buffer-read-only) 4099 (barf-if-buffer-read-only)
4100 (read-buffer "Insert buffer: " 4100 (read-buffer "Insert buffer: "
4101 (if (eq (selected-window) (next-window (selected-window))) 4101 (if (eq (selected-window) (next-window))
4102 (other-buffer (current-buffer)) 4102 (other-buffer (current-buffer))
4103 (window-buffer (next-window (selected-window)))) 4103 (window-buffer (next-window)))
4104 t)))) 4104 t))))
4105 (push-mark 4105 (push-mark
4106 (save-excursion 4106 (save-excursion
@@ -5965,7 +5965,7 @@ The variable `selective-display' has a separate value for each buffer."
5965 (setq selective-display 5965 (setq selective-display
5966 (and arg (prefix-numeric-value arg))) 5966 (and arg (prefix-numeric-value arg)))
5967 (recenter current-vpos)) 5967 (recenter current-vpos))
5968 (set-window-start (selected-window) (window-start (selected-window))) 5968 (set-window-start (selected-window) (window-start))
5969 (princ "selective-display set to " t) 5969 (princ "selective-display set to " t)
5970 (prin1 selective-display t) 5970 (prin1 selective-display t)
5971 (princ "." t)) 5971 (princ "." t))
@@ -6629,8 +6629,7 @@ Go to the window from which completion was requested."
6629 (interactive) 6629 (interactive)
6630 (let ((buf completion-reference-buffer)) 6630 (let ((buf completion-reference-buffer))
6631 (if (one-window-p t) 6631 (if (one-window-p t)
6632 (if (window-dedicated-p (selected-window)) 6632 (if (window-dedicated-p) (delete-frame))
6633 (delete-frame))
6634 (delete-window (selected-window)) 6633 (delete-window (selected-window))
6635 (if (get-buffer-window buf) 6634 (if (get-buffer-window buf)
6636 (select-window (get-buffer-window buf)))))) 6635 (select-window (get-buffer-window buf))))))
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 2f995219193..d9f59b3a665 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -2648,7 +2648,7 @@ Also resets scanner functions."
2648 (dframe-select-attached-frame speedbar-frame) 2648 (dframe-select-attached-frame speedbar-frame)
2649 ;; make sure we at least choose a window to 2649 ;; make sure we at least choose a window to
2650 ;; get a good directory from 2650 ;; get a good directory from
2651 (if (window-minibuffer-p (selected-window)) 2651 (if (window-minibuffer-p)
2652 nil 2652 nil
2653 ;; Check for special modes 2653 ;; Check for special modes
2654 (speedbar-maybe-add-localized-support (current-buffer)) 2654 (speedbar-maybe-add-localized-support (current-buffer))
@@ -3512,7 +3512,7 @@ interested in."
3512 (set-buffer speedbar-buffer) 3512 (set-buffer speedbar-buffer)
3513 3513
3514 (if (<= (count-lines (point-min) (point-max)) 3514 (if (<= (count-lines (point-min) (point-max))
3515 (1- (window-height (selected-window)))) 3515 (1- (window-height)))
3516 ;; whole buffer fits 3516 ;; whole buffer fits
3517 (let ((cp (point))) 3517 (let ((cp (point)))
3518 3518
@@ -3545,7 +3545,7 @@ interested in."
3545 (setq end (point-max))))) 3545 (setq end (point-max)))))
3546 ;; Now work out the details of centering 3546 ;; Now work out the details of centering
3547 (let ((nl (count-lines start end)) 3547 (let ((nl (count-lines start end))
3548 (wl (1- (window-height (selected-window)))) 3548 (wl (1- (window-height)))
3549 (cp (point))) 3549 (cp (point)))
3550 (if (> nl wl) 3550 (if (> nl wl)
3551 ;; We can't fit it all, so just center on cursor 3551 ;; We can't fit it all, so just center on cursor
@@ -3558,12 +3558,12 @@ interested in."
3558 nil 3558 nil
3559 ;; we need to do something... 3559 ;; we need to do something...
3560 (goto-char start) 3560 (goto-char start)
3561 (let ((newcent (/ (- (window-height (selected-window)) nl) 2)) 3561 (let ((newcent (/ (- (window-height) nl) 2))
3562 (lte (count-lines start (point-max)))) 3562 (lte (count-lines start (point-max))))
3563 (if (and (< (+ newcent lte) (window-height (selected-window))) 3563 (if (and (< (+ newcent lte) (window-height))
3564 (> (- (window-height (selected-window)) lte 1) 3564 (> (- (window-height) lte 1)
3565 newcent)) 3565 newcent))
3566 (setq newcent (- (window-height (selected-window)) 3566 (setq newcent (- (window-height)
3567 lte 1))) 3567 lte 1)))
3568 (recenter newcent)))) 3568 (recenter newcent))))
3569 (goto-char cp)))))) 3569 (goto-char cp))))))
@@ -3997,7 +3997,7 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
3997 3997
3998(defun speedbar-recenter () 3998(defun speedbar-recenter ()
3999 "Recenter the current buffer so point is in the center of the window." 3999 "Recenter the current buffer so point is in the center of the window."
4000 (recenter (/ (window-height (selected-window)) 2))) 4000 (recenter (/ (window-height) 2)))
4001 4001
4002 4002
4003;;; Color loading section. 4003;;; Color loading section.
diff --git a/lisp/startup.el b/lisp/startup.el
index 44eea7745f7..ec7d73306a2 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1541,7 +1541,7 @@ a face or button specification."
1541 (t "splash.pbm"))) 1541 (t "splash.pbm")))
1542 (img (create-image image-file)) 1542 (img (create-image image-file))
1543 (image-width (and img (car (image-size img)))) 1543 (image-width (and img (car (image-size img))))
1544 (window-width (window-width (selected-window)))) 1544 (window-width (window-width)))
1545 (when img 1545 (when img
1546 (when (> window-width image-width) 1546 (when (> window-width image-width)
1547 ;; Center the image in the window. 1547 ;; Center the image in the window.
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 94b184d09a1..3998fafa5cc 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2218,7 +2218,7 @@ Global `ispell-quit' set to start location to continue spell session."
2218 (window-min-height (min window-min-height 2218 (window-min-height (min window-min-height
2219 ispell-choices-win-default-height)) 2219 ispell-choices-win-default-height))
2220 (command-characters '( ? ?i ?a ?A ?r ?R ?? ?x ?X ?q ?l ?u ?m )) 2220 (command-characters '( ? ?i ?a ?A ?r ?R ?? ?x ?X ?q ?l ?u ?m ))
2221 (dedicated (window-dedicated-p (selected-window))) 2221 (dedicated (window-dedicated-p))
2222 (skipped 0) 2222 (skipped 0)
2223 char num result textwin dedicated-win) 2223 char num result textwin dedicated-win)
2224 2224
diff --git a/lisp/textmodes/makeinfo.el b/lisp/textmodes/makeinfo.el
index 35c6e607569..4b57e0b9746 100644
--- a/lisp/textmodes/makeinfo.el
+++ b/lisp/textmodes/makeinfo.el
@@ -211,7 +211,7 @@ nonsensical results."
211 (with-current-buffer buffer 211 (with-current-buffer buffer
212 (revert-buffer t t)) 212 (revert-buffer t t))
213 (setq buffer (find-file-noselect makeinfo-output-file-name))) 213 (setq buffer (find-file-noselect makeinfo-output-file-name)))
214 (if (window-dedicated-p (selected-window)) 214 (if (window-dedicated-p)
215 (switch-to-buffer-other-window buffer) 215 (switch-to-buffer-other-window buffer)
216 (switch-to-buffer buffer))) 216 (switch-to-buffer buffer)))
217 (goto-char (point-min)))) 217 (goto-char (point-min))))
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 39eb9e8b9aa..6fb8d05f438 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -896,7 +896,7 @@ Run the Viper tutorial? "))
896 ;; inserted at the start of the buffer, the "type C-v to 896 ;; inserted at the start of the buffer, the "type C-v to
897 ;; move to the next screen" might not be visible on the 897 ;; move to the next screen" might not be visible on the
898 ;; first screen (n < 0). How will the novice know what to do? 898 ;; first screen (n < 0). How will the novice know what to do?
899 (let ((n (- (window-height (selected-window)) 899 (let ((n (- (window-height)
900 (count-lines (point-min) (point)) 900 (count-lines (point-min) (point))
901 6))) 901 6)))
902 (if (< n 8) 902 (if (< n 8)
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index f0ea9c68464..f926a164797 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -813,12 +813,12 @@ non-nil, otherwise in local time."
813 813
814 (unless (equal file-name buffer-file-name) 814 (unless (equal file-name buffer-file-name)
815 (cond 815 (cond
816 ((equal file-name (buffer-file-name (window-buffer (selected-window)))) 816 ((equal file-name (buffer-file-name (window-buffer)))
817 ;; If the selected window already shows the desired buffer don't show 817 ;; If the selected window already shows the desired buffer don't show
818 ;; it again (particularly important if other-window is true). 818 ;; it again (particularly important if other-window is true).
819 ;; This is important for diff-add-change-log-entries-other-window. 819 ;; This is important for diff-add-change-log-entries-other-window.
820 (set-buffer (window-buffer (selected-window)))) 820 (set-buffer (window-buffer)))
821 ((or other-window (window-dedicated-p (selected-window))) 821 ((or other-window (window-dedicated-p))
822 (find-file-other-window file-name)) 822 (find-file-other-window file-name))
823 (t (find-file file-name)))) 823 (t (find-file file-name))))
824 (or (derived-mode-p 'change-log-mode) 824 (or (derived-mode-p 'change-log-mode)
diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el
index ae4fcc99a25..235ebe5a072 100644
--- a/lisp/vc/compare-w.el
+++ b/lisp/vc/compare-w.el
@@ -179,7 +179,7 @@ on third call it again advances points to the next difference and so on."
179 'compare-windows-sync-regexp 179 'compare-windows-sync-regexp
180 compare-windows-sync))) 180 compare-windows-sync)))
181 (setq p1 (point) b1 (current-buffer)) 181 (setq p1 (point) b1 (current-buffer))
182 (setq w2 (next-window (selected-window))) 182 (setq w2 (next-window))
183 (if (eq w2 (selected-window)) 183 (if (eq w2 (selected-window))
184 (setq w2 (next-window (selected-window) nil 'visible))) 184 (setq w2 (next-window (selected-window) nil 'visible)))
185 (if (eq w2 (selected-window)) 185 (if (eq w2 (selected-window))
diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el
index 833e84b6cea..78d1a6abfd1 100644
--- a/lisp/vc/ediff-help.el
+++ b/lisp/vc/ediff-help.el
@@ -253,7 +253,7 @@ the value of this variable and the variables `ediff-help-message-*' in
253 253
254 254
255(defun ediff-indent-help-message () 255(defun ediff-indent-help-message ()
256 (let* ((shift (/ (max 0 (- (window-width (selected-window)) 256 (let* ((shift (/ (max 0 (- (window-width)
257 (ediff-help-message-line-length))) 257 (ediff-help-message-line-length)))
258 2)) 258 2))
259 (str (make-string shift ?\ ))) 259 (str (make-string shift ?\ )))
diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index 8f84dfb14ef..2f2c71a71e6 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -537,7 +537,7 @@ to invocation.")
537;; to reside. 537;; to reside.
538(defun ediff-setup-control-buffer (ctl-buf) 538(defun ediff-setup-control-buffer (ctl-buf)
539 "Set up window for control buffer." 539 "Set up window for control buffer."
540 (if (window-dedicated-p (selected-window)) 540 (if (window-dedicated-p)
541 (set-buffer ctl-buf) ; we are in control frame but just in case 541 (set-buffer ctl-buf) ; we are in control frame but just in case
542 (switch-to-buffer ctl-buf)) 542 (switch-to-buffer ctl-buf))
543 (let ((window-min-height 2)) 543 (let ((window-min-height 2))
@@ -1629,7 +1629,7 @@ the width of the A/B/C windows."
1629 (setq lines (1+ lines))) 1629 (setq lines (1+ lines)))
1630 ;; And position the beginning on the right line 1630 ;; And position the beginning on the right line
1631 (goto-char beg) 1631 (goto-char beg)
1632 (recenter (/ (1+ (max (- (1- (window-height (selected-window))) 1632 (recenter (/ (1+ (max (- (1- (window-height))
1633 lines) 1633 lines)
1634 1) 1634 1)
1635 ) 1635 )
diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index 124bdbd26df..5a14c193344 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -861,7 +861,7 @@ into icons, regardless of the window manager."
861;; create a new splittable frame if none is found 861;; create a new splittable frame if none is found
862(defun ediff-skip-unsuitable-frames (&optional ok-unsplittable) 862(defun ediff-skip-unsuitable-frames (&optional ok-unsplittable)
863 (if (ediff-window-display-p) 863 (if (ediff-window-display-p)
864 (let ((wind-frame (window-frame (selected-window))) 864 (let ((wind-frame (window-frame))
865 seen-windows) 865 seen-windows)
866 (while (and (not (memq (selected-window) seen-windows)) 866 (while (and (not (memq (selected-window) seen-windows))
867 (or 867 (or
@@ -877,7 +877,7 @@ into icons, regardless of the window manager."
877 (setq seen-windows (cons (selected-window) seen-windows)) 877 (setq seen-windows (cons (selected-window) seen-windows))
878 ;; try new window 878 ;; try new window
879 (other-window 1 t) 879 (other-window 1 t)
880 (setq wind-frame (window-frame (selected-window))) 880 (setq wind-frame (window-frame))
881 ) 881 )
882 (if (memq (selected-window) seen-windows) 882 (if (memq (selected-window) seen-windows)
883 ;; fed up, no appropriate frames 883 ;; fed up, no appropriate frames
@@ -939,7 +939,7 @@ into icons, regardless of the window manager."
939 939
940 (setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame)) 940 (setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame))
941 (select-frame ctl-frame) 941 (select-frame ctl-frame)
942 (if (window-dedicated-p (selected-window)) 942 (if (window-dedicated-p)
943 () 943 ()
944 (delete-other-windows) 944 (delete-other-windows)
945 (switch-to-buffer ctl-buffer)) 945 (switch-to-buffer ctl-buffer))
diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el
index 0a1bd044125..8d0e8efc75c 100644
--- a/lisp/vc/emerge.el
+++ b/lisp/vc/emerge.el
@@ -1770,7 +1770,7 @@ to the left margin, if they are in windows."
1770 (setq lines (1+ lines))) 1770 (setq lines (1+ lines)))
1771 ;; And position the beginning on the right line 1771 ;; And position the beginning on the right line
1772 (goto-char beg) 1772 (goto-char beg)
1773 (recenter (/ (1+ (- (1- (window-height (selected-window))) 1773 (recenter (/ (1+ (- (1- (window-height))
1774 lines)) 1774 lines))
1775 2)))))) 1775 2))))))
1776 (goto-char pos)) 1776 (goto-char pos))
diff --git a/lisp/vc/pcvs-util.el b/lisp/vc/pcvs-util.el
index 28ae4ed3de3..2868bb98b29 100644
--- a/lisp/vc/pcvs-util.el
+++ b/lisp/vc/pcvs-util.el
@@ -97,7 +97,7 @@ try to split a new window instead."
97BUF is assumed to be a temporary buffer used from the buffer MAINBUF." 97BUF is assumed to be a temporary buffer used from the buffer MAINBUF."
98 (interactive (list (current-buffer))) 98 (interactive (list (current-buffer)))
99 (save-current-buffer 99 (save-current-buffer
100 (let ((win (if (eq buf (window-buffer (selected-window))) (selected-window) 100 (let ((win (if (eq buf (window-buffer)) (selected-window)
101 (get-buffer-window buf t)))) 101 (get-buffer-window buf t))))
102 (when win 102 (when win
103 (if (window-dedicated-p win) 103 (if (window-dedicated-p win)
@@ -111,8 +111,8 @@ BUF is assumed to be a temporary buffer used from the buffer MAINBUF."
111;;; ) 111;;; )
112 ))) 112 )))
113 (with-current-buffer buf 113 (with-current-buffer buf
114 (bury-buffer (unless (and (eq buf (window-buffer (selected-window))) 114 (bury-buffer (unless (and (eq buf (window-buffer))
115 (not (window-dedicated-p (selected-window)))) 115 (not (window-dedicated-p)))
116 buf))) 116 buf)))
117 (when mainbuf 117 (when mainbuf
118 (let ((mainwin (or (get-buffer-window mainbuf) 118 (let ((mainwin (or (get-buffer-window mainbuf)
diff --git a/lisp/window.el b/lisp/window.el
index 86d93c0a9f6..c36244f8f4e 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1486,7 +1486,7 @@ This function changes neither the order of recently selected
1486windows nor the buffer list." 1486windows nor the buffer list."
1487 ;; If we start from the minibuffer window, don't fail to come 1487 ;; If we start from the minibuffer window, don't fail to come
1488 ;; back to it. 1488 ;; back to it.
1489 (when (window-minibuffer-p (selected-window)) 1489 (when (window-minibuffer-p)
1490 (setq minibuf t)) 1490 (setq minibuf t))
1491 ;; Make sure to not mess up the order of recently selected 1491 ;; Make sure to not mess up the order of recently selected
1492 ;; windows. Use `save-selected-window' and `select-window' 1492 ;; windows. Use `save-selected-window' and `select-window'
@@ -6676,7 +6676,7 @@ is active. This function is run by `mouse-autoselect-window-timer'."
6676 ;; minibuffer. Use `unread-command-events' in order to execute pre- 6676 ;; minibuffer. Use `unread-command-events' in order to execute pre-
6677 ;; and post-command hooks and trigger idle timers. To avoid delaying 6677 ;; and post-command hooks and trigger idle timers. To avoid delaying
6678 ;; autoselection again, set `mouse-autoselect-window-state'." 6678 ;; autoselection again, set `mouse-autoselect-window-state'."
6679 (unless (window-minibuffer-p (selected-window)) 6679 (unless (window-minibuffer-p)
6680 (setq mouse-autoselect-window-state 'select) 6680 (setq mouse-autoselect-window-state 'select)
6681 (setq unread-command-events 6681 (setq unread-command-events
6682 (cons (list 'select-window (list window)) 6682 (cons (list 'select-window (list window))
@@ -6702,7 +6702,7 @@ is active. This function is run by `mouse-autoselect-window-timer'."
6702 ;; minibuffer gets unselected unexpectedly, and where 6702 ;; minibuffer gets unselected unexpectedly, and where
6703 ;; you then have to move your mouse all the way down to 6703 ;; you then have to move your mouse all the way down to
6704 ;; the minibuffer to select it. 6704 ;; the minibuffer to select it.
6705 (window-minibuffer-p (selected-window)) 6705 (window-minibuffer-p)
6706 ;; Don't switch to minibuffer window unless it's active. 6706 ;; Don't switch to minibuffer window unless it's active.
6707 (and (window-minibuffer-p window) 6707 (and (window-minibuffer-p window)
6708 (not (minibuffer-window-active-p window))) 6708 (not (minibuffer-window-active-p window)))
diff --git a/lisp/winner.el b/lisp/winner.el
index e7e7d0614b4..e81052f8499 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -227,8 +227,7 @@ You may want to include buffer names such as *Help*, *Apropos*,
227 (set-window-configuration winconf)) 227 (set-window-configuration winconf))
228 (cond 228 (cond
229 ((window-live-p chosen) (select-window chosen)) 229 ((window-live-p chosen) (select-window chosen))
230 ((window-minibuffer-p (selected-window)) 230 ((window-minibuffer-p) (other-window 1)))
231 (other-window 1)))
232 (when (/= minisize (window-height miniwin)) 231 (when (/= minisize (window-height miniwin))
233 (with-selected-window miniwin 232 (with-selected-window miniwin
234 (setf (window-height) minisize))))) 233 (setf (window-height) minisize)))))
@@ -381,7 +380,7 @@ In other words, \"undo\" changes in window configuration."
381 (setq winner-undone-data (list (winner-win-data)))) 380 (setq winner-undone-data (list (winner-win-data))))
382 (cl-incf winner-undo-counter) ; starting at 1 381 (cl-incf winner-undo-counter) ; starting at 1
383 (when (and (winner-undo-this) 382 (when (and (winner-undo-this)
384 (not (window-minibuffer-p (selected-window)))) 383 (not (window-minibuffer-p)))
385 (message "Winner undo (%d / %d)" 384 (message "Winner undo (%d / %d)"
386 winner-undo-counter 385 winner-undo-counter
387 (1- (ring-length winner-pending-undo-ring))))))) 386 (1- (ring-length winner-pending-undo-ring)))))))