Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-07-28 08:22:01 +08:00
commit 7c08995864
12 changed files with 253 additions and 181 deletions

View file

@ -2888,6 +2888,13 @@ must be the result of a previous @code{notifications-notify} call.
@item :app-icon @var{icon-file}
The file name of the notification icon. If set to @code{nil}, no icon
is displayed. The default is @code{notifications-application-icon}.
If the value is a string, the function interprets it as a file name
and converts to absolute by using @code{expand-file-name}; if it is a
symbol, the function will use its name (which is useful when using the
Icon Naming Specification @footnote{For more information about icon
naming convention see
@uref{https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html,
Icon Naming Specification}}).
@item :actions (@var{key} @var{title} @var{key} @var{title} ...)
A list of actions to be applied. @var{key} and @var{title} are both

View file

@ -597,6 +597,21 @@ Similarly to buffer restoration by Desktop, 'recentf-mode' checking
of the accessibility of remote files can now time out if
'remote-file-name-access-timeout' is set to a positive number.
** Notifications
+++
*** Allow to use Icon Naming Specification for app-icon
You can use a symbol as the value for ':app-icon' to provide icon name
without specifying a file, like this:
(notifications-notify
:title "I am playing music" :app-icon 'multimedia-player)
** Image Dired
*** New user option 'image-dired-thumb-naming'.
You can now configure how a thumbnail is named using this option.
* New Modes and Packages in Emacs 30.1

View file

@ -786,6 +786,17 @@ for speeding up processing.")
make-marker copy-marker point-marker mark-marker
set-marker
kbd key-description
skip-chars-forward skip-chars-backward
skip-syntax-forward skip-syntax-backward
current-column current-indentation
char-syntax syntax-class-to-char
parse-partial-sexp goto-char forward-line
next-window previous-window minibuffer-window
selected-frame selected-window
standard-case-table standard-syntax-table
syntax-table
frame-first-window frame-root-window
frame-selected-window
always))
t)
((eq head 'if)

View file

@ -4306,9 +4306,6 @@ This function is never called when `lexical-binding' is nil."
;; more complicated compiler macros
(byte-defop-compiler char-before)
(byte-defop-compiler backward-char)
(byte-defop-compiler backward-word)
(byte-defop-compiler list)
(byte-defop-compiler concat)
(byte-defop-compiler (indent-to-column byte-indent-to) byte-compile-indent-to)
@ -4319,40 +4316,6 @@ This function is never called when `lexical-binding' is nil."
(byte-defop-compiler (/ byte-quo) byte-compile-quo)
(byte-defop-compiler nconc)
;; Is this worth it? Both -before and -after are written in C.
(defun byte-compile-char-before (form)
(cond ((or (= 1 (length form))
(and (= 2 (length form)) (not (nth 1 form))))
(byte-compile-form '(char-after (1- (point)))))
((= 2 (length form))
(byte-compile-form (list 'char-after (if (numberp (nth 1 form))
(1- (nth 1 form))
`(1- (or ,(nth 1 form)
(point)))))))
(t (byte-compile-subr-wrong-args form "0-1"))))
;; backward-... ==> forward-... with negated argument.
;; Is this worth it? Both -backward and -forward are written in C.
(defun byte-compile-backward-char (form)
(cond ((or (= 1 (length form))
(and (= 2 (length form)) (not (nth 1 form))))
(byte-compile-form '(forward-char -1)))
((= 2 (length form))
(byte-compile-form (list 'forward-char (if (numberp (nth 1 form))
(- (nth 1 form))
`(- (or ,(nth 1 form) 1))))))
(t (byte-compile-subr-wrong-args form "0-1"))))
(defun byte-compile-backward-word (form)
(cond ((or (= 1 (length form))
(and (= 2 (length form)) (not (nth 1 form))))
(byte-compile-form '(forward-word -1)))
((= 2 (length form))
(byte-compile-form (list 'forward-word (if (numberp (nth 1 form))
(- (nth 1 form))
`(- (or ,(nth 1 form) 1))))))
(t (byte-compile-subr-wrong-args form "0-1"))))
(defun byte-compile-list (form)
(let ((count (length (cdr form))))
(cond ((= count 0)
@ -5797,6 +5760,28 @@ and corresponding effects."
(put 'remq 'compiler-macro #'bytecomp--check-memq-args)
(put 'delq 'compiler-macro #'bytecomp--check-memq-args)
;; Implement `char-before', `backward-char' and `backward-word' in
;; terms of `char-after', `forward-char' and `forward-word' which have
;; their own byte-ops.
(put 'char-before 'compiler-macro #'bytecomp--char-before)
(defun bytecomp--char-before (form &optional arg &rest junk-args)
(if junk-args
form ; arity error
`(char-after (1- (or ,arg (point))))))
(put 'backward-char 'compiler-macro #'bytecomp--backward-char)
(defun bytecomp--backward-char (form &optional arg &rest junk-args)
(if junk-args
form ; arity error
`(forward-char (- (or ,arg 1)))))
(put 'backward-word 'compiler-macro #'bytecomp--backward-word)
(defun bytecomp--backward-word (form &optional arg &rest junk-args)
(if junk-args
form ; arity error
`(forward-word (- (or ,arg 1)))))
(provide 'byte-compile)
(provide 'bytecomp)

View file

@ -1003,7 +1003,8 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
(symbol-name function)))))))
(real-def (cond
((and aliased (not (subrp def)))
(car (function-alias-p real-function)))
(or (car (function-alias-p real-function))
real-function))
((subrp def) (intern (subr-name def)))
(t def))))

View file

@ -30,6 +30,7 @@
(eval-when-compile (require 'cl-lib))
(defvar image-dired-dir)
(defvar image-dired-thumb-naming)
(defvar image-dired-thumbnail-storage)
(defconst image-dired--thumbnail-standard-sizes
@ -57,42 +58,59 @@ Create the thumbnail directory if it does not exist."
(message "Thumbnail directory created: %s" image-dired-dir))
image-dired-dir))
(defun image-dired-contents-sha1 (filename)
"Compute the SHA-1 of the first 4KiB of FILENAME's contents."
(with-temp-buffer
(insert-file-contents-literally filename nil 0 4096)
(sha1 (current-buffer))))
(defun image-dired-thumb-name (file)
"Return absolute file name for thumbnail FILE.
Depending on the value of `image-dired-thumbnail-storage', the
file name of the thumbnail will vary:
- For `use-image-dired-dir', make a SHA1-hash of the image file's
directory name and add that to make the thumbnail file name
unique.
- For `per-directory' storage, just add a subdirectory.
- For `standard' storage, produce the file name according to the
Thumbnail Managing Standard. Among other things, an MD5-hash
of the image file's directory name will be added to the
filename.
See also `image-dired-thumbnail-storage'."
Depending on the value of `image-dired-thumbnail-storage' and
`image-dired-thumb-naming', the file name of the thumbnail will
vary:
- If `image-dired-thumbnail-storage' is set to one of the value
of `image-dired--thumbnail-standard-sizes', produce the file
name according to the Thumbnail Managing Standard. Among other
things, an MD5-hash of the image file's directory name will be
added to the file name.
- Otherwise `image-dired-thumbnail-storage' is used to set the
directory where to store the thumbnail. In this latter case
the name given to the thumbnail depends on the value of
`image-dired-thumb-naming'.
See also `image-dired-thumbnail-storage' and
`image-dired-thumb-naming'."
(let ((file (expand-file-name file)))
(cond ((memq image-dired-thumbnail-storage
image-dired--thumbnail-standard-sizes)
(let ((thumbdir (cl-case image-dired-thumbnail-storage
(standard "thumbnails/normal")
(standard-large "thumbnails/large")
(standard-x-large "thumbnails/x-large")
(standard-xx-large "thumbnails/xx-large"))))
(expand-file-name
;; MD5 is mandated by the Thumbnail Managing Standard.
(concat (md5 (concat "file://" file)) ".png")
(expand-file-name thumbdir (xdg-cache-home)))))
((or (eq 'image-dired image-dired-thumbnail-storage)
;; Maintained for backwards compatibility:
(eq 'use-image-dired-dir image-dired-thumbnail-storage))
(expand-file-name (format "%s.jpg" (sha1 file))
(image-dired-dir)))
((eq 'per-directory image-dired-thumbnail-storage)
(expand-file-name (format "%s.thumb.jpg"
(file-name-nondirectory file))
(expand-file-name
".image-dired"
(file-name-directory file)))))))
(if (memq image-dired-thumbnail-storage
image-dired--thumbnail-standard-sizes)
(let ((thumbdir (cl-case image-dired-thumbnail-storage
(standard "thumbnails/normal")
(standard-large "thumbnails/large")
(standard-x-large "thumbnails/x-large")
(standard-xx-large "thumbnails/xx-large"))))
(expand-file-name
;; MD5 and PNG is mandated by the Thumbnail Managing
;; Standard.
(concat (md5 (concat "file://" file)) ".png")
(expand-file-name thumbdir (xdg-cache-home))))
(let ((name (if (eq 'sha1-contents image-dired-thumb-naming)
(image-dired-contents-sha1 file)
;; Defaults to SHA-1 of file name
(if (eq 'per-directory image-dired-thumbnail-storage)
(sha1 (file-name-nondirectory file))
(sha1 file)))))
(cond ((or (eq 'image-dired image-dired-thumbnail-storage)
;; Maintained for backwards compatibility:
(eq 'use-image-dired-dir image-dired-thumbnail-storage))
(expand-file-name (format "%s.jpg" name) (image-dired-dir)))
((eq 'per-directory image-dired-thumbnail-storage)
(expand-file-name (format "%s.jpg" name)
(expand-file-name
".image-dired"
(file-name-directory file)))))))))
(defvar image-dired-thumbnail-buffer "*image-dired*"
"Image-Dired's thumbnail buffer.")

View file

@ -162,8 +162,27 @@ to use the Thumbnail Managing Standard; they will be saved in
`image-dired-thumbnail-storage'."
:type 'directory)
(defcustom image-dired-thumb-naming 'sha1-filename
"How `image-dired' names thumbnail files.
When set to `sha1-filename' the name of thumbnail is built by
computing the SHA-1 of the full file name of the image.
When set to `sha1-contents' the name of thumbnail is built by
computing the SHA-1 of first 4KiB of the image contents (See
`image-dired-contents-sha1').
In both case, a \"jpg\" extension is appended to save as JPEG.
The value of this option is ignored if Image-Dired is customized
to use the Thumbnail Managing Standard. See
`image-dired-thumbnail-storage'."
:type '(choice :tag "How to name thumbnail files"
(const :tag "SHA-1 of the image file name" sha1-filename)
(const :tag "SHA-1 of the image contents" sha1-contents))
:version "30.1")
(defcustom image-dired-thumbnail-storage 'image-dired
"How `image-dired' stores thumbnail files.
"Where `image-dired' stores thumbnail files.
There are three ways that Image-Dired can store and generate
thumbnails:
@ -189,6 +208,9 @@ thumbnails:
Set this user option to `per-directory'.
To control the naming of thumbnails for alternatives (2) and (3)
above, customize the value of `image-dired-thumb-naming'.
To control the default size of thumbnails for alternatives (2)
and (3) above, customize the value of `image-dired-thumb-size'.
@ -197,7 +219,7 @@ format, as mandated by that standard; otherwise save them as JPEG.
For more information on the Thumbnail Managing Standard, see:
https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html"
:type '(choice :tag "How to store thumbnail files"
:type '(choice :tag "Where to store thumbnail files"
(const :tag "Use image-dired-dir" image-dired)
(const :tag "Thumbnail Managing Standard (normal 128x128)"
standard)

View file

@ -2715,7 +2715,8 @@ the result will be a local, non-Tramp, file name."
;; there could be the false positive "/:".
(if (or (and (eq system-type 'windows-nt)
(string-match-p
(rx bol (| (: alpha ":") (: (literal null-device) eol))) name))
(rx bol (| (: alpha ":") (: (literal (or null-device "")) eol)))
name))
(and (not (tramp-tramp-file-p name))
(not (tramp-tramp-file-p dir))))
(tramp-run-real-handler #'expand-file-name (list name dir))

View file

@ -7054,5 +7054,7 @@ If VEC is `tramp-null-hop', return local null device."
;; "/ssh:user1@host:~user2".
;;
;; * Implement file name abbreviation for user and host names.
;;
;; * Implement user and host name completion for multi-hops.
;;; tramp.el ends here

View file

@ -137,6 +137,12 @@ Various PARAMS can be set:
:app-icon The notification icon.
Default is `notifications-application-icon'.
Set to nil if you do not want any icon displayed.
If the value is a string, the function
interprets it as a file name and converts to
absolute by using `expand-file-name'; if it is a
symbol, the function will use its name (which is
useful when using the Icon Naming
Specification).
:actions A list of actions in the form:
(KEY TITLE KEY TITLE ...)
where KEY and TITLE are both strings.
@ -304,7 +310,10 @@ of another `notifications-notify' call."
notifications-application-name)
:uint32 (or replaces-id 0)
:string (if app-icon
(expand-file-name app-icon)
(if (stringp app-icon)
(expand-file-name app-icon)
;; Convert symbol to string
(symbol-name app-icon))
;; If app-icon is nil because user
;; requested it to be so, send the
;; empty string

View file

@ -364,112 +364,112 @@ of the file header. This is used for \"old GNU\" Tar format."
(if (and (null link-p) (null disable-slash) (string-match "/\\'" name))
(setq link-p 5)) ; directory
(if (member magic-str '("ustar " "ustar\0"))
(if (equal name "././@LongLink")
;; Supposedly @LongLink is only used for GNUTAR
;; format (i.e. "ustar ") but some POSIX Tar files
;; (with "ustar\0") have been seen using it as well.
;; This is a GNU Tar long-file-name header.
(let* ((size (tar-parse-octal-integer
string tar-size-offset tar-time-offset))
;; The long name is in the next 512-byte block.
;; We've already moved POS there, when we
;; computed STRING above.
(name (decode-coding-string
;; -1 so as to strip the terminating 0 byte.
(buffer-substring pos (+ pos size -1)) coding))
;; Tokenize the header of the _real_ file entry,
;; which is further 512 bytes into the archive.
(descriptor (tar-header-block-tokenize
(+ pos (tar-roundup-512 size)) coding
;; Don't intuit directories from
;; the trailing slash, because the
;; truncated name might by chance end
;; in a slash.
'ignore-trailing-slash)))
;; Fix the descriptor of the real file entry by using
;; the information from the long name entry.
(cond
((eq link-p (- ?L ?0)) ;GNUTYPE_LONGNAME.
(setf (tar-header-name descriptor) name))
((eq link-p (- ?K ?0)) ;GNUTYPE_LONGLINK.
(setf (tar-header-link-name descriptor) name))
(t
(message "Unrecognized GNU Tar @LongLink format")))
;; Fix the "link-type" attribute, based on the long name.
(if (and (null (tar-header-link-type descriptor))
(string-match "/\\'" name))
(setf (tar-header-link-type descriptor) 5)) ; directory
(setf (tar-header-header-start descriptor)
(copy-marker (- pos 512) t))
descriptor)
;; Posix pax extended header. FIXME: support ?g as well.
(if (eq link-p (- ?x ?0))
;; Get whatever attributes are in the extended header,
(let* ((pax-attrs (tar-parse-pax-extended-header pos))
(gid (pax-header-gid pax-attrs))
(gname (pax-header-gname pax-attrs))
(linkpath (pax-header-linkpath pax-attrs))
(mtime (pax-header-mtime pax-attrs))
(path (pax-header-path pax-attrs))
(size (pax-header-size pax-attrs))
(uid (pax-header-uid pax-attrs))
(uname (pax-header-uname pax-attrs))
;; Tokenize the header of the _real_ file entry,
;; which is further 512 bytes into the archive.
(descriptor
(tar-header-block-tokenize (+ pos 512) coding
'ignore-trailing-slash)))
;; Fix the descriptor of the real file entry by
;; overriding some of the fields with the information
;; from the extended header.
(if gid
(setf (tar-header-gid descriptor) gid))
(if gname
(setf (tar-header-gname descriptor) gname))
(if linkpath
(setf (tar-header-link-name descriptor) linkpath))
(if mtime
(setf (tar-header-date descriptor) mtime))
(if path
(setf (tar-header-name descriptor) path))
(if size
(setf (tar-header-size descriptor) size))
(if uid
(setf (tar-header-uid descriptor) uid))
(if uname
(setf (tar-header-uname descriptor) uname))
descriptor)
(if (and (equal name "././@LongLink")
;; Supposedly @LongLink is only used for GNUTAR
;; format (i.e. "ustar ") but some POSIX Tar files
;; (with "ustar\0") have been seen using it as well.
(member magic-str '("ustar " "ustar\0")))
(let* ((size (tar-parse-octal-integer
string tar-size-offset tar-time-offset))
;; The long name is in the next 512-byte block.
;; We've already moved POS there, when we
;; computed STRING above.
(name (decode-coding-string
;; -1 so as to strip the terminating 0 byte.
(buffer-substring pos (+ pos size -1)) coding))
;; Tokenize the header of the _real_ file entry,
;; which is further 512 bytes into the archive.
(descriptor (tar-header-block-tokenize
(+ pos (tar-roundup-512 size)) coding
;; Don't intuit directories from
;; the trailing slash, because the
;; truncated name might by chance end
;; in a slash.
'ignore-trailing-slash)))
;; Fix the descriptor of the real file entry by using
;; the information from the long name entry.
(cond
((eq link-p (- ?L ?0)) ;GNUTYPE_LONGNAME.
(setf (tar-header-name descriptor) name))
((eq link-p (- ?K ?0)) ;GNUTYPE_LONGLINK.
(setf (tar-header-link-name descriptor) name))
(t
(message "Unrecognized GNU Tar @LongLink format")))
;; Fix the "link-type" attribute, based on the long name.
(if (and (null (tar-header-link-type descriptor))
(string-match "/\\'" name))
(setf (tar-header-link-type descriptor) 5)) ; directory
(setf (tar-header-header-start descriptor)
(copy-marker (- pos 512) t))
descriptor)
;; Posix pax extended header. FIXME: support ?g as well.
(if (and (eq link-p (- ?x ?0))
(member magic-str '("ustar " "ustar\0")))
;; Get whatever attributes are in the extended header,
(let* ((pax-attrs (tar-parse-pax-extended-header pos))
(gid (pax-header-gid pax-attrs))
(gname (pax-header-gname pax-attrs))
(linkpath (pax-header-linkpath pax-attrs))
(mtime (pax-header-mtime pax-attrs))
(path (pax-header-path pax-attrs))
(size (pax-header-size pax-attrs))
(uid (pax-header-uid pax-attrs))
(uname (pax-header-uname pax-attrs))
;; Tokenize the header of the _real_ file entry,
;; which is further 512 bytes into the archive.
(descriptor
(tar-header-block-tokenize (+ pos 512) coding
'ignore-trailing-slash)))
;; Fix the descriptor of the real file entry by
;; overriding some of the fields with the information
;; from the extended header.
(if gid
(setf (tar-header-gid descriptor) gid))
(if gname
(setf (tar-header-gname descriptor) gname))
(if linkpath
(setf (tar-header-link-name descriptor) linkpath))
(if mtime
(setf (tar-header-date descriptor) mtime))
(if path
(setf (tar-header-name descriptor) path))
(if size
(setf (tar-header-size descriptor) size))
(if uid
(setf (tar-header-uid descriptor) uid))
(if uname
(setf (tar-header-uname descriptor) uname))
descriptor)
(make-tar-header
(copy-marker pos nil)
name
(tar-parse-octal-integer string tar-mode-offset
tar-uid-offset)
(tar-parse-octal-integer string tar-uid-offset
tar-gid-offset)
(tar-parse-octal-integer string tar-gid-offset
tar-size-offset)
(tar-parse-octal-integer string tar-size-offset
tar-time-offset)
(tar-parse-octal-integer string tar-time-offset
tar-chk-offset)
(tar-parse-octal-integer string tar-chk-offset
tar-linkp-offset)
link-p
linkname
uname-valid-p
(when uname-valid-p
(decode-coding-string
(substring string tar-uname-offset uname-end) coding))
(when uname-valid-p
(decode-coding-string
(substring string tar-gname-offset gname-end) coding))
(tar-parse-octal-integer string tar-dmaj-offset
tar-dmin-offset)
(tar-parse-octal-integer string tar-dmin-offset
tar-prefix-offset)
))))))))
(make-tar-header
(copy-marker pos nil)
name
(tar-parse-octal-integer string tar-mode-offset
tar-uid-offset)
(tar-parse-octal-integer string tar-uid-offset
tar-gid-offset)
(tar-parse-octal-integer string tar-gid-offset
tar-size-offset)
(tar-parse-octal-integer string tar-size-offset
tar-time-offset)
(tar-parse-octal-integer string tar-time-offset
tar-chk-offset)
(tar-parse-octal-integer string tar-chk-offset
tar-linkp-offset)
link-p
linkname
uname-valid-p
(when uname-valid-p
(decode-coding-string
(substring string tar-uname-offset uname-end) coding))
(when uname-valid-p
(decode-coding-string
(substring string tar-gname-offset gname-end) coding))
(tar-parse-octal-integer string tar-dmaj-offset
tar-dmin-offset)
(tar-parse-octal-integer string tar-dmin-offset
tar-prefix-offset)
)))))))
;; Pseudo-field.
(defun tar-header-data-end (descriptor)

View file

@ -17807,6 +17807,7 @@ redisplay_window_error (Lisp_Object error_data)
if (max_redisplay_ticks > 0
&& CONSP (error_data)
&& EQ (XCAR (error_data), Qerror)
&& CONSP (XCDR (error_data))
&& STRINGP (XCAR (XCDR (error_data))))
Vdelayed_warnings_list = Fcons (list2 (XCAR (error_data),
XCAR (XCDR (error_data))),
@ -27354,7 +27355,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
oprops = Fcopy_sequence (oprops);
tem = props;
while (CONSP (tem))
while (CONSP (tem) && CONSP (XCDR (tem)))
{
oprops = plist_put (oprops, XCAR (tem),
XCAR (XCDR (tem)));