[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android df761843f00: Merge remote-tracking branch 'origin/master
From: |
Po Lu |
Subject: |
feature/android df761843f00: Merge remote-tracking branch 'origin/master' into feature/android |
Date: |
Wed, 28 Jun 2023 20:29:46 -0400 (EDT) |
branch: feature/android
commit df761843f00966d34d452b54c2f4d92adad1b697
Merge: 8f87af4237d d6bcb39ba9d
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge remote-tracking branch 'origin/master' into feature/android
---
doc/misc/cc-mode.texi | 17 +++++++++++++++++
doc/misc/tramp.texi | 39 ++++++++++++++++++++++++++++----------
lisp/emacs-lisp/cl-macs.el | 8 ++++----
lisp/misc.el | 10 ++++++----
lisp/net/tramp-container.el | 18 +++++++++---------
lisp/net/tramp.el | 3 ++-
lisp/progmodes/cc-fonts.el | 45 ++++++++++++++++++++++++++++++++++++++++++--
lisp/progmodes/cc-langs.el | 11 ++++++++---
lisp/progmodes/cc-vars.el | 8 ++++++++
test/lisp/net/tramp-tests.el | 6 ++----
10 files changed, 128 insertions(+), 37 deletions(-)
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index 5f905be09d5..4ab95798468 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -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
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 01f46865a39..27145c3cca1 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -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
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index aadb498609a..0a3181561bd 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -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))
diff --git a/lisp/misc.el b/lisp/misc.el
index de82b97fa6f..ab083728a69 100644
--- a/lisp/misc.el
+++ b/lisp/misc.el
@@ -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.
diff --git a/lisp/net/tramp-container.el b/lisp/net/tramp-container.el
index 6e8d28a3016..7f8d4473ad7 100644
--- a/lisp/net/tramp-container.el
+++ b/lisp/net/tramp-container.el
@@ -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 ()
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 7f818d81123..04fe0eed3bc 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -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.
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index baf57d6839a..afbf841bcb1 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -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
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index d56366e1755..2422cf3deb0 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -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))))
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index 286d569aaca..c7b66f040cd 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -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
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index a2e57e468c1..45bcf23f790 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -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