1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-20 18:17:20 +00:00

Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs

This commit is contained in:
Alan Mackenzie 2016-03-10 11:46:36 +00:00
commit ae6dc08e0c
5 changed files with 108 additions and 27 deletions

View File

@ -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
@defun 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
@code{mode} 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
@code{inhibit-same-window}, @code{reusable-frames} and
@code{inhibit-switch-frame} as is done in the function
@code{display-buffer-reuse-window}.
@end 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

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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;