+2013-08-05 Dmitry Antipov <dmantipov@yandex.ru>
+
+ 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 <lekktu@gmail.com>
* frameset.el (frameset--set-id): Doc fix.
(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))
(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)
(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)))))
(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)))
(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)
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
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)
"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)
(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)))))
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)))))
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))))
(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")))
;; 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)
(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.
;; 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)
(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
(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
(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)))
(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
(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)
"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.
((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))
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*"))
(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)
(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)
;; 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)
(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))
(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)
(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)
(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).
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))
(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))
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))
(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)
(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
;;;***
\f
-;;;### (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" "\
(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)))
"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
(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.
(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
"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)
(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)))
(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)))
(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)
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))
;; 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
;; 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
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."))
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)
(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))
(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.
(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)
(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))
(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)
;; 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)
(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)))))
(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)))))
(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
(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))
(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))))))
(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))
(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)))
(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
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))))))
(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)))
\f
;;; Color loading section.
(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.
(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)
(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))))
;; 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)
(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)
'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))
(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 ?\ )))
;; 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))
(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)
)
;; 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
(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
(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))
(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))
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)
;;; )
)))
(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)
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'
;; 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))
;; 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)))
(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)))))
(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)))))))