]> git.eshelyaron.com Git - emacs.git/commitdiff
Sanitize buffer display handling in dired.el and proced.el.
authorMartin Rudalics <rudalics@gmx.at>
Wed, 12 Jan 2011 13:19:30 +0000 (14:19 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Wed, 12 Jan 2011 13:19:30 +0000 (14:19 +0100)
* dired.el (dired-display-file, dired-why): Use
display-buffer-other-window with label.
(dired-pop-to-buffer): Remove.
(dired-mark-pop-up): Use display-buffer and quit-restore-window.

* proced.el (proced-send-signal): Use display-buffer and
quit-restore-window.

lisp/ChangeLog
lisp/dired.el
lisp/proced.el

index 5a48ccb8b85c1aaed5b7dac9c021d3a410961734..235b5fdb69ba8b8b1d1c407dcee8796d84b47993 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-12  Martin Rudalics  <rudalics@gmx.at>
+
+       * dired.el (dired-display-file, dired-why): Use
+       display-buffer-other-window with label.
+       (dired-pop-to-buffer): Remove.
+       (dired-mark-pop-up): Use display-buffer and quit-restore-window.
+
+       * proced.el (proced-send-signal): Use display-buffer and
+       quit-restore-window.
+
 2011-01-11  Martin Rudalics  <rudalics@gmx.at>
 
        * vc/ediff-ptch.el (ediff-show-patch-diagnostics): Use
index 9d18b4586986ee573425329c45d6e8fd5a2d2ec8..3c6e09ac243238f948efa3384e0eeaa1630c89f2 100644 (file)
@@ -1994,7 +1994,8 @@ Otherwise, display it in another buffer."
 (defun dired-display-file ()
   "In Dired, display this file or directory in another window."
   (interactive)
-  (display-buffer (find-file-noselect (dired-get-file-for-visit))))
+  (display-buffer-other-window
+   (find-file-noselect (dired-get-file-for-visit)) 'dired-display-file))
 \f
 ;;; Functions for extracting and manipulating file names in Dired buffers.
 
@@ -2769,16 +2770,6 @@ name, or the marker and a count of marked files."
          (format "[next %d files]" arg)
        (format "%c [%d files]" dired-marker-char count)))))
 
-(defun dired-pop-to-buffer (buf)
-  "Pop up buffer BUF in a way suitable for Dired.
-Currently this means in another window on the same frame."
-  (pop-to-buffer-same-frame-other-window (get-buffer-create buf))
-  ;; If dired-shrink-to-fit is t, make its window fit its contents.
-  (when dired-shrink-to-fit
-    ;; Try to not delete window when we want to display less than
-    ;; `window-min-height' lines.
-    (fit-window-to-buffer (get-buffer-window buf) nil 1)))
-
 (defcustom dired-no-confirm nil
   "A list of symbols for commands Dired should not confirm, or t.
 Command symbols are `byte-compile', `chgrp', `chmod', `chown', `compress',
@@ -2820,10 +2811,15 @@ just the current file."
       ;; just one file that was marked, rather than the current line file.
       (dired-format-columns-of-files (if (eq (car files) t) (cdr files) files))
       (remove-text-properties (point-min) (point-max)
-                             '(mouse-face nil help-echo nil)))
-    (save-window-excursion
-      (dired-pop-to-buffer bufname)
-      (apply function args))))
+                             '(mouse-face nil help-echo nil))
+
+      (let ((window (display-buffer nil nil 'dired-mark-pop-up)))
+       (when dired-shrink-to-fit
+         (fit-window-to-buffer window nil 1))
+       (select-window window t)
+       (apply function args)
+       ;; We could kill the buffer here.
+       (quit-restore-window window)))))
 
 (defun dired-format-columns-of-files (files)
   (let ((beg (point)))
@@ -3191,7 +3187,8 @@ Thus, use \\[backward-page] to find the beginning of a group of errors."
   (interactive)
   (if (get-buffer dired-log-buffer)
       (let ((owindow (selected-window))
-           (window (display-buffer (get-buffer dired-log-buffer))))
+           (window (display-buffer-other-window
+                    (get-buffer dired-log-buffer) 'dired-why)))
        (unwind-protect
            (progn
              (select-window window)
index ee4e7b26ca1a9f98094317746c7b0fc84f666a7b..4cbbd6d9a6b738494976542784ad46dfb75c835f 100644 (file)
@@ -1725,23 +1725,24 @@ After sending the signal, this command runs the normal hook
             (setq buffer-read-only t)
             (dolist (process process-alist)
               (insert "  " (cdr process) "\n")))
-          (save-window-excursion
-            ;; Analogous to `dired-pop-to-buffer'
-            ;; Don't split window horizontally.  (Bug#1806)
-            (let (split-width-threshold)
-              (pop-to-buffer (current-buffer)))
-            (fit-window-to-buffer (get-buffer-window) nil 1)
-            (let* ((completion-ignore-case t)
-                   (pnum (if (= 1 (length process-alist))
-                             "1 process"
-                           (format "%d processes" (length process-alist))))
-                   (completion-annotate-function
-                    (lambda (s) (cdr (assoc s proced-signal-list)))))
-              (setq signal
-                    (completing-read (concat "Send signal [" pnum
-                                             "] (default TERM): ")
-                                     proced-signal-list
-                                     nil nil nil nil "TERM")))))))
+         ;; Don't split window horizontally.  (Bug#1806) We now do
+         ;; split windows horizontally again - override this via
+         ;; `display-buffer-alist' if you want to.
+          (let* ((window (display-buffer nil nil 'proced-send-signal))
+                (completion-ignore-case t)
+                (pnum (if (= 1 (length process-alist))
+                          "1 process"
+                        (format "%d processes" (length process-alist))))
+                (completion-annotate-function
+                 (lambda (s) (cdr (assoc s proced-signal-list)))))
+            (fit-window-to-buffer window nil 1)
+           (select-window window t)
+           (setq signal
+                 (completing-read (concat "Send signal [" pnum
+                                          "] (default TERM): ")
+                                  proced-signal-list
+                                  nil nil nil nil "TERM"))
+           (quit-restore-window window)))))
     ;; send signal
     (let ((count 0)
           failures)