[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ae6dc08 2/2: Merge branch 'master' of git.sv.gnu.or
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] master ae6dc08 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs |
Date: |
Thu, 10 Mar 2016 11:44:57 +0000 |
branch: master
commit ae6dc08e0c5961cd10469eefb3c78f6e8c14158b
Merge: f7adb8a 2d38251
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
doc/lispref/windows.texi | 17 ++++++++++++
lisp/mail/rmail.el | 2 +
lisp/window.el | 65 ++++++++++++++++++++++++++++++++++++++++++++++
src/process.c | 48 ++++++++++++++++-----------------
src/xfns.c | 3 +-
5 files changed, 108 insertions(+), 27 deletions(-)
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index f215eb7..bb13934 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -2409,6 +2409,23 @@ visible and, unless @var{alist} contains an
@code{inhibit-switch-frame}
entry (@pxref{Choosing Window Options}), raises that frame if necessary.
@end defun
address@hidden display-buffer-reuse-mode-window buffer alist
+This function tries to display @var{buffer} by finding a window
+that is displaying a buffer in a given mode.
+
+If @var{alist} contains a @code{mode} entry, its value is a major mode
+(a symbol) or a list of major modes. If @var{alist} contains no
address@hidden entry, the current major mode of @var{buffer} is used. A
+window is a candidate if it displays a buffer that derives from one of
+the given modes.
+
+The behaviour is also controlled by entries for
address@hidden, @code{reusable-frames} and
address@hidden as is done in the function
address@hidden
+
address@hidden defun
+
@defun display-buffer-pop-up-frame buffer alist
This function creates a new frame, and displays the buffer in that
frame's window. It actually performs the frame creation by calling
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 2790c89..68b3cfd 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -241,6 +241,7 @@ please report it with \\[report-emacs-bug].")
(declare-function mail-dont-reply-to "mail-utils" (destinations))
(declare-function rmail-update-summary "rmailsum" (&rest ignore))
(declare-function rmail-mime-toggle-hidden "rmailmm" ())
+(declare-function rmail-mime-entity-truncated "rmailmm" (entity))
(defun rmail-probe (prog)
"Determine what flavor of movemail PROG is.
@@ -4583,6 +4584,7 @@ Argument MIME is non-nil if this is a mime message."
;; There doesn't really seem to be an appropriate menu.
;; Eg the edit command is not in a menu either.
+(defvar rmail-mime-render-html-function) ; defcustom in rmailmm
(defun rmail-epa-decrypt ()
"Decrypt GnuPG or OpenPGP armors in current message."
(interactive)
diff --git a/lisp/window.el b/lisp/window.el
index c45e60e..28632a3 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6721,6 +6721,71 @@ that frame."
(unless (cdr (assq 'inhibit-switch-frame alist))
(window--maybe-raise-frame (window-frame window)))))))
+(defun display-buffer-reuse-mode-window (buffer alist)
+ "Return a window based on the mode of the buffer it displays.
+Display BUFFER in the returned window. Return nil if no usable
+window is found.
+
+If ALIST contains a `mode' entry, its value is a major mode (a
+symbol) or a list of modes. A window is a candidate if it
+displays a buffer that derives from one of the given modes. When
+ALIST contains no `mode' entry, the current major mode of BUFFER
+is used.
+
+The behaviour is also controlled by entries for
+`inhibit-same-window', `reusable-frames' and
+`inhibit-switch-frame' as is done in the function
+`display-buffer-reuse-window'."
+ (let* ((alist-entry (assq 'reusable-frames alist))
+ (alist-mode-entry (assq 'mode alist))
+ (frames (cond (alist-entry (cdr alist-entry))
+ ((if (eq pop-up-frames 'graphic-only)
+ (display-graphic-p)
+ pop-up-frames)
+ 0)
+ (display-buffer-reuse-frames 0)
+ (t (last-nonminibuffer-frame))))
+ (inhibit-same-window-p (cdr (assq 'inhibit-same-window alist)))
+ (windows (window-list-1 nil 'nomini frames))
+ (buffer-mode (with-current-buffer buffer major-mode))
+ (allowed-modes (if alist-mode-entry
+ (cdr alist-mode-entry)
+ buffer-mode))
+ (curwin (selected-window))
+ (curframe (selected-frame)))
+ (unless (listp allowed-modes)
+ (setq allowed-modes (list allowed-modes)))
+ (let (same-mode-same-frame
+ same-mode-other-frame
+ derived-mode-same-frame
+ derived-mode-other-frame)
+ (dolist (window windows)
+ (let (mode? frame?)
+ (with-current-buffer (window-buffer window)
+ (setq mode?
+ (cond ((memq major-mode allowed-modes)
+ 'same)
+ ((derived-mode-p allowed-modes)
+ 'derived))))
+ (when (and mode?
+ (not (and inhibit-same-window-p
+ (eq window curwin))))
+ (if (eq curframe (window-frame window))
+ (if (eq mode? 'same)
+ (push window same-mode-same-frame)
+ (push window derived-mode-same-frame))
+ (if (eq mode? 'same)
+ (push window same-mode-other-frame)
+ (push window derived-mode-other-frame))))))
+ (let ((window (car (nconc same-mode-same-frame
+ same-mode-other-frame
+ derived-mode-same-frame
+ derived-mode-other-frame))))
+ (when (window-live-p window)
+ (prog1 (window--display-buffer buffer window 'reuse alist)
+ (unless (cdr (assq 'inhibit-switch-frame alist))
+ (window--maybe-raise-frame (window-frame window)))))))))
+
(defun display-buffer--special-action (buffer)
"Return special display action for BUFFER, if any.
If `special-display-p' returns non-nil for BUFFER, return an
diff --git a/src/process.c b/src/process.c
index 359cd21..56f036c 100644
--- a/src/process.c
+++ b/src/process.c
@@ -845,23 +845,19 @@ nil, indicating the current buffer's process. */)
#ifdef HAVE_GETADDRINFO_A
if (p->dns_request)
{
- int ret;
+ /* Cancel the request. Unless shutting down, wait until
+ completion. Free the request if completely canceled. */
- gai_cancel (p->dns_request);
- ret = gai_error (p->dns_request);
- if (ret == EAI_CANCELED || ret == 0)
- free_dns_request (process);
- else
+ bool canceled = gai_cancel (p->dns_request) != EAI_NOTCANCELED;
+ if (!canceled && !inhibit_sentinels)
{
- /* If we're called during shutdown, we don't really about
- freeing all the resources. Otherwise wait until
- completion, and then free the request. */
- if (! inhibit_sentinels)
- {
- gai_suspend ((struct gaicb const **) &p->dns_request, 1, NULL);
- free_dns_request (process);
- }
+ struct gaicb const *req = p->dns_request;
+ while (gai_suspend (&req, 1, NULL) != 0)
+ continue;
+ canceled = true;
}
+ if (canceled)
+ free_dns_request (process);
}
#endif
@@ -3814,7 +3810,14 @@ usage: (make-network-process &rest ARGS) */)
ret = getaddrinfo (SSDATA (host), portstring, &hints, &res);
if (ret)
#ifdef HAVE_GAI_STRERROR
- error ("%s/%s %s", SSDATA (host), portstring, gai_strerror (ret));
+ {
+ synchronize_system_messages_locale ();
+ char const *str = gai_strerror (ret);
+ if (! NILP (Vlocale_coding_system))
+ str = SSDATA (code_convert_string_norecord
+ (build_string (str), Vlocale_coding_system, 0));
+ error ("%s/%s %s", SSDATA (host), portstring, str);
+ }
#else
error ("%s/%s getaddrinfo error %d", SSDATA (host), portstring, ret);
#endif
@@ -3932,21 +3935,17 @@ usage: (make-network-process &rest ARGS) */)
}
#ifdef HAVE_GETADDRINFO_A
- /* If we're doing async address resolution, the list of addresses
- here will be nil, so we postpone connecting to the server. */
+ /* With async address resolution, the list of addresses is empty, so
+ postpone connecting to the server. */
if (!p->is_server && NILP (ip_addresses))
{
p->dns_request = dns_request;
p->status = Qconnect;
+ return proc;
}
- else
- {
- connect_network_socket (proc, ip_addresses);
- }
-#else /* HAVE_GETADDRINFO_A */
- connect_network_socket (proc, ip_addresses);
#endif
+ connect_network_socket (proc, ip_addresses);
return proc;
}
@@ -4657,13 +4656,12 @@ check_for_dns (Lisp_Object proc)
{
struct Lisp_Process *p = XPROCESS (proc);
Lisp_Object ip_addresses = Qnil;
- int ret = 0;
/* Sanity check. */
if (! p->dns_request)
return Qnil;
- ret = gai_error (p->dns_request);
+ int ret = gai_error (p->dns_request);
if (ret == EAI_INPROGRESS)
return Qt;
diff --git a/src/xfns.c b/src/xfns.c
index c1ce1b7..596b67c 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5354,7 +5354,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
Lisp_Object parms)
int width, height;
ptrdiff_t count = SPECPDL_INDEX ();
bool face_change_before = face_change;
- Lisp_Object buffer;
int x_width = 0, x_height = 0;
if (!dpyinfo->terminal->name)
@@ -5873,6 +5872,7 @@ Text larger than the specified size is clipped. */)
ptrdiff_t count = SPECPDL_INDEX ();
ptrdiff_t count_1;
Lisp_Object window, size;
+ AUTO_STRING (tip, " *tip*");
specbind (Qinhibit_redisplay, Qt);
@@ -6036,7 +6036,6 @@ Text larger than the specified size is clipped. */)
tip_f = XFRAME (tip_frame);
window = FRAME_ROOT_WINDOW (tip_f);
- AUTO_STRING (tip, " *tip*");
set_window_buffer (window, Fget_buffer_create (tip), false, false);
w = XWINDOW (window);
w->pseudo_window_p = true;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master ae6dc08 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs,
Alan Mackenzie <=