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

This commit is contained in:
Po Lu 2021-12-07 09:32:13 +08:00
commit d9b3f665bc
20 changed files with 140 additions and 92 deletions

View file

@ -742,6 +742,15 @@ never creates such missing directories; the value @code{always},
means Dired automatically creates them; the value @code{ask}
means Dired asks you for confirmation before creating them.
@vindex dired-create-destination-dirs-on-trailing-dirsep
If the option @code{dired-create-destination-dirs-on-trailing-dirsep}
is non-@code{nil} in addition to @code{dired-create-destination-dirs},
a trailing directory separator at the destination directory is treated
specially. In that case, when copying to @samp{test/} and no
directory @samp{test} exists already, it will be created and the
specified source files or directories are copied into the newly
created directory.
@vindex dired-copy-preserve-time
If @code{dired-copy-preserve-time} is non-@code{nil}, then copying
with this command preserves the modification time of the old file in
@ -784,6 +793,14 @@ which to move the files (this is like the shell command @command{mv}).
The option @code{dired-create-destination-dirs} controls whether Dired
should create non-existent directories in @var{new}.
The option @code{dired-create-destination-dirs-on-trailing-dirsep},
when set in addition to @code{dired-create-destination-dirs}, controls
wether a trailing directory separator at the destination is treated
specially. In that case, when renaming a directory @samp{old} to
@samp{new/} and no directory @samp{new} exists already, it will be
created and @samp{old} is moved into the newly created directory.
Otherwise, @samp{old} is renamed to @samp{new}.
Dired automatically changes the visited file name of buffers associated
with renamed files so that they refer to the new names.

View file

@ -1099,6 +1099,20 @@ manual in the node called "Dired".
The manual also describes many other Emacs features.
* INSTALLING PACKAGES
---------------------
There's a rich set of packages for Emacs written by the community,
which extend Emacs' capabilities. These packages include support for
new languages, additional themes, plugins for integrating with
external applications, and much, much more.
To see a list of all available packages, type M-x list-packages. In
the display this shows, you can install or uninstall packages, as well
as read packages' descriptions. For more information about package
management, consult the manual.
* CONCLUSION
------------

View file

@ -1119,6 +1119,20 @@ Emacs-manualen i noden "Dired".
Manualen beskriver även många andra funktioner i Emacs.
* INSTALLERA PAKET
------------------
Det finns en stor mängd paket för Emacs skrivna av användare, som
utökar Emacs funktionalitet. Detta kan innefatta stöd för nya språk,
fler teman, insticksmoduler för integration med externa program och
mycket, mycket annat.
Skriv M-x list-packages för att se en lista över alla tillgängliga
paket. I detta läge kan du installera eller avinstallera paket samt
läsa mer om olika paket. Se användarmanualen för mer information om
pakethantering.
* SLUTORD
---------

View file

@ -288,7 +288,7 @@ mnemonics of the following coding systems:
Value is used for `mode-line-frame-identification', which see."
(if (or (null window-system)
(eq window-system 'pc))
"-%F "
" %F "
" "))
;; We need to defer the call to mode-line-frame-control to the time

View file

@ -1712,10 +1712,10 @@ It is too wide if it has any lines longer than the largest of
(nth 2 form)))))
(when (and (consp name) (eq (car name) 'quote))
(setq name (cadr name)))
(setq name (if name (format " `%s'" name) ""))
(setq name (if name (format " `%s' " name) ""))
(when (and kind docs (stringp docs)
(byte-compile--wide-docstring-p docs col))
(byte-compile-warn "%s%s docstring wider than %s characters"
(byte-compile-warn "%s%sdocstring wider than %s characters"
kind name col))))
form)

View file

@ -847,7 +847,8 @@ Overrides existing keywords with FORCE set non-nil."
(defun gnus-registry-register-message-ids ()
"Register the Message-ID of every article in the group."
(unless (or (gnus-parameter-registry-ignore gnus-newsgroup-name)
(null gnus-registry-register-all))
(null gnus-registry-register-all)
(null (eieio-object-p gnus-registry-db)))
(dolist (article gnus-newsgroup-articles)
(let* ((id (gnus-registry-fetch-message-id-fast article))
(groups (gnus-registry-get-id-key id 'group)))

View file

@ -283,8 +283,9 @@ the form (concat S2 S)."
((eq (car-safe action) 'boundaries)
(let ((beg (or (and (eq (car-safe res) 'boundaries) (cadr res)) 0)))
`(boundaries
,(max (min (length string) (length s1))
(+ beg (- (length s1) (length s2))))
,(min (length string)
(max (length s1)
(+ beg (- (length s1) (length s2)))))
. ,(and (eq (car-safe res) 'boundaries) (cddr res)))))
((stringp res)
(if (string-prefix-p s2 res completion-ignore-case)

View file

@ -1431,9 +1431,7 @@ ones, in case fg and bg are nil."
(defun shr-parse-style (style)
(when style
(save-match-data
(when (string-search "\n" style)
(setq style (replace-match " " t t style))))
(setq style (replace-regexp-in-string "\n" " " style))
(let ((plist nil))
(dolist (elem (split-string style ";"))
(when elem

View file

@ -67,7 +67,7 @@ SYNTAX can be one of the symbols `default' (default),
nil
(mapcar
(lambda (x)
(with-current-buffer x (when (tramp-tramp-file-p default-directory) x)))
(when (tramp-tramp-file-p (tramp-get-default-directory x)) x))
(buffer-list))))
;;;###tramp-autoload
@ -593,9 +593,8 @@ buffer in your bug report.
(defun tramp-reporter-dump-variable (varsym mailbuf)
"Pretty-print the value of the variable in symbol VARSYM."
(let* ((reporter-eval-buffer (symbol-value 'reporter-eval-buffer))
(val (with-current-buffer reporter-eval-buffer
(symbol-value varsym))))
(when-let ((reporter-eval-buffer reporter-eval-buffer)
(val (buffer-local-value varsym reporter-eval-buffer)))
(if (hash-table-p val)
;; Pretty print the cache.

View file

@ -1456,7 +1456,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
`file-notify' events."
(let* ((events (process-get proc 'events))
(rest-string (process-get proc 'rest-string))
(dd (with-current-buffer (process-buffer proc) default-directory))
(dd (tramp-get-default-directory (process-buffer proc)))
(ddu (regexp-quote (tramp-gvfs-url-file-name dd))))
(when rest-string
(tramp-message proc 10 "Previous string:\n%s" rest-string))

View file

@ -2601,7 +2601,7 @@ The method used must be an out-of-band method."
;; We cannot use `insert-buffer-substring' because the Tramp
;; buffer changes its contents before insertion due to calling
;; `expand-file-name' and alike.
(insert (with-current-buffer (tramp-get-buffer v) (buffer-string)))
(insert (tramp-get-buffer-string (tramp-get-buffer v)))
;; We must enable unibyte strings, because the "--dired"
;; output counts in bytes.
@ -3160,8 +3160,7 @@ implementation will be used."
(when outbuf
(with-current-buffer outbuf
(insert
(with-current-buffer (tramp-get-connection-buffer v)
(buffer-string))))
(tramp-get-buffer-string (tramp-get-connection-buffer v))))
(when (and display (get-buffer-window outbuf t)) (redisplay))))
;; When the user did interrupt, we should do it also. We use
;; return code -1 as marker.
@ -3475,8 +3474,7 @@ implementation will be used."
(not
(string-equal
(buffer-string)
(with-current-buffer (tramp-get-buffer v)
(buffer-string))))
(tramp-get-buffer-string (tramp-get-buffer v))))
(tramp-error
v 'file-error
(concat "Couldn't write region to `%s',"
@ -3770,8 +3768,7 @@ Fall back to normal file name handler if no Tramp handler exists."
"Read output from \"gio monitor\" and add corresponding `file-notify' events."
(let ((events (process-get proc 'events))
(remote-prefix
(with-current-buffer (process-buffer proc)
(file-remote-p default-directory)))
(file-remote-p (tramp-get-default-directory (process-buffer proc))))
(rest-string (process-get proc 'rest-string))
pos)
(when rest-string

View file

@ -1436,9 +1436,9 @@ component is used as the target of the symlink."
(unless (process-live-p proc)
;; Accept pending output.
(while (tramp-accept-process-output proc))
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 10 "\n%s" (buffer-string))
(throw 'tramp-action 'ok))))
(tramp-message
vec 10 "\n%s" (tramp-get-buffer-string (tramp-get-connection-buffer vec)))
(throw 'tramp-action 'ok)))
(defun tramp-smb-handle-set-file-acl (filename acl-string)
"Like `set-file-acl' for Tramp files."

View file

@ -453,12 +453,13 @@ the result will be a local, non-Tramp, file name."
(if (file-directory-p (expand-file-name f directory))
(file-name-as-directory f)
f))
(with-current-buffer (tramp-get-connection-buffer v)
(delq
nil
(mapcar
(lambda (l) (and (not (string-match-p "^[[:space:]]*$" l)) l))
(split-string (buffer-string) "\n" 'omit)))))))))
(delq
nil
(mapcar
(lambda (l) (and (not (string-match-p "^[[:space:]]*$" l)) l))
(split-string
(tramp-get-buffer-string (tramp-get-connection-buffer v))
"\n" 'omit))))))))
(defun tramp-sudoedit-handle-file-readable-p (filename)
"Like `file-readable-p' for Tramp files."

View file

@ -1866,6 +1866,20 @@ version, the function does nothing."
:user ,(file-remote-p default-directory 'user)
:machine ,(file-remote-p default-directory 'host)))))
(defsubst tramp-get-default-directory (buffer)
"Return `default-directory' of BUFFER."
(buffer-local-value 'default-directory buffer))
(put #'tramp-get-default-directory 'tramp-suppress-trace t)
(defsubst tramp-get-buffer-string (&optional buffer)
"Return contents of BUFFER.
If BUFFER is not a buffer, return the contents of `current-buffer'."
(with-current-buffer (if (bufferp buffer) buffer (current-buffer))
(substring-no-properties (buffer-string))))
(put #'tramp-get-buffer-string 'tramp-suppress-trace t)
(defun tramp-debug-buffer-name (vec)
"A name for the debug buffer for VEC."
(let ((method (tramp-file-name-method vec))
@ -2084,12 +2098,15 @@ applicable)."
;; Append connection buffer for error messages, if exists.
(when (= level 1)
(ignore-errors
(with-current-buffer
(if (processp vec-or-proc)
(process-buffer vec-or-proc)
(tramp-get-connection-buffer vec-or-proc 'dont-create))
(setq fmt-string (concat fmt-string "\n%s")
arguments (append arguments (list (buffer-string)))))))
(setq fmt-string (concat fmt-string "\n%s")
arguments
(append
arguments
`(,(tramp-get-buffer-string
(if (processp vec-or-proc)
(process-buffer vec-or-proc)
(tramp-get-connection-buffer
vec-or-proc 'dont-create))))))))
;; Translate proc to vec.
(when (processp vec-or-proc)
(setq vec-or-proc (process-get vec-or-proc 'vector))))
@ -2151,8 +2168,8 @@ an input event arrives. The other arguments are passed to `tramp-error'."
(and (tramp-file-name-p vec-or-proc)
(tramp-get-connection-buffer vec-or-proc))))
(vec (or (and (tramp-file-name-p vec-or-proc) vec-or-proc)
(and buf (with-current-buffer buf
(tramp-dissect-file-name default-directory))))))
(and buf (tramp-dissect-file-name
(tramp-get-default-directory buf))))))
(unwind-protect
(apply #'tramp-error vec-or-proc signal fmt-string arguments)
;; Save exit.
@ -2567,8 +2584,7 @@ Must be handled by the callers."
;; PROC.
((member operation '(file-notify-rm-watch file-notify-valid-p))
(when (processp (nth 0 args))
(with-current-buffer (process-buffer (nth 0 args))
default-directory)))
(tramp-get-default-directory (process-buffer (nth 0 args)))))
;; VEC.
((member operation '(tramp-get-remote-gid tramp-get-remote-uid))
(tramp-make-tramp-file-name (nth 0 args)))
@ -2845,7 +2861,7 @@ whether HANDLER is to be called. Add operations defined in
(defun tramp-command-completion-p (_symbol buffer)
"A predicate for Tramp interactive commands.
They are completed by \"M-x TAB\" only if the current buffer is remote."
(with-current-buffer buffer (tramp-tramp-file-p default-directory)))
(tramp-tramp-file-p (tramp-get-default-directory buffer)))
(defun tramp-connectable-p (vec-or-filename)
"Check, whether it is possible to connect the remote host w/o side-effects.
@ -4705,8 +4721,8 @@ of."
(save-window-excursion
(pop-to-buffer (tramp-get-connection-buffer vec))
(read-string (match-string 0)))))))
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string)))
(tramp-message
vec 6 "\n%s" (tramp-get-buffer-string (tramp-get-connection-buffer vec)))
(tramp-message vec 3 "Sending login name `%s'" user)
(tramp-send-string vec (concat user tramp-local-end-of-line)))
t)
@ -4749,8 +4765,8 @@ See also `tramp-action-yn'."
(unless (yes-or-no-p (match-string 0))
(kill-process proc)
(throw 'tramp-action 'permission-denied))
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string)))
(tramp-message
vec 6 "\n%s" (tramp-get-buffer-string (tramp-get-connection-buffer vec)))
(tramp-send-string vec (concat "yes" tramp-local-end-of-line)))
t)
@ -4763,8 +4779,8 @@ See also `tramp-action-yesno'."
(unless (y-or-n-p (match-string 0))
(kill-process proc)
(throw 'tramp-action 'permission-denied))
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string)))
(tramp-message
vec 6 "\n%s" (tramp-get-buffer-string (tramp-get-connection-buffer vec)))
(tramp-send-string vec (concat "y" tramp-local-end-of-line)))
t)
@ -4772,15 +4788,15 @@ See also `tramp-action-yesno'."
"Tell the remote host which terminal type to use.
The terminal type can be configured with `tramp-terminal-type'."
(tramp-message vec 5 "Setting `%s' as terminal type." tramp-terminal-type)
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string)))
(tramp-message
vec 6 "\n%s" (tramp-get-buffer-string (tramp-get-connection-buffer vec)))
(tramp-send-string vec (concat tramp-terminal-type tramp-local-end-of-line))
t)
(defun tramp-action-confirm-message (_proc vec)
"Return RET in order to confirm the message."
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string)))
(tramp-message
vec 6 "\n%s" (tramp-get-buffer-string (tramp-get-connection-buffer vec)))
(tramp-send-string vec tramp-local-end-of-line)
t)
@ -5068,8 +5084,8 @@ nil."
;; The process could have timed out, for example due to session
;; timeout of sudo. The process buffer does not exist any longer then.
(ignore-errors
(with-current-buffer (process-buffer proc)
(tramp-message proc 6 "\n%s" (buffer-string))))
(tramp-message
proc 6 "\n%s" (tramp-get-buffer-string (process-buffer proc))))
(unless found
(if timeout
(tramp-error
@ -5590,14 +5606,12 @@ are written with verbosity of 6."
(with-temp-buffer
(setq result
(apply
#'call-process program infile (or destination t) display args))
#'call-process program infile (or destination t) display args)
output (tramp-get-buffer-string destination))
;; `result' could also be an error string.
(when (stringp result)
(setq error result
result 1))
(with-current-buffer
(if (bufferp destination) destination (current-buffer))
(setq output (buffer-string))))
result 1)))
(error
(setq error (error-message-string err)
result 1)))
@ -5628,10 +5642,10 @@ are written with verbosity of 6."
;; `result' could also be an error string.
(when (stringp result)
(signal 'file-error (list result)))
(with-current-buffer (if (bufferp buffer) buffer (current-buffer))
(if (zerop result)
(tramp-message vec 6 "%d" result)
(tramp-message vec 6 "%d\n%s" result (buffer-string)))))
(if (zerop result)
(tramp-message vec 6 "%d" result)
(tramp-message
vec 6 "%d\n%s" result (tramp-get-buffer-string buffer))))
(error
(setq result 1)
(tramp-message vec 6 "%d\n%s" result (error-message-string err))))
@ -5696,7 +5710,7 @@ Invokes `password-read' if available, `read-passwd' else."
(format "%s for %s " (capitalize (match-string 1)) key))))
(auth-source-creation-prompts `((secret . ,pw-prompt)))
;; Use connection-local value.
(auth-sources (with-current-buffer (process-buffer proc) auth-sources))
(auth-sources (buffer-local-value 'auth-sources (process-buffer proc)))
;; We suspend the timers while reading the password.
(stimers (with-timeout-suspend))
auth-info auth-passwd)
@ -5922,5 +5936,11 @@ BODY is the backend specific code."
;; and friends, for most of the handlers this is the major
;; difference between the different backends. Other handlers but
;; *-process-file would profit from this as well.
;;
;; * Implement file name abbreviation for a different user. That is,
;; (abbreviate-file-name "/ssh:user1@host:/home/user2") =>
;; "/ssh:user1@host:~user2".
;;
;; * Implement file name abbreviation for user and host names.
;;; tramp.el ends here

View file

@ -1840,18 +1840,22 @@ a face or button specification."
(unless concise
(fancy-splash-insert
:face 'variable-pitch
"\nTo start... "
"\nTo start...\t"
:link `("Open a File"
,(lambda (_button) (call-interactively 'find-file))
"Specify a new file's name, to edit the file")
" "
"\t\t"
:link `("Open Home Directory"
,(lambda (_button) (dired "~"))
"Open your home directory, to operate on its files")
" "
"\n\t"
:link `("Customize Startup"
,(lambda (_button) (customize-group 'initialization))
"Change initialization settings including this screen")
"\t"
:link `("Explore Packages"
,(lambda (_button) (call-interactively 'package-list-packages))
"Explore, install and remove Emacs packages (requires Internet connection)")
"\n"))
(fancy-splash-insert
:face 'variable-pitch "To quit a partially entered command, type "

View file

@ -3187,14 +3187,6 @@ gui_put_x_image (struct frame *f, Emacs_Pix_Container pimg,
XFreeGC (FRAME_X_DISPLAY (f), gc);
#endif /* HAVE_X_WINDOWS */
#ifdef HAVE_NTGUI
#if 0 /* I don't think this is necessary looking at where it is used. */
HDC hdc = get_frame_dc (f);
SetDIBits (hdc, pixmap, 0, height, pimg->data, &(pimg->info), DIB_RGB_COLORS);
release_frame_dc (f, hdc);
#endif
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
eassert (pimg == pixmap);
ns_retain_object (pimg);
@ -11124,16 +11116,6 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
free_color_table ();
#endif
XDestroyImage (ximg);
#if 0 /* This doesn't seem to be the case. If we free the colors
here, we get a BadAccess later in image_clear_image when
freeing the colors. */
/* We have allocated colors once, but Ghostscript has also
allocated colors on behalf of us. So, to get the
reference counts right, free them once. */
if (img->ncolors)
x_free_colors (f, img->colors, img->ncolors);
#endif
}
else
image_error ("Cannot get X image of `%s'; colors will not be freed",

View file

@ -851,8 +851,7 @@ byte-compiled. Run with dynamic binding."
(byte-compile-file ,(ert-resource-file file))
(ert-info ((buffer-string) :prefix "buffer: ")
(,(if reverse 'should-not 'should)
(re-search-forward ,(string-replace " " "[ \n]+" re-warning)
nil t))))))
(re-search-forward ,re-warning nil t))))))
(bytecomp--define-warning-file-test "error-lexical-var-with-add-hook.el"
"add-hook.*lexical var")
@ -980,7 +979,7 @@ byte-compiled. Run with dynamic binding."
(bytecomp--define-warning-file-test
"warn-wide-docstring-defun.el"
"wider than .* characters")
"Warning: docstring wider than .* characters")
(bytecomp--define-warning-file-test
"warn-wide-docstring-defvar.el"

View file

@ -325,6 +325,7 @@
())
(with-suppressed-warnings ((obsolete defmethod)
(obsolete defgeneric)
(obsolete next-method-p)
(obsolete call-next-method))
(defmethod initialize-instance :after ((_this eitest-Jb) &rest _slots)

View file

@ -85,7 +85,8 @@
"foo@example.org\\|bar@example.org\\|baz@example.org")))
(ert-deftest mail-utils-tests-mail-rfc822-time-zone ()
(should (stringp (mail-rfc822-time-zone (current-time)))))
(with-suppressed-warnings ((obsolete mail-rfc822-time-zone))
(should (stringp (mail-rfc822-time-zone (current-time))))))
(ert-deftest mail-utils-test-mail-rfc822-date/contains-year ()
(should (string-match (rx " 20" digit digit " ")

View file

@ -219,8 +219,7 @@ is greater than 10.
(when (and (null tramp--test-instrument-test-case-p) (> tramp-verbose 3))
(untrace-all)
(dolist (buf (tramp-list-tramp-buffers))
(with-current-buffer buf
(message ";; %s\n%s" buf (buffer-string)))
(message ";; %s\n%s" buf (tramp-get-buffer-string buf))
(kill-buffer buf))))))
(defsubst tramp--test-message (fmt-string &rest arguments)
@ -5054,8 +5053,8 @@ INPUT, if non-nil, is a string sent to the process."
"echo foo >&2; echo bar" (current-buffer) stderr)
(should (string-equal "bar\n" (buffer-string)))
;; Check stderr.
(with-current-buffer stderr
(should (string-equal "foo\n" (buffer-string)))))
(should
(string-equal "foo\n" (tramp-get-buffer-string stderr))))
;; Cleanup.
(ignore-errors (kill-buffer stderr))))))