commit 83cdf7bf15d8f80fdc94e2de2ba96323f1d30101 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Fri Apr 26 10:39:24 2019 +0300 Avoid compiler warning in dynlib.c * src/dynlib.c (dynlib_addr) [WINDOWSNT]: Rename the first argument to be consistent with other platforms. Cast it to 'void *' to avoid compiler warning as result of changing the function's signature as part of the last recent change in dynlib.c. diff --git a/src/dynlib.c b/src/dynlib.c index 9c1bf4a82a..8c25b75537 100644 --- a/src/dynlib.c +++ b/src/dynlib.c @@ -123,7 +123,7 @@ dynlib_sym (dynlib_handle_ptr h, const char *sym) } void -dynlib_addr (void (*addr) (void), const char **fname, const char **symname) +dynlib_addr (void (*funcptr) (void), const char **fname, const char **symname) { static char dll_filename[MAX_UTF8_PATH]; static GetModuleHandleExA_Proc s_pfn_Get_Module_HandleExA = NULL; @@ -132,6 +132,7 @@ dynlib_addr (void (*addr) (void), const char **fname, const char **symname) HMODULE hm_dll = NULL; wchar_t mfn_w[MAX_PATH]; char mfn_a[MAX_PATH]; + void *addr = (void *) funcptr; /* Step 1: Find the handle of the module where ADDR lives. */ if (os_subtype == OS_9X commit a241e45b5a3a5664d9087069e8ef8e0f4ff0df7c Author: Glenn Morris Date: Thu Apr 25 22:06:34 2019 -0400 * test/lisp/progmodes/sql-tests.el (sql-tests-buffer-naming-harness): Fix previous for TEST_LOAD_EL=no. diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el index ef8fe58506..3ac9fb10e4 100644 --- a/test/lisp/progmodes/sql-tests.el +++ b/test/lisp/progmodes/sql-tests.el @@ -332,7 +332,7 @@ The ACTION will be tested after set-up of PRODUCT." (declare (indent 1)) `(progn - (skip-unless (executable-find sql-sqlite-program)) + (ert--skip-unless (executable-find sql-sqlite-program)) (let (new-bufs) (cl-letf (((symbol-function 'make-comint-in-buffer) commit a0bb2588b8fc79ac8e040fd7a8d8d3d0e158ffa0 Author: Alan Mackenzie Date: Fri Apr 26 01:15:00 2019 +0000 Fix the formatting of '\' (including apostrophes) in CC Mode. In particular, the second apostrophe must also get font-lock-warning-face. * lisp/progmodes/cc-mode.el (c-parse-quotes-before-change) (c-parse-quotes-after-change): Add cond arms to recognize and handle the anomalous construct '\'. Correct the handling of c-new-BEG in c-parse-quotes-before-change. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 1a36004875..ea865e0b0f 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1529,9 +1529,12 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") (goto-char (match-end 0)) (if (> (match-end 0) c-new-BEG) (setq c-new-BEG (1- (match-beginning 0))))) + ((looking-at "\\\\'") + (setq c-new-BEG (min c-new-BEG (1- (point)))) + (goto-char (match-end 0))) ((save-excursion (not (search-forward "'" c-new-BEG t))) - (setq c-new-BEG (1- (point)))) + (setq c-new-BEG (min c-new-BEG (1- (point))))) (t nil))) (goto-char c-new-END) @@ -1555,6 +1558,9 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") (goto-char (match-end 0)) (if (> (match-end 0) c-new-END) (setq c-new-END (match-end 0)))) + ((looking-at "\\\\'") + (goto-char (match-end 0)) + (setq c-new-END (max c-new-END (point)))) ((equal (c-get-char-property (1- (point)) 'syntax-table) '(1)) (when (c-search-forward-char-property-with-value-on-char 'syntax-table '(1) ?\' (c-point 'eoll)) @@ -1624,6 +1630,12 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") "\\([^\\']\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\ \\)'") ; balanced quoted expression. (goto-char (match-end 0))) + ((looking-at "\\\\'") ; Anomalous construct. + (c-invalidate-state-cache (1- (point))) + (c-truncate-semi-nonlit-pos-cache (1- (point))) + (c-put-char-properties-on-char (1- (point)) (+ (point) 2) + 'syntax-table '(1) ?') + (goto-char (match-end 0))) (t (c-invalidate-state-cache (1- (point))) (c-truncate-semi-nonlit-pos-cache (1- (point))) commit 80822917736edbab77969c4a18dfb8dd20fe3a88 Author: Glenn Morris Date: Thu Apr 25 19:53:02 2019 -0400 * test/lisp/progmodes/sql-tests.el (sql-tests-buffer-naming-harness): Skip if no sqlite program. diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el index ad1f797652..ef8fe58506 100644 --- a/test/lisp/progmodes/sql-tests.el +++ b/test/lisp/progmodes/sql-tests.el @@ -331,20 +331,22 @@ yield OUTP." The ACTION will be tested after set-up of PRODUCT." (declare (indent 1)) - `(let (new-bufs) - (cl-letf - (((symbol-function 'make-comint-in-buffer) - (lambda (_name buffer _program &optional _startfile &rest _switches) - (let ((b (get-buffer-create buffer))) - (message ">>make-comint-in-buffer %S" b) - (cl-pushnew b new-bufs) ;; Keep track of what we create - b)))) - - (let (,(intern (format "sql-%s-login-params" product))) - ,@action) - - (let (kill-buffer-query-functions) ;; Kill what we create - (mapc #'kill-buffer new-bufs))))) + `(progn + (skip-unless (executable-find sql-sqlite-program)) + (let (new-bufs) + (cl-letf + (((symbol-function 'make-comint-in-buffer) + (lambda (_name buffer _program &optional _startfile &rest _switches) + (let ((b (get-buffer-create buffer))) + (message ">>make-comint-in-buffer %S" b) + (cl-pushnew b new-bufs) ;; Keep track of what we create + b)))) + + (let (,(intern (format "sql-%s-login-params" product))) + ,@action) + + (let (kill-buffer-query-functions) ;; Kill what we create + (mapc #'kill-buffer new-bufs)))))) (ert-deftest sql-tests-buffer-naming-default () "Test buffer naming." commit 1486eadf7c9469f873fcd04beafd03f21564d580 Author: Stephen Leake Date: Thu Apr 25 15:49:38 2019 -0700 Fix Bug#33618; define search path variables for grep, byte-compile * etc/NEWS: Mention new variables. * lisp/emacs-lisp/bytecomp.el (emacs-lisp-compilation-search-path): New. * lisp/progmodes/grep.el (grep-search-path): New. diff --git a/etc/NEWS b/etc/NEWS index 788be7060a..721ebb2ded 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -325,8 +325,17 @@ and directory-local variables. longer. --- -** next-error-verbose controls when `next-error' outputs a message - about the error locus. +** New variable next-error-verbose controls when `next-error' outputs + a message about the error locus. + +--- +** New variable grep-search-path defines the directories searched for + grep hits (this used to be controlled by compilation-search-path). + +--- +** New variable emacs-lisp-compilation-search-path defines the + directories searched for byte-compiler error messages (this used to + be controlled by compilation-search-path). * Editing Changes in Emacs 27.1 diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 4c61e1a447..e76baf5ed0 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1022,6 +1022,15 @@ If STR is something like \"Buffer foo.el\", return # "The value for `compilation-parse-errors-filename-function' for when we go into emacs-lisp-compilation-mode.") +(defcustom emacs-lisp-compilation-search-path '(nil) + "Search path for byte-compile error messages. +Elements should be directory names, not file names of directories. +The value nil as an element means to try the default directory." + :group 'bytecomp + :version "27.1" + :type '(repeat (choice (const :tag "Default" nil) + (string :tag "Directory")))) + (define-compilation-mode emacs-lisp-compilation-mode "elisp-compile" "The variant of `compilation-mode' used for emacs-lisp error buffers") diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 8c7a58fd8b..85f9078d46 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -441,6 +441,15 @@ abbreviated part can also be toggled with :version "27.1" :group 'grep) +(defcustom grep-search-path '(nil) + "Search path for grep results. +Elements should be directory names, not file names of directories. +The value nil as an element means to try the default directory." + :group 'grep + :version "27.1" + :type '(repeat (choice (const :tag "Default" nil) + (string :tag "Directory")))) + (defvar grep-find-abbreviate-properties (let ((ellipsis (if (char-displayable-p ?…) "[…]" "[...]")) (map (make-sparse-keymap))) commit 83b0fc30d4bd6799e9593685d1767dfe2b3648a7 Author: Paul Eggert Date: Thu Apr 25 13:42:50 2019 -0700 Minor tweaks to recent UBSan-related fix * src/alloc.c: No need to include stdalign.h; it’s pervasive. (GC_STRING_OVERRUN_COOKIE_SIZE): Align to sdata’s alignment, so that the code works even if alignof (sdata) exceeds 8. Don’t require the cookie size to be 8, as this overly fattens 32-bit platforms and one DEADBEEF should be enough. (GC_STRING_EXTRA): Omit now-unnecessary ‘verify’. (allocate_string_data): Omit unnecessary cast. diff --git a/src/alloc.c b/src/alloc.c index 3b5e3bb9b0..c4ef4e9686 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see . */ #include #include -#include #include #include #include @@ -1576,16 +1575,15 @@ static struct Lisp_String *string_free_list; #ifdef GC_CHECK_STRING_OVERRUN -/* We check for overrun in string data blocks by appending a small +/* Check for overrun in string data blocks by appending a small "cookie" after each allocated string data block, and check for the presence of this cookie during GC. */ - -#define GC_STRING_OVERRUN_COOKIE_SIZE 8 +# define GC_STRING_OVERRUN_COOKIE_SIZE ROUNDUP (4, alignof (sdata)) static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = - { '\xde', '\xad', '\xbe', '\xef', '\xde', '\xad', '\xbe', '\xef' }; + { '\xde', '\xad', '\xbe', '\xef', /* Perhaps some zeros here. */ }; #else -#define GC_STRING_OVERRUN_COOKIE_SIZE 0 +# define GC_STRING_OVERRUN_COOKIE_SIZE 0 #endif /* Value is the size of an sdata structure large enough to hold NBYTES @@ -1615,13 +1613,7 @@ static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = #endif /* not GC_CHECK_STRING_BYTES */ /* Extra bytes to allocate for each string. */ - -#define GC_STRING_EXTRA (GC_STRING_OVERRUN_COOKIE_SIZE) - -/* Make sure that allocating the extra bytes doesn't misalign - `sdata'. */ - -verify (GC_STRING_EXTRA % alignof (sdata) == 0); +#define GC_STRING_EXTRA GC_STRING_OVERRUN_COOKIE_SIZE /* Exact bound on the number of bytes in a string, not counting the terminating NUL. A string cannot contain more bytes than @@ -1882,7 +1874,7 @@ allocate_string_data (struct Lisp_String *s, data->string = s; b->next_free = (sdata *) ((char *) data + needed + GC_STRING_EXTRA); - eassert ((uintptr_t) (char *) b->next_free % alignof (sdata) == 0); + eassert ((uintptr_t) b->next_free % alignof (sdata) == 0); MALLOC_UNBLOCK_INPUT; commit 69947311d84a2572e8382e401ab97fdab25cb433 Author: Paul Eggert Date: Thu Apr 25 13:21:39 2019 -0700 Port to Oracle Developer Studio 12.6 This compiler is a bit pickier about checking conformance to the C standard, ranging from syntax trivia (no extra ";" at the top level) to portability trivia (warnings re conversion between function and data pointers) to more-important stuff like lack of support for some __attribute__ usages. * src/dynlib.c (dynlib_addr): First argument is a function pointer, not a data pointer. All callers changed. * src/emacs-module.c (module_function_address): Return module_funcptr, not void *. All uses changed. * src/lisp.h (module_funcptr) [HAVE_MODULES]: New type. * src/lread.c (union ieee754_double): Don’t assume the usual semantics for converting signed to unsigned int when initializing a bitfield, as the Oracle compiler complains and the C standard is unclear. * src/pdumper.c (ALLOW_IMPLICIT_CONVERSION): Make it clearer that -Wsign-conversion is disabled everywhere in this file. (dump_trace, dump_tailq_prepend, dump_tailq_append): Don’t assume __attribute__. (dump_object_self_representing_p): Don’t disable conversion warnings; it’s not needed here. (DEFINE_FROMLISP_FUNC): Avoid possible signal in integer conversion from unsigned to signed. (DEFINE_FROMLISP_FUNC, finish_dump_pvec): Avoid warning about unreachable statements on platforms not supporting the __attribute__. (intmax_t_from_lisp, intmax_t_to_lisp, dump_off_from_lisp) (dump_off_to_lisp, dump_emacs_reloc_immediate_lv) (dump_emacs_reloc_immediate_ptrdiff_t) (dump_emacs_reloc_immediate_intmax_t) (dump_emacs_reloc_immediate_int, dump_emacs_reloc_immediate_bool): Omit stray semicolon that violates C standard. (dump_metadata_for_pdumper): Add cast to pacify compiler complaining about conversion from function pointer to data pointer. (Fdump_emacs_portable): Do not use CALLN to call a function with zero arguments, as C99 prohibits empty initializers. * src/xdisp.c (syms_of_xdisp): Do not nest calls to pure_list, to work around a bug in Oracle Developer Studio 12.6. diff --git a/src/dynlib.c b/src/dynlib.c index 878044558a..9c1bf4a82a 100644 --- a/src/dynlib.c +++ b/src/dynlib.c @@ -123,7 +123,7 @@ dynlib_sym (dynlib_handle_ptr h, const char *sym) } void -dynlib_addr (void *addr, const char **fname, const char **symname) +dynlib_addr (void (*addr) (void), const char **fname, const char **symname) { static char dll_filename[MAX_UTF8_PATH]; static GetModuleHandleExA_Proc s_pfn_Get_Module_HandleExA = NULL; @@ -279,11 +279,12 @@ dynlib_sym (dynlib_handle_ptr h, const char *sym) } void -dynlib_addr (void *ptr, const char **path, const char **sym) +dynlib_addr (void (*funcptr) (void), const char **path, const char **sym) { *path = NULL; *sym = NULL; #ifdef HAVE_DLADDR + void *ptr = (void *) funcptr; Dl_info info; if (dladdr (ptr, &info) && info.dli_fname && info.dli_sname) { diff --git a/src/dynlib.h b/src/dynlib.h index 168ddbc32c..2688712a13 100644 --- a/src/dynlib.h +++ b/src/dynlib.h @@ -35,6 +35,6 @@ dynlib_function_ptr dynlib_func (dynlib_handle_ptr h, const char *sym); /* Sets *FILE to the file name from which PTR was loaded, and *SYM to its symbol name. If the file or symbol name could not be determined, set the corresponding argument to NULL. */ -void dynlib_addr (void *ptr, const char **file, const char **sym); +void dynlib_addr (void (*ptr) (void), const char **file, const char **sym); #endif /* DYNLIB_H */ diff --git a/src/emacs-module.c b/src/emacs-module.c index 0b7b3d6ffb..80a04bafc2 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -934,10 +934,10 @@ module_function_documentation (const struct Lisp_Module_Function *function) return function->documentation; } -void * +module_funcptr module_function_address (const struct Lisp_Module_Function *function) { - return function->subr; + return (module_funcptr) function->subr; } diff --git a/src/lisp.h b/src/lisp.h index 8dc44291a8..f613ce20b0 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3069,7 +3069,9 @@ enum maxargs /* Call a function F that accepts many args, passing it the remaining args, E.g., 'return CALLN (Fformat, fmt, text);' is less error-prone than '{ Lisp_Object a[2]; a[0] = fmt; a[1] = text; return Fformat (2, a); }'. - CALLN is overkill for simple usages like 'Finsert (1, &text);'. */ + CALLN requires at least one function argument (as C99 prohibits + empty initializers), and is overkill for simple usages like + 'Finsert (1, &text);'. */ #define CALLN(f, ...) CALLMANY (f, ((Lisp_Object []) {__VA_ARGS__})) extern void defvar_lisp (struct Lisp_Objfwd const *, char const *); @@ -4168,14 +4170,21 @@ XMODULE_FUNCTION (Lisp_Object o) } #ifdef HAVE_MODULES +/* A function pointer type good enough for lisp.h. Actual module + function pointers are of a different type that relies on details + internal to emacs-module.c. */ +typedef void (*module_funcptr) (void); + /* Defined in alloc.c. */ extern Lisp_Object make_user_ptr (void (*finalizer) (void *), void *p); /* Defined in emacs-module.c. */ extern Lisp_Object funcall_module (Lisp_Object, ptrdiff_t, Lisp_Object *); extern Lisp_Object module_function_arity (const struct Lisp_Module_Function *); -extern Lisp_Object module_function_documentation (const struct Lisp_Module_Function *); -extern void *module_function_address (const struct Lisp_Module_Function *); +extern Lisp_Object module_function_documentation + (struct Lisp_Module_Function const *); +extern module_funcptr module_function_address + (struct Lisp_Module_Function const *); extern void mark_modules (void); extern void init_module_assertions (bool); extern void syms_of_module (void); diff --git a/src/lread.c b/src/lread.c index 6cd1029cd9..1c97805ca7 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3782,7 +3782,7 @@ string_to_number (char const *string, int base, ptrdiff_t *plen) state |= E_EXP; cp += 3; union ieee754_double u - = { .ieee_nan = { .exponent = -1, .quiet_nan = 1, + = { .ieee_nan = { .exponent = 0x7ff, .quiet_nan = 1, .mantissa0 = n >> 31 >> 1, .mantissa1 = n }}; value = u.d; } diff --git a/src/pdumper.c b/src/pdumper.c index 39931c6807..28045d1959 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -70,18 +70,18 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_PDUMPER -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) +#if GNUC_PREREQ (4, 7, 0) # pragma GCC diagnostic error "-Wconversion" +# pragma GCC diagnostic ignored "-Wsign-conversion" # pragma GCC diagnostic error "-Wshadow" # define ALLOW_IMPLICIT_CONVERSION \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wconversion\"") - _Pragma ("GCC diagnostic ignored \"-Wsign-conversion\"") # define DISALLOW_IMPLICIT_CONVERSION \ _Pragma ("GCC diagnostic pop") #else -# define ALLOW_IMPLICIT_CONVERSION ((void)0) -# define DISALLOW_IMPLICIT_CONVERSION ((void)0) +# define ALLOW_IMPLICIT_CONVERSION ((void) 0) +# define DISALLOW_IMPLICIT_CONVERSION ((void) 0) #endif #define VM_POSIX 1 @@ -124,7 +124,7 @@ along with GNU Emacs. If not, see . */ general-purpose computer made after 1990. */ verify (sizeof (ptrdiff_t) == sizeof (void *)); verify (sizeof (intptr_t) == sizeof (ptrdiff_t)); -verify (sizeof (void (*)(void)) == sizeof (void *)); +verify (sizeof (void (*) (void)) == sizeof (void *)); verify (sizeof (ptrdiff_t) <= sizeof (Lisp_Object)); verify (sizeof (ptrdiff_t) <= sizeof (EMACS_INT)); verify (CHAR_BIT == 8); @@ -151,8 +151,7 @@ typedef int_least32_t dump_off; #define DUMP_OFF_MIN INT_LEAST32_MIN #define DUMP_OFF_MAX INT_LEAST32_MAX -__attribute__((format (printf,1,2))) -static void +static void ATTRIBUTE_FORMAT ((printf, 1, 2)) dump_trace (const char *fmt, ...) { if (0) @@ -734,11 +733,7 @@ dump_builtin_symbol_p (Lisp_Object object) static bool dump_object_self_representing_p (Lisp_Object object) { - bool result; - ALLOW_IMPLICIT_CONVERSION; - result = FIXNUMP (object) || dump_builtin_symbol_p (object); - DISALLOW_IMPLICIT_CONVERSION; - return result; + return FIXNUMP (object) || dump_builtin_symbol_p (object); } #define DEFINE_FROMLISP_FUNC(fn, type) \ @@ -749,10 +744,13 @@ dump_object_self_representing_p (Lisp_Object object) if (FIXNUMP (value)) \ return XFIXNUM (value); \ eassert (BIGNUMP (value)); \ - return TYPE_SIGNED (type) \ - ? bignum_to_intmax (value) \ - : bignum_to_uintmax (value); \ + type result; \ + if (TYPE_SIGNED (type)) \ + result = bignum_to_intmax (value); \ + else \ + result = bignum_to_uintmax (value); \ DISALLOW_IMPLICIT_CONVERSION; \ + return result; \ } #define DEFINE_TOLISP_FUNC(fn, type) \ @@ -762,10 +760,10 @@ dump_object_self_representing_p (Lisp_Object object) return INT_TO_INTEGER (value); \ } -DEFINE_FROMLISP_FUNC (intmax_t_from_lisp, intmax_t); -DEFINE_TOLISP_FUNC (intmax_t_to_lisp, intmax_t); -DEFINE_FROMLISP_FUNC (dump_off_from_lisp, dump_off); -DEFINE_TOLISP_FUNC (dump_off_to_lisp, dump_off); +DEFINE_FROMLISP_FUNC (intmax_t_from_lisp, intmax_t) +DEFINE_TOLISP_FUNC (intmax_t_to_lisp, intmax_t) +DEFINE_FROMLISP_FUNC (dump_off_from_lisp, dump_off) +DEFINE_TOLISP_FUNC (dump_off_to_lisp, dump_off) static void dump_write (struct dump_context *ctx, const void *buf, dump_off nbyte) @@ -797,8 +795,7 @@ dump_tailq_length (const struct dump_tailq *tailq) return tailq->length; } -__attribute__((unused)) -static void +static void ATTRIBUTE_UNUSED dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value) { Lisp_Object link = Fcons (value, tailq->head); @@ -808,8 +805,7 @@ dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value) tailq->length += 1; } -__attribute__((unused)) -static void +static void ATTRIBUTE_UNUSED dump_tailq_append (struct dump_tailq *tailq, Lisp_Object value) { Lisp_Object link = Fcons (value, Qnil); @@ -1593,11 +1589,11 @@ dump_emacs_reloc_immediate (struct dump_context *ctx, ctx, emacs_ptr, &value, sizeof (value)); \ } -DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_lv, Lisp_Object); -DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_ptrdiff_t, ptrdiff_t); -DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_intmax_t, intmax_t); -DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_int, int); -DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_bool, bool); +DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_lv, Lisp_Object) +DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_ptrdiff_t, ptrdiff_t) +DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_intmax_t, intmax_t) +DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_int, int) +DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_bool, bool) /* Add an emacs relocation that makes a raw pointer in Emacs point into the dump. */ @@ -2011,8 +2007,10 @@ finish_dump_pvec (struct dump_context *ctx, union vectorlike_header *out_hdr) { ALLOW_IMPLICIT_CONVERSION; - return dump_object_finish (ctx, out_hdr, vectorlike_nbytes (out_hdr)); + dump_off result = dump_object_finish (ctx, out_hdr, + vectorlike_nbytes (out_hdr)); DISALLOW_IMPLICIT_CONVERSION; + return result; } static void @@ -3237,7 +3235,8 @@ static void dump_metadata_for_pdumper (struct dump_context *ctx) { for (int i = 0; i < nr_dump_hooks; ++i) - dump_emacs_reloc_to_emacs_ptr_raw (ctx, &dump_hooks[i], dump_hooks[i]); + dump_emacs_reloc_to_emacs_ptr_raw (ctx, &dump_hooks[i], + (void const *) dump_hooks[i]); dump_emacs_reloc_immediate_int (ctx, &nr_dump_hooks, nr_dump_hooks); for (int i = 0; i < nr_remembered_data; ++i) @@ -3801,8 +3800,8 @@ dump_merge_emacs_relocs (Lisp_Object lreloc_a, Lisp_Object lreloc_b) dump_off_to_lisp (reloc_a.length)); } -typedef void (*drain_reloc_handler)(struct dump_context *, Lisp_Object); -typedef Lisp_Object (*drain_reloc_merger)(Lisp_Object a, Lisp_Object b); +typedef void (*drain_reloc_handler) (struct dump_context *, Lisp_Object); +typedef Lisp_Object (*drain_reloc_merger) (Lisp_Object a, Lisp_Object b); static void drain_reloc_list (struct dump_context *ctx, @@ -4040,7 +4039,7 @@ types. */) ctx->deferred_symbols = Qnil; ctx->fixups = Qnil; - ctx->staticpro_table = CALLN (Fmake_hash_table); + ctx->staticpro_table = Fmake_hash_table (0, NULL); ctx->symbol_aux = Qnil; ctx->copied_queue = Qnil; ctx->cold_queue = Qnil; @@ -4587,7 +4586,7 @@ struct dump_memory_map { struct dump_memory_map_spec spec; void *mapping; /* Actual mapped memory. */ - void (*release)(struct dump_memory_map *); + void (*release) (struct dump_memory_map *); void *private; }; diff --git a/src/print.c b/src/print.c index 8b163e3ee3..68ed6781c8 100644 --- a/src/print.c +++ b/src/print.c @@ -1787,7 +1787,7 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, case PVEC_MODULE_FUNCTION: { print_c_string ("# Date: Thu Apr 25 15:34:05 2019 -0400 * lisp/simple.el (eval-expression): Fix paren typo. diff --git a/lisp/simple.el b/lisp/simple.el index 79db712105..5660f6574f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1647,7 +1647,7 @@ this command arranges for all errors to enter the debugger." (if (null eval-expression-debug-on-error) (push (eval (let ((lexical-binding t)) (macroexpand-all exp)) t) - values)) + values) (let ((old-value (make-symbol "t")) new-value) ;; Bind debug-on-error to something unique so that we can ;; detect when evalled code changes it. commit fe6c507f5ce0fd744b5bd1d0db6ea175e1188a7f Author: Philipp Stephani Date: Thu Apr 25 21:28:46 2019 +0200 Make sure that ‘sdata’ objects in ‘sblock’ objects are aligned. Issue found by Clang’s UBSan. * src/alloc.c (GC_STRING_OVERRUN_COOKIE_SIZE): Increase to 8. (string_overrun_cookie): Extend accordingly. (GC_STRING_EXTRA): Ensure that it’s properly aligned for ‘sdata’. (allocate_string_data): Verify that ‘sdata’ blocks remain aligned. diff --git a/src/alloc.c b/src/alloc.c index 402fada1ad..3b5e3bb9b0 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -21,6 +21,8 @@ along with GNU Emacs. If not, see . */ #include #include +#include +#include #include #include #include /* For CHAR_BIT. */ @@ -1578,9 +1580,9 @@ static struct Lisp_String *string_free_list; "cookie" after each allocated string data block, and check for the presence of this cookie during GC. */ -#define GC_STRING_OVERRUN_COOKIE_SIZE 4 +#define GC_STRING_OVERRUN_COOKIE_SIZE 8 static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = - { '\xde', '\xad', '\xbe', '\xef' }; + { '\xde', '\xad', '\xbe', '\xef', '\xde', '\xad', '\xbe', '\xef' }; #else #define GC_STRING_OVERRUN_COOKIE_SIZE 0 @@ -1616,6 +1618,11 @@ static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = #define GC_STRING_EXTRA (GC_STRING_OVERRUN_COOKIE_SIZE) +/* Make sure that allocating the extra bytes doesn't misalign + `sdata'. */ + +verify (GC_STRING_EXTRA % alignof (sdata) == 0); + /* Exact bound on the number of bytes in a string, not counting the terminating NUL. A string cannot contain more bytes than STRING_BYTES_BOUND, nor can it be so long that the size_t @@ -1875,6 +1882,7 @@ allocate_string_data (struct Lisp_String *s, data->string = s; b->next_free = (sdata *) ((char *) data + needed + GC_STRING_EXTRA); + eassert ((uintptr_t) (char *) b->next_free % alignof (sdata) == 0); MALLOC_UNBLOCK_INPUT; commit e08e0880f9892fba747abdb95b1f3382ebd17e32 Author: Stefan Monnier Date: Thu Apr 25 14:36:03 2019 -0400 Use lexical-binding by default for M-:, --eval, and *scratch* * lisp/startup.el (command-line): Default to lexical-binding in *scratch*. (normal-no-mouse-startup-screen, command-line-1): Use startup--get-buffer-create-scratch. (command-line-1): * lisp/simple.el (eval-expression): * lisp/server.el (server-eval-and-print): Use lexical-binding to evaluate the expression. (server-execute): Use startup--get-buffer-create-scratch. * lisp/ielm.el (inferior-emacs-lisp-mode): Default to lexical-binding. diff --git a/etc/NEWS b/etc/NEWS index e861a372b1..788be7060a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -178,6 +178,10 @@ The default value is 30000, as the previously hard-coded threshold. +++ ** The function 'read-passwd' uses '*' as default character to hide passwords. +** Lexical binding is now used when evaluating interactive Elisp forms +More specifically, lexical-binding is now used for M-:, --eval, as well +as in the *scratch* and *ielm* buffers. + --- ** The new option 'tooltip-resize-echo-area' avoids truncating tooltip text on GUI frames when tooltips are displayed in the echo area. Instead, diff --git a/lisp/ielm.el b/lisp/ielm.el index 82aff9901b..c7a31a23e6 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el @@ -559,10 +559,11 @@ Customized bindings may be defined in `ielm-map', which currently contains: ;; Useful for `hs-minor-mode'. (setq-local comment-start ";") (setq-local comment-use-syntax t) + (setq-local lexical-binding t) - (set (make-local-variable 'indent-line-function) 'ielm-indent-line) + (set (make-local-variable 'indent-line-function) #'ielm-indent-line) (set (make-local-variable 'ielm-working-buffer) (current-buffer)) - (set (make-local-variable 'fill-paragraph-function) 'lisp-fill-paragraph) + (set (make-local-variable 'fill-paragraph-function) #'lisp-fill-paragraph) ;; Value holders (set (make-local-variable '*) nil) diff --git a/lisp/server.el b/lisp/server.el index c38fdf8483..1e5c57a1c5 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -807,7 +807,7 @@ Server mode runs a process that accepts commands from the ;; intended it to interrupt us rather than interrupt whatever Emacs ;; was doing before it started handling the process filter. ;; Hence `with-local-quit' (bug#6585). - (let ((v (with-local-quit (eval (car (read-from-string expr)))))) + (let ((v (with-local-quit (eval (car (read-from-string expr)) t)))) (when proc (with-temp-buffer (let ((standard-output (current-buffer))) @@ -1329,7 +1329,7 @@ The following commands are accepted by the client: (find-file-noselect initial-buffer-choice)) ((functionp initial-buffer-choice) (funcall initial-buffer-choice))))) - (if (buffer-live-p buf) buf (get-buffer-create "*scratch*"))))) + (if (buffer-live-p buf) buf (startup--get-buffer-create-scratch))))) ;; Set current buffer so that newly created tty frames ;; show the correct buffer initially. (frame (with-current-buffer (or (car buffers) diff --git a/lisp/simple.el b/lisp/simple.el index 160c433845..79db712105 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1646,12 +1646,14 @@ this command arranges for all errors to enter the debugger." (eval-expression-get-print-arguments current-prefix-arg))) (if (null eval-expression-debug-on-error) - (push (eval (macroexpand-all exp) lexical-binding) values) + (push (eval (let ((lexical-binding t)) (macroexpand-all exp)) t) + values)) (let ((old-value (make-symbol "t")) new-value) ;; Bind debug-on-error to something unique so that we can ;; detect when evalled code changes it. (let ((debug-on-error old-value)) - (push (eval (macroexpand-all exp) lexical-binding) values) + (push (eval (let ((lexical-binding t)) (macroexpand-all exp)) t) + values) (setq new-value debug-on-error)) ;; If evalled code has changed the value of debug-on-error, ;; propagate that change to the global binding. diff --git a/lisp/startup.el b/lisp/startup.el index a9b58c5e01..421a6ea37d 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1378,7 +1378,8 @@ please check its value") (if (get-buffer "*scratch*") (with-current-buffer "*scratch*" (if (eq major-mode 'fundamental-mode) - (funcall initial-major-mode)))) + (funcall initial-major-mode)) + (setq-local lexical-binding t))) ;; Load library for our terminal type. ;; User init file can set term-file-prefix to nil to prevent this. @@ -2124,7 +2125,7 @@ If you have no Meta key, you may instead type ESC followed by the character.)")) (insert "\t\t") (insert-button "Open *scratch* buffer" 'action (lambda (_button) (switch-to-buffer - (get-buffer-create "*scratch*"))) + (startup--get-buffer-create-scratch))) 'follow-link t) (insert "\n") (insert "\n" (emacs-version) "\n" emacs-copyright "\n") @@ -2250,6 +2251,13 @@ A fancy display is used on graphic displays, normal otherwise." (defalias 'about-emacs 'display-about-screen) (defalias 'display-splash-screen 'display-startup-screen) +(defun startup--get-buffer-create-scratch () + (or (get-buffer "*scratch*") + (with-current-buffer (get-buffer-create "*scratch*") + (set-buffer-major-mode (current-buffer)) + (setq-local lexical-binding t) + (current-buffer)))) + (defun command-line-1 (args-left) "A subroutine of `command-line'." (display-startup-echo-area-message) @@ -2399,7 +2407,7 @@ nil default-directory" name) (unless (= end (length str-expr)) (error "Trailing garbage following expression: %s" (substring str-expr end))) - (eval expr))) + (eval expr t))) ((member argi '("-L" "-directory")) ;; -L :/foo adds /foo to the _end_ of load-path. @@ -2514,7 +2522,7 @@ nil default-directory" name) (when (eq initial-buffer-choice t) ;; When `initial-buffer-choice' equals t make sure that *scratch* ;; exists. - (get-buffer-create "*scratch*")) + (startup--get-buffer-create-scratch)) ;; If *scratch* exists and is empty, insert initial-scratch-message. ;; Do this before switching to *scratch* below to handle bug#9605. @@ -2538,7 +2546,7 @@ nil default-directory" name) ((functionp initial-buffer-choice) (funcall initial-buffer-choice)) ((eq initial-buffer-choice t) - (get-buffer-create "*scratch*")) + (startup--get-buffer-create-scratch)) (t (error "`initial-buffer-choice' must be a string, a function, or t"))))) (unless (buffer-live-p buf) commit 0c2d921a75375e5667224bfd92b28be3b77977b3 Author: Alan Mackenzie Date: Thu Apr 25 18:00:15 2019 +0000 Restore fontification of delimiters of multiline CC Mode strings. E.g., on typing the closing delimiter of a string continued onto a second line, the opening delimiter retained its font-lock-warning-face. * lisp/progmodes/cc-defs.el (c-c++-raw-string-opener-re) (c-c++-raw-string-opener-1-re): New constants. (c-sub-at-c++-raw-string-opener, c-at-c++-raw-string-opener): New macros. * lisp/progmodes/cc-engine.el (c-raw-string-pos) (c-depropertize-raw-strings-in-region, c-after-change-unmark-raw-strings): Replace uses of open-coded raw string regexps by the new constants and macros in cc-defs.el. * lisp/progmodes/cc-fonts.el (c-font-lock-raw-strings): Ditto * lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Set c-new-BEG to the beginning of the string when we encounter its closing ". When not in a raw string, but in a string, clear syntax-table properties from its delimiters and set c-new-BEG/END to its limits. (c-after-change-mark-abnormal-strings): When applying syntax-table properties to string delimiters, also set c-new-BEG/END to ensure subsequent fontification. diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 87ddf3ac1e..cd4ed6b352 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -503,6 +503,31 @@ to it is returned. This function does not modify the point or the mark." ;; Emacs <22 + XEmacs '(default-value 'sentence-end))) +(defconst c-c++-raw-string-opener-re "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(") +;; Matches a C++ raw string opener. Submatch 1 is its identifier. + +(defconst c-c++-raw-string-opener-1-re "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(") +;; Matches a C++ raw string opener starting after the initial R. + +(defmacro c-sub-at-c++-raw-string-opener () + `(save-excursion + (and + (if (eq (char-after) ?R) + (progn (forward-char) t) + (eq (char-before) ?R)) + (looking-at c-c++-raw-string-opener-1-re)))) + +(defmacro c-at-c++-raw-string-opener (&optional pos) + ;; Return non-nil if POS (default point) is either at the start of a C++ raw + ;; string opener, or after the introductory R of one. The match data is + ;; overwritten. On success the opener's identifier will be (match-string + ;; 1). Text properties on any characters are ignored. + (if pos + `(save-excursion + (goto-char ,pos) + (c-sub-at-c++-raw-string-opener)) + `(c-sub-at-c++-raw-string-opener))) + ;; The following is essentially `save-buffer-state' from lazy-lock.el. ;; It ought to be a standard macro. (defmacro c-save-buffer-state (varlist &rest body) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 6b44aae088..242954dbf2 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -6607,15 +6607,14 @@ comment at the start of cc-engine.el for more info." (while (and (search-forward-regexp - "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(" + c-c++-raw-string-opener-re (1+ here) 'limit) (< (point) here))) (and (eq (point) (1+ here)) (match-beginning 1) (goto-char (1- (match-beginning 1))))))) (not (bobp))))) - (eq (char-before) ?R) - (looking-at "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(")) + (c-at-c++-raw-string-opener)) (setq open-quote-pos (point) open-paren-pos (match-end 1) id (match-string-no-properties 1)) @@ -6733,7 +6732,7 @@ comment at the start of cc-engine.el for more info." (concat "\\(" ; 1 c-anchored-cpp-prefix ; 2 "\\)\\|\\(" ; 3 - "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(" ; 4 + c-c++-raw-string-opener-re ; 4 "\\)") finish t)) (when (save-excursion @@ -6752,7 +6751,7 @@ comment at the start of cc-engine.el for more info." (goto-char (match-end 2)) ; after the "#". (while (and (< (point) eom) (c-syntactic-re-search-forward - "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(" eom t)) + c-c++-raw-string-opener-re eom t)) (c-depropertize-raw-string (match-string-no-properties 1) ; id (1+ (match-beginning 0)) ; open quote @@ -6931,8 +6930,7 @@ comment at the start of cc-engine.el for more info." (goto-char end) (setq eoll (c-point 'eoll)) (when (and (null c-old-END-literality) - (search-forward-regexp "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(" - eoll t)) + (search-forward-regexp c-c++-raw-string-opener-re eoll t)) (setq state (c-state-semi-pp-to-literal end)) (when (eq (cadr state) 'string) (unwind-protect @@ -6969,7 +6967,7 @@ comment at the start of cc-engine.el for more info." (while (and (setq found - (search-forward-regexp "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(" + (search-forward-regexp c-c++-raw-string-opener-re c-new-END 'bound)) (<= (match-end 0) beg))) (when (and found (<= (match-beginning 0) end)) @@ -6983,7 +6981,7 @@ comment at the start of cc-engine.el for more info." 'syntax-table) '(1))) (goto-char (1- (cadr c-old-beg-rs))) - (unless (looking-at "R\"[^ ()\\\n\r\t]\\{0,16\\}(") + (unless (looking-at c-c++-raw-string-opener-re) (c-clear-char-property (1+ (point)) 'syntax-table) (c-truncate-semi-nonlit-pos-cache (1+ (point))) (if (c-search-forward-char-property 'syntax-table '(15) @@ -6998,7 +6996,7 @@ comment at the start of cc-engine.el for more info." (and c-old-beg-rs (eq (car c-old-beg-rs) 'open-delim))) (goto-char (cadr c-old-beg-rs)) - (when (looking-at "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(") + (when (looking-at c-c++-raw-string-opener-1-re) (setq id (match-string-no-properties 1)) (when (re-search-forward (concat ")" id "\"") nil t) ; No bound. (setq c-new-END (point-max)) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 4a5cf5719b..831fa30886 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1684,11 +1684,8 @@ casts and declarations are fontified. Used on level 2 and higher." (string-start (and (eq (cadr state) 'string) (car (cddr state)))) (raw-id (and string-start - (save-excursion - (goto-char string-start) - (and (eq (char-before) ?R) - (looking-at "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(") - (match-string-no-properties 1))))) + (c-at-c++-raw-string-opener string-start) + (match-string-no-properties 1))) (content-start (and raw-id (point)))) ;; We go round the next loop twice per raw string, once for each "end". (while (< (point) limit) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 27ed04fea5..1a36004875 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1261,7 +1261,8 @@ Note that the style variables are always made local to the buffer." (memq (char-after) c-string-delims)) ; Ignore an unterminated raw string's (. ;; Opening " on last line of text (without EOL). (c-clear-char-property (point) 'syntax-table) - (c-truncate-semi-nonlit-pos-cache (point))))) + (c-truncate-semi-nonlit-pos-cache (point)) + (setq c-new-BEG (min c-new-BEG (point)))))) (t (goto-char end) ; point-max (when @@ -1271,17 +1272,24 @@ Note that the style variables are always made local to the buffer." (c-clear-char-property (point) 'syntax-table) (c-truncate-semi-nonlit-pos-cache (point))))) - (unless (and c-multiline-string-start-char - (not (c-characterp c-multiline-string-start-char))) + (unless + (or (and + ;; Don't set c-new-BEG/END if we're in a raw string. + (eq beg-literal-type 'string) + (c-at-c++-raw-string-opener (car beg-limits))) + (and c-multiline-string-start-char + (not (c-characterp c-multiline-string-start-char)))) (when (and (eq end-literal-type 'string) (not (eq (char-before (cdr end-limits)) ?\())) (c-clear-char-property (1- (cdr end-limits)) 'syntax-table) - (c-truncate-semi-nonlit-pos-cache (1- (cdr end-limits)))) + (c-truncate-semi-nonlit-pos-cache (1- (cdr end-limits))) + (setq c-new-END (max c-new-END (cdr end-limits)))) (when (and (eq beg-literal-type 'string) (memq (char-after (car beg-limits)) c-string-delims)) (c-clear-char-property (car beg-limits) 'syntax-table) - (c-truncate-semi-nonlit-pos-cache (car beg-limits)))))) + (c-truncate-semi-nonlit-pos-cache (car beg-limits)) + (setq c-new-BEG (min c-new-BEG (car beg-limits))))))) (defun c-after-change-mark-abnormal-strings (beg end _old-len) ;; Mark any unbalanced strings in the region (c-new-BEG c-new-END) with @@ -1352,6 +1360,7 @@ Note that the style variables are always made local to the buffer." (car beg-limits)) (t ; comment (cdr beg-limits)))) + ;; Handle one string each time around the next while loop. (while (and (< (point) c-new-END) @@ -1373,10 +1382,15 @@ Note that the style variables are always made local to the buffer." (cond ((memq (char-after (match-end 0)) '(?\n ?\r)) (c-put-char-property (1- (point)) 'syntax-table '(15)) - (c-put-char-property (match-end 0) 'syntax-table '(15))) + (c-put-char-property (match-end 0) 'syntax-table '(15)) + (setq c-new-BEG (min c-new-BEG (point)) + c-new-END (max c-new-END (match-end 0)))) ((or (eq (match-end 0) (point-max)) (eq (char-after (match-end 0)) ?\\)) ; \ at EOB - (c-put-char-property (1- (point)) 'syntax-table '(15)))) + (c-put-char-property (1- (point)) 'syntax-table '(15)) + (setq c-new-BEG (min c-new-BEG (point)) + c-new-END (max c-new-END (match-end 0))) ; Do we need c-new-END? + )) (goto-char (min (1+ (match-end 0)) (point-max)))) (setq s nil))))) commit 6d8e0fc5aa7673540486af9ecbfc0a3e23c305cf Author: Stephen Berman Date: Thu Apr 25 19:17:23 2019 +0200 Make wdired-mode ignore ls file indicators * lisp/wdired.el (wdired--restore-dired-filename-prop): When dired-listing-switches includes "F" or "classify", don't treat appended indicator characters as part of the file name (bug#34915). * test/lisp/wdired-tests.el (wdired-test-bug34915): New test. diff --git a/lisp/wdired.el b/lisp/wdired.el index acc62e4e39..d2a298bd25 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el @@ -612,14 +612,23 @@ Optional arguments are ignored." (when (re-search-forward directory-listing-before-filename-regexp lep t) (setq beg (point) - ;; If the file is a symlink, put the dired-filename - ;; property only on the link name. (Using - ;; (file-symlink-p (dired-get-filename)) fails in - ;; wdired-mode, bug#32673.) - end (if (and (re-search-backward - dired-permission-flags-regexp nil t) - (looking-at "l") - (search-forward " -> " lep t)) + end (if (or + ;; If the file is a symlink, put the + ;; dired-filename property only on the link + ;; name. (Using (file-symlink-p + ;; (dired-get-filename)) fails in + ;; wdired-mode, bug#32673.) + (and (re-search-backward + dired-permission-flags-regexp nil t) + (looking-at "l") + (search-forward " -> " lep t)) + ;; When dired-listing-switches includes "F" + ;; or "classify", don't treat appended + ;; indicator characters as part of the file + ;; name (bug#34915). + (and (dired-check-switches dired-actual-switches + "F" "classify") + (re-search-forward "[*/@|=>]$" lep t))) (goto-char (match-beginning 0)) lep)) (put-text-property beg end 'dired-filename t)))))) diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el index dc67796cde..9682843db2 100644 --- a/test/lisp/wdired-tests.el +++ b/test/lisp/wdired-tests.el @@ -124,6 +124,51 @@ wdired-mode." (kill-buffer buf))) (delete-directory test-dir t))))) +(ert-deftest wdired-test-bug34915 () + "Test editing when dired-listing-switches includes -F. +Appended file indicators should not count as part of the file +name, either before or after editing. Since +dired-move-to-end-of-filename handles indicator characters, it +suffices to compare the return values of dired-get-filename and +wdired-get-filename before and after editing." + ;; FIXME: Add a test for a door (indicator ">") only under Solaris? + (let* ((test-dir (make-temp-file "test-dir-" t)) + (server-socket-dir test-dir) + (dired-listing-switches "-Fl") + (buf (find-file-noselect test-dir))) + (unwind-protect + (progn + (with-current-buffer buf + (dired-create-empty-file "foo") + (set-file-modes "foo" (file-modes-symbolic-to-number "+x")) + (make-symbolic-link "foo" "bar") + (make-directory "foodir") + (require 'dired-x) + (dired-smart-shell-command "mkfifo foopipe") + (server-force-delete) + (server-start) ; Add a socket file. + (kill-buffer buf)) + (dired test-dir) + (dired-toggle-read-only) + (let (names) + ;; Test that the file names are the same in Dired and WDired. + (while (not (eobp)) + (should (equal (dired-get-filename 'no-dir t) + (wdired-get-filename t))) + (insert "w") + (push (wdired-get-filename t) names) + (dired-next-line 1)) + (wdired-finish-edit) + ;; Test that editing the file names ignores the indicator + ;; character. + (let (dir) + (while (and (dired-previous-line 1) + (setq dir (dired-get-filename 'no-dir t))) + (should (equal dir (pop names))))))) + (kill-buffer (get-buffer test-dir)) + (server-force-delete) + (delete-directory test-dir t)))) + (provide 'wdired-tests) ;;; wdired-tests.el ends here commit 30030945c30c4710d0d70cabad9d1b512cede0ee Author: Paul Eggert Date: Thu Apr 25 08:50:50 2019 -0700 Port emacsclient euidaccess to Solaris 10 Without this fix, linking emacsclient fails with ‘Undefined symbol eaccess’ on Solaris 10 sparc. * lib-src/Makefile.in (LIB_EACCESS): New macro. (emacsclient${EXEEXT}, emacsclientw${EXEEXT}): Use it. diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 387a6e3324..b5b55b848e 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -204,6 +204,8 @@ LIBRESOLV=@LIBRESOLV@ LIBS_MAIL=@LIBS_MAIL@ ## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +## Whatever libraries are needed for euidaccess +LIB_EACCESS=@LIB_EACCESS@ ## empty or -lwsock2 for MinGW LIB_WSOCK32=@LIB_WSOCK32@ @@ -398,12 +400,12 @@ pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h) emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h) $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \ -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) \ - $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@ + $(LIB_WSOCK32) $(LIB_EACCESS) $(LIBS_ECLIENT) -o $@ emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h) $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows $< \ -DVERSION="\"${version}\"" $(LOADLIBES) \ - $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@ + $(LIB_WSOCK32) $(LIB_EACCESS) $(LIBS_ECLIENT) -o $@ NTINC = ${srcdir}/../nt/inc NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \ commit efb8921a574437aed6209695891c14860bd55f51 Author: Alan Mackenzie Date: Thu Apr 25 15:18:12 2019 +0000 Fix some corner cases in the recognition of C++ raw strings. These are where changing the identifier in a raw string delimiter causes different delimiters to match eachother. * lisp/progmodes/cc-engine.el (c-raw-string-end-delim-disrupted): New variable. (c-before-change-check-raw-strings): Use new variable. (c-after-change-unmark-raw-strings): When typing into an opening delimiter or altering its close delimiter causes the opening delimiter to match a later closing delimiter, clear all syntax-table char properties from the opening delimiter onwards, and set c-new-END to point max. Also, when changing a closing delimiter, check whether its new value matches a previously open opening delimiter earlier in the buffer, and amend the syntax-table text properties appropriately. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 80115fb3a3..6b44aae088 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -6567,6 +6567,9 @@ comment at the start of cc-engine.el for more info." ;; BEG and END. (defvar c-old-beg-rs nil) (defvar c-old-end-rs nil) +;; Whether a buffer change has disrupted or will disrupt the terminating id of +;; a raw string. +(defvar c-raw-string-end-delim-disrupted nil) (defun c-raw-string-pos () ;; Get POINT's relationship to any containing raw string. @@ -6768,17 +6771,12 @@ comment at the start of cc-engine.el for more info." ;; This function is called as a before-change function solely due to its ;; membership of the C++ value of `c-get-state-before-change-functions'. (goto-char end) + (setq c-raw-string-end-delim-disrupted nil) ;; We use the following to detect a R"( being swallowed into a string by ;; the pending change. (setq c-old-END-literality (c-in-literal)) (c-save-buffer-state - (;; (beg-rs (progn (goto-char beg) (c-raw-string-pos))) - ;; (end-rs (progn (goto-char end) (c-raw-string-pos))) - ; FIXME!!! - ; Optimize this so that we don't call - ; `c-raw-string-pos' twice when once - ; will do. (2016-06-02). - (term-del (c-raw-string-in-end-delim beg end)) + ((term-del (c-raw-string-in-end-delim beg end)) Rquote close-quote) (setq c-old-beg-rs (progn (goto-char beg) (c-raw-string-pos)) c-old-end-rs (progn (goto-char end) (c-raw-string-pos))) @@ -6792,6 +6790,7 @@ comment at the start of cc-engine.el for more info." (<= (car term-del) (nth 3 c-old-beg-rs)))) (setq Rquote (1- (cadr c-old-beg-rs)) close-quote (1+ (cdr term-del))) + (setq c-raw-string-end-delim-disrupted t) (c-depropertize-raw-strings-in-region Rquote close-quote) (setq c-new-BEG (min c-new-BEG Rquote) c-new-END (max c-new-END close-quote))) @@ -6991,42 +6990,45 @@ comment at the start of cc-engine.el for more info." (c-point 'eol)) (c-clear-char-property (1- (point)) 'syntax-table)))) + ;; Have we matched up with an existing terminator by typing into an + ;; opening delimiter? ... or by messing up a raw string's terminator so + ;; that it now matches a later terminator? + (when + (or c-raw-string-end-delim-disrupted + (and c-old-beg-rs + (eq (car c-old-beg-rs) 'open-delim))) + (goto-char (cadr c-old-beg-rs)) + (when (looking-at "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(") + (setq id (match-string-no-properties 1)) + (when (re-search-forward (concat ")" id "\"") nil t) ; No bound. + (setq c-new-END (point-max)) + (c-clear-char-properties (cadr c-old-beg-rs) c-new-END + 'syntax-table) + (c-truncate-semi-nonlit-pos-cache (cadr c-old-beg-rs))))) ;; Have we terminated an existing raw string by inserting or removing ;; text? (when (eq c-old-END-literality 'string) - (setq state (c-state-semi-pp-to-literal beg)) - (cond - ;; Possibly terminating a(n un)terminated raw string. - ((eq (nth 3 (car state)) t) - (goto-char (nth 8 (car state))) - (when - (and (eq (char-after) ?\() - (search-backward-regexp - "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)\\=" (- (point) 18) t)) - (setq id (match-string-no-properties 1) - found-beg (match-beginning 0) - found-end (1+ (match-end 0))))) - ;; Possibly terminating an already terminated raw string. - ((eq (nth 3 (car state)) ?\") - (goto-char (nth 8 (car state))) - (when - (and (eq (char-before) ?R) - (looking-at "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(")) - (setq id (match-string-no-properties 1) - found-beg (1- (point)) - found-end (match-end 0))))) - (when id - (goto-char (max (- beg 18) (point-min))) - (when (search-forward (concat ")" id "\"") (+ end 1 (length id)) t) - ;; Has an earlier close delimiter just been inserted into an - ;; already terminated raw string? - (if (and (eq (nth 3 (car state)) ?\") - (search-forward (concat ")" id "\"") nil t)) - (setq found-end (point))) - (setq c-new-BEG (min c-new-BEG found-beg) - c-new-END (max c-new-END found-end)) - (c-clear-char-properties found-beg found-end 'syntax-table) - (c-truncate-semi-nonlit-pos-cache found-beg)))) + ;; Have we just made or modified a closing delimiter? + (goto-char (max (- beg 18) (point-min))) + (while + (and + (setq found + (search-forward-regexp ")\\([^ ()\\\n\r\t]\\{0,16\\}\\)\"" + (+ end 17) t)) + (< (match-end 0) beg))) + (when (and found (<= (match-beginning 0) end)) + (setq id (match-string-no-properties 1)) + (goto-char (match-beginning 0)) + (while + (and + (setq found (search-backward (concat "R\"" id "(") nil t)) + (setq state (c-state-semi-pp-to-literal (point))) + (memq (nth 3 (car state)) '(t ?\")))) + (when found + (setq c-new-BEG (min (point) c-new-BEG) + c-new-END (point-max)) + (c-clear-char-properties (point) c-new-END 'syntax-table) + (c-truncate-semi-nonlit-pos-cache (point))))) ;; Are there any raw strings in a newly created macro? (when (< beg end)