Commit b968b733 authored by Glenn Morris's avatar Glenn Morris

Merge from origin/emacs-27

6cd9ccb0 (origin/emacs-27) Fix compression of directories in Dired
42329e6d ; * etc/NEWS: Review of the whole text.
af5709f1 Further enhancement on `tramp-file-local-name'
fb432446 Objective C Mode imenu: cease recognizing "functions" with...
a18373a9 ; * etc/NEWS: Update the text about the XDG_CONFIG_HOME/em...
73fd8a4b Fix BSD and macOS builds w.r.t. pthread_setname_np (bug#38...
f54b2430 Scale top-left coordinates in display-monitor-attributes-list
b46c75b1 xref-matches-in-files: Big Tramp speed-up
883b3490 * lisp/net/tramp.el (tramp-file-local-name): Remove `save-...
c01f55f1 Fix rendering bug due to unsynchronized cairo surface size...
075f21c0 Avoid crash by access to cleared img->pixmap->data/img->ma...
16c6dfb4 Avoid assertion violations in very small-height windows
9063124b Use pthread_setname_np to set thread name

# Conflicts:
#	etc/NEWS
#	lisp/net/tramp.el
parents f8a0b029 6cd9ccb0
Pipeline #4516 passed with stage
in 54 minutes and 23 seconds
......@@ -1767,7 +1767,7 @@ AC_CHECK_HEADERS_ONCE(
sys/sysinfo.h
coff.h pty.h
sys/resource.h
sys/utsname.h pwd.h utmp.h util.h sys/prctl.h)
sys/utsname.h pwd.h utmp.h util.h)
AC_CACHE_CHECK([for ADDR_NO_RANDOMIZE],
[emacs_cv_personality_addr_no_randomize],
......@@ -4192,9 +4192,26 @@ pthread_sigmask strsignal setitimer timer_getoverrun \
sendto recvfrom getsockname getifaddrs freeifaddrs \
gai_strerror sync \
getpwent endpwent getgrent endgrent \
cfmakeraw cfsetspeed __executable_start log2 prctl)
cfmakeraw cfsetspeed __executable_start log2 pthread_setname_np)
LIBS=$OLD_LIBS
if test "$ac_cv_func_pthread_setname_np" = "yes"; then
AC_CACHE_CHECK(
[whether pthread_setname_np takes a single argument],
[emacs_cv_pthread_setname_np_1arg],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <pthread.h>]],
[[pthread_setname_np ("a");]])],
[emacs_cv_pthread_setname_np_1arg=yes],
[emacs_cv_pthread_setname_np_1arg=no])])
if test "$emacs_cv_pthread_setname_np_1arg" = "yes"; then
AC_DEFINE(
HAVE_PTHREAD_SETNAME_NP_1ARG, 1,
[Define to 1 if pthread_setname_np takes a single argument.])
fi
fi
dnl No need to check for posix_memalign if aligned_alloc works.
AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break])
AC_CHECK_DECLS([aligned_alloc], [], [], [[#include <stdlib.h>]])
......
This diff is collapsed.
......@@ -992,7 +992,14 @@ command with a prefix argument (the value does not matter)."
(ignore-errors (dired-remove-entry new-file))
(goto-char start)
;; Now replace the current line with an entry for NEW-FILE.
(dired-update-file-line new-file) nil)
;; But don't remove the current line if either FROM-FILE or
;; NEW-FILE is a directory, because compressing/uncompressing
;; directories doesn't remove the original.
(if (or (file-directory-p from-file)
(file-directory-p new-file))
(dired-add-entry new-file nil t)
(dired-update-file-line new-file))
nil)
(dired-log (concat "Failed to (un)compress " from-file))
from-file)))
......@@ -1020,8 +1027,9 @@ command with a prefix argument (the value does not matter)."
("\\.7z\\'" "" "7z x -aoa -o%o %i")
;; This item controls naming for compression.
("\\.tar\\'" ".tgz" nil)
;; This item controls the compression of directories
(":" ".tar.gz" "tar -cf - %i | gzip -c9 > %o"))
;; This item controls the compression of directories. Its REGEXP
;; element should never match any valid file name.
("\000" ".tar.gz" "tar -cf - %i | gzip -c9 > %o"))
"Control changes in file name suffixes for compression and uncompression.
Each element specifies one transformation rule, and has the form:
(REGEXP NEW-SUFFIX PROGRAM)
......@@ -1145,7 +1153,7 @@ Return nil if no change in files."
(condition-case nil
(if (file-directory-p file)
(progn
(setq suffix (cdr (assoc ":" dired-compress-file-suffixes)))
(setq suffix (cdr (assoc "\000" dired-compress-file-suffixes)))
(when suffix
(let ((out-name (concat file (car suffix)))
(default-directory (file-name-directory file)))
......
......@@ -1330,8 +1330,7 @@ entry does not exist, return nil."
t))
;; This function bypasses the file name handler approach. It is NOT
;; recommended to use it in any package if not absolutely necessary,
;; because it won't work for remote file names not supported by Tramp.
;; recommended to use it in any package if not absolutely necessary.
;; However, it is more performant than `file-local-name', and might be
;; useful where performance matters, like in operations over a bulk
;; list of file names.
......@@ -1339,16 +1338,14 @@ entry does not exist, return nil."
"Return the local name component of NAME.
This function removes from NAME the specification of the remote
host and the method of accessing the host, leaving only the part
that identifies NAME locally on the remote system. NAME must be
a string that matches `tramp-file-name-regexp'. If NAME does not
match `tramp-file-name-regexp', just NAME is returned. The
returned file name can be used directly as argument of
`process-file', `start-file-process', or `shell-command'."
(save-match-data
(or (and (tramp-tramp-file-p name)
(string-match (nth 0 tramp-file-name-structure) name)
(match-string (nth 4 tramp-file-name-structure) name))
name)))
that identifies NAME locally on the remote system. If NAME does
not match `tramp-file-name-regexp', just `file-local-name' is
called. The returned file name can be used directly as argument
of `process-file', `start-file-process', or `shell-command'."
(or (and (tramp-tramp-file-p name)
(string-match (nth 0 tramp-file-name-structure) name)
(match-string (nth 4 tramp-file-name-structure) name))
(tramp-compat-file-local-name name)))
;; The localname can be quoted with "/:". Extract this.
(defun tramp-unquote-file-local-name (name)
......
......@@ -45,6 +45,7 @@
(cc-bytecomp-defvar imenu-case-fold-search)
(cc-bytecomp-defvar imenu-generic-expression)
(cc-bytecomp-defvar imenu-create-index-function)
(cc-bytecomp-defun c-literal-limits)
;; imenu integration
......@@ -437,55 +438,56 @@ Example:
(goto-char (point-max))
;;
(while (re-search-backward cc-imenu-objc-generic-expression nil t)
(setq langnum (if (match-beginning OBJC)
OBJC
(cond
((match-beginning Cproto) Cproto)
((match-beginning Cgeneralfunc) Cgeneralfunc)
((match-beginning Cnoreturn) Cnoreturn))))
(setq str (funcall func (match-beginning langnum) (match-end langnum)))
;;
(cond
;;
;; C
;;
((not (eq langnum OBJC))
(setq clist (cons (cons str (match-beginning langnum)) clist)))
;;
;; ObjC
;;
;; An instance Method
((eq (aref str 0) ?-)
(setq str (concat "-" (cc-imenu-objc-method-to-selector str)))
(setq methodlist (cons (cons str
(match-beginning langnum))
methodlist)))
;; A factory Method
((eq (aref str 0) ?+)
(setq str (concat "+" (cc-imenu-objc-method-to-selector str)))
(setq methodlist (cons (cons str
(match-beginning langnum))
methodlist)))
;; Interface or implementation or protocol
((eq (aref str 0) ?@)
(setq classcount (1+ classcount))
(when (not (c-literal-limits))
(setq langnum (if (match-beginning OBJC)
OBJC
(cond
((match-beginning Cproto) Cproto)
((match-beginning Cgeneralfunc) Cgeneralfunc)
((match-beginning Cnoreturn) Cnoreturn))))
(setq str (funcall func (match-beginning langnum) (match-end langnum)))
;;
(cond
((and (> (length str) implen)
(string= (substring str 0 implen) "@implementation"))
(setq str (substring str implen)
str2 "@implementation"))
((string= (substring str 0 intflen) "@interface")
(setq str (substring str intflen)
str2 "@interface"))
((string= (substring str 0 prtlen) "@protocol")
(setq str (substring str prtlen)
str2 "@protocol")))
(setq str (cc-imenu-objc-remove-white-space str))
(setq methodlist (cons (cons str2
(match-beginning langnum))
methodlist))
(setq toplist (cons (cons str methodlist) toplist)
methodlist nil))))
;;
;; C
;;
((not (eq langnum OBJC))
(setq clist (cons (cons str (match-beginning langnum)) clist)))
;;
;; ObjC
;;
;; An instance Method
((eq (aref str 0) ?-)
(setq str (concat "-" (cc-imenu-objc-method-to-selector str)))
(setq methodlist (cons (cons str
(match-beginning langnum))
methodlist)))
;; A factory Method
((eq (aref str 0) ?+)
(setq str (concat "+" (cc-imenu-objc-method-to-selector str)))
(setq methodlist (cons (cons str
(match-beginning langnum))
methodlist)))
;; Interface or implementation or protocol
((eq (aref str 0) ?@)
(setq classcount (1+ classcount))
(cond
((and (> (length str) implen)
(string= (substring str 0 implen) "@implementation"))
(setq str (substring str implen)
str2 "@implementation"))
((string= (substring str 0 intflen) "@interface")
(setq str (substring str intflen)
str2 "@interface"))
((string= (substring str 0 prtlen) "@protocol")
(setq str (substring str prtlen)
str2 "@protocol")))
(setq str (cc-imenu-objc-remove-white-space str))
(setq methodlist (cons (cons str2
(match-beginning langnum))
methodlist))
(setq toplist (cons (cons str methodlist) toplist)
methodlist nil)))))
;; In this buffer, there is only one or zero @{interface|implementation|protocol}.
(if (< classcount 2)
......
......@@ -1218,6 +1218,9 @@ IGNORES is a list of glob patterns for files to ignore."
#'xref-matches-in-directory
"27.1")
(declare-function tramp-tramp-file-p "tramp")
(declare-function tramp-file-local-name "tramp")
;;;###autoload
(defun xref-matches-in-files (regexp files)
"Find all matches for REGEXP in FILES.
......@@ -1240,7 +1243,12 @@ FILES must be a list of absolute file names."
"")
(shell-quote-argument (xref--regexp-to-extended regexp)))))
(when remote-id
(setq files (mapcar #'file-local-name files)))
(require 'tramp)
(setq files (mapcar
(if (tramp-tramp-file-p dir)
#'tramp-file-local-name
#'file-local-name)
files)))
(with-current-buffer output
(erase-buffer)
(with-temp-buffer
......
......@@ -1242,6 +1242,10 @@ prepare_image_for_display (struct frame *f, struct image *img)
if (img->cr_data == NULL || (cairo_pattern_get_type (img->cr_data)
!= CAIRO_PATTERN_TYPE_SURFACE))
{
/* Fill in the background/background_transparent field while
we have img->pixmap->data/img->mask->data. */
IMAGE_BACKGROUND (img, f, img->pixmap);
IMAGE_BACKGROUND_TRANSPARENT (img, f, img->mask);
cr_put_image_to_cr_data (img);
if (img->cr_data == NULL)
{
......
......@@ -98,10 +98,6 @@ sys_thread_yield (void)
#include <sched.h>
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
#endif
void
sys_mutex_init (sys_mutex_t *mutex)
{
......@@ -204,9 +200,28 @@ sys_thread_equal (sys_thread_t t, sys_thread_t u)
return pthread_equal (t, u);
}
void
sys_thread_set_name (const char *name)
{
#ifdef HAVE_PTHREAD_SETNAME_NP
/* We need to truncate here otherwise pthread_setname_np
fails to set the name. TASK_COMM_LEN is what the length
is called in the Linux kernel headers (Bug#38632). */
#define TASK_COMM_LEN 16
char p_name[TASK_COMM_LEN];
strncpy (p_name, name, TASK_COMM_LEN - 1);
p_name[TASK_COMM_LEN - 1] = '\0';
#ifdef HAVE_PTHREAD_SETNAME_NP_1ARG
pthread_setname_np (p_name);
#else
pthread_setname_np (pthread_self (), p_name);
#endif
#endif
}
bool
sys_thread_create (sys_thread_t *thread_ptr, const char *name,
thread_creation_function *func, void *arg)
sys_thread_create (sys_thread_t *thread_ptr, thread_creation_function *func,
void *arg)
{
pthread_attr_t attr;
bool result = false;
......@@ -225,13 +240,7 @@ sys_thread_create (sys_thread_t *thread_ptr, const char *name,
}
if (!pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED))
{
result = pthread_create (thread_ptr, &attr, func, arg) == 0;
#if defined (HAVE_SYS_PRCTL_H) && defined (HAVE_PRCTL) && defined (PR_SET_NAME)
if (result && name != NULL)
prctl (PR_SET_NAME, name);
#endif
}
result = pthread_create (thread_ptr, &attr, func, arg) == 0;
out: ;
int error = pthread_attr_destroy (&attr);
......@@ -452,26 +461,24 @@ w32_set_thread_name (DWORD thread_id, const char *name)
static thread_creation_function *thread_start_address;
void
sys_thread_set_name (const char *name)
{
w32_set_thread_name (GetCurrentThreadId (), name);
}
/* _beginthread wants a void function, while we are passed a function
that returns a pointer. So we use a wrapper. See the command in
w32term.h about the need for ALIGN_STACK attribute. */
static void ALIGN_STACK
w32_beginthread_wrapper (void *arg)
{
/* FIXME: This isn't very clean: systhread.c is not supposed to know
that ARG is a pointer to a thread_state object, or be familiar
with thread_state object's structure in general. */
struct thread_state *this_thread = arg;
if (this_thread->thread_name)
w32_set_thread_name (GetCurrentThreadId (), this_thread->thread_name);
(void)thread_start_address (arg);
}
bool
sys_thread_create (sys_thread_t *thread_ptr, const char *name,
thread_creation_function *func, void *arg)
sys_thread_create (sys_thread_t *thread_ptr, thread_creation_function *func,
void *arg)
{
/* FIXME: Do threads that run Lisp require some minimum amount of
stack? Zero here means each thread will get the same amount as
......
......@@ -112,10 +112,11 @@ extern sys_thread_t sys_thread_self (void)
extern bool sys_thread_equal (sys_thread_t, sys_thread_t)
ATTRIBUTE_WARN_UNUSED_RESULT;
extern bool sys_thread_create (sys_thread_t *, const char *,
thread_creation_function *, void *)
extern bool sys_thread_create (sys_thread_t *, thread_creation_function *,
void *)
ATTRIBUTE_WARN_UNUSED_RESULT;
extern void sys_thread_yield (void);
extern void sys_thread_set_name (const char *);
#endif /* SYSTHREAD_H */
......@@ -725,6 +725,9 @@ run_thread (void *state)
self->m_stack_bottom = self->stack_top = (char *) &stack_pos;
self->thread_id = sys_thread_self ();
if (self->thread_name)
sys_thread_set_name (self->thread_name);
acquire_global_lock (self);
/* Put a dummy catcher at top-level so that handlerlist is never NULL.
......@@ -826,13 +829,13 @@ If NAME is given, it must be a string; it names the new thread. */)
new_thread->next_thread = all_threads;
all_threads = new_thread;
char const *c_name = !NILP (name) ? SSDATA (ENCODE_UTF_8 (name)) : NULL;
char const *c_name = !NILP (name) ? SSDATA (ENCODE_SYSTEM (name)) : NULL;
if (c_name)
new_thread->thread_name = xstrdup (c_name);
else
new_thread->thread_name = NULL;
sys_thread_t thr;
if (! sys_thread_create (&thr, c_name, run_thread, new_thread))
if (! sys_thread_create (&thr, run_thread, new_thread))
{
/* Restore the previous situation. */
all_threads = all_threads->next_thread;
......
......@@ -169,8 +169,7 @@ struct thread_state
interrupter should broadcast to this condition. */
sys_cond_t *wait_condvar;
/* Thread's name in the locale encoding. Actually used only on
WINDOWSNT. */
/* Thread's name in the locale encoding. */
char *thread_name;
/* This thread might have released the global lock. If so, this is
......
......@@ -16244,8 +16244,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
bool string_from_text_prop = false;
/* Don't even try doing anything if called for a mode-line or
header-line row, since the rest of the code isn't prepared to
deal with such calamities. */
header-line or tab-line row, since the rest of the code isn't
prepared to deal with such calamities. */
eassert (!row->mode_line_p);
if (row->mode_line_p)
return false;
......@@ -17504,6 +17504,9 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp,
else
{
row = MATRIX_ROW (w->current_matrix, w->last_cursor_vpos);
/* Skip the tab-line and header-line rows, if any. */
if (row->tab_line_p)
++row;
if (row->mode_line_p)
++row;
if (!row->enabled_p)
......@@ -17576,6 +17579,9 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp,
|| row->mode_line_p)
{
row = w->current_matrix->rows;
/* Skip the tab-line and header-line rows, if any. */
if (row->tab_line_p)
++row;
if (row->mode_line_p)
++row;
}
......@@ -17640,8 +17646,9 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp,
;
else if (rc != CURSOR_MOVEMENT_SUCCESS
&& MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
/* Make sure this isn't a header line by any chance, since
then MATRIX_ROW_PARTIALLY_VISIBLE_P might yield true. */
/* Make sure this isn't a header line nor a tab-line by
any chance, since then MATRIX_ROW_PARTIALLY_VISIBLE_P
might yield true. */
&& !row->mode_line_p
&& !cursor_row_fully_visible_p (w, true, true, true))
{
......@@ -18769,11 +18776,14 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
}
}
/* Finally, fall back on the first row of the window after the
header line (if any). This is slightly better than not
displaying the cursor at all. */
tab-line and header line (if any). This is slightly better
than not displaying the cursor at all. */
if (!row)
{
row = matrix->rows;
/* Skip the tab-line and header-line rows, if any. */
if (row->tab_line_p)
++row;
if (row->mode_line_p)
++row;
}
......@@ -19787,7 +19797,9 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
ptrdiff_t mindif = BUF_ZV (XBUFFER (w->contents)) + 1;
int last_y;
/* If we happen to start on a header-line, skip that. */
/* If we happen to start on a header-line or a tab-line, skip that. */
if (row->tab_line_p)
++row;
if (row->mode_line_p)
++row;
......@@ -22380,7 +22392,7 @@ find_row_edges (struct it *it, struct glyph_row *row,
if (STRINGP (it->object)
/* this is not the first row */
&& row > it->w->desired_matrix->rows
/* previous row is not the header line */
/* previous row is not the header line or tab-line */
&& !r1->mode_line_p
/* previous row also ends in a newline from a string */
&& r1->ends_in_newline_from_string_p)
......@@ -5089,6 +5089,8 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#elif defined HAVE_GTK3
scale = gdk_screen_get_monitor_scale_factor (gscreen, i);
#endif
rec.x *= scale;
rec.y *= scale;
rec.width *= scale;
rec.height *= scale;
work.x *= scale;
......
......@@ -8934,6 +8934,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (f)
x_cr_update_surface_desired_size (f, configureEvent.xconfigure.width,
configureEvent.xconfigure.height);
else if (any && configureEvent.xconfigure.window == FRAME_X_WINDOW (any))
x_cr_update_surface_desired_size (any,
configureEvent.xconfigure.width,
configureEvent.xconfigure.height);
#endif
#ifdef USE_GTK
if (!f
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment