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

This commit is contained in:
Po Lu
2023-06-27 08:43:07 +08:00
4 changed files with 53 additions and 46 deletions

View File

@@ -174,12 +174,21 @@ It has the same meaning as `remote-file-name-inhibit-cache'.")
(or (tramp-get-file-property vec "/" "mounted")
(let* ((default-directory tramp-compat-temporary-file-directory)
(command (format "mount -t fuse.%s" (tramp-file-name-method vec)))
(mount (shell-command-to-string command)))
(mount (shell-command-to-string command))
(mount-spec (split-string (tramp-fuse-mount-spec vec) ":" 'omit)))
(tramp-message vec 6 "%s\n%s" command mount)
;; The mount-spec contains a trailing local file name part,
;; which might not be visible, for example with rclone
;; mounts of type "memory" or "gdrive". Make it optional.
(setq mount-spec
(if (cdr mount-spec)
(rx (literal (car mount-spec))
":" (? (literal (cadr mount-spec))))
(car mount-spec)))
(tramp-set-file-property
vec "/" "mounted"
(when (string-match
(rx bol (group (literal (tramp-fuse-mount-spec vec)))
(rx bol (group (regexp mount-spec))
" on " (group (+ (not blank))) blank)
mount)
(tramp-set-file-property

View File

@@ -300,25 +300,25 @@ file names."
(setq filename (file-name-directory filename)))
(with-parsed-tramp-file-name (expand-file-name filename) nil
(tramp-message v 5 "file system info: %s" localname)
(tramp-rclone-send-command v "about" (concat host ":"))
(with-current-buffer (tramp-get-connection-buffer v)
(let (total used free)
(goto-char (point-min))
(while (not (eobp))
(when (looking-at (rx "Total: " (+ blank) (group (+ digit))))
(setq total (string-to-number (match-string 1))))
(when (looking-at (rx "Used: " (+ blank) (group (+ digit))))
(setq used (string-to-number (match-string 1))))
(when (looking-at (rx "Free: " (+ blank) (group (+ digit))))
(setq free (string-to-number (match-string 1))))
(forward-line))
(when used
;; The used number of bytes is not part of the result. As
;; side effect, we store it as file property.
(tramp-set-file-property v localname "used-bytes" used))
;; Result.
(when (and total free)
(list total free (- total free))))))))
(when (zerop (tramp-rclone-send-command v "about" (concat host ":")))
(with-current-buffer (tramp-get-connection-buffer v)
(let (total used free)
(goto-char (point-min))
(while (not (eobp))
(when (looking-at (rx "Total: " (+ blank) (group (+ digit))))
(setq total (string-to-number (match-string 1))))
(when (looking-at (rx "Used: " (+ blank) (group (+ digit))))
(setq used (string-to-number (match-string 1))))
(when (looking-at (rx "Free: " (+ blank) (group (+ digit))))
(setq free (string-to-number (match-string 1))))
(forward-line))
(when used
;; The used number of bytes is not part of the result.
;; As side effect, we store it as file property.
(tramp-set-file-property v localname "used-bytes" used))
;; Result.
(when (and total free)
(list total free (- total free)))))))))
(defun tramp-rclone-handle-rename-file
(filename newname &optional ok-if-already-exists)

View File

@@ -1870,9 +1870,9 @@ with value CHAR in the region [FROM to)."
'(looking-at
"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\|\\s!\\)")
'(or (looking-at
"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\)"
"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\)")
(let ((prop (c-get-char-property (point) 'syntax-table)))
(equal prop '(14))))))) ; '(14) is generic comment delimiter.
(equal prop '(14)))))) ; '(14) is generic comment delimiter.
(defsubst c-intersect-lists (list alist)

View File

@@ -1038,13 +1038,21 @@ init-file, or to a default value if loading is not possible."
(debug-on-error-should-be-set nil)
(debug-on-error-initial
(if (eq init-file-debug t)
'startup
'startup--witness ;Dummy but recognizable non-nil value.
init-file-debug))
(d-i-e-from-init-file nil)
(d-i-e-initial
;; Use (startup--witness) instead of nil, so we can detect when the
;; init files set `debug-ignored-errors' to nil.
(if init-file-debug '(startup--witness) debug-ignored-errors))
;; The init file might contain byte-code with embedded NULs,
;; which can cause problems when read back, so disable nul
;; byte detection. (Bug#52554)
(inhibit-null-byte-detection t))
(let ((debug-on-error debug-on-error-initial))
(let ((debug-on-error debug-on-error-initial)
;; If they specified --debug-init, enter the debugger
;; on any error whatsoever.
(debug-ignored-errors d-i-e-initial))
(condition-case-unless-debug error
(when init-file-user
(let ((init-file-name (funcall filename-function)))
@@ -1054,17 +1062,11 @@ init-file, or to a default value if loading is not possible."
;; `user-init-file'.
(setq user-init-file t)
(when init-file-name
;; If they specified --debug-init, enter the debugger
;; on any error whatsoever.
(let ((debug-ignored-errors
(if (and init-file-debug (not noninteractive))
nil
debug-ignored-errors)))
(load (if (equal (file-name-extension init-file-name)
"el")
(file-name-sans-extension init-file-name)
init-file-name)
'noerror 'nomessage)))
(load (if (equal (file-name-extension init-file-name)
"el")
(file-name-sans-extension init-file-name)
init-file-name)
'noerror 'nomessage))
(when (and (eq user-init-file t) alternate-filename-function)
(let ((alt-file (funcall alternate-filename-function)))
@@ -1072,11 +1074,7 @@ init-file, or to a default value if loading is not possible."
(setq init-file-name alt-file))
(and (equal (file-name-extension alt-file) "el")
(setq alt-file (file-name-sans-extension alt-file)))
(let ((debug-ignored-errors
(if (and init-file-debug (not noninteractive))
nil
debug-ignored-errors)))
(load alt-file 'noerror 'nomessage))))
(load alt-file 'noerror 'nomessage)))
;; If we did not find the user's init file, set
;; user-init-file conclusively. Don't let it be
@@ -1115,11 +1113,7 @@ init-file, or to a default value if loading is not possible."
(not inhibit-default-init))
;; Prevent default.el from changing the value of
;; `inhibit-startup-screen'.
(let ((inhibit-startup-screen nil)
(debug-ignored-errors
(if (and init-file-debug (not noninteractive))
nil
debug-ignored-errors)))
(let ((inhibit-startup-screen nil))
(load "default" 'noerror 'nomessage))))
(error
(display-warning
@@ -1139,10 +1133,14 @@ the `--debug-init' option to view a complete error backtrace."
;; If we can tell that the init file altered debug-on-error,
;; arrange to preserve the value that it set up.
(or (eq debug-ignored-errors d-i-e-initial)
(setq d-i-e-from-init-file (list debug-ignored-errors)))
(or (eq debug-on-error debug-on-error-initial)
(setq debug-on-error-should-be-set t
debug-on-error-from-init-file debug-on-error)))
(when d-i-e-from-init-file
(setq debug-ignored-errors (car d-i-e-from-init-file)))
(when debug-on-error-should-be-set
(setq debug-on-error debug-on-error-from-init-file))))