Merge from origin/emacs-27

09eed01afb Wrap some set-auto-mode calls with delay-mode-hooks (bug#3...
4a0a114505 Support ido-vertical-mode better
ef5fba9f40 Fix faces tab-bar and tab-line.
831508422e Cater for 3-argument version of pthread_setname_np
f27187f963 Clarify lexvar restrictions for add-to-ordered-list, add-t...
32763dac46 Replace add-to-list to lexical variable with push (bug#39373)
d07f177382 Clarify add-to-list documentation (bug#39373)
d3d2ea927c MH-E: alter content in mh-display-msg, not mh-show-mode
db7fa2546f Update documentation for mh-show-mode-hook
d10be6bf28 Example goto-addr hook: MH-E already uses goto-address

# Conflicts:
#	etc/NEWS
This commit is contained in:
Glenn Morris 2020-02-06 07:50:29 -08:00
commit 68d43392a6
24 changed files with 94 additions and 52 deletions

View file

@ -4192,6 +4192,21 @@ if test "$ac_cv_func_pthread_setname_np" = "yes"; then
AC_DEFINE(
HAVE_PTHREAD_SETNAME_NP_1ARG, 1,
[Define to 1 if pthread_setname_np takes a single argument.])
else
AC_CACHE_CHECK(
[whether pthread_setname_np takes three arguments],
[emacs_cv_pthread_setname_np_3arg],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <pthread.h>]],
[[pthread_setname_np (0, "%s", "a");]])],
[emacs_cv_pthread_setname_np_3arg=yes],
[emacs_cv_pthread_setname_np_3arg=no])])
if test "$emacs_cv_pthread_setname_np_3arg" = "yes"; then
AC_DEFINE(
HAVE_PTHREAD_SETNAME_NP_3ARG, 1,
[Define to 1 if pthread_setname_np takes three arguments.])
fi
fi
fi

View file

@ -2939,9 +2939,8 @@ done by calling @code{browse-url} as a subroutine
It can be useful to add @code{goto-address-mode} to mode hooks and
hooks for displaying an incoming message
(e.g., @code{rmail-show-message-hook} for Rmail, and
@code{mh-show-mode-hook} for MH-E). This is not needed for Gnus,
which has a similar feature of its own.
(e.g., @code{rmail-show-message-hook} for Rmail). This is not needed
for Gnus or MH-E, which have similar features of their own.
@node FFAP
@subsection Finding Files and URLs at Point

View file

@ -777,6 +777,9 @@ non-@code{nil}, it is added at the end.
The argument @var{symbol} is not implicitly quoted; @code{add-to-list}
is an ordinary function, like @code{set} and unlike @code{setq}. Quote
the argument yourself if that is what you want.
Do not use this function when @var{symbol} refers to a lexical
variable.
@end defun
Here's a scenario showing how to use @code{add-to-list}:
@ -799,8 +802,9 @@ foo ;; @r{@code{foo} was changed.}
@var{value})} is this:
@example
(or (member @var{value} @var{var})
(setq @var{var} (cons @var{value} @var{var})))
(if (member @var{value} @var{var})
@var{var}
(setq @var{var} (cons @var{value} @var{var})))
@end example
@defun add-to-ordered-list symbol element &optional order
@ -828,6 +832,7 @@ and unlike @code{setq}. Quote the argument yourself if necessary.
The ordering information is stored in a hash table on @var{symbol}'s
@code{list-order} property.
@var{symbol} cannot refer to a lexical variable.
@end defun
Here's a scenario showing how to use @code{add-to-ordered-list}:

View file

@ -572,6 +572,7 @@ and returns the updated history list. It limits the list length to
the value of @var{maxelt} (if non-@code{nil}) or @code{history-length}
(described below). The possible values of @var{maxelt} have the same
meaning as the values of @code{history-length}.
@var{history-var} cannot refer to a lexical variable.
Normally, @code{add-to-history} removes duplicate members from the
history list if @code{history-delete-duplicates} is non-@code{nil}.

View file

@ -2256,10 +2256,10 @@ signature block is more to your liking.
Two hooks can be used to control how messages are displayed. The first
hook, @code{mh-show-mode-hook}, is called early on in the process of
the message display. It is usually used to perform some action on the
message's content. The second hook, @code{mh-show-hook}, is the last
message's buffer. The second hook, @code{mh-show-hook}, is the last
thing called after messages are displayed. It's used to affect the
behavior of MH-E in general or when @code{mh-show-mode-hook} is too
early.
message's content, the behavior of MH-E in general, or when
@code{mh-show-mode-hook} is too early.
@cindex MH-Show mode
@cindex modes, MH-Show

View file

@ -2630,6 +2630,14 @@ will be chosen even if you have an entry for "image/*" in your
overrides all system and Emacs-provided defaults. To get the old
method back, set 'mailcap-prefer-mailcap-viewers' to nil.
** MH-E
+++
*** The hook 'mh-show-mode-hook' is now called before the message is inserted.
Functions that want to affect the message text (for example, to change
highlighting) can no longer use 'mh-show-mode-hook', because the
message contents will not yet have been inserted when the hook is
called. Such functions should now be attached to 'mh-show-hook'.
** URL
---

View file

@ -171,7 +171,7 @@ If this contains a %s, that will be replaced by the matching rule."
(mapatoms (lambda (mode)
(let ((name (symbol-name mode)))
(when (string-match "-mode$" name)
(add-to-list 'modes name)))))
(push name modes)))))
(sort modes 'string<)))
(completing-read "Local variables for mode: " v1 nil t)
" . (("

View file

@ -819,14 +819,12 @@ META-NAME is a cons (OVERLOADABLE-SYMBOL . MAJOR-MODE)."
)
;; Order symbols by type
(mapatoms
#'(lambda (s)
(add-to-list (cond
((get s 'mode-variable-flag)
(if (get s 'constant-flag) 'mc 'mv))
((get s 'override-flag)
(if (get s 'constant-flag) 'fo 'ov))
('us))
s))
(lambda (s) (push s (cond
((get s 'mode-variable-flag)
(if (get s 'constant-flag) mc mv))
((get s 'override-flag)
(if (get s 'constant-flag) fo ov))
(t us))))
table)
;; Print symbols by type
(when us

View file

@ -497,7 +497,9 @@ If MODE is not set, try to find mode automatically."
(let ((auto-mode-alist
(delq (rassq 'doc-view-mode-maybe auto-mode-alist)
(copy-sequence auto-mode-alist))))
(set-auto-mode)
;; Don't run hooks that might assume buffer-file-name
;; really associates buffer with a file (bug#39190).
(delay-mode-hooks (set-auto-mode))
(setq mode major-mode)))
;; Do not fontify if the guess mode is fundamental.
(unless (eq major-mode 'fundamental-mode)

View file

@ -4732,6 +4732,9 @@ For details of keybindings, see `ido-find-file'."
(delete-overlay ido--overlay))
(let ((o (make-overlay (point-max) (point-max) nil t t)))
(when (> (length inf) 0)
;; For hacks that redefine ido-completions function (bug#39379)
(when (eq (aref inf 0) ?\n)
(setq inf (concat " " inf)))
(put-text-property 0 1 'cursor t inf))
(overlay-put o 'after-string inf)
(setq ido--overlay o)))

View file

@ -3380,13 +3380,14 @@ used to affect the behavior of MH-E in general or when
(defcustom-mh mh-show-mode-hook nil
"Hook run upon entry to `mh-show-mode'.
This hook is called early on in the process of the message
display. It is usually used to perform some action on the
message's content. See `mh-show-hook'."
This hook is called early on in the process of the message display,
before the message contents have been inserted into the buffer.
It is usually used to perform some action on the
buffer itself. See also `mh-show-hook'."
:type 'hook
:group 'mh-hooks
:group 'mh-show
:package-version '(MH-E . "6.0"))
:package-version '(MH-E . "8.7"))
(defcustom-mh mh-unseen-updated-hook nil
"Hook run after the unseen sequence has been updated.

View file

@ -63,7 +63,7 @@ you wish to see all of them, use the command \\[mh-header-display].
Two hooks can be used to control how messages are displayed. The
first hook, `mh-show-mode-hook', is called early on in the
process of the message display. It is usually used to perform
some action on the message's content. The second hook,
some action on the message's buffer. The second hook,
`mh-show-hook', is the last thing called after messages are
displayed. It's used to affect the behavior of MH-E in general or
when `mh-show-mode-hook' is too early.
@ -234,6 +234,9 @@ Sets the current buffer to the show buffer."
(mh-add-missing-mime-version-header)
(setf (mh-buffer-data) (mh-make-buffer-data))
(mh-mime-display))
(mh-show-unquote-From)
(mh-show-xface)
(mh-show-addr)
;; Header cleanup
(goto-char (point-min))
(cond (clean-message-header
@ -840,9 +843,6 @@ See also `mh-folder-mode'.
(mh-tool-bar-init :show))
(set (make-local-variable 'mail-header-separator) mh-mail-header-separator)
(setq paragraph-start (default-value 'paragraph-start))
(mh-show-unquote-From)
(mh-show-xface)
(mh-show-addr)
(setq buffer-invisibility-spec '((vanish . t) t))
(set (make-local-variable 'line-move-ignore-invisible) t)
(make-local-variable 'font-lock-defaults)

View file

@ -5,7 +5,7 @@
;; Author: Eric Ding <ericding@alum.mit.edu>
;; Maintainer: emacs-devel@gnu.org
;; Created: 15 Aug 1995
;; Keywords: mh-e, www, mouse, mail
;; Keywords: www, mouse, mail
;; This file is part of GNU Emacs.
@ -32,10 +32,10 @@
;; INSTALLATION
;;
;; To use goto-address in a particular mode (for example, while
;; reading mail in mh-e), add this to your init file:
;; To use goto-address in a particular mode (this example uses
;; the fictional rich-text-mode), add this to your init file:
;;
;; (add-hook 'mh-show-mode-hook 'goto-address)
;; (add-hook 'rich-text-mode-hook 'goto-address)
;;
;; The mouse click method is bound to [mouse-2] on highlighted URLs or
;; e-mail addresses only; it functions normally everywhere else. To bind

View file

@ -368,7 +368,7 @@ used to cache connection properties of the local machine."
(let ((hash (gethash key tramp-cache-data))
properties)
(when (hash-table-p hash)
(maphash (lambda (x _y) (add-to-list 'properties x 'append)) hash))
(maphash (lambda (x _y) (push x properties)) hash))
properties))
(setq tramp-cache-data-changed t)
(remhash key tramp-cache-data))
@ -417,7 +417,7 @@ used to cache connection properties of the local machine."
(when (and (tramp-file-name-p key)
(null (tramp-file-name-localname key))
(tramp-connection-property-p key "process-buffer"))
(add-to-list 'result key)))
(push key result)))
tramp-cache-data)
result))

View file

@ -256,17 +256,17 @@ supported keys depend on the service type.")
"Return all discovered Avahi service names as list."
(let (result)
(maphash
(lambda (_key value) (add-to-list 'result (zeroconf-service-name value)))
(lambda (_key value) (push (zeroconf-service-name value) result))
zeroconf-services-hash)
result))
(delete-dups result)))
(defun zeroconf-list-service-types ()
"Return all discovered Avahi service types as list."
(let (result)
(maphash
(lambda (_key value) (add-to-list 'result (zeroconf-service-type value)))
(lambda (_key value) (push (zeroconf-service-type value) result))
zeroconf-services-hash)
result))
(delete-dups result)))
(defun zeroconf-list-services (type)
"Return all discovered Avahi services for a given service type TYPE.
@ -278,9 +278,9 @@ format of SERVICE."
(maphash
(lambda (_key value)
(when (equal type (zeroconf-service-type value))
(add-to-list 'result value)))
(push value result)))
zeroconf-services-hash)
result))
(delete-dups result)))
(defvar zeroconf-service-added-hooks-hash (make-hash-table :test 'equal)
"Hash table of hooks for newly added services.

View file

@ -18682,13 +18682,14 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
(and (string= org-dir contrib-dir)
(org-load-noerror-mustsuffix (concat contrib-dir f)))
(and (org-load-noerror-mustsuffix (concat (org-find-library-dir f) f))
(add-to-list 'load-uncore f 'append)
(push f load-uncore)
't)
f))
lfeat)))
(when load-uncore
(message "The following feature%s found in load-path, please check if that's correct:\n%s"
(if (> (length load-uncore) 1) "s were" " was") load-uncore))
(if (> (length load-uncore) 1) "s were" " was")
(reverse load-uncore)))
(if load-misses
(message "Some error occurred while reloading Org feature%s\n%s\nPlease check *Messages*!\n%s"
(if (> (length load-misses) 1) "s" "") load-misses (org-version nil 'full))

View file

@ -1845,6 +1845,7 @@ COMPARE-FN if that's non-nil.
If ELEMENT is added, it is added at the beginning of the list,
unless the optional argument APPEND is non-nil, in which case
ELEMENT is added at the end.
LIST-VAR should not refer to a lexical variable.
The return value is the new value of LIST-VAR.
@ -1934,6 +1935,7 @@ of ELEMENT if it has one.
The list order for each element is stored in LIST-VAR's
`list-order' property.
LIST-VAR cannot refer to a lexical variable.
The return value is the new value of LIST-VAR."
(let ((ordering (get list-var 'list-order)))
@ -1962,7 +1964,8 @@ variable. The possible values of maximum length have the same meaning as
the values of `history-length'.
Remove duplicates of NEWELT if `history-delete-duplicates' is non-nil.
If optional fourth arg KEEP-ALL is non-nil, add NEWELT to history even
if it is empty or duplicates the most recent entry in the history."
if it is empty or duplicates the most recent entry in the history.
HISTORY-VAR cannot refer to a lexical variable."
(unless maxelt
(setq maxelt (or (get history-var 'history-length)
history-length)))

View file

@ -51,11 +51,11 @@
:version "27.1")
(defface tab-bar
'((((type x w32 ns) (class color))
'((((class color) (min-colors 88))
:inherit variable-pitch
:background "grey85"
:foreground "black")
(((type x) (class mono))
(((class mono))
:background "grey")
(t
:inverse-video t))

View file

@ -42,12 +42,12 @@
:version "27.1")
(defface tab-line
'((((type x w32 ns) (class color))
'((((class color) (min-colors 88))
:inherit variable-pitch
:height 0.9
:background "grey85"
:foreground "black")
(((type x) (class mono))
(((class mono))
:background "grey")
(t
:inverse-video t))

View file

@ -2719,7 +2719,9 @@ hunk text is not found in the source file."
(cl-assert (null buffer-file-name))
(let ((enable-local-variables :safe) ;; to find `mode:'
(buffer-file-name file))
(set-auto-mode)
;; Don't run hooks that might assume buffer-file-name
;; really associates buffer with a file (bug#39190).
(delay-mode-hooks (set-auto-mode))
;; FIXME: Is this really worth the trouble?
(when (and (fboundp 'generic-mode-find-file-hook)
(memq #'generic-mode-find-file-hook

View file

@ -2098,7 +2098,9 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file."
;; For non-interactive, skip any questions
(let ((enable-local-variables :safe) ;; to find `mode:'
(buffer-file-name file))
(ignore-errors (set-auto-mode)))
;; Don't run hooks that might assume buffer-file-name
;; really associates buffer with a file (bug#39190).
(ignore-errors (delay-mode-hooks (set-auto-mode))))
(normal-mode))
(set-buffer-modified-p nil)
(setq buffer-read-only t))

View file

@ -1684,7 +1684,7 @@ cleaning up these problems."
(mapcar
#'(lambda (option)
(when force
(add-to-list 'style (car option)))
(push (car option) style))
(goto-char rstart)
(let ((regexp
(cond

View file

@ -214,11 +214,13 @@ sys_thread_set_name (const char *name)
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
# ifdef HAVE_PTHREAD_SETNAME_NP_1ARG
pthread_setname_np (p_name);
#else
# elif defined HAVE_PTHREAD_SETNAME_NP_3ARG
pthread_setname_np (pthread_self (), "%s", p_name);
# else
pthread_setname_np (pthread_self (), p_name);
#endif
# endif
#endif
}

View file

@ -227,7 +227,7 @@ Evaluate BODY for each created map.
(with-maps-do map
(let ((result nil))
(map-do (lambda (k v)
(add-to-list 'result (list (int-to-string k) v)))
(push (list (int-to-string k) v) result))
map)
(should (equal result '(("2" 5) ("1" 4) ("0" 3)))))))