]> code.delx.au - gnu-emacs/blobdiff - lisp/window.el
Fix the prefix action of shr-copy-url
[gnu-emacs] / lisp / window.el
index 1d41d821dc467b84c1cc39630fe5130b7386cf2a..a0bdfeb672a454b2547c7f090a5763286fc8816c 100644 (file)
@@ -1889,9 +1889,19 @@ the font."
           (ncols (/ window-width font-width)))
       (if (and (display-graphic-p)
               overflow-newline-into-fringe
-              (/= (frame-parameter nil 'left-fringe) 0)
-              (/= (frame-parameter nil 'right-fringe) 0))
+               (not
+                (or (eq left-fringe-width 0)
+                    (and (null left-fringe-width)
+                         (= (frame-parameter nil 'left-fringe) 0))))
+               (not
+                (or (eq right-fringe-width 0)
+                    (and (null right-fringe-width)
+                         (= (frame-parameter nil 'right-fringe) 0)))))
          ncols
+        ;; FIXME: This should remove 1 more column when there are no
+        ;; fringes, lines are truncated, and the window is hscrolled,
+        ;; but EOL is not in the view, because then there are 2
+        ;; truncation glyphs, not one.
        (1- ncols)))))
 
 (defun window-current-scroll-bars (&optional window)
@@ -7137,7 +7147,7 @@ buffer with the name BUFFER-OR-NAME and return that buffer."
            buffer))
     (other-buffer)))
 
-(defcustom switch-to-buffer-preserve-window-point nil
+(defcustom switch-to-buffer-preserve-window-point t
   "If non-nil, `switch-to-buffer' tries to preserve `window-point'.
 If this is nil, `switch-to-buffer' displays the buffer at that
 buffer's `point'.  If this is `already-displayed', it tries to
@@ -7155,7 +7165,7 @@ the selected window or never appeared in it before, or if
          (const :tag "If already displayed elsewhere" already-displayed)
          (const :tag "Always" t))
   :group 'windows
-  :version "24.3")
+  :version "25.2")
 
 (defcustom switch-to-buffer-in-dedicated-window nil
   "Allow switching to buffer in strongly dedicated windows.
@@ -8550,10 +8560,10 @@ WINDOWS is a list of windows associated with PROCESS.  REDUCER is
 a two-argument function used to combine the widths and heights of
 the given windows."
   (when windows
-    (let ((width (window-body-width (car windows)))
+    (let ((width (window-max-chars-per-line (car windows)))
           (height (window-body-height (car windows))))
       (dolist (window (cdr windows))
-        (setf width (funcall reducer width (window-body-width window)))
+        (setf width (funcall reducer width (window-max-chars-per-line window)))
         (setf height (funcall reducer height (window-body-height window))))
       (cons width height))))
 
@@ -8575,38 +8585,40 @@ A window is associated with a process if that window is
 displaying that processes's buffer."
   (let ((processes (process-list))
         (process-windows nil))
-    (walk-windows
-     (lambda (window)
-       (let ((buffer (window-buffer window))
-             (iter processes))
-         (while (let ((process (car iter)))
-                  (if (and (process-live-p process)
-                           (eq buffer (process-buffer process)))
-                      (let ((procwin (assq process process-windows)))
-                        ;; Add this window to the list of windows
-                        ;; displaying process.
-                        (if procwin
-                            (push window (cdr procwin))
-                          (push (list process window) process-windows))
-                        ;; We found our process for this window, so
-                        ;; stop iterating over the process list.
-                        nil)
-                    (setf iter (cdr iter)))))))
-     1 t)
+    (if processes
+        (walk-windows
+         (lambda (window)
+           (let ((buffer (window-buffer window))
+                 (iter processes))
+             (while (let ((process (car iter)))
+                      (if (and (process-live-p process)
+                               (eq buffer (process-buffer process)))
+                          (let ((procwin (assq process process-windows)))
+                            ;; Add this window to the list of windows
+                            ;; displaying process.
+                            (if procwin
+                                (push window (cdr procwin))
+                              (push (list process window) process-windows))
+                            ;; We found our process for this window, so
+                            ;; stop iterating over the process list.
+                            nil)
+                        (setf iter (cdr iter)))))))
+         1 t))
     process-windows))
 
 (defun window--adjust-process-windows ()
   "Update process window sizes to match the current window configuration."
-  (dolist (procwin (window--process-window-list))
-    (let ((process (car procwin)))
-      (with-demoted-errors "Error adjusting window size: %S"
-        (with-current-buffer (process-buffer process)
-          (let ((size (funcall
-                       (or (process-get process 'adjust-window-size-function)
-                           window-adjust-process-window-size-function)
-                       process (cdr procwin))))
-            (when size
-              (set-process-window-size process (cdr size) (car size)))))))))
+  (when (fboundp 'process-list)
+    (dolist (procwin (window--process-window-list))
+      (let ((process (car procwin)))
+        (with-demoted-errors "Error adjusting window size: %S"
+          (with-current-buffer (process-buffer process)
+            (let ((size (funcall
+                         (or (process-get process 'adjust-window-size-function)
+                             window-adjust-process-window-size-function)
+                         process (cdr procwin))))
+              (when size
+                (set-process-window-size process (cdr size) (car size))))))))))
 
 (add-hook 'window-configuration-change-hook 'window--adjust-process-windows)