commit bd9e8b31a1a38a2ffa5c2ff5e805a42ffccc36ec (HEAD, refs/remotes/origin/master) Author: Simen Heggestøyl Date: Sat Dec 16 09:49:54 2017 +0100 Add command for cycling between CSS color formats * lisp/textmodes/css-mode.el (css-mode-map): Add keybinding for 'css-cycle-color-format'. (css--rgb-color): Add support for extracting alpha component. (css--hex-alpha, css--color-to-4-dpc, css--named-color-to-hex) (css--format-rgba-alpha, css--hex-to-rgb) (css--rgb-to-named-color-or-hex): New functions. (css-cycle-color-format): New command for cycling between color formats. * test/lisp/textmodes/css-mode-tests.el (css-test-color-to-4-dpc): (css-test-named-color-to-hex, css-test-format-rgba-alpha) (css-test-hex-to-rgb, css-test-rgb-to-named-color-or-hex) (css-test-cycle-color-format, css-test-hex-alpha): New tests for the changes mentioned above. * etc/NEWS: Mention the new command. diff --git a/etc/NEWS b/etc/NEWS index bec7753d19..1382f96a37 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -77,6 +77,13 @@ whether '"' is also replaced in 'electric-quote-mode'. If non-nil, * Changes in Specialized Modes and Packages in Emacs 27.1 +** CSS mode + +--- +*** A new command 'css-cycle-color-format' for cycling between color +formats (e.g. "black" => "#000000" => "rgb(0, 0, 0)") has been added, +bound to 'C-c C-f'. + ** Dired +++ diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index b0e66d397f..f0988827c3 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -32,12 +32,13 @@ ;;; Code: -(require 'eww) (require 'cl-lib) (require 'color) +(require 'eww) (require 'seq) (require 'sgml-mode) (require 'smie) +(require 'thingatpt) (eval-when-compile (require 'subr-x)) (defgroup css nil @@ -806,6 +807,7 @@ cannot be completed sensibly: `custom-ident', (defvar css-mode-map (let ((map (make-sparse-keymap))) (define-key map [remap info-lookup-symbol] 'css-lookup-symbol) + (define-key map "\C-c\C-f" 'css-cycle-color-format) map) "Keymap used in `css-mode'.") @@ -936,11 +938,13 @@ cannot be completed sensibly: `custom-ident', "Skip blanks and comments." (while (forward-comment 1))) -(cl-defun css--rgb-color () +(cl-defun css--rgb-color (&optional include-alpha) "Parse a CSS rgb() or rgba() color. Point should be just after the open paren. Returns a hex RGB color, or nil if the color could not be recognized. -This recognizes CSS-color-4 extensions." +This recognizes CSS-color-4 extensions. +When INCLUDE-ALPHA is non-nil, the alpha component is included in +the returned hex string." (let ((result '()) (iter 0)) (while (< iter 4) @@ -952,8 +956,8 @@ This recognizes CSS-color-4 extensions." (number (string-to-number str))) (when is-percent (setq number (* 255 (/ number 100.0)))) - ;; Don't push the alpha. - (when (< iter 3) + (if (and include-alpha (= iter 3)) + (push (round (* number 255)) result) (push (min (max 0 (truncate number)) 255) result)) (goto-char (match-end 0)) (css--color-skip-blanks) @@ -966,7 +970,11 @@ This recognizes CSS-color-4 extensions." (css--color-skip-blanks))) (when (looking-at ")") (forward-char) - (apply #'format "#%02x%02x%02x" (nreverse result))))) + (apply #'format + (if (and include-alpha (= (length result) 4)) + "#%02x%02x%02x%02x" + "#%02x%02x%02x") + (nreverse result))))) (cl-defun css--hsl-color () "Parse a CSS hsl() or hsla() color. @@ -1039,6 +1047,14 @@ This function simply drops any transparency." ;; Either #RGB or #RRGGBB, drop the "A" or "AA". (substring str 0 (if (> (length str) 5) 7 4))) +(defun css--hex-alpha (hex) + "Return the alpha component of CSS color HEX. +HEX can either be in the #RGBA or #RRGGBBAA format. Return nil +if the color doesn't have an alpha component." + (cl-case (length hex) + (5 (string (elt hex 4))) + (9 (substring hex 7 9)))) + (defun css--named-color (start-point str) "Check whether STR, seen at point, is CSS named color. Returns STR if it is a valid color. Special care is taken @@ -1381,6 +1397,111 @@ tags, classes and IDs." (progn (insert ": ;") (forward-char -1)))))))))) +(defun css--color-to-4-dpc (hex) + "Convert the CSS color HEX to four digits per component. +CSS colors use one or two digits per component for RGB hex +values. Convert the given color to four digits per component. + +Note that this function handles CSS colors specifically, and +should not be mixed with those in color.el." + (let ((six-digits (= (length hex) 7))) + (apply + #'concat + `("#" + ,@(seq-mapcat + (apply-partially #'make-list (if six-digits 2 4)) + (seq-partition (seq-drop hex 1) (if six-digits 2 1))))))) + +(defun css--named-color-to-hex () + "Convert named CSS color at point to hex format. +Return non-nil if a conversion was made. + +Note that this function handles CSS colors specifically, and +should not be mixed with those in color.el." + (save-excursion + (unless (or (looking-at css--colors-regexp) + (eq (char-before) ?#)) + (backward-word)) + (when (member (word-at-point) (mapcar #'car css--color-map)) + (looking-at css--colors-regexp) + (let ((color (css--compute-color (point) (match-string 0)))) + (replace-match color)) + t))) + +(defun css--format-rgba-alpha (alpha) + "Return ALPHA component formatted for use in rgba()." + (let ((a (string-to-number (format "%.2f" alpha)))) + (if (or (= a 0) + (= a 1)) + (format "%d" a) + (string-remove-suffix "0" (number-to-string a))))) + +(defun css--hex-to-rgb () + "Convert CSS hex color at point to RGB format. +Return non-nil if a conversion was made. + +Note that this function handles CSS colors specifically, and +should not be mixed with those in color.el." + (save-excursion + (unless (or (eq (char-after) ?#) + (eq (char-before) ?\()) + (backward-sexp)) + (when-let* ((hex (when (looking-at css--colors-regexp) + (and (eq (elt (match-string 0) 0) ?#) + (match-string 0)))) + (rgb (css--hex-color hex))) + (seq-let (r g b) + (mapcar (lambda (x) (round (* x 255))) + (color-name-to-rgb (css--color-to-4-dpc rgb))) + (replace-match + (if-let* ((alpha (css--hex-alpha hex)) + (a (css--format-rgba-alpha + (/ (string-to-number alpha 16) + (float (expt 16 (length alpha))))))) + (format "rgba(%d, %d, %d, %s)" r g b a) + (format "rgb(%d, %d, %d)" r g b)) + t)) + t))) + +(defun css--rgb-to-named-color-or-hex () + "Convert CSS RGB color at point to a named color or hex format. +Convert to a named color if the color at point has a name, else +convert to hex format. Return non-nil if a conversion was made. + +Note that this function handles CSS colors specifically, and +should not be mixed with those in color.el." + (save-excursion + (when-let* ((open-paren-pos (nth 1 (syntax-ppss)))) + (when (save-excursion + (goto-char open-paren-pos) + (looking-back "rgba?" (- (point) 4))) + (goto-char (nth 1 (syntax-ppss))))) + (when (eq (char-before) ?\)) + (backward-sexp)) + (skip-chars-backward "rgba") + (when (looking-at css--colors-regexp) + (let* ((start (match-end 0)) + (color (save-excursion + (goto-char start) + (css--rgb-color t)))) + (when color + (kill-sexp) + (kill-sexp) + (let ((named-color (seq-find (lambda (x) (equal (cdr x) color)) + css--color-map))) + (insert (if named-color (car named-color) color))) + t))))) + +(defun css-cycle-color-format () + "Cycle the color at point between different CSS color formats. +Supported formats are by name (if possible), hexadecimal, and +rgb()/rgba()." + (interactive) + (or (css--named-color-to-hex) + (css--hex-to-rgb) + (css--rgb-to-named-color-or-hex) + (message "It doesn't look like a color at point"))) + ;;;###autoload (define-derived-mode css-mode prog-mode "CSS" "Major mode to edit Cascading Style Sheets (CSS). diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el index 1e58751f14..2be5772625 100644 --- a/test/lisp/textmodes/css-mode-tests.el +++ b/test/lisp/textmodes/css-mode-tests.el @@ -244,6 +244,73 @@ (should (member "body" completions)) (should-not (member "article" completions))))) +(ert-deftest css-test-color-to-4-dpc () + (should (equal (css--color-to-4-dpc "#ffffff") + (css--color-to-4-dpc "#fff"))) + (should (equal (css--color-to-4-dpc "#aabbcc") + (css--color-to-4-dpc "#abc"))) + (should (equal (css--color-to-4-dpc "#fab") + "#ffffaaaabbbb")) + (should (equal (css--color-to-4-dpc "#fafbfc") + "#fafafbfbfcfc"))) + +(ert-deftest css-test-named-color-to-hex () + (dolist (item '(("black" "#000000") + ("white" "#ffffff") + ("salmon" "#fa8072"))) + (with-temp-buffer + (css-mode) + (insert (nth 0 item)) + (css--named-color-to-hex) + (should (equal (buffer-string) (nth 1 item)))))) + +(ert-deftest css-test-format-rgba-alpha () + (should (equal (css--format-rgba-alpha 0) "0")) + (should (equal (css--format-rgba-alpha 0.0) "0")) + (should (equal (css--format-rgba-alpha 0.00001) "0")) + (should (equal (css--format-rgba-alpha 1) "1")) + (should (equal (css--format-rgba-alpha 1.0) "1")) + (should (equal (css--format-rgba-alpha 1.00001) "1")) + (should (equal (css--format-rgba-alpha 0.10000) "0.1")) + (should (equal (css--format-rgba-alpha 0.100001) "0.1")) + (should (equal (css--format-rgba-alpha 0.2524334) "0.25"))) + +(ert-deftest css-test-hex-to-rgb () + (dolist (item '(("#000" "rgb(0, 0, 0)") + ("#000000" "rgb(0, 0, 0)") + ("#fff" "rgb(255, 255, 255)") + ("#ffffff" "rgb(255, 255, 255)") + ("#ffffff80" "rgba(255, 255, 255, 0.5)") + ("#fff8" "rgba(255, 255, 255, 0.5)"))) + (with-temp-buffer + (css-mode) + (insert (nth 0 item)) + (css--hex-to-rgb) + (should (equal (buffer-string) (nth 1 item)))))) + +(ert-deftest css-test-rgb-to-named-color-or-hex () + (dolist (item '(("rgb(0, 0, 0)" "black") + ("rgb(255, 255, 255)" "white") + ("rgb(255, 255, 240)" "ivory") + ("rgb(18, 52, 86)" "#123456") + ("rgba(18, 52, 86, 0.5)" "#12345680"))) + (with-temp-buffer + (css-mode) + (insert (nth 0 item)) + (css--rgb-to-named-color-or-hex) + (should (equal (buffer-string) (nth 1 item)))))) + +(ert-deftest css-test-cycle-color-format () + (with-temp-buffer + (css-mode) + (insert "black") + (css-cycle-color-format) + (should (equal (buffer-string) "#000000")) + (css-cycle-color-format) + (should (equal (buffer-string) "rgb(0, 0, 0)")) + (css-cycle-color-format) + (should (equal (buffer-string) "black")))) + (ert-deftest css-mdn-symbol-guessing () (dolist (item '(("@med" "ia" "@media") ("@keyframes " "{" "@keyframes") @@ -301,6 +368,12 @@ (should (equal (css--hex-color "#aabbcc") "#aabbcc")) (should (equal (css--hex-color "#aabbccdd") "#aabbcc"))) +(ert-deftest css-test-hex-alpha () + (should (equal (css--hex-alpha "#abcd") "d")) + (should-not (css--hex-alpha "#abc")) + (should (equal (css--hex-alpha "#aabbccdd") "dd")) + (should-not (css--hex-alpha "#aabbcc"))) + (ert-deftest css-test-named-color () (dolist (text '("@mixin black" "@include black")) (with-temp-buffer commit ac0d6c06b805b8f05a854a69639531bf737fea3f Author: Stefan Monnier Date: Sat Dec 16 17:43:38 2017 -0500 * lisp/textmodes/css-mode.el (css--hex-color): Trivial simplification diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 96c3f6b939..b0e66d397f 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1037,9 +1037,7 @@ This recognizes CSS-color-4 extensions." STR is the incoming CSS hex color. This function simply drops any transparency." ;; Either #RGB or #RRGGBB, drop the "A" or "AA". - (if (> (length str) 5) - (substring str 0 7) - (substring str 0 4))) + (substring str 0 (if (> (length str) 5) 7 4))) (defun css--named-color (start-point str) "Check whether STR, seen at point, is CSS named color. commit f74d811e805ebbcff9328e6cb8b5793f9d8c85ec Merge: 8e46d93dcd 080f227331 Author: Glenn Morris Date: Sat Dec 16 12:18:45 2017 -0800 ; Merge from origin/emacs-26 The following commit was skipped: 080f227331 (origin/emacs-26) Use utf-8-hfs-unix on macOS (Bug#29712) commit 8e46d93dcdabfa9fb099345fa12378479b4dbe63 Merge: da2c441079 28e0261890 Author: Glenn Morris Date: Sat Dec 16 12:18:45 2017 -0800 Merge from origin/emacs-26 28e0261890 * lisp/progmodes/cc-defs.el (c-version): Update to 5.33.1. ac53084f9b Improve fix for Bug#29712 ffd4771560 * doc/lispref/sequences.texi (Sequence Functions): Improve... f274cbd185 Avoid reordering of output in 'shr-insert-document' 7890864413 Improve documentation of 'invisible-p' a1327bbc64 Remove one more check that Vframe_list is non-nil 63b6281fdd Fix off-by-one error in 'css--hex-color' 804b37ca63 Save and restore text-pixel height and width of frames (Bu... 777fe94661 Partially revert "Mention new strictness for &optional, &r... ad17db7964 * lisp/vc/smerge-mode.el (smerge-refine): Respect font-loc... 5a7d0095a4 * lisp/vc/smerge-mode.el (smerge-refine): Replace obsolete... e019c35df6 FOR_EACH_FRAME no longer assumes frame-list d64b88da2f * src/font.c (Ffont_info): Doc fix. (Bug#29682) 92b2604a7f Modernise message.el face spec syntax b1efbe6564 Update message.el obsolete face aliases 2494c14e76 ; * lisp/comint.el (comint-terminfo-terminal): Add a :vers... 12ad276d15 Improve documentation of TERM environment variable 8ed529f0f3 Add option to configure comint TERM 889f07c352 Better support utf-8-with-signature and utf-8-hfs in XML/HTML a2697fac0e * lisp/menu-bar.el (menu-bar-mode): Doc fix. ffb50eace6 ; * etc/NEWS: Fix last change. 95606af8b0 Fix Bug#29712 in tramp-tests.el 9bf66c6bee Don't run FOR_EACH_FRAME when there's no frame left (Bug#2... c2a88ec8e8 * lisp/textmodes/tex-mode.el: Ensure uncompiled file is lo... b178870528 Remember password change for IMAP in Gnus (Bug#29692) a21dac18bb Add %DUMBFW to the default GnuTLS priority strings 780407cff1 Small fixes prompted by make check-declare 541a60108d Fix some custom groups e220d6e112 Fix fontification of first declaration within a C++ lambda... aa66da220c * src/data.c (Fadd_variable_watcher): Doc fix. f838210b01 Fix misfontification of C++ member initialization list aft... 232c6465ce Fix doc-string of Fbuffer_list 3f9aac68d7 Don't raise an extraneous frame (bug#29696) e7b1111155 Mention new strictness for &optional, &rest in arglists (B... 4cb8696e47 Don't misfontify "foo ()" inside C++ initialization parent... ce31e726ad Fixes for defcustoms, prompted by cus-test-opts aacd1e14fc * lisp/net/newst-backend.el (newsticker--raw-url-list-defa... 7e2f4d3d41 * lisp/htmlfontify.el (hfy-which-etags): Fix it. 52d2a690f6 Add missing :version tags revealed by cusver-check f5d0360234 Escape column-zero doc parens # Conflicts: # etc/NEWS commit 080f227331ed328bbe57e8481042e6609beb8964 Author: Alan Third Date: Sat Dec 16 17:13:34 2017 +0000 Use utf-8-hfs-unix on macOS (Bug#29712) This is a quick fix for the Emacs 26 release. Do not merge to master. * test/src/fileio-tests.el (fileio-tests--symlink-failure): Override file-name-coding-system to utf-8-hfs-unix to prevent test failure. diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 01c280d275..6962b68456 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -29,7 +29,8 @@ (defun fileio-tests--symlink-failure () (let* ((dir (make-temp-file "fileio" t)) - (link (expand-file-name "link" dir))) + (link (expand-file-name "link" dir)) + (file-name-coding-system 'utf-8-hfs-unix)) (unwind-protect (let (failure (char 0)) commit da2c441079c74b18399176df3f92613436ef53dc Author: Philipp Stephani Date: Sat Dec 16 19:16:01 2017 +0100 Remove two unused variables in macfont.m * src/macfont.m (macfont_get_glyph_for_character): Remove two unused variables. diff --git a/src/macfont.m b/src/macfont.m index 6985364b34..6c119d90dc 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -1441,8 +1441,6 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font, CGGlyph *glyphs; int i, len; int nrows; - dispatch_queue_t queue; - dispatch_group_t group = NULL; int nkeys; if (row != 0) commit a4f220d09b12b9bb4819949902ec4156ea2c385f Author: Alan Third Date: Sat Dec 16 17:02:15 2017 +0000 Use utf-8-hfs-unix on macOS (Bug#29712) * lisp/term/ns-win.el: Use utf-8-hfs-unix instead of utf-8-hfs. diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index 82041a665d..d512e8e506 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -354,7 +354,7 @@ See `ns-insert-working-text'." ;; Used prior to Emacs 25. (define-coding-system-alias 'utf-8-nfd 'utf-8-hfs) - (set-file-name-coding-system 'utf-8-hfs)) + (set-file-name-coding-system 'utf-8-hfs-unix)) ;;;; Inter-app communications support. commit 95e7195f0d2a30beb2aaa0c324dd6049a168ba5b Author: Alan Third Date: Sun Dec 10 20:15:52 2017 +0000 Silence macOS 10.13 deprecation notices (Bug#29643) * src/nsfns.m (Fx_display_backing_store): (Fx_display_save_under): Don't use NSBackingStoreRetained or NSBackingStoreNonretained on macOS 10.13+. * src/nsselect.m (symbol_to_nsstring): (ns_string_to_symbol): (nxatoms_of_nsselect): Replace NSGeneralPboard with NSPasteboardNameGeneral. * src/nsterm.h: #define NSPasteboardNameGeneral to NSGeneralPboard on GNUstep and macOS < 10.13. * src/nsterm.m (EmacsView::resetCursorRects): (EmacsScroller::resetCursorRects): Don't use setOnMouseEntered on macOS 10.13+. diff --git a/src/nsfns.m b/src/nsfns.m index 8172268167..064b476fb4 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1896,10 +1896,12 @@ and GNUstep implementations ("distributor-specific release { case NSBackingStoreBuffered: return intern ("buffered"); +#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 101300 case NSBackingStoreRetained: return intern ("retained"); case NSBackingStoreNonretained: return intern ("non-retained"); +#endif default: error ("Strange value for backingType parameter of frame"); } @@ -1953,9 +1955,11 @@ and GNUstep implementations ("distributor-specific release case NSBackingStoreBuffered: return Qt; +#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 101300 case NSBackingStoreRetained: case NSBackingStoreNonretained: return Qnil; +#endif default: error ("Strange value for backingType parameter of frame"); diff --git a/src/nsselect.m b/src/nsselect.m index 067c7788e8..d1ce9437a7 100644 --- a/src/nsselect.m +++ b/src/nsselect.m @@ -36,7 +36,7 @@ Updated by Christian Limpach (chris@nice.ch) static Lisp_Object Vselection_alist; -/* NSGeneralPboard is pretty much analogous to X11 CLIPBOARD */ +/* NSPasteboardNameGeneral is pretty much analogous to X11 CLIPBOARD */ static NSString *NXPrimaryPboard; static NSString *NXSecondaryPboard; @@ -54,7 +54,7 @@ Updated by Christian Limpach (chris@nice.ch) symbol_to_nsstring (Lisp_Object sym) { CHECK_SYMBOL (sym); - if (EQ (sym, QCLIPBOARD)) return NSGeneralPboard; + if (EQ (sym, QCLIPBOARD)) return NSPasteboardNameGeneral; if (EQ (sym, QPRIMARY)) return NXPrimaryPboard; if (EQ (sym, QSECONDARY)) return NXSecondaryPboard; if (EQ (sym, QTEXT)) return NSStringPboardType; @@ -70,7 +70,7 @@ Updated by Christian Limpach (chris@nice.ch) static Lisp_Object ns_string_to_symbol (NSString *t) { - if ([t isEqualToString: NSGeneralPboard]) + if ([t isEqualToString: NSPasteboardNameGeneral]) return QCLIPBOARD; if ([t isEqualToString: NXPrimaryPboard]) return QPRIMARY; @@ -469,7 +469,7 @@ Updated by Christian Limpach (chris@nice.ch) pasteboard_changecount = [[NSMutableDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithLong:0], NSGeneralPboard, + [NSNumber numberWithLong:0], NSPasteboardNameGeneral, [NSNumber numberWithLong:0], NXPrimaryPboard, [NSNumber numberWithLong:0], NXSecondaryPboard, [NSNumber numberWithLong:0], NSStringPboardType, diff --git a/src/nsterm.h b/src/nsterm.h index c81bf5fb63..e669c95931 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1322,5 +1322,10 @@ enum NSWindowTabbingMode NSWindowTabbingModePreferred, NSWindowTabbingModeDisallowed }; +#endif /* !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_12) */ + +#if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_13) +/* Deprecated in macOS 10.13. */ +#define NSPasteboardNameGeneral NSGeneralPboard #endif #endif /* HAVE_NS */ diff --git a/src/nsterm.m b/src/nsterm.m index 50e06c94d4..07ac8f978f 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6016,7 +6016,13 @@ - (void)resetCursorRects if (!NSIsEmptyRect (visible)) [self addCursorRect: visible cursor: currentCursor]; - [currentCursor setOnMouseEntered: YES]; + +#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 101300 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 + if ([currentCursor respondsToSelector: @selector(setOnMouseEntered)]) +#endif + [currentCursor setOnMouseEntered: YES]; +#endif } @@ -8746,7 +8752,14 @@ - (void)resetCursorRects if (!NSIsEmptyRect (visible)) [self addCursorRect: visible cursor: [NSCursor arrowCursor]]; - [[NSCursor arrowCursor] setOnMouseEntered: YES]; + +#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 101300 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 + if ([[NSCursor arrowCursor] respondsToSelector: + @selector(setOnMouseEntered)]) +#endif + [[NSCursor arrowCursor] setOnMouseEntered: YES]; +#endif } commit 28e0261890e6335cb49cc03c47c206ce9c022448 Author: Alan Mackenzie Date: Sat Dec 16 16:01:49 2017 +0000 * lisp/progmodes/cc-defs.el (c-version): Update to 5.33.1. diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index bff1c9eb65..973d97c256 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -87,7 +87,7 @@ ;;; Variables also used at compile time. -(defconst c-version "5.33" +(defconst c-version "5.33.1" "CC Mode version number.") (defconst c-version-sym (intern c-version)) commit ac53084f9b8a6ae7369f1de24003575d60e40614 Author: Michael Albinus Date: Sat Dec 16 16:40:03 2017 +0100 Improve fix for Bug#29712 * test/lisp/net/tramp-tests.el (tramp-test32-environment-variables-and-port-numbers): Adapt check for systems which do not support "echo -n". (Bug#29712) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index c1577008d3..d4f568fedd 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3637,8 +3637,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (ert-deftest tramp-test32-environment-variables-and-port-numbers () "Check that two connections with separate ports are different." (skip-unless (tramp--test-enabled)) - ;; Bug#29712. - (skip-unless (not (eq system-type 'darwin))) ;; We test it only for the mock-up connection; otherwise there might ;; be problems with the used ports. (skip-unless (and (eq tramp-syntax 'default) @@ -3663,7 +3661,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (format "%s=%d" envvar port) tramp-remote-process-environment))) (should - (string-equal + (string-match (number-to-string port) (shell-command-to-string (format "echo -n $%s" envvar)))))) commit ffd4771560bf91eb4f52970b9e7119ff7b804aed Author: Eli Zaretskii Date: Sat Dec 16 16:54:32 2017 +0200 * doc/lispref/sequences.texi (Sequence Functions): Improve indexing. diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 4fba880803..8d56e022d8 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -425,6 +425,7 @@ useful example of @code{sort}. @cindex sequence functions in seq @cindex seq library +@cindex sequences, generalized The @file{seq.el} library provides the following additional sequence manipulation macros and functions, prefixed with @code{seq-}. To use them, you must first load the @file{seq} library. @@ -859,6 +860,7 @@ it is a function of two arguments to use instead of the default @code{equal}. @end defun @defun seq-subseq sequence start &optional end +@cindex sub-sequence This function returns a subset of @var{sequence} from @var{start} to @var{end}, both integers (@var{end} defaults to the last element). If @var{start} or @var{end} is negative, it counts from the end of @@ -926,6 +928,8 @@ contain less elements than @var{n}. @var{n} must be an integer. If @end defun @defun seq-intersection sequence1 sequence2 &optional function +@cindex sequences, intersection of +@cindex intersection of sequences This function returns a list of the elements that appear both in @var{sequence1} and @var{sequence2}. If the optional argument @var{function} is non-@code{nil}, it is a function of two arguments to @@ -972,6 +976,10 @@ of @var{sequence}. Keys are compared using @code{equal}. @end defun @defun seq-into sequence type +@cindex convert sequence to another type +@cindex list to vector +@cindex vector to list +@cindex string to vector This function converts the sequence @var{sequence} into a sequence of type @var{type}. @var{type} can be one of the following symbols: @code{vector}, @code{string} or @code{list}. @@ -993,6 +1001,8 @@ of type @var{type}. @var{type} can be one of the following symbols: @end defun @defun seq-min sequence +@cindex minimum value of sequence +@cindex sequence minimum This function returns the smallest element of @var{sequence}. The elements of @var{sequence} must be numbers or markers (@pxref{Markers}). @@ -1010,6 +1020,8 @@ elements of @var{sequence} must be numbers or markers @end defun @defun seq-max sequence +@cindex maximum value of sequence +@cindex sequence maximum This function returns the largest element of @var{sequence}. The elements of @var{sequence} must be numbers or markers. @@ -1027,6 +1039,7 @@ elements of @var{sequence} must be numbers or markers. @defmac seq-doseq (var sequence) body@dots{} @cindex sequence iteration +@cindex iteration over vector or string This macro is like @code{dolist} (@pxref{Iteration, dolist}), except that @var{sequence} can be a list, vector or string. This is primarily useful for side-effects. commit f274cbd185ddab4e414ccecf6c0b30e6fd3ef303 Author: Eli Zaretskii Date: Sat Dec 16 16:09:41 2017 +0200 Avoid reordering of output in 'shr-insert-document' * lisp/net/shr.el (shr-string-pixel-width): Preserve point across shr-pixel-column invocations. (Bug#29734) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 8a64f7549f..c505f25a5a 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -591,9 +591,14 @@ size, and full-buffer size." (defun shr-string-pixel-width (string) (if (not shr-use-fonts) (length string) - (with-temp-buffer - (insert string) - (shr-pixel-column)))) + ;; Save and restore point across with-temp-buffer, since + ;; shr-pixel-column uses save-window-excursion, which can reset + ;; point to 1. + (let ((pt (point))) + (with-temp-buffer + (insert string) + (shr-pixel-column)) + (goto-char pt)))) (defsubst shr--translate-insertion-chars () ;; Remove soft hyphens. commit 78908644131e70f20de28fed08ef4dc2878878a3 Author: Eli Zaretskii Date: Sat Dec 16 12:15:06 2017 +0200 Improve documentation of 'invisible-p' * doc/lispref/display.texi (Invisible Text): Document the return value of 'invisible-p'. * src/xdisp.c (Finvisible_p): Rename the argument POS. Doc fix. (Bug#29721) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 7af8d9efb7..50069e3d1d 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -929,13 +929,18 @@ major mode should use the mode's own name as an element of @defun invisible-p pos-or-prop If @var{pos-or-prop} is a marker or number, this function returns a -non-@code{nil} value if the text at that position is invisible. +non-@code{nil} value if the text at that position is currently +invisible. If @var{pos-or-prop} is any other kind of Lisp object, that is taken to mean a possible value of the @code{invisible} text or overlay property. In that case, this function returns a non-@code{nil} value if that value would cause text to become invisible, based on the current value of @code{buffer-invisibility-spec}. + +The return value of this function is @code{t} if the text would be +completely hidden on display, or a non-@code{nil}, non-@code{t} value +if the text would be replaced by an ellipsis. @end defun @vindex line-move-ignore-invisible diff --git a/src/xdisp.c b/src/xdisp.c index 0a37013c56..7601e26a90 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -25086,19 +25086,25 @@ invisible_prop (Lisp_Object propval, Lisp_Object list) } DEFUN ("invisible-p", Finvisible_p, Sinvisible_p, 1, 1, 0, - doc: /* Non-nil if the property makes the text invisible. -POS-OR-PROP can be a marker or number, in which case it is taken to be -a position in the current buffer and the value of the `invisible' property -is checked; or it can be some other value, which is then presumed to be the -value of the `invisible' property of the text of interest. -The non-nil value returned can be t for truly invisible text or something -else if the text is replaced by an ellipsis. */) - (Lisp_Object pos_or_prop) + doc: /* Non-nil if text properties at POS cause text there to be currently invisible. +POS should be a marker or a buffer position; the value of the `invisible' +property at that position in the current buffer is examined. +POS can also be the actual value of the `invisible' text or overlay +property of the text of interest, in which case the value itself is +examined. + +The non-nil value returned can be t for currently invisible text that is +entirely hidden on display, or some other non-nil, non-t value if the +text is replaced by an ellipsis. + +Note that whether text with `invisible' property is actually hidden on +display may depend on `buffer-invisibility-spec', which see. */) + (Lisp_Object pos) { Lisp_Object prop - = (NATNUMP (pos_or_prop) || MARKERP (pos_or_prop) - ? Fget_char_property (pos_or_prop, Qinvisible, Qnil) - : pos_or_prop); + = (NATNUMP (pos) || MARKERP (pos) + ? Fget_char_property (pos, Qinvisible, Qnil) + : pos); int invis = TEXT_PROP_MEANS_INVISIBLE (prop); return (invis == 0 ? Qnil : invis == 1 ? Qt commit f63d9f86b5688ac84ec6e7eecdbb6cac103dbcf2 Author: Michael Albinus Date: Sat Dec 16 10:47:06 2017 +0100 Suppress timers in Tramp operations * lisp/net/tramp.el (tramp-accept-process-output): * lisp/net/tramp-adb.el (tramp-adb-handle-start-file-process): * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band) (tramp-sh-handle-start-file-process): * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory) (tramp-smb-handle-file-acl, tramp-smb-handle-process-file) (tramp-smb-handle-set-file-acl) (tramp-smb-handle-start-file-process): Suppress timers. * test/lisp/net/tramp-tests.el (tramp-test41-asynchronous-requests): Use $REMOTE_PARALLEL_PROCESSES. Flush cache prior file operations. Add instrumentation messages. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index d06031f1a6..c614acfa4d 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -1037,7 +1037,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (or (null program) tramp-process-connection-type)) (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) (name1 name) - (i 0)) + (i 0) + ;; We do not want to run timers. + timer-list timer-idle-list) (while (get-process name1) ;; NAME must be unique as process name. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 361e4c3e30..96a0d84907 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2473,7 +2473,9 @@ The method used must be an out-of-band method." ;; The default directory must be remote. (let ((default-directory (file-name-directory (if t1 filename newname))) - (process-environment (copy-sequence process-environment))) + (process-environment (copy-sequence process-environment)) + ;; We do not want to run timers. + timer-list timer-idle-list) ;; Set the transfer process properties. (tramp-set-connection-property v "process-name" (buffer-name (current-buffer))) @@ -2894,7 +2896,9 @@ the result will be a local, non-Tramp, file name." ;; We do not want to raise an error when ;; `start-file-process' has been started several times in ;; `eshell' and friends. - (tramp-current-connection nil) + tramp-current-connection + ;; We do not want to run timers. + timer-list timer-idle-list p) (while (get-process name1) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index ec689aea15..fee14df991 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -457,7 +457,9 @@ pass to the OPERATION." (expand-file-name tramp-temp-name-prefix (tramp-compat-temporary-file-directory)))) - (args (list (concat "//" host "/" share) "-E"))) + (args (list (concat "//" host "/" share) "-E")) + ;; We do not want to run timers. + timer-list timer-idle-list) (if (not (zerop (length user))) (setq args (append args (list "-U" user))) @@ -739,7 +741,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (let* ((share (tramp-smb-get-share v)) (localname (replace-regexp-in-string "\\\\" "/" (tramp-smb-get-localname v))) - (args (list (concat "//" host "/" share) "-E"))) + (args (list (concat "//" host "/" share) "-E")) + ;; We do not want to run timers. + timer-list timer-idle-list) (if (not (zerop (length user))) (setq args (append args (list "-U" user))) @@ -1215,6 +1219,8 @@ component is used as the target of the symlink." (let* ((name (file-name-nondirectory program)) (name1 name) (i 0) + ;; We do not want to run timers. + timer-list timer-idle-list input tmpinput outbuf command ret) ;; Determine input. @@ -1391,7 +1397,9 @@ component is used as the target of the symlink." "\\\\" "/" (tramp-smb-get-localname v))) (args (list (concat "//" host "/" share) "-E" "-S" (replace-regexp-in-string - "\n" "," acl-string)))) + "\n" "," acl-string))) + ;; We do not want to run timers. + timer-list timer-idle-list) (if (not (zerop (length user))) (setq args (append args (list "-U" user))) @@ -1471,7 +1479,9 @@ component is used as the target of the symlink." (command (mapconcat 'identity (cons program args) " ")) (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) (name1 name) - (i 0)) + (i 0) + ;; We do not want to run timers. + timer-list timer-idle-list) (unwind-protect (save-excursion (save-restriction diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 3129984afc..01a3e44c73 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3833,7 +3833,9 @@ connection buffer." This is needed in order to hide `last-coding-system-used', which is set for process communication also." (with-current-buffer (process-buffer proc) - (let (buffer-read-only last-coding-system-used) + (let (buffer-read-only last-coding-system-used + ;; We do not want to run timers. + timer-list timer-idle-list) ;; Under Windows XP, `accept-process-output' doesn't return ;; sometimes. So we add an additional timeout. JUST-THIS-ONE ;; is set due to Bug#12145. It is an integer, in order to avoid diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 5fb3162769..1bcd3a0f98 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -33,6 +33,10 @@ ;; remote host, set this environment variable to "/dev/null" or ;; whatever is appropriate on your system. +;; For slow remote connections, `tramp-test41-asynchronous-requests' +;; might be too heavy. Setting $REMOTE_PARALLEL_PROCESSES to a proper +;; value less than 10 could help. + ;; A whole test run can be performed calling the command `tramp-test-all'. ;;; Code: @@ -4504,8 +4508,13 @@ process sentinels. They shall not disturb each other." (inhibit-message t) ;; Do not run delayed timers. (timer-max-repeats 0) - ;; Number of asynchronous processes for test. - (number-proc 10) + ;; Number of asynchronous processes for test. Tests on + ;; some machines handle less parallel processes. + (number-proc + (or + (ignore-errors + (string-to-number (getenv "REMOTE_PARALLEL_PROCESSES"))) + 10)) ;; On hydra, timings are bad. (timer-repeat (cond @@ -4571,14 +4580,20 @@ process sentinels. They shall not disturb each other." (set-process-filter proc (lambda (proc string) + (tramp--test-message + "Process filter %s %s %s" proc string (current-time-string)) (with-current-buffer (process-buffer proc) (insert string)) (unless (zerop (length string)) + (dired-uncache (process-get proc 'foo)) (should (file-attributes (process-get proc 'foo)))))) ;; Add process sentinel. (set-process-sentinel proc (lambda (proc _state) + (tramp--test-message + "Process sentinel %s %s" proc (current-time-string)) + (dired-uncache (process-get proc 'foo)) (should-not (file-attributes (process-get proc 'foo))))))) ;; Send a string. Use a random order of the buffers. Mix @@ -4594,6 +4609,7 @@ process sentinels. They shall not disturb each other." (tramp--test-message "Start action %d %s %s" count buf (current-time-string)) ;; Regular operation prior process action. + (dired-uncache file) (if (= count 0) (should-not (file-attributes file)) (should (file-attributes file))) @@ -4602,7 +4618,10 @@ process sentinels. They shall not disturb each other." (accept-process-output proc 0.1 nil 0) ;; Give the watchdog a chance. (read-event nil nil 0.01) + (tramp--test-message + "Continue action %d %s %s" count buf (current-time-string)) ;; Regular operation post process action. + (dired-uncache file) (if (= count 2) (should-not (file-attributes file)) (should (file-attributes file))) commit a1327bbc645efa42f14024785da4fed88aa7ec21 Author: Martin Rudalics Date: Sat Dec 16 10:14:29 2017 +0100 Remove one more check that Vframe_list is non-nil * src/dispnew.c (check_glyph_memory): Remove no-longer-needed check that Vframe_list is non-nil, as FOR_EACH_FRAME no longer assumes that. diff --git a/src/dispnew.c b/src/dispnew.c index d07864718c..b0fc5c31fa 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2260,9 +2260,8 @@ check_glyph_memory (void) Lisp_Object tail, frame; /* Free glyph memory for all frames. */ - if (!NILP (Vframe_list)) - FOR_EACH_FRAME (tail, frame) - free_glyphs (XFRAME (frame)); + FOR_EACH_FRAME (tail, frame) + free_glyphs (XFRAME (frame)); #if defined GLYPH_DEBUG && defined ENABLE_CHECKING /* Check that nothing is left allocated. */ commit 63b6281fdd9c00c6d968e936289c1e32aa9d0dd3 Author: Simen Heggestøyl Date: Sat Dec 16 09:37:11 2017 +0100 Fix off-by-one error in 'css--hex-color' * lisp/textmodes/css-mode.el (css--hex-color): Fix off-by-one error. * test/lisp/textmodes/css-mode-tests.el (css-test-hex-color): New test for 'css--hex-color'. diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 1de4ff0fca..f2481da8aa 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1037,7 +1037,7 @@ This recognizes CSS-color-4 extensions." STR is the incoming CSS hex color. This function simply drops any transparency." ;; Either #RGB or #RRGGBB, drop the "A" or "AA". - (if (> (length str) 4) + (if (> (length str) 5) (substring str 0 7) (substring str 0 4))) diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el index 47cf5f9244..1e58751f14 100644 --- a/test/lisp/textmodes/css-mode-tests.el +++ b/test/lisp/textmodes/css-mode-tests.el @@ -295,6 +295,12 @@ (insert input ")")) (should (equal (css--hsl-color) "#ff0000"))))) +(ert-deftest css-test-hex-color () + (should (equal (css--hex-color "#abc") "#abc")) + (should (equal (css--hex-color "#abcd") "#abc")) + (should (equal (css--hex-color "#aabbcc") "#aabbcc")) + (should (equal (css--hex-color "#aabbccdd") "#aabbcc"))) + (ert-deftest css-test-named-color () (dolist (text '("@mixin black" "@include black")) (with-temp-buffer commit 804b37ca63ecd68c5359febbedbec120c06918af Author: Aaron Jensen Date: Sat Dec 16 09:36:35 2017 +0100 Save and restore text-pixel height and width of frames (Bug#28442) * lisp/frameset.el (frameset--record-relationships): Record text-pixel-height and text-pixel-width of frame. (frameset--restore-frame): Restore text-pixel-height and text-pixel-width of frame if available. (Bug#28442) diff --git a/lisp/frameset.el b/lisp/frameset.el index 16940f814a..e2d26411e9 100644 --- a/lisp/frameset.el +++ b/lisp/frameset.el @@ -745,6 +745,8 @@ The relationships recorded for each frame are - `delete-before' via `frameset--delete-before' - `parent-frame' via `frameset--parent-frame' - `mouse-wheel-frame' via `frameset--mouse-wheel-frame' +- `text-pixel-width' via `frameset--text-pixel-width' +- `text-pixel-height' via `frameset--text-pixel-height' Internal use only." ;; Record frames with their own minibuffer @@ -791,7 +793,23 @@ Internal use only." 'frameset--mini (cons nil (and mb-frame - (frameset-frame-id mb-frame)))))))))) + (frameset-frame-id mb-frame))))))))) + ;; Now store text-pixel width and height if it differs from the calculated + ;; width and height and the frame is not fullscreen. + (dolist (frame frame-list) + (unless (frame-parameter frame 'fullscreen) + (unless (eq (* (frame-parameter frame 'width) + (frame-char-width frame)) + (frame-text-width frame)) + (set-frame-parameter + frame 'frameset--text-pixel-width + (frame-text-width frame))) + (unless (eq (* (frame-parameter frame 'height) + (frame-char-height frame)) + (frame-text-height frame)) + (set-frame-parameter + frame 'frameset--text-pixel-height + (frame-text-height frame)))))) ;;;###autoload (cl-defun frameset-save (frame-list @@ -1002,6 +1020,14 @@ Internal use only." (display (cdr (assq 'display filtered-cfg))) ;; post-filtering alt-cfg frame) + ;; Use text-pixels for height and width, if available. + (let ((text-pixel-width (cdr (assq 'frameset--text-pixel-width parameters))) + (text-pixel-height (cdr (assq 'frameset--text-pixel-height parameters)))) + (when text-pixel-width + (setf (alist-get 'width filtered-cfg) (cons 'text-pixels text-pixel-width))) + (when text-pixel-height + (setf (alist-get 'height filtered-cfg) (cons 'text-pixels text-pixel-height)))) + (when fullscreen ;; Currently Emacs has the limitation that it does not record the size ;; and position of a frame before maximizing it, so we cannot save & commit 777fe9466168d935e9055c7592b943cd4d2d2ff9 Author: Noam Postavsky Date: Fri Dec 15 23:20:25 2017 -0500 Partially revert "Mention new strictness for &optional, &rest..." The changes to cl argument parsing are not backwards compatible, and cause inconvenience when writing macros (e.g., instead of doing '&aux ,@auxargs', some more complicated conditionals would be required). The `cl-defstruct' macro makes use of this convenience when defining empty structs (Bug#29728). * lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): (cl--do-&aux, cl--do-arglist): Undo strict checking of &rest, &key, and &aux. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-bad-arglist): Remove test. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 6aed060cb5..5535100d4a 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -281,13 +281,8 @@ FORM is of the form (ARGS . BODY)." (or (not optional) ;; Optional args whose default is nil are simple. (null (nth 1 (assq (car args) (cdr cl--bind-defs))))) - (not (and (eq (car args) '&optional) - (progn - (when (memq (cadr args) - '(nil &rest &body &key &aux)) - (error "Variable missing after &optional")) - (setq optional t) - (car cl--bind-defs))))) + (not (and (eq (car args) '&optional) (setq optional t) + (car cl--bind-defs)))) (push (pop args) simple-args)) (when optional (if args (push '&optional args)) @@ -539,17 +534,14 @@ its argument list allows full Common Lisp conventions." arglist)))) (defun cl--do-&aux (args) - (when (eq (car args) '&aux) - (pop args) - (when (null args) - (error "Variable missing after &aux"))) - (while (and args (not (memq (car args) cl--lambda-list-keywords))) - (if (consp (car args)) - (if (and cl--bind-enquote (cl-cadar args)) - (cl--do-arglist (caar args) - `',(cadr (pop args))) - (cl--do-arglist (caar args) (cadr (pop args)))) - (cl--do-arglist (pop args) nil))) + (while (and (eq (car args) '&aux) (pop args)) + (while (and args (not (memq (car args) cl--lambda-list-keywords))) + (if (consp (car args)) + (if (and cl--bind-enquote (cl-cadar args)) + (cl--do-arglist (caar args) + `',(cadr (pop args))) + (cl--do-arglist (caar args) (cadr (pop args)))) + (cl--do-arglist (pop args) nil)))) (if args (error "Malformed argument list ends with: %S" args))) (defun cl--do-arglist (args expr &optional num) ; uses cl--bind-* @@ -566,9 +558,6 @@ its argument list allows full Common Lisp conventions." (keys nil) (laterarg nil) (exactarg nil) minarg) (or num (setq num 0)) - (when (and restarg (or (null (cdr restarg)) - (memq (cadr restarg) cl--lambda-list-keywords))) - (error "Variable missing after &rest")) (setq restarg (if (listp (cadr restarg)) (make-symbol "--cl-rest--") (cadr restarg))) @@ -620,12 +609,7 @@ its argument list allows full Common Lisp conventions." `',cl--bind-block) (+ ,num (length ,restarg))))) cl--bind-forms))) - (while (eq (car args) '&key) - (pop args) - (when (or (null args) (memq (car args) cl--lambda-list-keywords)) - (error "Missing variable after &key")) - (when keys - (error "Multiple occurrences of &key")) + (while (and (eq (car args) '&key) (pop args)) (while (and args (not (memq (car args) cl--lambda-list-keywords))) (let ((arg (pop args))) (or (consp arg) (setq arg (list arg))) diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index bf2e7e1275..575f170af6 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -497,35 +497,4 @@ collection clause." vconcat (vector (1+ x))) [2 3 4 5 6]))) - -;;; cl-lib lambda list handling - -(ert-deftest cl-macs-bad-arglist () - "Check that `cl-defun' and friends reject weird argument lists. -See Bug#29165, and similar `eval-tests--bugs-24912-and-24913' in -eval-tests.el." - (dolist (args (cl-mapcan - ;; For every &rest and &optional variant, check also - ;; the same thing with &key and &aux respectively - ;; instead. - (lambda (arglist) - (let ((arglists (list arglist))) - (when (memq '&rest arglist) - (push (cl-subst '&key '&rest arglist) arglists)) - (when (memq '&optional arglist) - (push (cl-subst '&aux '&optional arglist) arglists)) - arglists)) - '((&optional) (&rest) (&optional &rest) (&rest &optional) - (&optional &rest _a) (&optional _a &rest) - (&rest _a &optional) (&rest &optional _a) - (&optional &optional) (&optional &optional _a) - (&optional _a &optional _b) - (&rest &rest) (&rest &rest _a) - (&rest _a &rest _b)))) - (ert-info ((prin1-to-string args) :prefix "arglist: ") - (should-error (eval `(funcall (cl-function (lambda ,args))) t)) - (should-error (cl--transform-lambda (cons args t))) - (let ((byte-compile-debug t)) - (should-error (eval `(byte-compile (cl-function (lambda ,args))) t)))))) - ;;; cl-macs-tests.el ends here commit ad17db7964a1022fb0f646b35a00ffc5fb70ec30 Author: Glenn Morris Date: Fri Dec 15 13:40:06 2017 -0500 * lisp/vc/smerge-mode.el (smerge-refine): Respect font-lock-mode. diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index f1a8ed48c7..ea1e0c726f 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -1191,12 +1191,12 @@ repeating the command will highlight other two parts." (smerge-refine-regions (match-beginning n1) (match-end n1) (match-beginning n2) (match-end n2) (if smerge-use-changed-face - '((smerge . refine) (face . smerge-refined-change))) + '((smerge . refine) (font-lock-face . smerge-refined-change))) nil (unless smerge-use-changed-face - '((smerge . refine) (face . smerge-refined-removed))) + '((smerge . refine) (font-lock-face . smerge-refined-removed))) (unless smerge-use-changed-face - '((smerge . refine) (face . smerge-refined-added)))))) + '((smerge . refine) (font-lock-face . smerge-refined-added)))))) (defun smerge-swap () "Swap the \"Upper\" and the \"Lower\" chunks. commit 5a7d0095a49faf6c71800bfde61c42eb6edd0125 Author: Glenn Morris Date: Fri Dec 15 13:35:25 2017 -0500 * lisp/vc/smerge-mode.el (smerge-refine): Replace obsolete alias. diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index b988463de1..f1a8ed48c7 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -919,7 +919,7 @@ Its behavior has mainly two restrictions: after the newline. This only matters if `smerge-refine-ignore-whitespace' is nil. - it needs to be unaffected by changes performed by the `preproc' argument - to `smerge-refine-subst'. + to `smerge-refine-regions'. This only matters if `smerge-refine-weight-hack' is nil.") (defvar smerge-refine-ignore-whitespace t @@ -1188,7 +1188,7 @@ repeating the command will highlight other two parts." (put-text-property (match-beginning 0) (1+ (match-beginning 0)) 'smerge-refine-part (cons (buffer-chars-modified-tick) part))) - (smerge-refine-subst (match-beginning n1) (match-end n1) + (smerge-refine-regions (match-beginning n1) (match-end n1) (match-beginning n2) (match-end n2) (if smerge-use-changed-face '((smerge . refine) (face . smerge-refined-change))) commit e019c35df60a306750e1025db99c36701a726ecb Author: Paul Eggert Date: Fri Dec 15 09:07:52 2017 -0800 FOR_EACH_FRAME no longer assumes frame-list This cleans up a recent fix related to Bug#29661. Suggested by Stefan Monnier in: https://lists.gnu.org/r/emacs-devel/2017-12/msg00544.html * src/frame.c (next_frame, prev_frame, delete_frame): Restore debugging checks that Vframe_list is non-nil, as FOR_EACH_FRAME no longer has these checks. (delete_frame): Remove no-longer-needed checks that Vframe_list is non-nil, as FOR_EACH_FRAME no longer assumes that. * src/frame.h (FOR_EACH_FRAME): Do not assume Vframe_list is non-nil. diff --git a/src/frame.c b/src/frame.c index 66d1b5c759..63fa8abb7d 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1607,6 +1607,8 @@ next_frame (Lisp_Object frame, Lisp_Object minibuf) Lisp_Object f, tail; int passed = 0; + eassume (CONSP (Vframe_list)); + while (passed < 2) FOR_EACH_FRAME (tail, f) { @@ -1629,6 +1631,8 @@ prev_frame (Lisp_Object frame, Lisp_Object minibuf) { Lisp_Object f, tail, prev = Qnil; + eassume (CONSP (Vframe_list)); + FOR_EACH_FRAME (tail, f) { if (EQ (frame, f) && !NILP (prev)) @@ -1914,6 +1918,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) if (f == sf) { Lisp_Object tail; + eassume (CONSP (Vframe_list)); /* Look for another visible frame on the same terminal. Do not call next_frame here because it may loop forever. @@ -2058,7 +2063,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If we've deleted the last_nonminibuf_frame, then try to find another one. */ - if (f == last_nonminibuf_frame && !NILP (Vframe_list)) + if (f == last_nonminibuf_frame) { last_nonminibuf_frame = 0; @@ -2076,7 +2081,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If there's no other frame on the same kboard, get out of single-kboard state if we're in it for this kboard. */ - if (kb != NULL && !NILP (Vframe_list)) + if (kb != NULL) { /* Some frame we found on the same kboard, or nil if there are none. */ Lisp_Object frame_on_same_kboard = Qnil; @@ -2093,9 +2098,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If we've deleted this keyboard's default_minibuffer_frame, try to find another one. Prefer minibuffer-only frames, but also notice frames with other windows. */ - if (kb != NULL - && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame)) - && !NILP (Vframe_list)) + if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame))) { /* The last frame we saw with a minibuffer, minibuffer-only or not. */ Lisp_Object frame_with_minibuf = Qnil; diff --git a/src/frame.h b/src/frame.h index a3b7763643..a5d4e4fc88 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1149,8 +1149,7 @@ default_pixels_per_inch_y (void) /* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a `for' loop which iterates over the elements of Vframe_list. The loop will set FRAME_VAR, a Lisp_Object, to each frame in - Vframe_list in succession and execute the statement. Vframe_list - should be nonempty, so the body is executed at least once. LIST_VAR + Vframe_list in succession and execute the statement. LIST_VAR should be a Lisp_Object too; it is used to iterate through the Vframe_list. Note that this macro walks over child frames and the tooltip frame as well. @@ -1160,7 +1159,7 @@ default_pixels_per_inch_y (void) something which executes the statement once. */ #define FOR_EACH_FRAME(list_var, frame_var) \ - for ((list_var) = (eassume (CONSP (Vframe_list)), Vframe_list); \ + for ((list_var) = Vframe_list; \ (CONSP (list_var) \ && (frame_var = XCAR (list_var), true)); \ list_var = XCDR (list_var)) commit d64b88da2fcc23cb0676fca382b4ddc7d1b68020 Author: Eli Zaretskii Date: Fri Dec 15 12:30:30 2017 +0200 * src/font.c (Ffont_info): Doc fix. (Bug#29682) diff --git a/src/font.c b/src/font.c index 441652b095..69efd7d56d 100644 --- a/src/font.c +++ b/src/font.c @@ -5055,10 +5055,10 @@ DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0, doc: /* Return information about a font named NAME on frame FRAME. If FRAME is omitted or nil, use the selected frame. -The returned value is a vector: +The returned value is a vector of 14 elements: [ OPENED-NAME FULL-NAME SIZE HEIGHT BASELINE-OFFSET RELATIVE-COMPOSE DEFAULT-ASCENT MAX-WIDTH ASCENT DESCENT SPACE-WIDTH AVERAGE-WIDTH - CAPABILITY ] + FILENAME CAPABILITY ] where OPENED-NAME is the name used for opening the font, FULL-NAME is the full name of the font, @@ -5068,12 +5068,12 @@ where RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling how to compose characters, MAX-WIDTH is the maximum advance width of the font, - ASCENT, DESCENT, SPACE-WIDTH, AVERAGE-WIDTH are metrics of the font - in pixels, + ASCENT, DESCENT, SPACE-WIDTH, and AVERAGE-WIDTH are metrics of + the font in pixels, FILENAME is the font file name, a string (or nil if the font backend doesn't provide a file name). CAPABILITY is a list whose first element is a symbol representing the - font format, one of x, opentype, truetype, type1, pcf, or bdf. + font format, one of `x', `opentype', `truetype', `type1', `pcf', or `bdf'. The remaining elements describe the details of the font capabilities, as follows: commit 92b2604a7f1757e0b2487451441c39a48f989c19 Author: Basil L. Contovounesios Date: Fri Dec 15 12:20:38 2017 +0200 Modernise message.el face spec syntax * lisp/gnus/message.el (message-header-to, message-header-cc) (message-header-subject, message-header-newsgroups) (message-header-other, message-header-name, message-header-xheader) (message-separator, message-cited-text, message-mml): Use (DISPLAY . PLIST) face spec syntax as recommended in `(elisp) Defining Faces'. (Bug#29405) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 508d725a78..750958dab7 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -1428,12 +1428,12 @@ starting with `not' and followed by regexps." (defface message-header-to '((((class color) (background dark)) - (:foreground "DarkOliveGreen1" :bold t)) + :foreground "DarkOliveGreen1" :bold t) (((class color) (background light)) - (:foreground "MidnightBlue" :bold t)) + :foreground "MidnightBlue" :bold t) (t - (:bold t :italic t))) + :bold t :italic t)) "Face used for displaying To headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-to-face @@ -1442,12 +1442,12 @@ starting with `not' and followed by regexps." (defface message-header-cc '((((class color) (background dark)) - (:foreground "chartreuse1" :bold t)) + :foreground "chartreuse1" :bold t) (((class color) (background light)) - (:foreground "MidnightBlue")) + :foreground "MidnightBlue") (t - (:bold t))) + :bold t)) "Face used for displaying Cc headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-cc-face @@ -1456,12 +1456,12 @@ starting with `not' and followed by regexps." (defface message-header-subject '((((class color) (background dark)) - (:foreground "OliveDrab1")) + :foreground "OliveDrab1") (((class color) (background light)) - (:foreground "navy blue" :bold t)) + :foreground "navy blue" :bold t) (t - (:bold t))) + :bold t)) "Face used for displaying Subject headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-subject-face @@ -1470,12 +1470,12 @@ starting with `not' and followed by regexps." (defface message-header-newsgroups '((((class color) (background dark)) - (:foreground "yellow" :bold t :italic t)) + :foreground "yellow" :bold t :italic t) (((class color) (background light)) - (:foreground "blue4" :bold t :italic t)) + :foreground "blue4" :bold t :italic t) (t - (:bold t :italic t))) + :bold t :italic t)) "Face used for displaying Newsgroups headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-newsgroups-face @@ -1484,12 +1484,12 @@ starting with `not' and followed by regexps." (defface message-header-other '((((class color) (background dark)) - (:foreground "VioletRed1")) + :foreground "VioletRed1") (((class color) (background light)) - (:foreground "steel blue")) + :foreground "steel blue") (t - (:bold t :italic t))) + :bold t :italic t)) "Face used for displaying other headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-other-face @@ -1498,12 +1498,12 @@ starting with `not' and followed by regexps." (defface message-header-name '((((class color) (background dark)) - (:foreground "green")) + :foreground "green") (((class color) (background light)) - (:foreground "cornflower blue")) + :foreground "cornflower blue") (t - (:bold t))) + :bold t)) "Face used for displaying header names." :group 'message-faces) (define-obsolete-face-alias 'message-header-name-face @@ -1512,12 +1512,12 @@ starting with `not' and followed by regexps." (defface message-header-xheader '((((class color) (background dark)) - (:foreground "DeepSkyBlue1")) + :foreground "DeepSkyBlue1") (((class color) (background light)) - (:foreground "blue")) + :foreground "blue") (t - (:bold t))) + :bold t)) "Face used for displaying X-Header headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-xheader-face @@ -1526,12 +1526,12 @@ starting with `not' and followed by regexps." (defface message-separator '((((class color) (background dark)) - (:foreground "LightSkyBlue1")) + :foreground "LightSkyBlue1") (((class color) (background light)) - (:foreground "brown")) + :foreground "brown") (t - (:bold t))) + :bold t)) "Face used for displaying the separator." :group 'message-faces) (define-obsolete-face-alias 'message-separator-face @@ -1540,12 +1540,12 @@ starting with `not' and followed by regexps." (defface message-cited-text '((((class color) (background dark)) - (:foreground "LightPink1")) + :foreground "LightPink1") (((class color) (background light)) - (:foreground "red")) + :foreground "red") (t - (:bold t))) + :bold t)) "Face used for displaying cited text names." :group 'message-faces) (define-obsolete-face-alias 'message-cited-text-face @@ -1554,12 +1554,12 @@ starting with `not' and followed by regexps." (defface message-mml '((((class color) (background dark)) - (:foreground "MediumSpringGreen")) + :foreground "MediumSpringGreen") (((class color) (background light)) - (:foreground "ForestGreen")) + :foreground "ForestGreen") (t - (:bold t))) + :bold t)) "Face used for displaying MML." :group 'message-faces) (define-obsolete-face-alias 'message-mml-face commit b1efbe656477bcda66de1bfab028e4e39bace055 Author: Basil L. Contovounesios Date: Fri Dec 15 12:18:43 2017 +0200 Update message.el obsolete face aliases * lisp/gnus/message.el: (message-header-to, message-header-cc) (message-header-subject, message-header-newsgroups) (message-header-other, message-header-name, message-header-xheader) (message-separator, message-cited-text, message-mml): Use define-obsolete-face-alias. (Bug#29405) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index fa5f47be30..508d725a78 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -1436,9 +1436,8 @@ starting with `not' and followed by regexps." (:bold t :italic t))) "Face used for displaying To headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-to-face 'face-alias 'message-header-to) -(put 'message-header-to-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-to-face + 'message-header-to "22.1") (defface message-header-cc '((((class color) @@ -1451,9 +1450,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying Cc headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-cc-face 'face-alias 'message-header-cc) -(put 'message-header-cc-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-cc-face + 'message-header-cc "22.1") (defface message-header-subject '((((class color) @@ -1466,9 +1464,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying Subject headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-subject-face 'face-alias 'message-header-subject) -(put 'message-header-subject-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-subject-face + 'message-header-subject "22.1") (defface message-header-newsgroups '((((class color) @@ -1481,9 +1478,8 @@ starting with `not' and followed by regexps." (:bold t :italic t))) "Face used for displaying Newsgroups headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-newsgroups-face 'face-alias 'message-header-newsgroups) -(put 'message-header-newsgroups-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-newsgroups-face + 'message-header-newsgroups "22.1") (defface message-header-other '((((class color) @@ -1496,9 +1492,8 @@ starting with `not' and followed by regexps." (:bold t :italic t))) "Face used for displaying other headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-other-face 'face-alias 'message-header-other) -(put 'message-header-other-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-other-face + 'message-header-other "22.1") (defface message-header-name '((((class color) @@ -1511,9 +1506,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying header names." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-name-face 'face-alias 'message-header-name) -(put 'message-header-name-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-name-face + 'message-header-name "22.1") (defface message-header-xheader '((((class color) @@ -1526,9 +1520,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying X-Header headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-xheader-face 'face-alias 'message-header-xheader) -(put 'message-header-xheader-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-xheader-face + 'message-header-xheader "22.1") (defface message-separator '((((class color) @@ -1541,9 +1534,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying the separator." :group 'message-faces) -;; backward-compatibility alias -(put 'message-separator-face 'face-alias 'message-separator) -(put 'message-separator-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-separator-face + 'message-separator "22.1") (defface message-cited-text '((((class color) @@ -1556,9 +1548,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying cited text names." :group 'message-faces) -;; backward-compatibility alias -(put 'message-cited-text-face 'face-alias 'message-cited-text) -(put 'message-cited-text-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-cited-text-face + 'message-cited-text "22.1") (defface message-mml '((((class color) @@ -1571,9 +1562,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying MML." :group 'message-faces) -;; backward-compatibility alias -(put 'message-mml-face 'face-alias 'message-mml) -(put 'message-mml-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-mml-face + 'message-mml "22.1") (defun message-font-lock-make-header-matcher (regexp) (let ((form commit 2494c14e7659af10b3db0e4bd765850328a976f7 Author: Eli Zaretskii Date: Fri Dec 15 11:50:11 2017 +0200 ; * lisp/comint.el (comint-terminfo-terminal): Add a :version tag. diff --git a/lisp/comint.el b/lisp/comint.el index 7c56c259c4..5ee4e48d63 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -462,7 +462,8 @@ executed once when the buffer is created." (defcustom comint-terminfo-terminal "dumb" "Value to use for TERM when the system uses terminfo." :type 'string - :group 'comint) + :group 'comint + :version "26.1") (defvar comint-mode-map (let ((map (make-sparse-keymap))) commit 12ad276d1586b2fe3cff9620538e2542773bc0f1 Author: Eli Zaretskii Date: Fri Dec 15 11:45:22 2017 +0200 Improve documentation of TERM environment variable * doc/emacs/trouble.texi (Checklist): * doc/emacs/building.texi (Compilation Shell): * doc/emacs/misc.texi (Shell Options): Improve indexing of TERM. * doc/emacs/building.texi (Compilation Shell): Mention 'comint-terminfo-terminal' in conjunction with the TERM value. diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 87ac61bac3..e108a4e7c1 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -303,6 +303,11 @@ And here's how to do it in csh: if ($?prompt) set prompt = @dots{} @end example +@vindex TERM, environment variable, in compilation mode + If you want to customize the value of the @env{TERM} environment +variable passed to the compilation subshell, customize the variable +@code{comint-terminfo-terminal} (@pxref{Shell Options}). + Emacs does not expect a compiler process to launch asynchronous subprocesses; if it does, and they keep running after the main compiler process has terminated, Emacs may kill them or their output diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index b6b396af8f..e4be004ae5 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1397,9 +1397,10 @@ directory stack if they are not already on it underlying shell, of course. @vindex comint-terminfo-terminal +@vindex TERM, environment variable, in sub-shell Comint mode sets the @env{TERM} environment variable to a safe default value, but this value disables some useful features. For example, -color is disabled for applications that use @env{TERM} to determine if +color is disabled in applications that use @env{TERM} to determine if color is supported. Therefore, Emacs provides an option @code{comint-terminfo-terminal}, which you can set to a terminal that is present in your system's terminfo database, in order to take diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 4a836c3224..e98322d74e 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -780,7 +780,7 @@ the dribble file. @item @findex open-termscript @cindex termscript file -@cindex @env{TERM} environment variable +@vindex TERM, environment variable, and display bugs For possible display bugs, the terminal type (the value of environment variable @env{TERM}), the complete termcap entry for the terminal from @file{/etc/termcap} (since that file is not identical on all machines), commit 8ed529f0f300487600ac49cff22cce09c45db94b Author: Allen Li Date: Fri Dec 15 11:30:25 2017 +0200 Add option to configure comint TERM * lisp/comint.el (comint-terminfo-terminal): New defcustom. (comint-term-environment): New function for setting terminal options (comint-exec-1): Use comint-term-environment. (Bug#29583) * lisp/progmodes/compile.el (compilation-start): Use comint-term-environment. * etc/NEWS: * doc/emacs/misc.texi (Shell Options): Document the new option. diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 6ad5fbafdd..b6b396af8f 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1396,6 +1396,15 @@ directory stack if they are not already on it (@code{shell-pushd-dunique}). The values you choose should match the underlying shell, of course. +@vindex comint-terminfo-terminal +Comint mode sets the @env{TERM} environment variable to a safe default +value, but this value disables some useful features. For example, +color is disabled for applications that use @env{TERM} to determine if +color is supported. Therefore, Emacs provides an option +@code{comint-terminfo-terminal}, which you can set to a terminal that +is present in your system's terminfo database, in order to take +advantage of advanced features of that terminal. + @node Terminal emulator @subsection Emacs Terminal Emulator @findex term diff --git a/etc/NEWS b/etc/NEWS index 6151543ee4..784c608041 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -812,6 +812,13 @@ whose content matches a regexp; bound to '% g'. *** New user option 'comint-move-point-for-matching-input' to control where to place point after 'C-c M-r' and 'C-c M-s'. ++++ +*** New user option 'comint-terminfo-terminal'. +This option allows control of the value of the TERM environment +variable Emacs puts into the environment of the Comint mode and its +derivatives, such as Shell mode and Compilation Shell minor-mode. The +default is "dumb", for compatibility with previous behavior. + ** Compilation mode --- diff --git a/lisp/comint.el b/lisp/comint.el index dcf1ff794f..7c56c259c4 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -459,6 +459,11 @@ executed once when the buffer is created." :type 'hook :group 'comint) +(defcustom comint-terminfo-terminal "dumb" + "Value to use for TERM when the system uses terminfo." + :type 'string + :group 'comint) + (defvar comint-mode-map (let ((map (make-sparse-keymap))) ;; Keys: @@ -817,19 +822,7 @@ series of processes in the same Comint buffer. The hook (defun comint-exec-1 (name buffer command switches) (let ((process-environment (nconc - ;; If using termcap, we specify `emacs' as the terminal type - ;; because that lets us specify a width. - ;; If using terminfo, we specify `dumb' because that is - ;; a defined terminal type. `emacs' is not a defined terminal type - ;; and there is no way for us to define it here. - ;; Some programs that use terminfo get very confused - ;; if TERM is not a valid terminal type. - ;; ;; There is similar code in compile.el. - (if (and (boundp 'system-uses-terminfo) system-uses-terminfo) - (list "TERM=dumb" "TERMCAP=" - (format "COLUMNS=%d" (window-width))) - (list "TERM=emacs" - (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))) + (comint-term-environment) (list (format "INSIDE_EMACS=%s,comint" emacs-version)) process-environment)) (default-directory @@ -858,6 +851,22 @@ series of processes in the same Comint buffer. The hook (set-process-coding-system proc decoding encoding)) proc)) +(defun comint-term-environment () + "Return an environment variable list for terminal configuration." + ;; If using termcap, we specify `emacs' as the terminal type + ;; because that lets us specify a width. + ;; If using terminfo, we default to `dumb' because that is + ;; a defined terminal type. `emacs' is not a defined terminal type + ;; and there is no way for us to define it here. + ;; Some programs that use terminfo get very confused + ;; if TERM is not a valid terminal type. + (if (and (boundp 'system-uses-terminfo) system-uses-terminfo) + (list (format "TERM=%s" comint-terminfo-terminal) + "TERMCAP=" + (format "COLUMNS=%d" (window-width))) + (list "TERM=emacs" + (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))) + (defun comint-nonblank-p (str) "Return non-nil if STR contains non-whitespace syntax." (not (string-match "\\`\\s *\\'" str))) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 4cce47e5d8..c68001d236 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1746,13 +1746,7 @@ Returns the compilation buffer created." (let ((process-environment (append compilation-environment - (if (if (boundp 'system-uses-terminfo);`If' for compiler warning. - system-uses-terminfo) - (list "TERM=dumb" "TERMCAP=" - (format "COLUMNS=%d" (window-width))) - (list "TERM=emacs" - (format "TERMCAP=emacs:co#%d:tc=unknown:" - (window-width)))) + (comint-term-environment) (list (format "INSIDE_EMACS=%s,compile" emacs-version)) (copy-sequence process-environment)))) (set (make-local-variable 'compilation-arguments) commit 889f07c352f7e0deccf59353a60a45f2716551d8 Author: Eli Zaretskii Date: Fri Dec 15 11:06:07 2017 +0200 Better support utf-8-with-signature and utf-8-hfs in XML/HTML * lisp/international/mule.el (sgml-xml-auto-coding-function): Support UTF-8 with BOM and utf-8-hfs as variants of UTF-8, and obey the buffer's encoding if it is one of these variants, instead of re-encoding in UTF-8 proper. (Bug#20623) diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 857fa800eb..81c04db90e 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -2493,7 +2493,17 @@ This function is intended to be added to `auto-coding-functions'." (let* ((match (match-string 1)) (sym (intern (downcase match)))) (if (coding-system-p sym) - sym + ;; If the encoding tag is UTF-8 and the buffer's + ;; encoding is one of the variants of UTF-8, use the + ;; buffer's encoding. This allows, e.g., saving an + ;; XML file as UTF-8 with BOM when the tag says UTF-8. + (let ((sym-type (coding-system-type sym)) + (bfcs-type + (coding-system-type buffer-file-coding-system))) + (if (and (coding-system-equal 'utf-8 sym-type) + (coding-system-equal 'utf-8 bfcs-type)) + buffer-file-coding-system + sym)) (message "Warning: unknown coding system \"%s\"" match) nil)) ;; Files without an encoding tag should be UTF-8. But users @@ -2506,7 +2516,8 @@ This function is intended to be added to `auto-coding-functions'." (coding-system-base (detect-coding-region (point-min) size t))))) ;; Pure ASCII always comes back as undecided. - (if (memq detected '(utf-8 undecided)) + (if (memq detected + '(utf-8 'utf-8-with-signature 'utf-8-hfs undecided)) 'utf-8 (warn "File contents detected as %s. Consider adding an encoding attribute to the xml declaration, commit a2697fac0ec0d4dd915b619bb76792121514acfa Author: Eli Zaretskii Date: Fri Dec 15 10:59:33 2017 +0200 * lisp/menu-bar.el (menu-bar-mode): Doc fix. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 2b38cb5f2b..5c96663316 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2294,8 +2294,8 @@ It must accept a buffer as its only required argument.") (define-minor-mode menu-bar-mode "Toggle display of a menu bar on each frame (Menu Bar mode). With a prefix argument ARG, enable Menu Bar mode if ARG is -positive, and disable it otherwise. If called from Lisp, enable -Menu Bar mode if ARG is omitted or nil. +positive, and disable it otherwise. If called from Lisp, also +enable Menu Bar mode if ARG is omitted or nil. This command applies to all frames that exist and frames to be created in the future." commit ffb50eace65c67656ad9c20be40e91e19cacb064 Author: Eli Zaretskii Date: Fri Dec 15 10:50:22 2017 +0200 ; * etc/NEWS: Fix last change. diff --git a/etc/NEWS b/etc/NEWS index 8080e10c7e..6151543ee4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -433,6 +433,8 @@ want to reverse the direction of the scroll, customize +++ ** The default GnuTLS priority string now includes %DUMBFW. +This is to avoid bad behavior in some firewalls, which causes the +connection to be closed by the remote host. ** Emacsclient changes commit 95606af8b06129f82efef54714bb95d6e95c0836 Author: Michael Albinus Date: Fri Dec 15 09:37:42 2017 +0100 Fix Bug#29712 in tramp-tests.el * test/lisp/net/tramp-tests.el (tramp-test32-environment-variables-and-port-numbers): Skip for macOS. (Bug#29712) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 1261a81378..c1577008d3 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3637,6 +3637,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (ert-deftest tramp-test32-environment-variables-and-port-numbers () "Check that two connections with separate ports are different." (skip-unless (tramp--test-enabled)) + ;; Bug#29712. + (skip-unless (not (eq system-type 'darwin))) ;; We test it only for the mock-up connection; otherwise there might ;; be problems with the used ports. (skip-unless (and (eq tramp-syntax 'default) commit 9bf66c6beec81927e960d31e78b7b3bad060c63e Author: Martin Rudalics Date: Fri Dec 15 08:30:09 2017 +0100 Don't run FOR_EACH_FRAME when there's no frame left (Bug#29961) This does not fix Bug#29961 but avoids that Emacs segfaults when trying to shut down because it lost connection to the X server. * src/dispnew.c (check_glyph_memory): * src/frame.c (delete_frame): Don't run FOR_EACH_FRAME when there's no frame left (Bug#29961). diff --git a/src/dispnew.c b/src/dispnew.c index b0fc5c31fa..d07864718c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2260,8 +2260,9 @@ check_glyph_memory (void) Lisp_Object tail, frame; /* Free glyph memory for all frames. */ - FOR_EACH_FRAME (tail, frame) - free_glyphs (XFRAME (frame)); + if (!NILP (Vframe_list)) + FOR_EACH_FRAME (tail, frame) + free_glyphs (XFRAME (frame)); #if defined GLYPH_DEBUG && defined ENABLE_CHECKING /* Check that nothing is left allocated. */ diff --git a/src/frame.c b/src/frame.c index 5bafbeddcc..66d1b5c759 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2058,7 +2058,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If we've deleted the last_nonminibuf_frame, then try to find another one. */ - if (f == last_nonminibuf_frame) + if (f == last_nonminibuf_frame && !NILP (Vframe_list)) { last_nonminibuf_frame = 0; @@ -2076,7 +2076,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If there's no other frame on the same kboard, get out of single-kboard state if we're in it for this kboard. */ - if (kb != NULL) + if (kb != NULL && !NILP (Vframe_list)) { /* Some frame we found on the same kboard, or nil if there are none. */ Lisp_Object frame_on_same_kboard = Qnil; @@ -2093,7 +2093,9 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If we've deleted this keyboard's default_minibuffer_frame, try to find another one. Prefer minibuffer-only frames, but also notice frames with other windows. */ - if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame))) + if (kb != NULL + && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame)) + && !NILP (Vframe_list)) { /* The last frame we saw with a minibuffer, minibuffer-only or not. */ Lisp_Object frame_with_minibuf = Qnil; commit c2a88ec8e8f3246c0f5051b208337205f7f96cca Author: Glenn Morris Date: Thu Dec 14 22:01:32 2017 -0800 * lisp/textmodes/tex-mode.el: Ensure uncompiled file is loadable. diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index f228e28b74..432a779b4a 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -1014,9 +1014,10 @@ Inherits `shell-mode-map' with a few additions.") ;; This is a) ugly, and b) cheating, but this was the last ;; remaining warning from byte-compiling all of Emacs... (eval-when-compile - (setq byte-compile-function-environment - (delq (assq 'tex-mode byte-compile-function-environment) - byte-compile-function-environment))) + (if (boundp 'byte-compile-function-environment) + (setq byte-compile-function-environment + (delq (assq 'tex-mode byte-compile-function-environment) + byte-compile-function-environment)))) ;;;###autoload (defun tex-mode () commit b1788705284048382a3ef51783525b37e5443b1f Author: Ted Zlatanov Date: Fri Dec 15 00:17:30 2017 -0500 Remember password change for IMAP in Gnus (Bug#29692) Reported by Trey Jackson . * lisp/gnus/mail-source.el (mail-source-fetch-imap): Check `mail-source-password-cache' for password. diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el index 93f03be72d..ef34c49254 100644 --- a/lisp/gnus/mail-source.el +++ b/lisp/gnus/mail-source.el @@ -1097,7 +1097,8 @@ This only works when `display-time' is enabled." ;; remember password (with-current-buffer buf (when (and imap-password - (not (assoc from mail-source-password-cache))) + (not (member (cons from imap-password) + mail-source-password-cache))) (push (cons from imap-password) mail-source-password-cache))) ;; if predicate is nil, use all uids (dolist (uid (imap-search (or predicate "1:*") buf)) commit a21dac18bb17d23c9d6958149800c054687f8373 Author: Ted Zlatanov Date: Thu Dec 14 23:16:38 2017 -0500 Add %DUMBFW to the default GnuTLS priority strings * lisp/net/gnutls.el (gnutls-boot-parameters): Add %DUMBFW to the default priority strings (Bug#25061). * etc/NEWS: Mention it. * doc/misc/emacs-gnutls.texi (Help For Users): Point to the GnuTLS priority string documentation URL. diff --git a/doc/misc/emacs-gnutls.texi b/doc/misc/emacs-gnutls.texi index 92846a924c..1715c83a0d 100644 --- a/doc/misc/emacs-gnutls.texi +++ b/doc/misc/emacs-gnutls.texi @@ -116,9 +116,11 @@ information. The @code{gnutls-algorithm-priority} variable sets the GnuTLS priority string. This is global, not per host name (although @code{gnutls-negotiate} supports a priority string per connection so -it could be done if needed). The priority string syntax is in the +it could be done if needed). For details see the @uref{https://www.gnu.org/software/gnutls/documentation.html, GnuTLS -documentation}. +documentation} and the +@uref{https://gnutls.org/manual/html_node/Priority-Strings.html, +GnuTLS priority string syntax and description}. @end defvar @defvar gnutls-trustfiles diff --git a/etc/NEWS b/etc/NEWS index 5324a0944e..8080e10c7e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -431,6 +431,9 @@ You can enable this by customizing 'mwheel-tilt-scroll-p'. If you want to reverse the direction of the scroll, customize 'mwheel-flip-direction'. ++++ +** The default GnuTLS priority string now includes %DUMBFW. + ** Emacsclient changes +++ diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index 98f7b58558..a406b0b07f 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el @@ -217,7 +217,7 @@ For the meaning of the rest of the parameters, see `gnutls-boot-parameters'." TYPE is `gnutls-x509pki' (default) or `gnutls-anon'. Use nil for the default. HOSTNAME is the remote hostname. It must be a valid string. -PRIORITY-STRING is as per the GnuTLS docs, default is \"NORMAL\". +PRIORITY-STRING is as per the GnuTLS docs, default is based on \"NORMAL\". TRUSTFILES is a list of CA bundles. It defaults to `gnutls-trustfiles'. CRLFILES is a list of CRL files. KEYLIST is an alist of (client key file, client cert file) pairs. @@ -265,11 +265,11 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." (priority-string (or priority-string (cond ((eq type 'gnutls-anon) - "NORMAL:+ANON-DH:!ARCFOUR-128") + "NORMAL:+ANON-DH:!ARCFOUR-128:%DUMBFW") ((eq type 'gnutls-x509pki) (if gnutls-algorithm-priority (upcase gnutls-algorithm-priority) - "NORMAL"))))) + "NORMAL:%DUMBFW"))))) (verify-error (or verify-error ;; this uses the value of `gnutls-verify-error' (cond commit 780407cff13149c73085c5797c14dc0b7469fbcd Author: Glenn Morris Date: Thu Dec 14 21:31:28 2017 -0500 Small fixes prompted by make check-declare * lisp/frame.el (x-focus-frame): Update declaration. (ns-mouse-absolute-pixel-position): Fix declaration. * lisp/vc/diff-mode.el (diff-refine-hunk): Use smerge-refine-regions rather than obsolete alias. (smerge-refine-subst): Remove declaration, no longer relevant. diff --git a/lisp/frame.el b/lisp/frame.el index 2e925325a9..6f8d6a1cc9 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -800,7 +800,7 @@ the user during startup." (nreverse frame-initial-geometry-arguments)) (cdr param-list)) -(declare-function x-focus-frame "frame.c" (frame)) +(declare-function x-focus-frame "frame.c" (frame &optional noactivate)) (defun select-frame-set-input-focus (frame &optional norecord) "Select FRAME, raise it, and set input focus, if possible. @@ -1484,7 +1484,7 @@ FRAME." (declare-function w32-mouse-absolute-pixel-position "w32fns.c") (declare-function x-mouse-absolute-pixel-position "xfns.c") -(declare-function ns-mouse-absolute-pixel-position "nsfns.c") +(declare-function ns-mouse-absolute-pixel-position "nsfns.m") (defun mouse-absolute-pixel-position () "Return absolute position of mouse cursor in pixels. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index df9627abdf..df33d10ed0 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2005,9 +2005,6 @@ For use in `add-log-current-defun-function'." (replace-match (cdr (assq (char-before) '((?+ . "-") (?> . "<")))))) ) -(declare-function smerge-refine-subst "smerge-mode" - (beg1 end1 beg2 end2 props-c &optional preproc props-r props-a)) - (defun diff--forward-while-leading-char (char bound) "Move point until reaching a line not starting with CHAR. Return new point, if it was moved." @@ -2049,13 +2046,13 @@ Return new point, if it was moved." (diff--forward-while-leading-char ?+ end) (progn (diff--forward-while-leading-char ?\\ end) (setq end-add (point)))) - (smerge-refine-subst beg-del beg-add beg-add end-add + (smerge-refine-regions beg-del beg-add beg-add end-add nil 'diff-refine-preproc props-r props-a))))) (`context (let* ((middle (save-excursion (re-search-forward "^---"))) (other middle)) (while (re-search-forward "^\\(?:!.*\n\\)+" middle t) - (smerge-refine-subst (match-beginning 0) (match-end 0) + (smerge-refine-regions (match-beginning 0) (match-end 0) (save-excursion (goto-char other) (re-search-forward "^\\(?:!.*\n\\)+" end) @@ -2070,7 +2067,7 @@ Return new point, if it was moved." (let ((beg1 (1+ (point)))) (when (re-search-forward "^---.*\n" end t) ;; It's a combined add&remove, so there's something to do. - (smerge-refine-subst beg1 (match-beginning 0) + (smerge-refine-regions beg1 (match-beginning 0) (match-end 0) end nil 'diff-refine-preproc props-r props-a))))))))) commit 541a60108d8777119430953245ee530665e603ff Author: Glenn Morris Date: Thu Dec 14 21:01:08 2017 -0500 Fix some custom groups * lisp/vc/vc-hooks.el (vc-faces): Rename from vc-state-faces. * lisp/vc/cvs-status.el (cvs-status): Unused, remove. diff --git a/lisp/eshell/em-tramp.el b/lisp/eshell/em-tramp.el index e322cea1e2..e2da3468ab 100644 --- a/lisp/eshell/em-tramp.el +++ b/lisp/eshell/em-tramp.el @@ -32,6 +32,8 @@ (require 'eshell) (require 'tramp)) +;; There are no items in this custom group, but eshell modules (ab)use +;; custom groups. ;;;###autoload (progn (defgroup eshell-tramp nil diff --git a/lisp/eshell/em-xtra.el b/lisp/eshell/em-xtra.el index 7b80f64d62..89814467d1 100644 --- a/lisp/eshell/em-xtra.el +++ b/lisp/eshell/em-xtra.el @@ -29,6 +29,8 @@ (require 'pcomplete)) (require 'compile) +;; There are no items in this custom group, but eshell modules (ab)use +;; custom groups. ;;;###autoload (progn (defgroup eshell-xtra nil diff --git a/lisp/vc/cvs-status.el b/lisp/vc/cvs-status.el index 770791a3c0..3124a61422 100644 --- a/lisp/vc/cvs-status.el +++ b/lisp/vc/cvs-status.el @@ -33,11 +33,6 @@ ;;; -(defgroup cvs-status nil - "Major mode for browsing `cvs status' output." - :group 'pcl-cvs - :prefix "cvs-status-") - (easy-mmode-defmap cvs-status-mode-map '(("n" . next-line) ("p" . previous-line) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 99c8211ad5..394b86c024 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -34,9 +34,9 @@ ;; Faces -(defgroup vc-state-faces nil +(defgroup vc-faces nil "Faces used in the mode line by the VC state indicator." - :group 'vc-faces + :group 'vc :group 'mode-line :version "25.1") commit e220d6e112e33f3f897c305d0d5d278d83191774 Author: Alan Mackenzie Date: Thu Dec 14 21:04:39 2017 +0000 Fix fontification of first declaration within a C++ lambda form. * lisp/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): Cease spuriously recognizing the braces of a lambda form as a brace list when there is an "=" preceding the introductory brackets. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 881209c286..12ec8f74fe 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10440,7 +10440,7 @@ comment at the start of cc-engine.el for more info." c-decl-block-key)) (braceassignp 'dontknow) inexpr-brace-list bufpos macro-start res pos after-type-id-pos - in-paren) + in-paren parens-before-brace) (setq res (c-backward-token-2 1 t lim)) ;; Checks to do only on the first sexp before the brace. @@ -10458,6 +10458,9 @@ comment at the start of cc-engine.el for more info." ((and (looking-at c-symbol-start) (not (looking-at c-keywords-regexp))) (setq after-type-id-pos (point))) + ((eq (char-after) ?\() + (setq parens-before-brace t) + nil) (t nil)) (save-excursion (cond @@ -10506,6 +10509,14 @@ comment at the start of cc-engine.el for more info." ;; Single identifier between '(' and '{'. We have a bracelist. (cons after-type-id-pos 'in-paren)) + ;; Are we at the parens of a C++ lambda expression? + ((and parens-before-brace + (save-excursion + (and + (zerop (c-backward-token-2 1 t lim)) + (c-looking-at-c++-lambda-capture-list)))) + nil) ; a lambda expression isn't a brace list. + (t (goto-char pos) ;; Checks to do on all sexps before the brace, up to the commit aa66da220cdb6aaab5b347093fd40f0e1580913b Author: Charles A. Roelli Date: Thu Dec 14 20:53:35 2017 +0100 * src/data.c (Fadd_variable_watcher): Doc fix. diff --git a/src/data.c b/src/data.c index d54c46d72b..841a295fbe 100644 --- a/src/data.c +++ b/src/data.c @@ -1481,7 +1481,7 @@ SYMBOL is the variable being changed. NEWVAL is the value it will be changed to. OPERATION is a symbol representing the kind of change, one of: `set', `let', `unlet', `makunbound', and `defvaralias'. -WHERE is a buffer if the buffer-local value of the variable being +WHERE is a buffer if the buffer-local value of the variable is being changed, nil otherwise. All writes to aliases of SYMBOL will call WATCH-FUNCTION too. */) commit f838210b018b74b5dd86800aba807c78c921fc3a Author: Alan Mackenzie Date: Thu Dec 14 17:55:59 2017 +0000 Fix misfontification of C++ member initialization list after "throw" * lisp/progmodes/cc-engine.el (c-forward-type): Stop recognizing a "type" starting with "throw", by using c-opt-type-modifier-prefix-key. * lisp/progmodes/cc-langs.el (c-type-modifier-prefix-kwds): New lang const which, in C++, doesn't contain "throw", otherwise like c-type-modifier-kwds. (c-opt-type-modifier-prefix-key): New lang const and var, a regexp matching any keyword in the previous lang const. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 138a0e5da2..881209c286 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -7572,8 +7572,8 @@ comment at the start of cc-engine.el for more info." ;; Skip leading type modifiers. If any are found we know it's a ;; prefix of a type. - (when c-opt-type-modifier-key ; e.g. "const" "volatile", but NOT "typedef" - (while (looking-at c-opt-type-modifier-key) + (when c-opt-type-modifier-prefix-key ; e.g. "const" "volatile", but NOT "typedef" + (while (looking-at c-opt-type-modifier-prefix-key) (goto-char (match-end 1)) (c-forward-syntactic-ws) (setq res 'prefix))) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 869048bee3..169b61c3dd 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1925,16 +1925,32 @@ on one of the `*-decl-kwds' lists." t (c-make-keywords-re t (c-lang-const c-type-prefix-kwds))) (c-lang-defvar c-type-prefix-key (c-lang-const c-type-prefix-key)) -(c-lang-defconst c-type-modifier-kwds - "Type modifier keywords. These can occur almost anywhere in types -but they don't build a type of themselves. Unlike the keywords on -`c-primitive-type-kwds', they are fontified with the keyword face and -not the type face." +(c-lang-defconst c-type-modifier-prefix-kwds + "Type modifier keywords which can appear in front of a type. These can +also occur almost anywhere in types but they don't build a type of +themselves. Unlike the keywords on `c-primitive-type-kwds', they are +fontified with the keyword face and not the type face." t nil c '("const" "restrict" "volatile") - c++ '("const" "noexcept" "volatile" "throw") + c++ '("const" "noexcept" "volatile") objc '("const" "volatile")) +(c-lang-defconst c-opt-type-modifier-prefix-key + ;; Adorned regexp matching `c-type-modifier-prefix-kwds', or nil in + ;; languages without such keywords. + t (and (c-lang-const c-type-modifier-prefix-kwds) + (c-make-keywords-re t (c-lang-const c-type-modifier-prefix-kwds)))) +(c-lang-defvar c-opt-type-modifier-prefix-key + (c-lang-const c-opt-type-modifier-prefix-key)) + +(c-lang-defconst c-type-modifier-kwds + "Type modifier keywords. These can occur almost anywhere in types except +at the start, but they don't build a type of themselves. Unlike the keywords +on `c-primitive-type-kwds', they are fontified with the keyword face and not +the type face." + t (c-lang-const c-type-modifier-prefix-kwds) + c++ (append (c-lang-const c-type-modifier-prefix-kwds) '("throw"))) + (c-lang-defconst c-opt-type-modifier-key ;; Adorned regexp matching `c-type-modifier-kwds', or nil in ;; languages without such keywords. commit 232c6465ce789f980da16063a865ac915b060ca4 Author: Martin Rudalics Date: Thu Dec 14 09:38:06 2017 +0100 Fix doc-string of Fbuffer_list * src/buffer.c (Fbuffer_list): Fix doc-string. diff --git a/src/buffer.c b/src/buffer.c index c6f9eb28e2..7ae889decf 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -386,9 +386,9 @@ Value is nil if OBJECT is not a buffer or if it has been killed. */) } DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0, - doc: /* Return a list of all existing live buffers. -If the optional arg FRAME is a frame, we return the buffer list in the -proper order for that frame: the buffers show in FRAME come first, + doc: /* Return a list of all live buffers. +If the optional arg FRAME is a frame, return the buffer list in the +proper order for that frame: the buffers shown in FRAME come first, followed by the rest of the buffers. */) (Lisp_Object frame) { commit 3f9aac68d7ec9854a2998e9b5e7d77fbc18bf2d0 Author: Basil L. Contovounesios Date: Thu Dec 14 04:45:21 2017 +0000 Don't raise an extraneous frame (bug#29696) * lisp/gnus/gnus-art.el (gnus-article-read-summary-keys): Lookup summary buffer keys from article buffer without affecting window configuration (bug#29696). diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index e9cc09ce9b..65d3bbe71c 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -6712,8 +6712,7 @@ not have a face in `gnus-article-boring-faces'." (member keys nosave-but-article) (member keys nosave-in-article)) (let (func) - (save-window-excursion - (pop-to-buffer gnus-article-current-summary) + (with-current-buffer gnus-article-current-summary ;; We disable the pick minor mode commands. (let (gnus-pick-mode) (setq func (key-binding keys t)))) commit e7b1111155b3116d0c7b137e0e1d312db0f1ca80 Author: Noam Postavsky Date: Mon Nov 13 12:46:13 2017 -0500 Mention new strictness for &optional, &rest in arglists (Bug#29165) * etc/NEWS: Explain that '&optional' not followed by a variable is now an error. * lisp/emacs-lisp/cl-macs.el (cl--transform-lambda, cl--do-&aux) (cl--do-arglist): Also reject '&optional', '&rest', or '&aux' not followed by a variable for consistency. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-bad-arglist): New test. diff --git a/etc/NEWS b/etc/NEWS index 64b53d88c8..5324a0944e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1462,6 +1462,17 @@ them through 'format' first. Even that is discouraged: for ElDoc support, you should set 'eldoc-documentation-function' instead of calling 'eldoc-message' directly. +--- +** Using '&rest' or '&optional' incorrectly is now an error. +For example giving '&optional' without a following variable, or +passing '&optional' multiple times: + + (defun foo (&optional &rest x)) + (defun bar (&optional &optional x)) + +Previously, Emacs would just ignore the extra keyword, or give +incorrect results in certain cases. + * Lisp Changes in Emacs 26.1 diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 5535100d4a..6aed060cb5 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -281,8 +281,13 @@ FORM is of the form (ARGS . BODY)." (or (not optional) ;; Optional args whose default is nil are simple. (null (nth 1 (assq (car args) (cdr cl--bind-defs))))) - (not (and (eq (car args) '&optional) (setq optional t) - (car cl--bind-defs)))) + (not (and (eq (car args) '&optional) + (progn + (when (memq (cadr args) + '(nil &rest &body &key &aux)) + (error "Variable missing after &optional")) + (setq optional t) + (car cl--bind-defs))))) (push (pop args) simple-args)) (when optional (if args (push '&optional args)) @@ -534,14 +539,17 @@ its argument list allows full Common Lisp conventions." arglist)))) (defun cl--do-&aux (args) - (while (and (eq (car args) '&aux) (pop args)) - (while (and args (not (memq (car args) cl--lambda-list-keywords))) - (if (consp (car args)) - (if (and cl--bind-enquote (cl-cadar args)) - (cl--do-arglist (caar args) - `',(cadr (pop args))) - (cl--do-arglist (caar args) (cadr (pop args)))) - (cl--do-arglist (pop args) nil)))) + (when (eq (car args) '&aux) + (pop args) + (when (null args) + (error "Variable missing after &aux"))) + (while (and args (not (memq (car args) cl--lambda-list-keywords))) + (if (consp (car args)) + (if (and cl--bind-enquote (cl-cadar args)) + (cl--do-arglist (caar args) + `',(cadr (pop args))) + (cl--do-arglist (caar args) (cadr (pop args)))) + (cl--do-arglist (pop args) nil))) (if args (error "Malformed argument list ends with: %S" args))) (defun cl--do-arglist (args expr &optional num) ; uses cl--bind-* @@ -558,6 +566,9 @@ its argument list allows full Common Lisp conventions." (keys nil) (laterarg nil) (exactarg nil) minarg) (or num (setq num 0)) + (when (and restarg (or (null (cdr restarg)) + (memq (cadr restarg) cl--lambda-list-keywords))) + (error "Variable missing after &rest")) (setq restarg (if (listp (cadr restarg)) (make-symbol "--cl-rest--") (cadr restarg))) @@ -609,7 +620,12 @@ its argument list allows full Common Lisp conventions." `',cl--bind-block) (+ ,num (length ,restarg))))) cl--bind-forms))) - (while (and (eq (car args) '&key) (pop args)) + (while (eq (car args) '&key) + (pop args) + (when (or (null args) (memq (car args) cl--lambda-list-keywords)) + (error "Missing variable after &key")) + (when keys + (error "Multiple occurrences of &key")) (while (and args (not (memq (car args) cl--lambda-list-keywords))) (let ((arg (pop args))) (or (consp arg) (setq arg (list arg))) diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 575f170af6..bf2e7e1275 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -497,4 +497,35 @@ collection clause." vconcat (vector (1+ x))) [2 3 4 5 6]))) + +;;; cl-lib lambda list handling + +(ert-deftest cl-macs-bad-arglist () + "Check that `cl-defun' and friends reject weird argument lists. +See Bug#29165, and similar `eval-tests--bugs-24912-and-24913' in +eval-tests.el." + (dolist (args (cl-mapcan + ;; For every &rest and &optional variant, check also + ;; the same thing with &key and &aux respectively + ;; instead. + (lambda (arglist) + (let ((arglists (list arglist))) + (when (memq '&rest arglist) + (push (cl-subst '&key '&rest arglist) arglists)) + (when (memq '&optional arglist) + (push (cl-subst '&aux '&optional arglist) arglists)) + arglists)) + '((&optional) (&rest) (&optional &rest) (&rest &optional) + (&optional &rest _a) (&optional _a &rest) + (&rest _a &optional) (&rest &optional _a) + (&optional &optional) (&optional &optional _a) + (&optional _a &optional _b) + (&rest &rest) (&rest &rest _a) + (&rest _a &rest _b)))) + (ert-info ((prin1-to-string args) :prefix "arglist: ") + (should-error (eval `(funcall (cl-function (lambda ,args))) t)) + (should-error (cl--transform-lambda (cons args t))) + (let ((byte-compile-debug t)) + (should-error (eval `(byte-compile (cl-function (lambda ,args))) t)))))) + ;;; cl-macs-tests.el ends here commit 4cb8696e4754d815efd5fd5e26f2b6b2567a11fe Author: Alan Mackenzie Date: Wed Dec 13 20:55:03 2017 +0000 Don't misfontify "foo ()" inside C++ initialization parentheses as a type Also recognize and handle function names introduced by "extern" inside a function. * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Add a new element to the result list which is t when our declaration is, or is to be treated as, being at top level. * lisp/progmodes/cc-fonts.el (c-get-fontification-context): Detect being inside a C++ uniform initialization and return (not-decl nil) for this case. (c-font-lock-declarations): Use the new element 4 of the result of c-forward-decl-or-cast-1. * lisp/progmodes/cc-langs.el (c-make-top-level-kwds, c-make-top-level-key): New lang consts/vars. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index ab0204cb96..138a0e5da2 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -8167,9 +8167,9 @@ comment at the start of cc-engine.el for more info." ;; If a declaration is parsed: ;; ;; The point is left at the first token after the first complete - ;; declarator, if there is one. The return value is a list of 4 elements, + ;; declarator, if there is one. The return value is a list of 5 elements, ;; where the first is the position of the first token in the declarator. - ;; (See below for the other three.) + ;; (See below for the other four.) ;; Some examples: ;; ;; void foo (int a, char *b) stuff ... @@ -8210,7 +8210,9 @@ comment at the start of cc-engine.el for more info." ;; ;; The third element of the return value is non-nil when the declaration ;; parsed might be an expression. The fourth element is the position of - ;; the start of the type identifier. + ;; the start of the type identifier. The fifth element is t if either + ;; CONTEXT was 'top, or the declaration is detected to be treated as top + ;; level (e.g. with the keyword "extern"). ;; ;; If a cast is parsed: ;; @@ -8308,6 +8310,9 @@ comment at the start of cc-engine.el for more info." ;; Set when the symbol before `preceding-token-end' is known to ;; terminate the previous construct, or when we're at point-min. at-decl-start + ;; Set when we have encountered a keyword (e.g. "extern") which + ;; causes the following declaration to be treated as though top-level. + make-top ;; Save `c-record-type-identifiers' and ;; `c-record-ref-identifiers' since ranges are recorded ;; speculatively and should be thrown away if it turns out @@ -8339,7 +8344,9 @@ comment at the start of cc-engine.el for more info." (cond ;; Look for a specifier keyword clause. - ((or (looking-at c-prefix-spec-kwds-re) + ((or (and (looking-at c-make-top-level-key) + (setq make-top t)) + (looking-at c-prefix-spec-kwds-re) (and (c-major-mode-is 'java-mode) (looking-at "@[A-Za-z0-9]+"))) (save-match-data @@ -8609,7 +8616,7 @@ comment at the start of cc-engine.el for more info." ;; construct here in C, since we want to recognize this as a ;; typeless function declaration. (not (and (c-major-mode-is 'c-mode) - (eq context 'top) + (or (eq context 'top) make-top) (eq (char-after) ?\))))) (if (eq (char-after) ?\)) (when (> paren-depth 0) @@ -8657,7 +8664,7 @@ comment at the start of cc-engine.el for more info." ;; Recognize a top-level typeless ;; function declaration in C. (and (c-major-mode-is 'c-mode) - (eq context 'top) + (or (eq context 'top) make-top) (eq (char-after) ?\)))))))) (setq pos (c-up-list-forward (point))) (eq (char-before pos) ?\))) @@ -8914,6 +8921,7 @@ comment at the start of cc-engine.el for more info." (when (and got-identifier (looking-at c-after-suffixed-type-decl-key) (or (eq context 'top) + make-top (and (eq context nil) (match-beginning 1))) (if (and got-parens @@ -9080,7 +9088,7 @@ comment at the start of cc-engine.el for more info." ;; CASE 19 (or (eq context 'decl) (and (c-major-mode-is 'c-mode) - (eq context 'top)))))) + (or (eq context 'top) make-top)))))) ;; The point is now after the type decl expression. @@ -9185,7 +9193,8 @@ comment at the start of cc-engine.el for more info." (and (or at-type-decl at-typedef) (cons at-type-decl at-typedef)) maybe-expression - type-start)) + type-start + (or (eq context 'top) make-top))) (t ;; False alarm. Restore the recorded ranges. diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index d352e5b08c..7b99c2f54e 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1251,6 +1251,17 @@ casts and declarations are fontified. Used on level 2 and higher." ;; Got a cached hit in some other type of arglist. (type (cons 'arglist t)) + ;; We're at a C++ uniform initialization. + ((and (c-major-mode-is 'c++-mode) + (eq (char-before match-pos) ?\() + (save-excursion + (goto-char match-pos) + (and + (zerop (c-backward-token-2 2)) + (looking-at c-identifier-start) + (c-got-face-at (point) + '(font-lock-variable-name-face))))) + (cons 'not-decl nil)) ((and not-front-decl ;; The point is within the range of a previously ;; encountered type decl expression, so the arglist @@ -1589,7 +1600,8 @@ casts and declarations are fontified. Used on level 2 and higher." (setq max-type-decl-end (point)))) (goto-char start-pos) (c-font-lock-single-decl limit decl-or-cast match-pos - context toplev)) + context + (or toplev (nth 4 decl-or-cast)))) (t t)))) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 227b3e1648..869048bee3 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -2355,6 +2355,16 @@ construct it's part of continues." t nil (c c++ objc) '("extern")) +(c-lang-defconst c-make-top-level-kwds + "Keywords which make declarations they introduce be handled as top-level." + t nil + (c c++ objc) '("extern")) + +(c-lang-defconst c-make-top-level-key + ;; A regexp which matches any `c-make-top-level-kwds' keyword. + t (c-make-keywords-re t (c-lang-const c-make-top-level-kwds))) +(c-lang-defvar c-make-top-level-key (c-lang-const c-make-top-level-key)) + (c-lang-defconst c-type-list-kwds "Keywords that may be followed by a comma separated list of type identifiers, where each optionally can be prefixed by keywords. (Can commit ce31e726adbb4d24557b3d1ff067cc4c04d94446 Author: Glenn Morris Date: Wed Dec 13 15:29:24 2017 -0500 Fixes for defcustoms, prompted by cus-test-opts * lisp/files.el (save-some-buffers-default-predicate): * lisp/time.el (display-time-world-list): * lisp/gnus/gnus-art.el (gnus-article-show-cursor): * lisp/progmodes/cc-vars.el (c-noise-macro-with-parens-names): * lisp/progmodes/verilog-mode.el (verilog-auto-wire-type): * lisp/textmodes/less-css-mode.el (less-css-output-directory) (less-css-output-file-name, less-css-input-file-name): * lisp/vc/emerge.el (emerge-metachars): * lisp/vc/vc-hg.el (vc-hg-symbolic-revision-styles): Fix :types. * lisp/net/newst-backend.el (newsticker-url-list-defaults): Fix url. diff --git a/lisp/files.el b/lisp/files.el index 4b6d4e88ac..90c865782f 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5195,7 +5195,9 @@ Before and after saving the buffer, this function runs This allows you to stop `save-some-buffers' from asking about certain files that you'd usually rather not save." :group 'auto-save - :type 'function + ;; FIXME nil should not be a valid option, let alone the default, + ;; eg so that add-function can be used. + :type '(choice (const :tag "Default" nil) function) :version "26.1") (defun save-some-buffers (&optional arg pred) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index c130dc1b6c..e9cc09ce9b 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -527,7 +527,7 @@ each invocation of the saving commands." "If non-nil, show the cursor in the Article buffer even when not selected." :version "25.1" :group 'gnus-article - :type 'bool) + :type 'boolean) (defcustom gnus-saved-headers gnus-visible-headers "Headers to keep if `gnus-save-all-headers' is nil. diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 0fb347fc4e..ed60a8a3ae 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -162,7 +162,7 @@ value effective." (defcustom newsticker-url-list-defaults '(("Emacs Wiki" - "http://www.emacswiki.org/cgi-bin/wiki.pl?action=rss" + "https://www.emacswiki.org/emacs?action=rss" nil 3600)) "A customizable list of news feeds to select from. diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 37d6675821..f7bfe7c672 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1669,7 +1669,7 @@ this implicitly by reinitializing C/C++/Objc Mode on any buffer)." which optionally have arguments in parentheses, and which expand to nothing. These are recognized by CC Mode only in declarations." :version "26.1" - :type '(regexp :tag "List of names (possibly empty)" string) + :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) diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 10a1edc3ee..1baac1d420 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -764,14 +764,14 @@ mode is experimental." :version "24.1" ; rev670 :group 'verilog-mode-actions :type 'boolean) -(put 'verilog-auto-declare-nettype 'safe-local-variable `stringp) +(put 'verilog-auto-declare-nettype 'safe-local-variable 'stringp) (defcustom verilog-auto-wire-comment t "Non-nil indicates to insert to/from comments with `verilog-auto-wire' etc." :version "25.1" :group 'verilog-mode-actions :type 'boolean) -(put 'verilog-auto-wire-comment 'safe-local-variable `verilog-booleanp) +(put 'verilog-auto-wire-comment 'safe-local-variable 'verilog-booleanp) (defcustom verilog-auto-wire-type nil "Non-nil specifies the data type to use with `verilog-auto-wire' etc. @@ -781,8 +781,8 @@ this is generally only appropriate when making a non-SystemVerilog wrapper containing SystemVerilog cells." :version "24.1" ; rev673 :group 'verilog-mode-actions - :type 'string) -(put 'verilog-auto-wire-type 'safe-local-variable `stringp) + :type '(choice (const nil) string)) +(put 'verilog-auto-wire-type 'safe-local-variable 'stringp) (defcustom verilog-auto-endcomments t "Non-nil means insert a comment /* ... */ after `end's. diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el index 387d1c2fd5..c2846ac926 100644 --- a/lisp/textmodes/less-css-mode.el +++ b/lisp/textmodes/less-css-mode.el @@ -106,7 +106,7 @@ Use \"-x\" to minify output." This path is expanded relative to the directory of the Less file using `expand-file-name', so both relative and absolute paths will work as expected." - :type 'directory) + :type '(choice (const :tag "Same as Less file" nil) directory)) ;;;###autoload (put 'less-css-output-directory 'safe-local-variable 'stringp) @@ -116,7 +116,7 @@ This can be also be set to a full path, or a relative path. If the path is relative, it will be relative to the value of `less-css-output-dir', if set, or the current directory by default." - :type 'file) + :type '(choice (const :tag "Default" nil) file)) (make-variable-buffer-local 'less-css-output-file-name) (defcustom less-css-input-file-name nil @@ -132,7 +132,7 @@ variables. This can be also be set to a full path, or a relative path. If the path is relative, it will be relative to the current directory by default." - :type 'file) + :type '(choice (const nil) file)) ;;;###autoload (put 'less-css-input-file-name 'safe-local-variable 'stringp) (make-variable-buffer-local 'less-css-input-file-name) diff --git a/lisp/time.el b/lisp/time.el index c8726a9a1b..7f85b86688 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -173,7 +173,9 @@ If the value is t instead of an alist, use the value of `legacy-style-world-list' otherwise." :group 'display-time - :type '(repeat (list string string)) + :type '(choice (const :tag "Default" t) + (repeat :tag "List of zones and labels" + (list (string :tag "Zone") (string :tag "Label")))) :version "23.1") (defun time--display-world-list () diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el index 9c25ec4332..3f945bbb2b 100644 --- a/lisp/vc/emerge.el +++ b/lisp/vc/emerge.el @@ -3171,11 +3171,9 @@ See also `auto-save-file-name-p'." (setq limit (1+ (match-end 0))))) s) -;; Metacharacters that have to be protected from the shell when executing -;; a diff/diff3 command. (defcustom emerge-metachars nil - "Obsolete, emerge now uses `shell-quote-argument'." - :type 'regexp + "No longer used. Emerge now uses `shell-quote-argument'." + :type '(choice (const nil) regexp) :group 'emerge) (make-obsolete-variable 'emerge-metachars nil "26.1") diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 99c8869ae0..a404626fba 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -278,7 +278,7 @@ within the repository. If no list entry produces a useful revision, return `nil'." :type '(repeat (choice - (const :tag "Active bookmark" 'bookmark) + (const :tag "Active bookmark" builtin-active-bookmark) (string :tag "Hg template") (function :tag "Custom"))) :version "26.1" commit aacd1e14fc6ab872bc2c588d8c6077c88ce8a310 Author: Glenn Morris Date: Wed Dec 13 15:25:56 2017 -0500 * lisp/net/newst-backend.el (newsticker--raw-url-list-defaults): Update. diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index d1ce0e2af7..0fb347fc4e 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -64,9 +64,12 @@ considered to be running if the newsticker timer list is not empty." "Aggregator for RSS and Atom feeds." :group 'applications) +;; Hard-coding URLs like this is a recipe for propagating obsolete info. (defconst newsticker--raw-url-list-defaults - '(("CNET News.com" - "http://export.cnet.com/export/feeds/news/rss/1,11176,,00.xml") + '( + ;; 2017/12: no response. +;;; ("CNET News.com" +;;; "http://export.cnet.com/export/feeds/news/rss/1,11176,,00.xml") ("Debian Security Advisories" "http://www.debian.org/security/dsa.en.rdf") ("Debian Security Advisories - Long format" @@ -76,23 +79,24 @@ considered to be running if the newsticker timer list is not empty." nil 3600) ("LWN (Linux Weekly News)" - "http://lwn.net/headlines/rss") - ("NY Times: Technology" - "http://partners.userland.com/nytRss/technology.xml") - ("NY Times" - "http://partners.userland.com/nytRss/nytHomepage.xml") + "https://lwn.net/headlines/rss") + ;; Not updated since 2010. +;;; ("NY Times: Technology" +;;; "http://www.nytimes.com/services/xml/rss/userland/Technology.xml") +;;; ("NY Times" +;;; "http://www.nytimes.com/services/xml/rss/userland/HomePage.xml") ("Quote of the day" - "http://www.quotationspage.com/data/qotd.rss" + "http://feeds.feedburner.com/quotationspage/qotd" "07:00" 86400) ("The Register" - "http://www.theregister.co.uk/tonys/slashdot.rdf") + "https://www.theregister.co.uk/headlines.rss") ("slashdot" - "http://slashdot.org/index.rss" + "http://rss.slashdot.org/Slashdot/slashdot" nil 3600) ;/. will ban you if under 3600 seconds! ("Wired News" - "http://www.wired.com/news_drop/netcenter/netcenter.rdf") + "https://www.wired.com/feed/rss") ("Heise News (german)" "http://www.heise.de/newsticker/heise.rdf") ("Tagesschau (german)" commit 7e2f4d3d416fc06a4462c8c4c38ec1b54b02611a Author: Glenn Morris Date: Wed Dec 13 13:55:29 2017 -0500 * lisp/htmlfontify.el (hfy-which-etags): Fix it. diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index 0c5a2477e5..aa7cf430a4 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -370,8 +370,8 @@ commands in `hfy-etags-cmd-alist'." (when (eq (call-process hfy-etags-bin nil t nil "--version") 0) (goto-char (point-min)) (cond - ((looking-at-p "exube") "exuberant ctags") - ((looking-at-p "GNU E") "emacs etags"))) + ((search-forward "exube" nil t) "exuberant ctags") + ((search-forward "GNU E" nil t) "emacs etags"))) ;; Return nil if the etags binary isn't executable (Bug#25468). (file-error nil)))) commit 52d2a690f66de135fbfbcf5a195014e24be64170 Author: Glenn Morris Date: Tue Dec 12 23:21:24 2017 -0800 Add missing :version tags revealed by cusver-check * lisp/comint.el (comint-move-point-for-matching-input): * lisp/epa.el (epa-replace-original-text): * lisp/image-dired.el (image-dired-cmd-optipng-program) (image-dired-cmd-optipng-options): * lisp/emacs-lisp/bytecomp.el (byte-compile-cond-use-jump-table): * lisp/gnus/gnus-cloud.el (gnus-cloud-storage-method) (gnus-cloud-interactive): * lisp/net/mailcap.el (mailcap-user-mime-data): * lisp/progmodes/cc-vars.el (c-asymmetry-fontification-flag) (c-noise-macro-names, c-noise-macro-with-parens-names): * lisp/progmodes/flymake.el (flymake-start-on-flymake-mode) (flymake-wrap-around): * lisp/progmodes/grep.el (grep-use-null-filename-separator): * lisp/progmodes/js.el (js-indent-align-list-continuation): * lisp/progmodes/perl-mode.el (perl-flymake-command): * lisp/progmodes/python.el (python-flymake-command) (python-flymake-command-output-pattern, python-flymake-msg-alist): * lisp/progmodes/ruby-mode.el (ruby-flymake-use-rubocop-if-available) (ruby-rubocop-config): * lisp/textmodes/less-css-mode.el (less-css): * lisp/textmodes/tex-mode.el (tex-chktex-program) (tex-chktex-extra-flags): Add missing :version tags. diff --git a/lisp/comint.el b/lisp/comint.el index aa7dab28f3..dcf1ff794f 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -290,6 +290,7 @@ If `after-input', point will be positioned after the input typed by the user, but before the rest of the history entry that has been inserted. If `end-of-line', point will be positioned at the end of the current logical (not visual) line after insertion." + :version "26.1" :type '(radio (const :tag "Stay after input" after-input) (const :tag "Move to end of line" end-of-line)) :group 'comint) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index f69ac7f342..d62d8128c1 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -236,6 +236,7 @@ This includes variable references and calls to functions such as `car'." (defcustom byte-compile-cond-use-jump-table t "Compile `cond' clauses to a jump table implementation (using a hash-table)." + :version "26.1" :group 'bytecomp :type 'boolean) diff --git a/lisp/epa.el b/lisp/epa.el index 6e908e1aa3..da5a894d80 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -40,6 +40,7 @@ If t, replace the original text without any confirmation. If nil, don't replace the original text and show the result in a new buffer. If neither t nor nil, ask user for confirmation." + :version "26.1" :type '(choice (const :tag "Never" nil) (const :tag "Ask the user" ask) (const :tag "Always" t)) diff --git a/lisp/gnus/gnus-cloud.el b/lisp/gnus/gnus-cloud.el index 5ea2d691f1..34d54ec3ca 100644 --- a/lisp/gnus/gnus-cloud.el +++ b/lisp/gnus/gnus-cloud.el @@ -51,6 +51,7 @@ (defcustom gnus-cloud-storage-method (if (featurep 'epg) 'epg 'base64-gzip) "Storage method for cloud data, defaults to EPG if that's available." + :version "26.1" :group 'gnus-cloud :type '(radio (const :tag "No encoding" nil) (const :tag "Base64" base64) @@ -59,6 +60,7 @@ (defcustom gnus-cloud-interactive t "Whether Gnus Cloud changes should be confirmed." + :version "26.1" :group 'gnus-cloud :type 'boolean) diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 175d9df5e8..e8046af3c0 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -305,6 +305,7 @@ temporary file name (typically generated by pnqnq)" (defcustom image-dired-cmd-optipng-program (executable-find "optipng") "The file name of the `optipng' program." + :version "26.1" :type '(choice (const :tag "Not Set" nil) file) :group 'image-dired) @@ -312,6 +313,7 @@ temporary file name (typically generated by pnqnq)" "Arguments passed to `image-dired-optipng-program'. Available format specifiers are described in `image-dired-cmd-create-thumbnail-options'." + :version "26.1" :type '(repeat (string :tag "Argument")) :link '(url-link "man:optipng(1)") :group 'image-dired) diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index b4b38707c8..be1a171cd4 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -99,6 +99,7 @@ When selecting a viewer for a given MIME type, the first viewer in this list with a matching MIME-TYPE and successful TEST is selected. Only if none matches, the standard `mailcap-mime-data' is consulted." + :version "26.1" :type '(repeat (list (choice (function :tag "Function or mode") diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 51caef2fc3..37d6675821 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1643,6 +1643,7 @@ particularly in C++, due to ambiguities in the language. When such a construct is like \"foo * bar\" or \"foo &bar\", and this variable is non-nil \(the default), the construct will be fontified as a declaration if there is white space either before or after the operator, but not both." + :version "26.1" :type 'boolean :group 'c) @@ -1658,6 +1659,7 @@ identifiers. If you change this variable's value, call the function `c-make-noise-macro-regexps' to set the necessary internal variables (or do this implicitly by reinitializing C/C++/Objc Mode on any buffer)." + :version "26.1" :type '(repeat :tag "List of names" string) :group 'c) (put 'c-noise-macro-names 'safe-local-variable #'c-string-list-p) @@ -1666,6 +1668,7 @@ this implicitly by reinitializing C/C++/Objc Mode on any buffer)." "A list of names of macros \(or compiler extensions like \"__attribute__\") which optionally have arguments in parentheses, and which expand to nothing. These are recognized by CC Mode only in declarations." + :version "26.1" :type '(regexp :tag "List of names (possibly empty)" string) :group 'c) (put 'c-noise-macro-with-parens-names 'safe-local-variable #'c-string-list-p) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index c6345aa968..66d1497b40 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -127,6 +127,7 @@ If nil, never start checking buffer automatically like this." (defcustom flymake-start-on-flymake-mode t "Start syntax check when `flymake-mode' is enabled. Specifically, start it when the buffer is actually displayed." + :version "26.1" :type 'boolean) (define-obsolete-variable-alias 'flymake-start-syntax-check-on-find-file @@ -141,6 +142,7 @@ Specifically, start it when the buffer is actually displayed." (defcustom flymake-wrap-around t "If non-nil, moving to errors wraps around buffer boundaries." + :version "26.1" :type 'boolean) (when (fboundp 'define-fringe-bitmap) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index c2d8022354..dac3726bb1 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -162,6 +162,7 @@ Customize or call the function `grep-apply-setting'." (defcustom grep-use-null-filename-separator 'auto-detect "If non-nil, use `grep's `--null' option. This is done to disambiguate file names in `grep's output." + :version "26.1" :type '(choice (const :tag "Do Not Use `--null'" nil) (const :tag "Use `--null'" t) (other :tag "Not Set" auto-detect)) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 1f86909362..5cdabd03be 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -477,6 +477,7 @@ This applies to function movement, marking, and so on." (defcustom js-indent-align-list-continuation t "Align continuation of non-empty ([{ lines in `js-mode'." + :version "26.1" :type 'boolean :group 'js) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index f3cb810913..fecdb720f5 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -587,6 +587,7 @@ create a new comment." This is a non empty list of strings, the checker tool possibly followed by required arguments. Once launched it will receive the Perl source to be checked as its standard input." + :version "26.1" :group 'perl :type '(repeat string)) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9d3e428e23..2de40c4ab8 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5165,6 +5165,7 @@ This is a non empty list of strings, the checker tool possibly followed by required arguments. Once launched it will receive the Python source to be checked as its standard input. To use `flake8' you would set this to (\"flake8\" \"-\")." + :version "26.1" :group 'python-flymake :type '(repeat string)) @@ -5186,6 +5187,7 @@ MESSAGE'th gives the message text itself. If COLUMN or TYPE are nil or that index didn't match, that information is not present on the matched line and a default will be used." + :version "26.1" :group 'python-flymake :type '(list regexp (integer :tag "Line's index") @@ -5209,6 +5211,7 @@ For example, when using `flake8' a possible configuration could be: (\"^[EW][0-9]+\" . :note)) By default messages are considered errors." + :version "26.1" :group 'python-flymake :type `(alist :key-type (regexp) :value-type (symbol))) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index dc1b0f8e2d..1c7df7e35a 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -2314,12 +2314,14 @@ See `font-lock-syntax-table'.") (defcustom ruby-flymake-use-rubocop-if-available t "Non-nil to use the Rubocop Flymake backend. Only takes effect if Rubocop is installed." + :version "26.1" :type 'boolean :group 'ruby :safe 'booleanp) (defcustom ruby-rubocop-config ".rubocop.yml" "Configuration file for `ruby-flymake-rubocop'." + :version "26.1" :type 'string :group 'ruby :safe 'stringp) diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el index d31414e3a4..387d1c2fd5 100644 --- a/lisp/textmodes/less-css-mode.el +++ b/lisp/textmodes/less-css-mode.el @@ -78,6 +78,7 @@ (defgroup less-css nil "Less CSS mode." + :version "26.1" :prefix "less-css-" :group 'css) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 5c585ea46c..f228e28b74 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -266,12 +266,14 @@ measured relative to that of the normal text." (defcustom tex-chktex-program "chktex" "ChkTeX executable to use for linting TeX files." + :version "26.1" :type 'string :link '(url-link "man:chktex(1)") :group 'tex-flymake) (defcustom tex-chktex-extra-flags nil "Extra command line flags for `tex-chktex-program'." + :version "26.1" :type '(repeat string) :group 'tex-flymake) commit f5d036023494dc0d757d062f086a6adb6728f364 Author: Glenn Morris Date: Tue Dec 12 23:18:35 2017 -0800 Escape column-zero doc parens * lisp/htmlfontify.el (hfy-display-class): * lisp/calendar/icalendar.el (icalendar--do-create-ical-alarm): * lisp/net/shr.el (shr-external-rendering-functions): * lisp/progmodes/cc-vars.el (c-asymmetry-fontification-flag): * lisp/textmodes/tildify.el (tildify-tildify): Escape column-zero doc parens. A shame bug#21871 remains unfixed. diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 129cd6d9ad..27f1b0324e 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -1310,7 +1310,7 @@ Returns an alist." Argument ADVANCE-TIME is a number giving the time when the alarm fires (minutes before the respective event). Argument ALARM-SPEC is a list which must be one of (audio), (display) or -(email (ADDRESS1 ...)), see `icalendar-export-alarms'. Argument +\(email (ADDRESS1 ...)), see `icalendar-export-alarms'. Argument SUMMARY is a string which contains a short description for the alarm." (let* ((action (car alarm-spec)) diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index cb4c83d33e..0c5a2477e5 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -426,7 +426,7 @@ Some valid class specification elements are:\n (type lucid) Multiple values for a tag may be combined, to indicate that any one or more of these values in the specification key constitutes a match, eg:\n -((class color grayscale) (type tty)) would match any of:\n +\((class color grayscale) (type tty)) would match any of:\n ((class color)) ((class grayscale)) ((class color grayscale)) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index ad5d869531..8a64f7549f 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -149,7 +149,7 @@ cid: URL as the argument.") "Alist of tag/function pairs used to alter how shr renders certain tags. For instance, eww uses this to alter rendering of title, forms and other things: -((title . eww-tag-title) +\((title . eww-tag-title) (form . eww-tag-form) ...)") diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index c421379763..51caef2fc3 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1641,7 +1641,7 @@ In the fontification engine, it is sometimes impossible to determine whether a construct is a declaration or an expression. This happens particularly in C++, due to ambiguities in the language. When such a construct is like \"foo * bar\" or \"foo &bar\", and this variable is non-nil -(the default), the construct will be fontified as a declaration if there is +\(the default), the construct will be fontified as a declaration if there is white space either before or after the operator, but not both." :type 'boolean :group 'c) diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 0d7b15dfc6..f25dfbcc75 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el @@ -350,7 +350,7 @@ If ASK is nil, perform replace without asking user for confirmation. Returns (count . response) cons where count is number of string replacements done and response is one of symbols: t (all right), nil -(quit), force (replace without further questions)." +\(quit), force (replace without further questions)." (save-excursion (goto-char beg) (let ((regexp tildify-pattern)