From 290d5b5890c5c8d096bd846eb48552d4608d5ed6 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 5 Aug 2013 18:26:57 +0400 Subject: [PATCH] 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. --- lisp/ChangeLog | 72 ++++++++++++++++++++++++++++++++++++++++++ lisp/abbrev.el | 2 +- lisp/bs.el | 2 +- lisp/buff-menu.el | 2 +- lisp/calc/calc.el | 2 +- lisp/calendar/calendar.el | 2 +- lisp/calendar/diary-lib.el | 9 ++---- lisp/comint.el | 8 ++--- lisp/completion.el | 2 +- lisp/dabbrev.el | 4 +-- lisp/disp-table.el | 2 +- lisp/doc-view.el | 2 +- lisp/ebuff-menu.el | 2 +- lisp/ehelp.el | 2 +- lisp/emacs-lisp/easy-mmode.el | 2 +- lisp/emacs-lisp/edebug.el | 4 +-- lisp/emacs-lisp/helper.el | 2 +- lisp/emulation/cua-base.el | 2 +- lisp/eshell/esh-mode.el | 2 +- lisp/ffap.el | 2 +- lisp/help-macro.el | 4 +-- lisp/hilit-chg.el | 2 +- lisp/hippie-exp.el | 6 ++-- lisp/hl-line.el | 2 +- lisp/icomplete.el | 2 +- lisp/isearch.el | 2 +- lisp/jit-lock.el | 2 +- lisp/mail/rmail.el | 4 +-- lisp/mail/rmailsum.el | 2 +- lisp/mouse-drag.el | 2 +- lisp/mpc.el | 5 ++- lisp/net/rcirc.el | 2 +- lisp/play/gomoku.el | 4 +-- lisp/play/landmark.el | 4 +-- lisp/play/zone.el | 2 +- lisp/progmodes/compile.el | 2 +- lisp/progmodes/ebrowse.el | 2 +- lisp/progmodes/etags.el | 2 +- lisp/progmodes/fortran.el | 3 +- lisp/progmodes/gdb-mi.el | 2 +- lisp/progmodes/verilog-mode.el | 2 +- lisp/reposition.el | 2 +- lisp/rot13.el | 4 +-- lisp/server.el | 8 ++--- lisp/shell.el | 4 +-- lisp/simple.el | 9 +++--- lisp/speedbar.el | 16 +++++----- lisp/startup.el | 2 +- lisp/textmodes/ispell.el | 2 +- lisp/textmodes/makeinfo.el | 2 +- lisp/tutorial.el | 2 +- lisp/vc/add-log.el | 6 ++-- lisp/vc/compare-w.el | 2 +- lisp/vc/ediff-help.el | 2 +- lisp/vc/ediff-util.el | 4 +-- lisp/vc/ediff-wind.el | 6 ++-- lisp/vc/emerge.el | 2 +- lisp/vc/pcvs-util.el | 6 ++-- lisp/window.el | 6 ++-- lisp/winner.el | 5 ++- 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 @@ +2013-08-05 Dmitry Antipov + + 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. + 2013-08-05 Juanma Barranquero * 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'.)" (endmark (copy-marker wordend t))) (unless (or ;; executing-kbd-macro noninteractive - (window-minibuffer-p (selected-window))) + (window-minibuffer-p)) ;; Add an undo boundary, in case we are doing this for ;; a self-inserting command which has avoided making one so far. (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." (select-window active-window) (bs--restore-window-config) (setq bs--window-config-coming-from (current-window-configuration)) - (when (> (window-height (selected-window)) 7) + (when (> (window-height) 7) ;; Errors would mess with the window configuration (bug#10882). (ignore-errors (select-window (split-window-below))))) (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." (select-window (posn-window (event-end event))) (let ((buffer (tabulated-list-get-id (posn-point (event-end event))))) (when (buffer-live-p buffer) - (if (and (window-dedicated-p (selected-window)) + (if (and (window-dedicated-p) (eq (selected-window) (frame-root-window))) (switch-to-buffer-other-frame buffer) (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." (calc-keypad)))) (when (get-buffer-window "*Calc Keypad*") (calc-keypad) - (set-buffer (window-buffer (selected-window)))) + (set-buffer (window-buffer))) (if (eq major-mode 'calc-mode) (calc-quit) (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." (year (calendar-extract-year today)) (today-visible (or (not mon) (<= (abs (calendar-interval mon yr month year)) 1))) - (in-calendar-window (eq (window-buffer (selected-window)) + (in-calendar-window (eq (window-buffer) (get-buffer calendar-buffer)))) (calendar-generate (or mon month) (or yr year)) (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 in the mode line. This is an option for `diary-display-function'." ;; If selected window is dedicated (to the calendar), need a new one ;; to display the diary. - (let* ((pop-up-frames (or pop-up-frames - (window-dedicated-p (selected-window)))) + (let* ((pop-up-frames (or pop-up-frames (window-dedicated-p))) (dbuff (find-buffer-visiting diary-file)) (empty (diary-display-no-entries))) ;; 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 is created." (interactive) (let* ((d-file (diary-check-diary-file)) - (pop-up-frames (or pop-up-frames - (window-dedicated-p (selected-window)))) + (pop-up-frames (or pop-up-frames (window-dedicated-p))) (win (selected-window)) (height (window-height))) (with-current-buffer (or (find-buffer-visiting d-file) @@ -2116,8 +2114,7 @@ calendar." "Insert a diary entry STRING which may be NONMARKING in FILE. If omitted, NONMARKING defaults to nil and FILE defaults to `diary-file'." - (let ((pop-up-frames (or pop-up-frames - (window-dedicated-p (selected-window))))) + (let ((pop-up-frames (or pop-up-frames (window-dedicated-p)))) (find-file-other-window (or file diary-file))) (when (eq major-mode (default-value 'major-mode)) (diary-mode)) (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 (interactive "P") ; Defeat snooping via C-x ESC ESC (let ((proc (get-buffer-process (current-buffer))) (prefix - (if (eq (window-buffer (selected-window)) (current-buffer)) + (if (eq (window-buffer) (current-buffer)) "" (format "(In buffer %s) " (current-buffer))))) @@ -3108,7 +3108,7 @@ completions listing is dependent on the value of `comint-completion-autolist'. Returns t if successful." (interactive) (when (comint--match-partial-filename) - (unless (window-minibuffer-p (selected-window)) + (unless (window-minibuffer-p) (message "Completing file name...")) (let ((data (comint--complete-file-name-data))) (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data))))) @@ -3211,7 +3211,7 @@ Return `listed' if a completion listing was shown. See also `comint-dynamic-complete-filename'." (declare (obsolete completion-in-region "24.1")) (let* ((completion-ignore-case (memq system-type '(ms-dos windows-nt cygwin))) - (minibuffer-p (window-minibuffer-p (selected-window))) + (minibuffer-p (window-minibuffer-p)) (suffix (cond ((not comint-completion-addsuffix) "") ((not (consp comint-completion-addsuffix)) " ") (t (cdr comint-completion-addsuffix)))) @@ -3308,7 +3308,7 @@ Typing SPC flushes the completions buffer." (current-window-configuration)) (with-output-to-temp-buffer "*Completions*" (display-completion-list completions common-substring)) - (if (window-minibuffer-p (selected-window)) + (if (window-minibuffer-p) (minibuffer-message "Type space to flush; repeat completion command to scroll") (message "Type space to flush; repeat completion command to scroll"))) 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 :: ;; Get the next completion (let* ((print-status-p (and (>= baud-rate completion-prompt-speed-threshold) - (not (window-minibuffer-p (selected-window))))) + (not (window-minibuffer-p)))) (insert-point (point)) (entry (completion-search-next cmpl-current-index)) 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]." (markerp dabbrev--last-abbrev-location) (marker-position dabbrev--last-abbrev-location) (or (eq last-command this-command) - (and (window-minibuffer-p (selected-window)) + (and (window-minibuffer-p) (= dabbrev--last-abbrev-location (point))))) ;; Find a different expansion for the same abbrev as last time. @@ -793,7 +793,7 @@ of the start of the occurrence." ;; In a minibuffer, search the buffer it was activated from, ;; first after the minibuffer itself. Unless we aren't supposed ;; to search the current buffer either. - (if (and (window-minibuffer-p (selected-window)) + (if (and (window-minibuffer-p) (not dabbrev-search-these-buffers-only)) (setq list (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', (defun describe-current-display-table () "Describe the display table in use in the selected window and buffer." (interactive) - (let ((disptab (or (window-display-table (selected-window)) + (let ((disptab (or (window-display-table) buffer-display-table standard-display-table))) (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." (car (image-size image 'pixels))) img-width) img-width)) - (window-width (window-width (selected-window)))) + (window-width (window-width))) (setf (doc-view-current-image) image) (move-overlay ol (point-min) (point-max)) ;; 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." (defun Electric-buffer-menu-mouse-select (event) (interactive "e") (select-window (posn-window (event-end event))) - (set-buffer (window-buffer (selected-window))) + (set-buffer (window-buffer)) (goto-char (posn-point (event-end event))) (throw 'electric-buffer-menu-select (point))) 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." (unwind-protect (save-excursion (when one - (goto-char (window-start (selected-window)))) + (goto-char (window-start))) (let ((pop-up-windows t)) (pop-to-buffer buffer)) (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." (goto-char (or ,(if endfun `(funcall #',endfun)) (point-max))) (user-error "No next %s" ,name)) (goto-char (match-beginning 0)) - (when (and (eq (current-buffer) (window-buffer (selected-window))) + (when (and (eq (current-buffer) (window-buffer)) (called-interactively-p 'interactive)) (let ((endpt (or (save-excursion ,(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 `&'." "Return t if there are two windows." (and (not (one-window-p)) (eq (selected-window) - (next-window (next-window (selected-window)))))) + (next-window (next-window))))) (defun edebug-sort-alist (alist function) ;; Return the ALIST sorted with comparison function FUNCTION. @@ -334,7 +334,7 @@ Return the result of the last expression in BODY." ((and (edebug-window-live-p window) (eq (window-buffer window) buffer)) window) - ((eq (window-buffer (selected-window)) buffer) + ((eq (window-buffer) buffer) ;; Selected window already displays BUFFER. (selected-window)) ((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 @@ Helper-return-blurb) "return"))) (save-window-excursion - (goto-char (window-start (selected-window))) + (goto-char (window-start)) (if (get-buffer-window "*Help*") (pop-to-buffer "*Help*") (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." (mark t) (point) cua--explicit-region-start)))) ;; Disable transient-mark-mode if rectangle active in current buffer. - (if (not (window-minibuffer-p (selected-window))) + (if (not (window-minibuffer-p)) (setq transient-mark-mode (and (not cua--rectangle) (if cua-highlight-region-shift-only (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." (if (<= (point) oend) (setq oend (+ oend nchars))) (insert-before-markers string) - (if (= (window-start (selected-window)) (point)) + (if (= (window-start) (point)) (set-window-start (selected-window) (- (point) nchars))) (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." ;; Preserve selected buffer, but do not do save-window-excursion, ;; since we want to see any window created by the form. Temporarily ;; select the article buffer, so we can see any point movement. - (let ((sb (window-buffer (selected-window)))) + (let ((sb (window-buffer))) (gnus-configure-windows 'article) (pop-to-buffer gnus-article-buffer) (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." (setq config (current-window-configuration)) (pop-to-buffer " *Metahelp*" nil t) (and (fboundp 'make-frame) - (not (eq (window-frame (selected-window)) + (not (eq (window-frame) prev-frame)) - (setq new-frame (window-frame (selected-window)) + (setq new-frame (window-frame) config nil)) (setq buffer-read-only nil) (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 (get-buffer (read-buffer "buffer-a " (current-buffer) t)) (get-buffer (read-buffer "buffer-b " - (window-buffer (next-window (selected-window))) t)))) + (window-buffer (next-window)) t)))) (let ((file-a (buffer-file-name buf-a)) (file-b (buffer-file-name buf-b))) (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." (message "No further expansions found")) (ding)) (if (and hippie-expand-verbose - (not (window-minibuffer-p (selected-window)))) + (not (window-minibuffer-p))) (message "Using %s" (nth he-num hippie-expand-try-functions-list))))) (if (and (>= he-num 0) @@ -305,7 +305,7 @@ undoes the expansion." (setq he-num -1) (he-reset-string) (if (and hippie-expand-verbose - (not (window-minibuffer-p (selected-window)))) + (not (window-minibuffer-p))) (message "Undoing expansions")))))) ;; 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 for subsequent calls (for further possible expansions of the same string). It returns t if a new expansion is found, nil otherwise." (let ((expansion ()) - (flag (if (frame-visible-p (window-frame (selected-window))) + (flag (if (frame-visible-p (window-frame)) 'visible t))) (unless old (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 (defun global-hl-line-highlight () "Highlight the current line in the current window." (when global-hl-line-mode ; Might be changed outside the mode function. - (unless (window-minibuffer-p (selected-window)) + (unless (window-minibuffer-p) (unless global-hl-line-overlay (setq global-hl-line-overlay (make-overlay 1 1)) ; to be moved (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: indicate some non-standard, non-simple completion mechanism, like file-name and other custom-func completions)." - (and (window-minibuffer-p (selected-window)) + (and (window-minibuffer-p) (not executing-kbd-macro) minibuffer-completion-table (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." (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout) (isearch-dehighlight) (lazy-highlight-cleanup lazy-highlight-cleanup) - (let ((found-start (window-start (selected-window))) + (let ((found-start (window-start)) (found-point (point))) (when isearch-window-configuration (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." (cancel-timer jit-lock-stealth-repeat-timer)) (unless (or executing-kbd-macro memory-full - (window-minibuffer-p (selected-window)) + (window-minibuffer-p) ;; For first invocation set up `jit-lock-stealth-buffers'. ;; In repeated invocations it's already been set up. (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. ;;;*** -;;;### (autoloads (rmail-summary-by-senders rmail-summary-by-topic -;;;;;; rmail-summary-by-regexp rmail-summary-by-recipients rmail-summary-by-labels -;;;;;; rmail-summary) "rmailsum" "rmailsum.el" "61e7ad0931be1e07034dd57825ff326a") +;;;### (autoloads nil "rmailsum" "rmailsum.el" "a9b3bbd9b82dd566524a1209b5cdb7dd") ;;; Generated autoloads from rmailsum.el (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." (prog1 ;; Is EOB visible in the buffer? (save-excursion - (let ((ht (window-height (selected-window)))) + (let ((ht (window-height))) (move-to-window-line (- ht 2)) (end-of-line) (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." "Determine if it's wise to enable col-scrolling for the current window. Basically, we check for existing horizontal scrolling." (or truncate-lines - (> (window-hscroll (selected-window)) 0) + (> (window-hscroll) 0) (not (window-full-width-p)) (and 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." (let* ((newbuf (mpc-tagbrowser-buf tag)) (win (get-buffer-window newbuf 0))) (if win (select-window win) - (if (with-current-buffer (window-buffer (selected-window)) + (if (with-current-buffer (window-buffer) (derived-mode-p 'mpc-tagbrowser-mode)) (setq win (selected-window)) ;; Find a tagbrowser-mode buffer. @@ -2618,8 +2618,7 @@ This is used so that they can be compared with `eq', which is needed for (song-win (get-buffer-window song-buf 0))) (if song-win (select-window song-win) - (if (or (window-dedicated-p (selected-window)) - (window-minibuffer-p)) + (if (or (window-dedicated-p) (window-minibuffer-p)) (ignore-errors (select-frame (make-frame mpc-frame-alist))) (with-current-buffer song-buf (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." "Return a buffer for PROCESS, either the one selected or the process buffer." (if rcirc-always-use-server-buffer-flag (process-buffer process) - (let ((buffer (window-buffer (selected-window)))) + (let ((buffer (window-buffer))) (if (and buffer (with-current-buffer buffer (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." (defun gomoku-max-width () "Largest possible board width for the current window." - (1+ (/ (- (window-width (selected-window)) + (1+ (/ (- (window-width) gomoku-x-offset gomoku-x-offset 1) gomoku-square-width))) (defun gomoku-max-height () "Largest possible board height for the current window." - (1+ (/ (- (window-height (selected-window)) + (1+ (/ (- (window-height) gomoku-y-offset gomoku-y-offset 2) ;; 2 instead of 1 because WINDOW-HEIGHT includes the mode line ! 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." (defun landmark-max-width () "Largest possible board width for the current window." - (1+ (/ (- (window-width (selected-window)) + (1+ (/ (- (window-width) landmark-x-offset landmark-x-offset 1) landmark-square-width))) (defun landmark-max-height () "Largest possible board height for the current window." - (1+ (/ (- (window-height (selected-window)) + (1+ (/ (- (window-height) landmark-y-offset landmark-y-offset 2) ;; 2 instead of 1 because WINDOW-HEIGHT includes the mode line ! 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, (let ((f (selected-frame)) (outbuf (get-buffer-create "*zone*")) (text (buffer-substring (window-start) (window-end))) - (wp (1+ (- (window-point (selected-window)) + (wp (1+ (- (window-point) (window-start))))) (put 'zone 'orig-buffer (current-buffer)) (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." All arguments are markers. If END-MK is non-nil, mark is set there and overlay is highlighted between MK and END-MK." ;; Show compilation buffer in other window, scrolled to this error. - (let* ((from-compilation-buffer (eq (window-buffer (selected-window)) + (let* ((from-compilation-buffer (eq (window-buffer) (marker-buffer msg))) ;; Use an existing window if it is in a visible frame. (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." ;; Get the source file to view or find. (setf file (ebrowse-find-source-file file tags-file)) ;; If current window is dedicated, use another frame. - (when (window-dedicated-p (selected-window)) + (when (window-dedicated-p) (setf where 'other-window)) (cond (view (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'." ;; selected window's buffer; without the hair, point is moved in both ;; windows. To prevent this, we save the selected window's point before ;; doing find-tag-noselect, and restore it after. - (let* ((window-point (window-point (selected-window))) + (let* ((window-point (window-point)) (tagbuf (find-tag-noselect tagname next-p regexp-p)) (tagpoint (progn (set-buffer tagbuf) (point)))) (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." fortran-column-ruler-fixed) (save-excursion (beginning-of-line) - (if (eq (window-start (selected-window)) - (window-point (selected-window))) + (if (eq (window-start) (window-point)) (line-beginning-position 2) (point))) 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." obj) (when (numberp pos) (with-selected-window (posn-window posn) - (with-current-buffer (window-buffer (selected-window)) + (with-current-buffer (window-buffer) (goto-char pos) (dolist (overlay (overlays-in pos pos)) (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'." (defun verilog-point-text (&optional pointnum) "Return text describing where POINTNUM or current point is (for errors). Use filename, if current buffer being edited shorten to just buffer name." - (concat (or (and (equal (window-buffer (selected-window)) (current-buffer)) + (concat (or (and (equal (window-buffer) (current-buffer)) (buffer-name)) buffer-file-name (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)." (here (point)) ;; change this name once I've gotten rid of references to ht. ;; this is actually the number of the last screen line - (ht (- (window-height (selected-window)) 2)) + (ht (- (window-height) 2)) (line (repos-count-screen-lines (window-start) (point))) (comment-height ;; 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'." (defun toggle-rot13-mode () "Toggle the use of ROT13 encoding for the current window." (interactive) - (if (eq (window-display-table (selected-window)) rot13-display-table) + (if (eq (window-display-table) rot13-display-table) (set-window-display-table (selected-window) nil) - (if (null (window-display-table (selected-window))) + (if (null (window-display-table)) (set-window-display-table (selected-window) rot13-display-table)))) (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)." (setq next-buffer (car (process-get proc 'buffers)))) (setq rest (cdr rest))))) (and next-buffer (server-switch-buffer next-buffer killed-one)) - (unless (or next-buffer killed-one (window-dedicated-p (selected-window))) + (unless (or next-buffer killed-one (window-dedicated-p)) ;; (switch-to-buffer (other-buffer)) (message "No server buffers remain to edit"))) (if (not (buffer-live-p next-buffer)) @@ -1584,10 +1584,10 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)." (unless (frame-live-p server-window) (setq server-window (make-frame))) (select-window (frame-selected-window server-window)))) - (when (window-minibuffer-p (selected-window)) + (when (window-minibuffer-p) (select-window (next-window nil 'nomini 0))) ;; Move to a non-dedicated window, if we have one. - (when (window-dedicated-p (selected-window)) + (when (window-dedicated-p) (select-window (get-window-with-predicate (lambda (w) @@ -1601,7 +1601,7 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)." ;; a minibuffer/dedicated-window (if there's no other). (error (pop-to-buffer next-buffer))))))) (when server-raise-frame - (select-frame-set-input-focus (window-frame (selected-window)))))) + (select-frame-set-input-focus (window-frame))))) ;;;###autoload (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." (interactive) (let ((data (shell-command-completion))) (if data - (prog2 (unless (window-minibuffer-p (selected-window)) + (prog2 (unless (window-minibuffer-p) (message "Completing command name...")) (apply #'completion-in-region data))))) @@ -1232,7 +1232,7 @@ Returns non-nil if successful." (interactive) (let ((data (shell-environment-variable-completion))) (if data - (prog2 (unless (window-minibuffer-p (selected-window)) + (prog2 (unless (window-minibuffer-p) (message "Completing variable name...")) (apply #'completion-in-region data))))) 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!" (progn (barf-if-buffer-read-only) (read-buffer "Insert buffer: " - (if (eq (selected-window) (next-window (selected-window))) + (if (eq (selected-window) (next-window)) (other-buffer (current-buffer)) - (window-buffer (next-window (selected-window)))) + (window-buffer (next-window))) t)))) (push-mark (save-excursion @@ -5965,7 +5965,7 @@ The variable `selective-display' has a separate value for each buffer." (setq selective-display (and arg (prefix-numeric-value arg))) (recenter current-vpos)) - (set-window-start (selected-window) (window-start (selected-window))) + (set-window-start (selected-window) (window-start)) (princ "selective-display set to " t) (prin1 selective-display t) (princ "." t)) @@ -6629,8 +6629,7 @@ Go to the window from which completion was requested." (interactive) (let ((buf completion-reference-buffer)) (if (one-window-p t) - (if (window-dedicated-p (selected-window)) - (delete-frame)) + (if (window-dedicated-p) (delete-frame)) (delete-window (selected-window)) (if (get-buffer-window buf) (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." (dframe-select-attached-frame speedbar-frame) ;; make sure we at least choose a window to ;; get a good directory from - (if (window-minibuffer-p (selected-window)) + (if (window-minibuffer-p) nil ;; Check for special modes (speedbar-maybe-add-localized-support (current-buffer)) @@ -3512,7 +3512,7 @@ interested in." (set-buffer speedbar-buffer) (if (<= (count-lines (point-min) (point-max)) - (1- (window-height (selected-window)))) + (1- (window-height))) ;; whole buffer fits (let ((cp (point))) @@ -3545,7 +3545,7 @@ interested in." (setq end (point-max))))) ;; Now work out the details of centering (let ((nl (count-lines start end)) - (wl (1- (window-height (selected-window)))) + (wl (1- (window-height))) (cp (point))) (if (> nl wl) ;; We can't fit it all, so just center on cursor @@ -3558,12 +3558,12 @@ interested in." nil ;; we need to do something... (goto-char start) - (let ((newcent (/ (- (window-height (selected-window)) nl) 2)) + (let ((newcent (/ (- (window-height) nl) 2)) (lte (count-lines start (point-max)))) - (if (and (< (+ newcent lte) (window-height (selected-window))) - (> (- (window-height (selected-window)) lte 1) + (if (and (< (+ newcent lte) (window-height)) + (> (- (window-height) lte 1) newcent)) - (setq newcent (- (window-height (selected-window)) + (setq newcent (- (window-height) lte 1))) (recenter newcent)))) (goto-char cp)))))) @@ -3997,7 +3997,7 @@ TEXT is the buffer's name, TOKEN and INDENT are unused." (defun speedbar-recenter () "Recenter the current buffer so point is in the center of the window." - (recenter (/ (window-height (selected-window)) 2))) + (recenter (/ (window-height) 2))) ;;; 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." (t "splash.pbm"))) (img (create-image image-file)) (image-width (and img (car (image-size img)))) - (window-width (window-width (selected-window)))) + (window-width (window-width))) (when img (when (> window-width image-width) ;; 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." (window-min-height (min window-min-height ispell-choices-win-default-height)) (command-characters '( ? ?i ?a ?A ?r ?R ?? ?x ?X ?q ?l ?u ?m )) - (dedicated (window-dedicated-p (selected-window))) + (dedicated (window-dedicated-p)) (skipped 0) char num result textwin dedicated-win) 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." (with-current-buffer buffer (revert-buffer t t)) (setq buffer (find-file-noselect makeinfo-output-file-name))) - (if (window-dedicated-p (selected-window)) + (if (window-dedicated-p) (switch-to-buffer-other-window buffer) (switch-to-buffer buffer))) (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? ")) ;; inserted at the start of the buffer, the "type C-v to ;; move to the next screen" might not be visible on the ;; first screen (n < 0). How will the novice know what to do? - (let ((n (- (window-height (selected-window)) + (let ((n (- (window-height) (count-lines (point-min) (point)) 6))) (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." (unless (equal file-name buffer-file-name) (cond - ((equal file-name (buffer-file-name (window-buffer (selected-window)))) + ((equal file-name (buffer-file-name (window-buffer))) ;; If the selected window already shows the desired buffer don't show ;; it again (particularly important if other-window is true). ;; This is important for diff-add-change-log-entries-other-window. - (set-buffer (window-buffer (selected-window)))) - ((or other-window (window-dedicated-p (selected-window))) + (set-buffer (window-buffer))) + ((or other-window (window-dedicated-p)) (find-file-other-window file-name)) (t (find-file file-name)))) (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." 'compare-windows-sync-regexp compare-windows-sync))) (setq p1 (point) b1 (current-buffer)) - (setq w2 (next-window (selected-window))) + (setq w2 (next-window)) (if (eq w2 (selected-window)) (setq w2 (next-window (selected-window) nil 'visible))) (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 (defun ediff-indent-help-message () - (let* ((shift (/ (max 0 (- (window-width (selected-window)) + (let* ((shift (/ (max 0 (- (window-width) (ediff-help-message-line-length))) 2)) (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.") ;; to reside. (defun ediff-setup-control-buffer (ctl-buf) "Set up window for control buffer." - (if (window-dedicated-p (selected-window)) + (if (window-dedicated-p) (set-buffer ctl-buf) ; we are in control frame but just in case (switch-to-buffer ctl-buf)) (let ((window-min-height 2)) @@ -1629,7 +1629,7 @@ the width of the A/B/C windows." (setq lines (1+ lines))) ;; And position the beginning on the right line (goto-char beg) - (recenter (/ (1+ (max (- (1- (window-height (selected-window))) + (recenter (/ (1+ (max (- (1- (window-height)) lines) 1) ) 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." ;; create a new splittable frame if none is found (defun ediff-skip-unsuitable-frames (&optional ok-unsplittable) (if (ediff-window-display-p) - (let ((wind-frame (window-frame (selected-window))) + (let ((wind-frame (window-frame)) seen-windows) (while (and (not (memq (selected-window) seen-windows)) (or @@ -877,7 +877,7 @@ into icons, regardless of the window manager." (setq seen-windows (cons (selected-window) seen-windows)) ;; try new window (other-window 1 t) - (setq wind-frame (window-frame (selected-window))) + (setq wind-frame (window-frame)) ) (if (memq (selected-window) seen-windows) ;; fed up, no appropriate frames @@ -939,7 +939,7 @@ into icons, regardless of the window manager." (setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame)) (select-frame ctl-frame) - (if (window-dedicated-p (selected-window)) + (if (window-dedicated-p) () (delete-other-windows) (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." (setq lines (1+ lines))) ;; And position the beginning on the right line (goto-char beg) - (recenter (/ (1+ (- (1- (window-height (selected-window))) + (recenter (/ (1+ (- (1- (window-height)) lines)) 2)))))) (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." BUF is assumed to be a temporary buffer used from the buffer MAINBUF." (interactive (list (current-buffer))) (save-current-buffer - (let ((win (if (eq buf (window-buffer (selected-window))) (selected-window) + (let ((win (if (eq buf (window-buffer)) (selected-window) (get-buffer-window buf t)))) (when win (if (window-dedicated-p win) @@ -111,8 +111,8 @@ BUF is assumed to be a temporary buffer used from the buffer MAINBUF." ;;; ) ))) (with-current-buffer buf - (bury-buffer (unless (and (eq buf (window-buffer (selected-window))) - (not (window-dedicated-p (selected-window)))) + (bury-buffer (unless (and (eq buf (window-buffer)) + (not (window-dedicated-p))) buf))) (when mainbuf (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 windows nor the buffer list." ;; If we start from the minibuffer window, don't fail to come ;; back to it. - (when (window-minibuffer-p (selected-window)) + (when (window-minibuffer-p) (setq minibuf t)) ;; Make sure to not mess up the order of recently selected ;; windows. Use `save-selected-window' and `select-window' @@ -6676,7 +6676,7 @@ is active. This function is run by `mouse-autoselect-window-timer'." ;; minibuffer. Use `unread-command-events' in order to execute pre- ;; and post-command hooks and trigger idle timers. To avoid delaying ;; autoselection again, set `mouse-autoselect-window-state'." - (unless (window-minibuffer-p (selected-window)) + (unless (window-minibuffer-p) (setq mouse-autoselect-window-state 'select) (setq unread-command-events (cons (list 'select-window (list window)) @@ -6702,7 +6702,7 @@ is active. This function is run by `mouse-autoselect-window-timer'." ;; minibuffer gets unselected unexpectedly, and where ;; you then have to move your mouse all the way down to ;; the minibuffer to select it. - (window-minibuffer-p (selected-window)) + (window-minibuffer-p) ;; Don't switch to minibuffer window unless it's active. (and (window-minibuffer-p window) (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*, (set-window-configuration winconf)) (cond ((window-live-p chosen) (select-window chosen)) - ((window-minibuffer-p (selected-window)) - (other-window 1))) + ((window-minibuffer-p) (other-window 1))) (when (/= minisize (window-height miniwin)) (with-selected-window miniwin (setf (window-height) minisize))))) @@ -381,7 +380,7 @@ In other words, \"undo\" changes in window configuration." (setq winner-undone-data (list (winner-win-data)))) (cl-incf winner-undo-counter) ; starting at 1 (when (and (winner-undo-this) - (not (window-minibuffer-p (selected-window)))) + (not (window-minibuffer-p))) (message "Winner undo (%d / %d)" winner-undo-counter (1- (ring-length winner-pending-undo-ring))))))) -- 2.11.4.GIT