emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android 2341d1d52ac 4/5: Merge remote-tracking branch 'origin/ma


From: Po Lu
Subject: feature/android 2341d1d52ac 4/5: Merge remote-tracking branch 'origin/master' into feature/android
Date: Fri, 17 Feb 2023 06:16:22 -0500 (EST)

branch: feature/android
commit 2341d1d52ac500a3d4b4326181d33ee0d7ba032e
Merge: ecb48e8d636 7ab6c6ac833
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'origin/master' into feature/android
---
 etc/NEWS                                           |  5 ++
 lisp/emacs-lisp/package-vc.el                      | 19 ++++++-
 lisp/progmodes/c-ts-mode.el                        |  3 +-
 lisp/progmodes/cc-engine.el                        | 44 +++++++++++++++-
 lisp/progmodes/cc-fonts.el                         | 59 +++++++++++++++++-----
 lisp/progmodes/cc-langs.el                         | 11 ++++
 lisp/textmodes/emacs-news-mode.el                  | 23 +++++++--
 lisp/time.el                                       |  6 +++
 .../{toggle-tag.erts => cycle-tag.erts}            |  0
 test/lisp/textmodes/emacs-news-mode-tests.el       |  6 +--
 10 files changed, 153 insertions(+), 23 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 3f3f5bff05c..94e41df8f3c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -62,6 +62,11 @@ This allows the user to customize the prompt that is 
appended by
 'yes-or-no-p' when asking questions.  The default value is
 "(yes or no) ".
 
+---
+** New face 'display-time-time-and-date-indicator'.
+This is used for displaying the time and date components of
+'display-time-mode'.
+
 
 * Editing Changes in Emacs 30.1
 
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index bad59aa6c0f..b753adcb8a0 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -440,7 +440,7 @@ version of that package."
                    (package-desc-version a)))
                 (duplicate-p (a b)
                   "Are A and B the same package?"
-                  (equal a (car b)))
+                  (eq (package-desc-name a) (package-desc-name b)))
                 (depends-on-p (target package)
                   "Does PACKAGE depend on TARGET?"
                   (or (eq target package)
@@ -457,7 +457,7 @@ version of that package."
                         (depends-on-p desc-a desc-b)))))
       (mapc #'search requirements)
       (cl-callf sort to-install #'version-order)
-      (cl-callf seq-uniq to-install)
+      (cl-callf seq-uniq to-install #'duplicate-p)
       (cl-callf sort to-install #'dependent-order))
     (mapc #'package-install-from-archive to-install)
     missing))
@@ -602,6 +602,13 @@ attribute in PKG-SPEC."
           (vc-retrieve-tag dir release-rev)
         (message "No release revision was found, continuing...")))))
 
+(defvar package-vc-non-code-file-names
+  '(".dir-locals.el" ".dir-locals-2.el")
+  "List of file names that do not contain Emacs Lisp code.
+This list is used by `package-vc--unpack' to better check if the
+user is fetching code from a repository that does not contain any
+Emacs Lisp files.")
+
 (defun package-vc--unpack (pkg-desc pkg-spec &optional rev)
   "Install the package described by PKG-DESC.
 PKG-SPEC is a package specification, a property list describing
@@ -623,6 +630,14 @@ checkout.  This overrides the `:branch' attribute in 
PKG-SPEC."
     (when (directory-empty-p pkg-dir)
       (delete-directory pkg-dir)
       (error "Empty checkout for %s" name))
+    (unless (seq-remove
+             (lambda (file)
+               (member (file-name-nondirectory file) 
package-vc-non-code-file-names))
+             (directory-files-recursively pkg-dir "\\.el\\'" nil))
+      (when (yes-or-no-p (format "No Emacs Lisp files found when fetching 
\"%s\", \
+abort installation?" name))
+        (delete-directory pkg-dir t)
+        (user-error "Installation aborted")))
 
     ;; When nothing is specified about a `lisp-dir', then should
     ;; heuristically check if there is a sub-directory with lisp
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 38aaea139f1..8a4cc2fac18 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -219,6 +219,7 @@ delimiters < and >'s."
 MODE is either `c' or `cpp'."
   (let ((common
          `(((parent-is "translation_unit") point-min 0)
+           ((query "(ERROR (ERROR)) @indent") point-min 0)
            ((node-is ")") parent 1)
            ((node-is "]") parent-bol 0)
            ((node-is "else") parent-bol 0)
@@ -816,7 +817,7 @@ the semicolon.  This function skips the semicolon."
 
   ;; Electric
   (setq-local electric-indent-chars
-              (append "{}():;," electric-indent-chars))
+              (append "{}():;,#" electric-indent-chars))
 
   ;; Imenu.
   (setq-local treesit-simple-imenu-settings
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 1899b522ab0..f8ae49c42dd 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -14911,7 +14911,49 @@ comment at the start of cc-engine.el for more info."
          (c-add-syntax 'topmost-intro-cont (c-point 'boi)))
         ))
 
-       ;; (CASE 6 has been removed.)
+       ;; ((Old) CASE 6 has been removed.)
+       ;; CASE 6: line is within a C11 _Generic expression.
+       ((and c-generic-key
+            (eq (char-after containing-sexp) ?\()
+            (progn (setq tmp-pos (c-safe-scan-lists
+                                  containing-sexp 1 0
+                                  (min (+ (point) 2000) (point-max))))
+                   t)
+            (save-excursion
+              (and
+               (progn (goto-char containing-sexp)
+                      (zerop (c-backward-token-2)))
+               (looking-at c-generic-key)
+               (progn (goto-char (1+ containing-sexp))
+                      (c-syntactic-re-search-forward
+                       "," indent-point 'bound t t))
+               (setq placeholder (point)))))
+       (let ((res (c-syntactic-re-search-forward
+                   "[,:)]"
+                   (or tmp-pos (min (+ (point) 2000) (point-max)))
+                   'bound t t)))
+         (cond
+          ((and res
+                (eq (char-before) ?\))
+                (save-excursion
+                  (backward-char)
+                  (c-backward-syntactic-ws indent-point)
+                  (eq (point) indent-point)))
+           (c-add-stmt-syntax
+            'arglist-close (list containing-sexp) t
+            (c-most-enclosing-brace paren-state indent-point) paren-state))
+          ((or (not res)
+               (eq (char-before) ?\)))
+           (backward-char)
+           (c-syntactic-skip-backward "^,:"  containing-sexp t)
+           (c-add-syntax (if (eq (char-before) ?:)
+                             'statement-case-intro
+                           'case-label)
+                         (1+ containing-sexp)))
+          (t (c-add-syntax (if (eq (char-before) ?:)
+                               'case-label
+                             'statement-case-intro)
+                           (1+ containing-sexp))))))
 
        ;; CASE 7: line is an expression, not a statement.  Most
        ;; likely we are either in a function prototype or a function
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index c220d8d8789..4ec21af1b25 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -259,14 +259,14 @@
 
   (defmacro c-fontify-types-and-refs (varlist &rest body)
     (declare (indent 1) (debug let*))
-    ;; Like `let', but additionally activates `c-record-type-identifiers'
+    ;; Like `let*', but additionally activates `c-record-type-identifiers'
     ;; and `c-record-ref-identifiers', and fontifies the recorded ranges
     ;; accordingly on exit.
     ;;
     ;; This function does hidden buffer changes.
-    `(let ((c-record-type-identifiers t)
-          c-record-ref-identifiers
-          ,@varlist)
+    `(let* ((c-record-type-identifiers t)
+           c-record-ref-identifiers
+           ,@varlist)
        (prog1 (progn ,@body)
         (c-fontify-recorded-types-and-refs))))
 
@@ -1219,6 +1219,7 @@ casts and declarations are fontified.  Used on level 2 
and higher."
   ;;           inside a function declaration arglist).
   ;; '<>       In an angle bracket arglist.
   ;; 'arglist  Some other type of arglist.
+  ;; 'generic  In a C11 _Generic construct.
   ;; 'top      Some other context and point is at the top-level (either
   ;;           outside any braces or directly inside a class or namespace,
   ;;           etc.)
@@ -1345,6 +1346,15 @@ casts and declarations are fontified.  Used on level 2 
and higher."
             (c-back-over-member-initializers)))
       (c-put-char-property (1- match-pos) 'c-type 'c-not-decl)
       (cons 'not-decl nil))
+     ;; In a C11 _Generic construct.
+     ((and c-generic-key
+          (eq (char-before match-pos) ?,)
+          (save-excursion
+            (and (c-go-up-list-backward match-pos
+                                        (max (- (point) 2000) (point-min)))
+                 (zerop (c-backward-token-2))
+                 (looking-at c-generic-key))))
+      (cons 'generic nil))
      ;; At start of a declaration inside a declaration paren.
      ((save-excursion
        (goto-char match-pos)
@@ -1616,13 +1626,16 @@ casts and declarations are fontified.  Used on level 2 
and higher."
                   (c-forward-syntactic-ws))
 
                 ;; Now analyze the construct.
-                (if (eq context 'not-decl)
-                    (progn
-                      (setq decl-or-cast nil)
-                      (if (c-syntactic-re-search-forward
-                           "," (min limit (point-max)) 'at-limit t)
-                          (c-put-char-property (1- (point)) 'c-type 
'c-not-decl))
-                      nil)
+                (cond
+                 ((eq context 'not-decl)
+                  (setq decl-or-cast nil)
+                  (if (c-syntactic-re-search-forward
+                       "," (min limit (point-max)) 'at-limit t)
+                      (c-put-char-property (1- (point)) 'c-type 'c-not-decl))
+                  nil)
+                 ((eq context 'generic)
+                  (c-font-lock-c11-generic-clause))
+                 (t
                   (setq decl-or-cast
                         (c-forward-decl-or-cast-1
                          match-pos context last-cast-end inside-macro))
@@ -1683,7 +1696,7 @@ casts and declarations are fontified.  Used on level 2 
and higher."
                                              context
                                              (or toplev (nth 4 decl-or-cast))))
 
-                   (t t))))
+                   (t t)))))
 
             ;; It was a false alarm.  Check if we're in a label (or other
             ;; construct with `:' except bitfield) instead.
@@ -1713,6 +1726,28 @@ casts and declarations are fontified.  Used on level 2 
and higher."
 
        nil))))
 
+(defun c-font-lock-c11-generic-clause ()
+  ;; Fontify a type inside the C11 _Generic clause.  Point will be at the
+  ;; type and will be left at the next comma of the clause (if any) or the
+  ;; closing parenthesis, if any, or at the end of the type, otherwise.
+  ;; The return value is always nil.
+  (c-fontify-types-and-refs
+      ((here (point))
+       (type-type (c-forward-type t))
+       (c-promote-possible-types (if (eq type-type 'maybe) 'just-one t))
+       (pos (point)) pos1)
+    (when (and type-type (eq (char-after) ?:))
+      (goto-char here)
+      (c-forward-type t))              ; Fontify the type.
+    (cond
+     ((c-syntactic-re-search-forward "," nil t t t)
+      (backward-char))
+     ((and (setq pos1 (c-up-list-forward))
+          (eq (char-before pos1) ?\)))
+      (goto-char (1- pos1)))
+     (t (goto-char pos))))
+  nil)
+
 (defun c-font-lock-enum-body (limit)
   ;; Fontify the identifiers of each enum we find by searching forward.
   ;;
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index daa23bd14fa..61f81f09b3e 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -3085,6 +3085,17 @@ Keywords here should also be in `c-block-stmt-1-kwds'."
   t (c-make-keywords-re t (c-lang-const c-block-stmt-2-kwds)))
 (c-lang-defvar c-block-stmt-2-key (c-lang-const c-block-stmt-2-key))
 
+(c-lang-defconst c-generic-kwds
+  "The keyword \"_Generic\" which introduces a C11 generic statement."
+  t nil
+  c '("_Generic"))
+
+(c-lang-defconst c-generic-key
+  ;; Regexp matching the keyword(s) in `c-generic-kwds'.
+  t (if (c-lang-const c-generic-kwds)
+       (c-make-keywords-re t (c-lang-const c-generic-kwds))))
+(c-lang-defvar c-generic-key (c-lang-const c-generic-key))
+
 (c-lang-defconst c-block-stmt-kwds
   ;; Union of `c-block-stmt-1-kwds' and `c-block-stmt-2-kwds'.
   t (c--delete-duplicates (append (c-lang-const c-block-stmt-1-kwds)
diff --git a/lisp/textmodes/emacs-news-mode.el 
b/lisp/textmodes/emacs-news-mode.el
index b844955e1be..c5e7b8f4bc6 100644
--- a/lisp/textmodes/emacs-news-mode.el
+++ b/lisp/textmodes/emacs-news-mode.el
@@ -53,13 +53,28 @@
   :parent emacs-news-common-map
   "C-c C-s" #'emacs-news-next-untagged-entry
   "C-c C-r" #'emacs-news-previous-untagged-entry
-  "C-c C-t" #'emacs-news-toggle-tag
+  "C-c C-t" #'emacs-news-cycle-tag
+  "C-c C-d" #'emacs-news-delete-temporary-markers
   "C-c C-g" #'emacs-news-goto-section
   "C-c C-j" #'emacs-news-find-heading
   "C-c C-e" #'emacs-news-count-untagged-entries
   "C-x C-q" #'emacs-news-view-mode
   "<remap> <open-line>" #'emacs-news-open-line)
 
+(easy-menu-define emacs-news-mode-menu emacs-news-mode-map
+  "Menu for `emacs-news-mode'."
+  '("News"
+    ["Next Untagged" emacs-news-next-untagged-entry :help "Go to next untagged 
entry"]
+    ["Previous Untagged" emacs-news-previous-untagged-entry :help "Go to 
previous untagged entry"]
+    ["Count Untagged" emacs-news-count-untagged-entries :help "Count the 
number of untagged entries"]
+    ["Cycle Tag" emacs-news-cycle-tag :help "Cycle documentation tag of 
current entry"]
+    ["Delete Tags" emacs-news-delete-temporary-markers :help "Delete all 
documentation tags in buffer"]
+    "--"
+    ["Goto Section" emacs-news-goto-section :help "Prompt for section and go 
to it"]
+    ["Goto Heading" emacs-news-find-heading :help "Prompt for heading and go 
to it"]
+    "--"
+    ["Enter View Mode" emacs-news-view-mode :help "Enter view-only mode"]))
+
 (defvar emacs-news-view-mode-map
   ;; This is defined this way instead of inheriting because we're
   ;; deriving the mode from `special-mode' and want the keys from there.
@@ -173,8 +188,8 @@ untagged NEWS entry."
   (interactive nil emacs-news-mode)
   (emacs-news-next-untagged-entry t))
 
-(defun emacs-news-toggle-tag ()
-  "Toggle documentation tag of current headline in the Emacs NEWS file."
+(defun emacs-news-cycle-tag ()
+  "Cycle documentation tag of current headline in the Emacs NEWS file."
   (interactive nil emacs-news-mode)
   (save-excursion
     (goto-char (line-beginning-position))
@@ -191,7 +206,7 @@ untagged NEWS entry."
            (insert "+++"))
           ((looking-at (rx bol "+++" eol))
            (delete-char 4))
-          (t (user-error "Invalid headline tag; can't toggle")))))
+          (t (user-error "Invalid headline tag; can't cycle")))))
 
 (defun emacs-news-count-untagged-entries ()
   "Say how many untagged entries there are in the current NEWS buffer."
diff --git a/lisp/time.el b/lisp/time.el
index f04a22dfd28..030aef9d49b 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -139,6 +139,11 @@ make the mail indicator stand out on a color display."
   :version "22.1"
   :type '(choice (const :tag "None" nil) face))
 
+(defface display-time-time-and-date-indicator nil
+  "Face for `display-time-format'."
+  :group 'mode-line-faces
+  :version "30.1")
+
 (defvar display-time-mail-icon
   (find-image '((:type xpm :file "letter.xpm" :ascent center)
                (:type pbm :file "letter.pbm" :ascent center)))
@@ -179,6 +184,7 @@ depend on `display-time-day-and-date' and 
`display-time-24hr-format'."
      (format-time-string (or display-time-format
                             (if display-time-24hr-format "%H:%M" "%-I:%M%p"))
                         now)
+     'face 'display-time-time-and-date-indicator
      'help-echo (format-time-string "%a %b %e, %Y" now))
     load
     (if mail
diff --git a/test/lisp/textmodes/emacs-news-mode-resources/toggle-tag.erts 
b/test/lisp/textmodes/emacs-news-mode-resources/cycle-tag.erts
similarity index 100%
rename from test/lisp/textmodes/emacs-news-mode-resources/toggle-tag.erts
rename to test/lisp/textmodes/emacs-news-mode-resources/cycle-tag.erts
diff --git a/test/lisp/textmodes/emacs-news-mode-tests.el 
b/test/lisp/textmodes/emacs-news-mode-tests.el
index e1152265a45..676a3270da6 100644
--- a/test/lisp/textmodes/emacs-news-mode-tests.el
+++ b/test/lisp/textmodes/emacs-news-mode-tests.el
@@ -23,10 +23,10 @@
 (require 'ert-x)
 (require 'emacs-news-mode)
 
-(ert-deftest emacs-news-toggle-tag ()
-  (ert-test-erts-file (ert-resource-file "toggle-tag.erts")
+(ert-deftest emacs-news-cycle-tag ()
+  (ert-test-erts-file (ert-resource-file "cycle-tag.erts")
                       (lambda ()
                         (emacs-news-mode)
-                        (emacs-news-toggle-tag))))
+                        (emacs-news-cycle-tag))))
 
 ;;; emacs-news-mode-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]