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

This commit is contained in:
Po Lu 2023-06-29 08:28:41 +08:00
commit df761843f0
10 changed files with 128 additions and 37 deletions

View file

@ -2169,6 +2169,23 @@ which aren't of the default style will be fontified with
@section Miscellaneous Font Locking
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Some compilers, notably GCC, allow the character @samp{$} to be a
constituent of identifiers in the languages C, C++, and Objective C.
CC Mode defaults to accepting these @samp{$} characters and fontifying
the identifiers in which they appear like any others.
However, the compiler you're using, or your project coding standards
may disallow such use. In such cases, you can set
@code{c-warn-ids-with-dollar} to non-@code{nil}. This causes these
invalid identifiers to be fontified distinctively.
@defvar c-warn-ids-with-dollar
@vindex warn-ids-with-dollar (c-)
When this customization option is non-@code{nil}, identifiers
containing the @samp{$} character are fontified with
@code{font-lock-warning-face}.
@end defvar
In some languages, particularly in C++, there are constructs which are
syntactically ambiguous---they could be either declarations or
expressions, and @ccmode{} cannot tell for sure which. Often such a

View file

@ -142,6 +142,7 @@ on the remote host.
* Ssh setup:: Ssh setup hints.
* FUSE setup:: @acronym{FUSE} setup hints.
* Android shell setup:: Android shell setup hints.
* Kubernetes setup:: Kubernetes setup hints.
* Auto-save File Lock and Backup::
Auto-save, File Lock and Backup.
* Keeping files encrypted:: Protect remote files by encryption.
@ -700,6 +701,7 @@ on the remote host.
* Ssh setup:: Ssh setup hints.
* FUSE setup:: @acronym{FUSE} setup hints.
* Android shell setup:: Android shell setup hints.
* Kubernetes setup:: Kubernetes setup hints.
* Auto-save File Lock and Backup::
Auto-save, File Lock and Backup.
* Keeping files encrypted:: Protect remote files by encryption.
@ -921,16 +923,10 @@ if desired.
@cindex method @option{kubernetes}
@cindex @option{kubernetes} method
Integration for containers in Kubernetes pods. The host name is a pod
name returned by @samp{kubectl get pods}, or
@samp{@var{container}.@var{pod}} if an explicit container name shall
be used. Otherwise, the first container in a pod is used.
@vindex tramp-kubernetes-context
@vindex tramp-kubernetes-namespace
If another Kubernetes context or namespace shall be used, configure
the user options @code{tramp-kubernetes-context} and
@code{tramp-kubernetes-namespace}.
Integration for containers in Kubernetes pods. The host name is
@samp{@var{pod}}, or @samp{@var{container}.@var{pod}} if an
explicit container name shall be used. Otherwise, the first container
in a pod is used.
This method does not support user names.
@ -3122,6 +3118,29 @@ Open a remote connection with the more concise command @kbd{C-x C-f
@end itemize
@node Kubernetes setup
@section Kubernetes setup hints
With the @option{kubernetes} method, containers in Kubernetes pods can
be accessed. The host name is a pod name returned by @samp{kubectl
get pods}, or @samp{@var{container}.@var{pod}} if an explicit
container name shall be used. Otherwise, the first container in a pod
is used.
Sometimes, asynchronous processes for a host without a dedicated
container name show a warning like @samp{Defaulted container
"container1" out of: container1, container2}. This can be mitigated
by setting the pod annotation
@samp{kubectl.kubernetes.io/default-container} to a proper value
(@samp{container1} in this example).
@vindex tramp-kubernetes-context
@vindex tramp-kubernetes-namespace
@value{tramp} uses the default Kubernetes context and namespace. If
another context or namespace shall be used, configure the user options
@code{tramp-kubernetes-context} and @code{tramp-kubernetes-namespace}.
@node Auto-save File Lock and Backup
@section Auto-save, File Lock and Backup configuration
@cindex auto-save

View file

@ -246,10 +246,10 @@ The name is made by appending a number to PREFIX, default \"T\"."
(defun cl--slet (bindings body &optional nowarn)
"Like `cl--slet*' but for \"parallel let\"."
(let ((dyns nil)) ;Vars declared as dynbound among the bindings?
;; `seq-some' lead to bootstrap problems.
(dolist (binding bindings)
(when (macroexp--dynamic-variable-p (car binding))
(push (car binding) dyns)))
(when lexical-binding
(dolist (binding bindings) ;; `seq-some' lead to bootstrap problems.
(when (macroexp--dynamic-variable-p (car binding))
(push (car binding) dyns))))
(cond
(dyns
(let ((form `(funcall (lambda (,@(mapcar #'car bindings))

View file

@ -63,6 +63,10 @@ Also see the `duplicate-line' command."
(+ n (point)))))))
(insert string)))
(defun duplicate--insert-copies (n string)
"Insert N copies of STRING at point."
(insert (mapconcat #'identity (make-list n string))))
;;;###autoload
(defun duplicate-line (&optional n)
"Duplicate the current line N times.
@ -78,8 +82,7 @@ Also see the `copy-from-above-command' command."
(forward-line 1)
(unless (bolp)
(insert "\n"))
(dotimes (_ n)
(insert line)))))
(duplicate--insert-copies n line))))
(declare-function rectangle--duplicate-right "rect" (n))
@ -111,8 +114,7 @@ Interactively, N is the prefix numeric argument, and defaults to 1."
(text (buffer-substring beg end)))
(save-excursion
(goto-char end)
(dotimes (_ n)
(insert text))))
(duplicate--insert-copies n text)))
(setq deactivate-mark nil))
;; Duplicate line.

View file

@ -256,7 +256,7 @@ Obey `tramp-kubernetes-context'"
;;;###tramp-autoload
(defun tramp-kubernetes--context-namespace (vec)
"The kubectl options for context and namespace."
"The kubectl options for context and namespace as string."
(mapconcat
#'identity
`(,(when-let ((context (tramp-kubernetes--current-context vec)))
@ -404,7 +404,7 @@ see its function help for a description of the format."
;; Default connection-local variables for Tramp.
(defconst tramp-container-connection-local-default-kubernetes-variables
(defconst tramp-kubernetes-connection-local-default-variables
'((tramp-config-check . tramp-kubernetes--current-context-data)
;; This variable will be eval'ed in `tramp-expand-args'.
(tramp-extra-expand-args
@ -414,24 +414,24 @@ see its function help for a description of the format."
"Default connection-local variables for remote kubernetes connections.")
(connection-local-set-profile-variables
'tramp-container-connection-local-default-kubernetes-profile
tramp-container-connection-local-default-kubernetes-variables)
'tramp-kubernetes-connection-local-default-profile
tramp-kubernetes-connection-local-default-variables)
(connection-local-set-profiles
`(:application tramp :protocol ,tramp-kubernetes-method)
'tramp-container-connection-local-default-kubernetes-profile)
'tramp-kubernetes-connection-local-default-profile)
(defconst tramp-container-connection-local-default-flatpak-variables
(defconst tramp-flatpak-connection-local-default-variables
`((tramp-remote-path . ,(cons "/app/bin" tramp-remote-path)))
"Default connection-local variables for remote flatpak connections.")
(connection-local-set-profile-variables
'tramp-container-connection-local-default-flatpak-profile
tramp-container-connection-local-default-flatpak-variables)
'tramp-flatpak-connection-local-default-profile
tramp-flatpak-connection-local-default-variables)
(connection-local-set-profiles
`(:application tramp :protocol ,tramp-flatpak-method)
'tramp-container-connection-local-default-flatpak-profile))
'tramp-flatpak-connection-local-default-profile))
(add-hook 'tramp-unload-hook
(lambda ()

View file

@ -4973,7 +4973,8 @@ a connection-local variable."
;; Merge both spec lists. Remove duplicate entries.
(while spec-list
(unless (member (car spec-list) extra-spec-list)
(setq extra-spec-list (append (take 2 spec-list) extra-spec-list)))
(setq extra-spec-list
(append (tramp-compat-take 2 spec-list) extra-spec-list)))
(setq spec-list (cddr spec-list)))
(setq spec (apply #'format-spec-make extra-spec-list))
;; Expand format spec.

View file

@ -1890,6 +1890,38 @@ casts and declarations are fontified. Used on level 2 and higher."
(c-font-lock-declarators limit t in-typedef
(not (c-bs-at-toplevel-p (point)))))))))))
(defun c-font-lock-ids-with-dollar (limit)
;; Maybe fontify identifiers with a dollar using `font-lock-warning-face'.
;; This is done only for languages which tolerate a $ in ids, and only when
;; the flag variable `c-warn-ids-with-dollar' is set to non-nil. This
;; function only works after functions such as `c-font-lock-declarations'
;; have already been run.
;;
;; This function will be called from font-lock for a region bounded by POINT
;; and LIMIT, as though it were to identify a keyword for
;; font-lock-keyword-face. It always returns NIL to inhibit this and
;; prevent a repeat invocation. See elisp/lispref page "Search-based
;; Fontification".
(when c-warn-ids-with-dollar
(let (id-start)
(while (and (< (point) limit)
(skip-chars-forward "^$" limit)
(< (point) limit)
(eq (char-after) ?$))
(if (and (memq (c-get-char-property (point) 'face)
'(font-lock-variable-name-face
font-lock-function-name-face
font-lock-type-face))
(setq id-start (c-on-identifier)))
(progn
(goto-char id-start)
(looking-at c-identifier-key)
(c-put-font-lock-face (match-beginning 0) (match-end 0)
'font-lock-warning-face)
(goto-char (match-end 0)))
(forward-char)))
nil)))
(defun c-font-lock-ml-strings (limit)
;; Fontify multi-line strings.
;;
@ -2290,7 +2322,12 @@ on level 2 only and so aren't combined with `c-complex-decl-matchers'."
;; Fontify generic colon labels in languages that support them.
,@(when (c-lang-const c-recognize-colon-labels)
'(c-font-lock-labels))))
'(c-font-lock-labels))
;; Maybe fontify identifiers containing a dollar sign with
;; `font-lock-warning-face'.
,@(when (c-lang-const c-dollar-in-ids)
`(c-font-lock-ids-with-dollar))))
(c-lang-defconst c-complex-decl-matchers
"Complex font lock matchers for types and declarations. Used on level
@ -2366,7 +2403,11 @@ on level 2 only and so aren't combined with `c-complex-decl-matchers'."
;; (see Elisp page "Search-based Fontification").
'(("\\<new\\>"
(c-font-lock-c++-new))))
))
;; Maybe fontify identifiers containing a dollar sign with
;; `font-lock-warning-face'.
,@(when (c-lang-const c-dollar-in-ids)
`(c-font-lock-ids-with-dollar))))
(defun c-font-lock-labels (limit)
;; Fontify all statement labels from the point to LIMIT. Assumes

View file

@ -834,8 +834,9 @@ which `c-backward-sexp' needs to be called twice to move backwards over."
keyword. It's unspecified how far it matches. Does not contain a \\|
operator at the top level."
t (concat "[" c-alpha "_]")
(c c++) (concat "[" c-alpha "_$]")
java (concat "[" c-alpha "_@]")
objc (concat "[" c-alpha "_@]")
objc (concat "[" c-alpha "_@$]")
pike (concat "[" c-alpha "_`]"))
(c-lang-defvar c-symbol-start (c-lang-const c-symbol-start))
@ -848,6 +849,10 @@ This is of the form that fits inside [ ] in a regexp."
objc (concat c-alnum "_$@"))
(c-lang-defvar c-symbol-chars (c-lang-const c-symbol-chars))
(c-lang-defconst c-dollar-in-ids
"Non-nil when a dollar (can be) a non-standard constituent of an identifier."
t (string-match (c-lang-const c-symbol-start) "$"))
(c-lang-defconst c-symbol-char-key
"Regexp matching a sequence of at least one identifier character."
t (concat "[" (c-lang-const c-symbol-chars) "]+"))
@ -859,9 +864,9 @@ to match if `c-symbol-start' matches on the same position."
t (concat (c-lang-const c-symbol-start)
"[" (c-lang-const c-symbol-chars) "]\\{,1000\\}")
pike (concat
;; Use the value from C here since the operator backquote is
;; Use the value from AWK here since the operator backquote is
;; covered by the other alternative.
(c-lang-const c-symbol-key c)
(c-lang-const c-symbol-key awk)
"\\|"
(c-make-keywords-re nil
(c-lang-const c-overloadable-operators))))

View file

@ -280,6 +280,14 @@ anchoring position to indent the line in that case."
:type 'boolean
:group 'c)
(defcustom c-warn-ids-with-dollar nil
"Fontify identifiers with a dollar character in font-lock-warn-face.
This has effect only for languages in which `c-dollar-in-ids' is
non-nil, e.g. C, C++, Objective C. It covers languages where
\"$\" is permitted in ids \"informally\", but only by some compilers."
:type 'boolean
:group 'c)
(defcustom-c-stylevar c-basic-offset 4
"Amount of basic offset used by + and - symbols in `c-offsets-alist'.
Also used as the indentation step when `c-syntactic-indentation' is

View file

@ -6136,8 +6136,7 @@ INPUT, if non-nil, is a string sent to the process."
(inhibit-message t)
kill-buffer-query-functions
(clpa connection-local-profile-alist)
(clca connection-local-criteria-alist)
connection-local-profile-alist connection-local-criteria-alist)
(clca connection-local-criteria-alist))
(unwind-protect
(progn
(make-directory tmp-name1)
@ -6219,8 +6218,7 @@ INPUT, if non-nil, is a string sent to the process."
(let ((default-directory ert-remote-temporary-file-directory)
explicit-shell-file-name kill-buffer-query-functions
(clpa connection-local-profile-alist)
(clca connection-local-criteria-alist)
connection-local-profile-alist connection-local-criteria-alist)
(clca connection-local-criteria-alist))
(unwind-protect
(progn
(connection-local-set-profile-variables