commit 287dd6baa38f12de4995e5571ec75af83b3f56d8 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Mon Feb 18 00:18:11 2019 -0800 * src/fns.c: Fix comment. diff --git a/src/fns.c b/src/fns.c index 95bafae6c4..d55158e72f 100644 --- a/src/fns.c +++ b/src/fns.c @@ -91,8 +91,7 @@ See Info node `(elisp)Random Numbers' for more details. */) /* Random data-structure functions. */ -/* Return the length of LIST. Signal an error if LIST is not a proper - list or if the length does not fit into a fixnum or into ptrdiff_t. */ +/* Return LIST's length. Signal an error if LIST is not a proper list. */ ptrdiff_t list_length (Lisp_Object list) commit 9cb2cb97253b49f2c469981055571b2afbcd60df Author: Paul Eggert Date: Sun Feb 17 23:17:12 2019 -0800 emacs-init-time outputs more digits now * lisp/time.el (emacs-init-time): Output more digits; formerly this was always outputting "0.0 seconds" for me because the number of seconds was less than 0.1. diff --git a/lisp/time.el b/lisp/time.el index d95f708161..9084217024 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -582,7 +582,7 @@ For example, the Unix uptime command format is \"%D, %z%2h:%.2m\"." "Return a string giving the duration of the Emacs initialization." (interactive) (let ((str - (format "%.1f seconds" + (format "%s seconds" (float-time (time-subtract after-init-time before-init-time))))) (if (called-interactively-p 'interactive) commit 43f6fd434dd23fa7202ba95bd1cc3f41234ad609 Author: Paul Eggert Date: Sun Feb 17 21:35:19 2019 -0800 * lisp/emacs-lisp/cl-lib.el (cl-endp): Remove stray 'x. diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 3756b52feb..60c52c26ca 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -370,7 +370,7 @@ SEQ, this is like `mapcar'. With several, it is like the Common Lisp Signal an error if X is not a list." (if (listp x) (null x) - (signal 'wrong-type-argument (list 'listp x 'x)))) + (signal 'wrong-type-argument (list 'listp x)))) (cl--defalias 'cl-third 'cl-caddr "Return the third element of the list X.") (cl--defalias 'cl-fourth 'cl-cadddr "Return the fourth element of the list X.") commit 4f24b4a6dff0c257d1c1ea49338efcdff59446b0 Author: Juri Linkov Date: Sun Feb 17 23:07:43 2019 +0200 * lisp/tar-mode.el (tar--try-jka-compr): Remove. (Bug#34251) (tar-extract): Call archive-try-jka-compr instead of tar--try-jka-compr. * lisp/arc-mode.el (archive-try-jka-compr): Call set-buffer-multibyte after erase-buffer. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 2b5b6166ad..8de0103019 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -967,8 +967,8 @@ using `make-temp-file', and the generated name is returned." ;; Don't re-compress this data just before decompressing it. (jka-compr-inhibit t)) (write-region (point-min) (point-max) tmpfile nil 'quiet)) - (set-buffer-multibyte t) (erase-buffer) + (set-buffer-multibyte t) (insert-file-contents tmpfile)) (delete-file tmpfile))))) diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index c5382d3f3d..599da9ac80 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -95,6 +95,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(require 'arc-mode) (defgroup tar nil "Simple editing of tar files." @@ -852,26 +853,6 @@ actually appear on disk when you save the tar-file's buffer." (goto-char (posn-point (event-end event))) (tar-extract)) -(defun tar--try-jka-compr () - (when (and auto-compression-mode - (jka-compr-get-compression-info buffer-file-name)) - (let* ((basename (file-name-nondirectory buffer-file-name)) - (tmpname (if (string-match ":\\([^:]+\\)\\'" basename) - (match-string 1 basename) basename)) - (tmpfile (make-temp-file (file-name-sans-extension tmpname) - nil - (file-name-extension tmpname 'period)))) - (unwind-protect - (progn - (let ((coding-system-for-write 'no-conversion) - ;; Don't re-compress this data just before decompressing it. - (jka-compr-inhibit t)) - (write-region (point-min) (point-max) tmpfile nil 'quiet)) - (set-buffer-multibyte t) - (erase-buffer) - (insert-file-contents tmpfile)) - (delete-file tmpfile))))) - (defun tar-file-name-handler (op &rest args) "Helper function for `tar-extract'." (or (eq op 'file-exists-p) @@ -951,7 +932,7 @@ actually appear on disk when you save the tar-file's buffer." (setq buffer-file-name new-buffer-file-name) (setq buffer-file-truename (abbreviate-file-name buffer-file-name)) - (tar--try-jka-compr) ;Pretty ugly hack :-( + (archive-try-jka-compr) ;Pretty ugly hack :-( ;; Force buffer-file-coding-system to what ;; decode-coding-region actually used. (set-buffer-file-coding-system last-coding-system-used t) commit adeea448bcbf12b8f6f33af0ddc9867fa49f5b4a Author: Alan Mackenzie Date: Sun Feb 17 18:57:10 2019 +0000 Fontify C function identifiers in parentheses correctly (e.g. in lisp.h) Fix handling of CC Mode's syntactic WS cache. Make noise-macro option variables buffer local. * lisp/progmodes/cc-engine.el (c-put-is-sws, c-put-in-sws, c-remove-is-sws) (c-remove-in-sws c-remove-is-and-in-sws): Add edebug specs. (c-invalidate-sws-region-before): Add a `beg' parameter. Handle noise macros like other literals. (c-invalidate-sws-region-after-del): Move the adjustment of (cdr c-sws-lit-limits) due to buffer change to c-invalidate-sws-region-after. (c-invalidate-sws-region-after-ins): Move (goto-char end) to the correct place. (c-invalidate-sws-region-after): Adjust (cdr c-sws-lit-limits) due to buffer change. Handle noise macros. (c-backward-sws): Set simple-ws-beg appropriately when the start point is in the middle of a noise macro. (c-forward-decl-or-cast-1): Recognize a function identifier being declared in parentheses. * lisp/promodes/cc-mode.el (c-before-change): Supply a `beg' argument to c-invalidate-sws-region-before. * lisp/progmodes/cc-vars.el (c-noise-macro-with-parens-name-re) (c-noise-macro-name-re, c-noise-macro-names, c-noise-macro-with-parens-names): Make these buffer local variables. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 071efbc55b..27ce3029c4 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -1732,6 +1732,7 @@ comment at the start of cc-engine.el for more info." (put-text-property beg end 'c-is-sws t) ,@(when (facep 'c-debug-is-sws-face) '((c-debug-add-face beg end 'c-debug-is-sws-face))))) +(def-edebug-spec c-put-is-sws t) (defmacro c-put-in-sws (beg end) ;; This macro does a hidden buffer change. @@ -1739,6 +1740,7 @@ comment at the start of cc-engine.el for more info." (put-text-property beg end 'c-in-sws t) ,@(when (facep 'c-debug-is-sws-face) '((c-debug-add-face beg end 'c-debug-in-sws-face))))) +(def-edebug-spec c-put-in-sws t) (defmacro c-remove-is-sws (beg end) ;; This macro does a hidden buffer change. @@ -1746,6 +1748,7 @@ comment at the start of cc-engine.el for more info." (remove-text-properties beg end '(c-is-sws nil)) ,@(when (facep 'c-debug-is-sws-face) '((c-debug-remove-face beg end 'c-debug-is-sws-face))))) +(def-edebug-spec c-remove-is-sws t) (defmacro c-remove-in-sws (beg end) ;; This macro does a hidden buffer change. @@ -1753,6 +1756,7 @@ comment at the start of cc-engine.el for more info." (remove-text-properties beg end '(c-in-sws nil)) ,@(when (facep 'c-debug-is-sws-face) '((c-debug-remove-face beg end 'c-debug-in-sws-face))))) +(def-edebug-spec c-remove-in-sws t) (defmacro c-remove-is-and-in-sws (beg end) ;; This macro does a hidden buffer change. @@ -1761,6 +1765,7 @@ comment at the start of cc-engine.el for more info." ,@(when (facep 'c-debug-is-sws-face) '((c-debug-remove-face beg end 'c-debug-is-sws-face) (c-debug-remove-face beg end 'c-debug-in-sws-face))))) +(def-edebug-spec c-remove-is-and-in-sws t) ;; The type of literal position `end' is in a `before-change-functions' ;; function - one of `c', `c++', `pound', or nil (but NOT `string'). @@ -1769,12 +1774,14 @@ comment at the start of cc-engine.el for more info." ;; enclosing END, if any, else nil. (defvar c-sws-lit-limits nil) -(defun c-invalidate-sws-region-before (end) - ;; Called from c-before-change. END is the end of the change region, the - ;; standard parameter given to all before-change-functions. +(defun c-invalidate-sws-region-before (beg end) + ;; Called from c-before-change. BEG and END are the bounds of the change + ;; region, the standard parameters given to all before-change-functions. ;; - ;; Note whether END is inside a comment or CPP construct, and if so note its - ;; bounds in `c-sws-lit-limits' and type in `c-sws-lit-type'. + ;; Note whether END is inside a comment, CPP construct, or noise macro, and + ;; if so note its bounds in `c-sws-lit-limits' and type in `c-sws-lit-type'. + (setq c-sws-lit-type nil + c-sws-lit-limits nil) (save-excursion (goto-char end) (let* ((limits (c-literal-limits)) @@ -1787,8 +1794,19 @@ comment at the start of cc-engine.el for more info." (setq c-sws-lit-type 'pound c-sws-lit-limits (cons (point) (progn (c-end-of-macro) (point))))) - (t (setq c-sws-lit-type nil - c-sws-lit-limits nil)))))) + ((progn (skip-syntax-backward "w_") + (looking-at c-noise-macro-name-re)) + (setq c-sws-lit-type 'noise + c-sws-lit-limits (cons (match-beginning 1) (match-end 1)))) + (t)))) + (save-excursion + (goto-char beg) + (skip-syntax-backward "w_") + (when (looking-at c-noise-macro-name-re) + (setq c-sws-lit-type 'noise) + (if (consp c-sws-lit-limits) + (setcar c-sws-lit-limits (match-beginning 1)) + (setq c-sws-lit-limits (cons (match-beginning 1) (match-end 1))))))) (defun c-invalidate-sws-region-after-del (beg end old-len) ;; Text has been deleted, OLD-LEN characters of it starting from position @@ -1797,7 +1815,6 @@ comment at the start of cc-engine.el for more info." ;; deletion deleted or "damaged" its opening delimiter. If so, return the ;; current position of where the construct ended, otherwise return nil. (when c-sws-lit-limits - (setcdr c-sws-lit-limits (- (cdr c-sws-lit-limits) old-len)) (if (and (< beg (+ (car c-sws-lit-limits) 2)) ; A lazy assumption that ; comment delimiters are 2 ; chars long. @@ -1815,9 +1832,9 @@ comment at the start of cc-engine.el for more info." ;; or `c-is-sws' text properties inside this literal. If there are, return ;; the buffer position of the end of the literal, else return nil. (save-excursion + (goto-char end) (let* ((limits (c-literal-limits)) (lit-type (c-literal-type limits))) - (goto-char end) (when (and (not (memq lit-type '(c c++))) (c-beginning-of-macro)) (setq lit-type 'pound @@ -1841,6 +1858,10 @@ comment at the start of cc-engine.el for more info." ;; properties right after they're added. ;; ;; This function does hidden buffer changes. + (when c-sws-lit-limits + (setcar c-sws-lit-limits (min beg (car c-sws-lit-limits))) + (setcdr c-sws-lit-limits + (max end (- (+ (cdr c-sws-lit-limits) (- end beg)) old-len)))) (let ((del-end (and (> old-len 0) (c-invalidate-sws-region-after-del beg end old-len))) @@ -1860,6 +1881,10 @@ comment at the start of cc-engine.el for more info." (when (and (eolp) (not (eobp))) (setq end (1+ (point))))) + (when (eq c-sws-lit-type 'noise) + (setq beg (car c-sws-lit-limits) + end (cdr c-sws-lit-limits))) ; This last setting may be redundant. + (when (and (= beg end) (get-text-property beg 'c-in-sws) (> beg (point-min)) @@ -1879,6 +1904,7 @@ comment at the start of cc-engine.el for more info." (setq end (max (or del-end end) (or ins-end end) + (or (cdr c-sws-lit-limits) end) end)) (c-debug-sws-msg "c-invalidate-sws-region-after [%s..%s]" beg end) @@ -2147,7 +2173,8 @@ comment at the start of cc-engine.el for more info." ;; Try to find a rung position in the simple ws preceding point, so that ;; we can get a cache hit even if the last bit of the simple ws has ;; changed recently. - (setq simple-ws-beg (point)) + (setq simple-ws-beg (or (match-end 1) ; Noise macro + (match-end 0))) ; c-syntactic-ws-end (skip-chars-backward " \t\n\r\f\v") (if (setq rung-is-marked (text-property-any (point) (min (1+ rung-pos) (point-max)) @@ -8672,7 +8699,16 @@ comment at the start of cc-engine.el for more info." (not (and (c-major-mode-is 'c-mode) (not got-prefix) (or (eq context 'top) make-top) - (eq (char-after) ?\))))) + (eq (char-after) ?\)) + (or (memq at-type '(nil maybe)) + (not got-identifier) + (save-excursion + (goto-char after-paren-pos) + (c-forward-syntactic-ws) + ;; Prevent the symbol being recorded as a type. + (let (c-record-type-identifiers) + (not (memq (c-forward-type) + '(nil maybe))))))))) (if (eq (char-after) ?\)) (when (> paren-depth 0) (setq paren-depth (1- paren-depth)) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index a2ad07fddb..6718813b79 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1623,7 +1623,7 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") ;; Are we coalescing two tokens together, e.g. "fo o" -> "foo"? (when (< beg end) (c-unfind-coalesced-tokens beg end)) - (c-invalidate-sws-region-before end) + (c-invalidate-sws-region-before beg end) ;; Are we (potentially) disrupting the syntactic context which ;; makes a type a type? E.g. by inserting stuff after "foo" in ;; "foo bar;", or before "foo" in "typedef foo *bar;"? diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 66960b630e..8953488267 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1649,7 +1649,9 @@ white space either before or after the operator, but not both." ;; Initialize the next two to a regexp which never matches. (defvar c-noise-macro-with-parens-name-re "a\\`") +(make-variable-buffer-local 'c-noise-macro-with-parens-name-re) (defvar c-noise-macro-name-re "a\\`") +(make-variable-buffer-local 'c-noise-macro-name-re) (defcustom c-noise-macro-names nil "A list of names of macros which expand to nothing, or compiler extensions @@ -1664,6 +1666,7 @@ this implicitly by reinitializing C/C++/Objc Mode on any buffer)." :type '(repeat :tag "List of names" string) :group 'c) (put 'c-noise-macro-names 'safe-local-variable #'c-string-list-p) +(make-variable-buffer-local 'c-noise-macro-names) (defcustom c-noise-macro-with-parens-names nil "A list of names of macros \(or compiler extensions like \"__attribute__\") @@ -1673,6 +1676,7 @@ These are recognized by CC Mode only in declarations." :type '(repeat :tag "List of names (possibly empty)" string) :group 'c) (put 'c-noise-macro-with-parens-names 'safe-local-variable #'c-string-list-p) +(make-variable-buffer-local 'c-noise-macro-with-parens-names) (defun c-make-noise-macro-regexps () ;; Convert `c-noise-macro-names' and `c-noise-macro-with-parens-names' into commit 7898568bbb62acc6e6c44513a06ddf2b7b656c22 Author: Alan Mackenzie Date: Sun Feb 17 18:33:54 2019 +0000 * Put INLINE and ATTRIBUTE_NO_SANITIZE_UNDEFINED into c-noise-macro-names * .dir-locals (entry for c-mode): Put the two strings into c-noise-macro-names. diff --git a/.dir-locals.el b/.dir-locals.el index 96473a7086..9cd39920c2 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -2,7 +2,7 @@ (sentence-end-double-space . t) (fill-column . 70))) (c-mode . ((c-file-style . "GNU") - (c-noise-macro-names . ("UNINIT" "CALLBACK" "ALIGN_STACK")) + (c-noise-macro-names . ("INLINE" "ATTRIBUTE_NO_SANITIZE_UNDEFINED" "UNINIT" "CALLBACK" "ALIGN_STACK")) (electric-quote-comment . nil) (electric-quote-string . nil))) (objc-mode . ((c-file-style . "GNU")