]> git.eshelyaron.com Git - emacs.git/commitdiff
Rewrite more functions using buffer display specifiers.
authorMartin Rudalics <rudalics@gmx.at>
Fri, 5 Nov 2010 10:41:43 +0000 (11:41 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Fri, 5 Nov 2010 10:41:43 +0000 (11:41 +0100)
* electric.el (Electric-pop-up-window): Use buffer display
specifiers.

* emacs-lisp/elint.el (elint-display-log): Use
display-buffer-other-window.

* vc/pcvs-util.el (cvs-pop-to-buffer-same-frame): Use buffer
display specifiers.

* message.el (message-mail-other-window)
(message-news-other-window): Pass pop-to-buffer-other-window as
switch-function to message-pop-to-buffer.
(message-mail-other-frame, message-news-other-frame): Pass
pop-to-buffer-other-frame as switch-function to
message-pop-to-buffer.

* mh-comp.el (mh-send-other-window): Pass t as extra argument to
mh-send-sub.
(mh-send-sub): New optional argument OTHER-WINDOW. Pass extra
argument to mh-read-draft.
(mh-read-draft): New optional argument OTHER-WINDOW. Pass it in
suitable fashion to pop-to-buffer.

lisp/ChangeLog
lisp/electric.el
lisp/emacs-lisp/elint.el
lisp/gnus/ChangeLog
lisp/gnus/message.el
lisp/mh-e/ChangeLog
lisp/mh-e/mh-comp.el
lisp/vc/pcvs-util.el

index a225bcbd1654109656622d9772328919e30b705e..cdf9ec917d474079bc5de5cb12793f801a9a8e58 100644 (file)
@@ -1,3 +1,14 @@
+2010-11-05  Martin Rudalics  <rudalics@gmx.at>
+
+       * electric.el (Electric-pop-up-window): Use buffer display
+       specifiers.
+
+       * emacs-lisp/elint.el (elint-display-log): Use
+       display-buffer-other-window.
+
+       * vc/pcvs-util.el (cvs-pop-to-buffer-same-frame): Use buffer
+       display specifiers.
+
 2010-11-04  Martin Rudalics  <rudalics@gmx.at>
 
        * window.el (display-buffer-names, display-buffer-regexps): Make
index a0d849bbcca5823f5b2fa1680258841a4ae42e62..0c63182b41c7587a78e44956421922ac367ec149 100644 (file)
 (defun Electric-pop-up-window (buffer &optional max-height)
   (let* ((win (or (get-buffer-window buffer) (selected-window)))
         (buf (get-buffer buffer))
-        (one-window (one-window-p t))
-        (pop-up-windows t)
-        (pop-up-frames nil))
+        (one-window (one-window-p t)))
     (if (not buf)
        (error "Buffer %s does not exist" buffer)
       (cond ((and (eq (window-buffer win) buf))
             (select-window win))
            (one-window
-            (pop-to-buffer buffer)
+            (pop-to-buffer
+             ;; Try to do what the comment above says.
+             buffer '(same-frame (new-window (selected . below))))
             (setq win (selected-window)))
            (t
             (switch-to-buffer buf)))
@@ -302,7 +302,7 @@ This can be convenient for people who find it easier to hit ) than C-f."
                 #'electric-pair-post-self-insert-function)
     (remove-hook 'post-self-insert-hook
                  #'electric-pair-post-self-insert-function)))
-        
+
 (provide 'electric)
 
 ;; arch-tag: dae045eb-dc2d-4fb7-9f27-9cc2ce277be8
index b9aa29decd03c72074bb4ec701d953f298d72683..274544520dae7dbdf237418f89a1ffff994d13a6 100644 (file)
@@ -1036,9 +1036,8 @@ Insert HEADER followed by a blank line if non-nil."
 
 (defun elint-display-log ()
   "Display the lint log buffer."
-  (let ((pop-up-windows t))
-    (display-buffer (elint-get-log-buffer))
-    (sit-for 0)))
+  (display-buffer-other-window (elint-get-log-buffer))
+  (sit-for 0))
 
 (defvar elint-running)
 
index 2cb1a77107a3aa218948aeb0cc10e870e45e399e..7cac6d107e20930465bb968a63df45127ea8d0e6 100644 (file)
@@ -1,3 +1,12 @@
+2010-11-05  Martin Rudalics  <rudalics@gmx.at>
+
+       * message.el (message-mail-other-window)
+       (message-news-other-window): Pass pop-to-buffer-other-window as
+       switch-function to message-pop-to-buffer.
+       (message-mail-other-frame, message-news-other-frame): Pass
+       pop-to-buffer-other-frame as switch-function to
+       message-pop-to-buffer.
+
 2010-11-04  Andrew Cohen  <cohen@andy.bu.edu>
 
        * nnir.el (gnus-summary-nnir-goto-thread): limiting work done by
index cc793dfcf9a9c8d53cc5ceedf278b8b4b2e2dd81..ad5574d268f0c7bc4fde7d93eb1f9726af6fb3d1 100644 (file)
@@ -7490,12 +7490,8 @@ you."
   "Like `message-mail' command, but display mail buffer in another window."
   (interactive)
   (unless (message-mail-user-agent)
-    (let ((pop-up-windows t)
-         (special-display-buffer-names nil)
-         (special-display-regexps nil)
-         (same-window-buffer-names nil)
-         (same-window-regexps nil))
-      (message-pop-to-buffer (message-buffer-name "mail" to))))
+    (message-pop-to-buffer
+     (message-buffer-name "mail" to) 'pop-to-buffer-other-window))
   (let ((message-this-is-mail t))
     (message-setup `((To . ,(or to "")) (Subject . ,(or subject "")))
                   nil nil nil 'switch-to-buffer-other-window)))
@@ -7505,12 +7501,8 @@ you."
   "Like `message-mail' command, but display mail buffer in another frame."
   (interactive)
   (unless (message-mail-user-agent)
-    (let ((pop-up-frames t)
-         (special-display-buffer-names nil)
-         (special-display-regexps nil)
-         (same-window-buffer-names nil)
-         (same-window-regexps nil))
-      (message-pop-to-buffer (message-buffer-name "mail" to))))
+    (message-pop-to-buffer
+     (message-buffer-name "mail" to) 'pop-to-buffer-other-frame))
   (let ((message-this-is-mail t))
     (message-setup `((To . ,(or to "")) (Subject . ,(or subject "")))
                   nil nil nil 'switch-to-buffer-other-frame)))
@@ -7519,12 +7511,8 @@ you."
 (defun message-news-other-window (&optional newsgroups subject)
   "Start editing a news article to be sent."
   (interactive)
-  (let ((pop-up-windows t)
-       (special-display-buffer-names nil)
-       (special-display-regexps nil)
-       (same-window-buffer-names nil)
-       (same-window-regexps nil))
-    (message-pop-to-buffer (message-buffer-name "posting" nil newsgroups)))
+  (message-pop-to-buffer
+   (message-buffer-name "posting" nil newsgroups) 'pop-to-buffer-other-window)
   (let ((message-this-is-news t))
     (message-setup `((Newsgroups . ,(or newsgroups ""))
                     (Subject . ,(or subject ""))))))
@@ -7533,12 +7521,8 @@ you."
 (defun message-news-other-frame (&optional newsgroups subject)
   "Start editing a news article to be sent."
   (interactive)
-  (let ((pop-up-frames t)
-       (special-display-buffer-names nil)
-       (special-display-regexps nil)
-       (same-window-buffer-names nil)
-       (same-window-regexps nil))
-    (message-pop-to-buffer (message-buffer-name "posting" nil newsgroups)))
+  (message-pop-to-buffer
+   (message-buffer-name "posting" nil newsgroups) 'pop-to-buffer-other-frame)
   (let ((message-this-is-news t))
     (message-setup `((Newsgroups . ,(or newsgroups ""))
                     (Subject . ,(or subject ""))))))
index 164829c53e87c09d04593b1ed7744a14c791a1c4..c3814795ba9fcd5c36d67ad3a2e2d5a655e59575 100644 (file)
@@ -1,3 +1,12 @@
+2010-11-05  Martin Rudalics  <rudalics@gmx.at>
+
+       * mh-comp.el (mh-send-other-window): Pass t as extra argument to
+       mh-send-sub.
+       (mh-send-sub): New optional argument OTHER-WINDOW. Pass extra
+       argument to mh-read-draft.
+       (mh-read-draft): New optional argument OTHER-WINDOW. Pass it in
+       suitable fashion to pop-to-buffer.
+
 2010-11-03  Glenn Morris  <rgm@gnu.org>
 
        * mh-mime.el (dots, type, ov): Avoid unnecessary declaration.
index 762aad86080ea73b77ff04d48cf9a1de2df167b8..9c3d83eda2556dea540b50b95a23dd1909144cff 100644 (file)
@@ -169,8 +169,7 @@ TO, CC, and SUBJECT arguments are used."
                 (mh-interactive-read-address "To: ")
                 (mh-interactive-read-address "Cc: ")
                 (mh-interactive-read-string "Subject: ")))
-  (let ((pop-up-windows t))
-    (mh-send-sub to cc subject (current-window-configuration))))
+  (mh-send-sub to cc subject (current-window-configuration) t))
 
 (defvar mh-error-if-no-draft nil)       ;raise error over using old draft
 
@@ -773,10 +772,11 @@ Optional argument BUFFER can be used to specify the buffer."
           (t
            nil))))
 
-(defun mh-send-sub (to cc subject config)
+(defun mh-send-sub (to cc subject config &optional other-window)
   "Do the real work of composing and sending a letter.
 Expects the TO, CC, and SUBJECT fields as arguments.
-CONFIG is the window configuration before sending mail."
+CONFIG is the window configuration before sending mail.
+OTHER-WINDOW non-nil means use another window for composing."
   (let ((folder mh-current-folder)
         (msg-num (mh-get-msg-num nil)))
     (message "Composing a message...")
@@ -795,7 +795,7 @@ CONFIG is the window configuration before sending mail."
                      (t
                       (error "Can't find %s in %s or %s"
                              mh-comp-formfile mh-user-path mh-lib))))
-                  nil)))
+                  nil (and other-window t))))
       (mh-insert-fields "To:" to "Subject:" subject "Cc:" cc)
       (goto-char (point-max))
       (mh-compose-and-send-mail draft "" folder msg-num
@@ -804,7 +804,7 @@ CONFIG is the window configuration before sending mail."
       (mh-letter-mode-message)
       (mh-letter-adjust-point))))
 
-(defun mh-read-draft (use initial-contents delete-contents-file)
+(defun mh-read-draft (use initial-contents delete-contents-file &optional other-window)
   "Read draft file into a draft buffer and make that buffer the current one.
 
 USE is a message used for prompting about the intended use of the
@@ -812,6 +812,8 @@ message.
 INITIAL-CONTENTS is filename that is read into an empty buffer, or nil
 if buffer should not be modified. Delete the initial-contents file if
 DELETE-CONTENTS-FILE flag is set.
+OTHER-WINDOW non-nil means use another window for displaying the
+draft file.
 Returns the draft folder's name.
 If the draft folder facility is enabled in ~/.mh_profile, a new buffer
 is used each time and saved in the draft folder. The draft file can
@@ -821,14 +823,15 @@ then be reused."
                (draft-file-name (mh-new-draft-name)))
            (pop-to-buffer (generate-new-buffer
                            (format "draft-%s"
-                                   (file-name-nondirectory draft-file-name))))
+                                   (file-name-nondirectory draft-file-name)))
+                          (and other-window t))
            (condition-case ()
                (insert-file-contents draft-file-name t)
              (file-error))
            (setq default-directory orig-default-dir)))
         (t
          (let ((draft-name (expand-file-name "draft" mh-user-path)))
-           (pop-to-buffer "draft")      ; Create if necessary
+           (pop-to-buffer "draft" (and other-window t)) ; Create if necessary
            (if (buffer-modified-p)
                (if (y-or-n-p "Draft has been modified; kill anyway? ")
                    (set-buffer-modified-p nil)
index 595b762b2fa9be1ba554ae735a394e8e3a0e9f18..f3f579bf6a234bc9a0a9d601c3738fac65497d99 100644 (file)
@@ -85,13 +85,9 @@ the other elements.  The ordering among elements is maintained."
   "Pop to BUF like `pop-to-buffer' but staying on the same frame.
 If `pop-to-buffer' would have opened a new frame, this function would
 try to split a new window instead."
-  (let ((pop-up-windows (or pop-up-windows pop-up-frames))
-       (pop-up-frames nil))
-    (or (let ((buf (get-buffer-window buf))) (and buf (select-window buf)))
-       (and pop-up-windows
-            (ignore-errors (select-window (split-window-vertically)))
-            (switch-to-buffer buf))
-       (pop-to-buffer (current-buffer)))))
+  (pop-to-buffer
+   (current-buffer) '(same-frame (new-window (selected . below))
+                                (reuse-buffer-window . nil))))
 
 (defun cvs-bury-buffer (buf &optional mainbuf)
   "Hide the buffer BUF that was temporarily popped up.