commit 7407f89fe71c87be45f35cf3d4f8bc0550cf8384 (HEAD, refs/remotes/origin/master) Author: João Távora Date: Thu Dec 13 00:09:01 2018 +0000 Allow per-diagnostic overlay properties in Flymake * lisp/progmodes/flymake.el (Version): Bump to 1.0.3. (flymake--diag): Add new field overlay-properties. (flymake-make-diagnostic): New optional arg overlay-properties. (flymake--highlight-line): Use it. diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index ad8f50cd7a..7b100da42b 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -4,7 +4,7 @@ ;; Author: Pavel Kobyakov ;; Maintainer: João Távora -;; Version: 1.0.2 +;; Version: 1.0.3 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: c languages tools @@ -293,7 +293,7 @@ generated it." (cl-defstruct (flymake--diag (:constructor flymake--diag-make)) - buffer beg end type text backend data overlay) + buffer beg end type text backend data overlay-properties overlay) ;;;###autoload (defun flymake-make-diagnostic (buffer @@ -301,13 +301,20 @@ generated it." end type text - &optional data) + &optional data + overlay-properties) "Make a Flymake diagnostic for BUFFER's region from BEG to END. TYPE is a key to symbol and TEXT is a description of the problem detected in this region. DATA is any object that the caller -wishes to attach to the created diagnostic for later retrieval." +wishes to attach to the created diagnostic for later retrieval. + +OVERLAY-PROPERTIES is an an alist of properties attached to the +created diagnostic, overriding the default properties and any +properties of `flymake-overlay-control' of the diagnostic's +type." (flymake--diag-make :buffer buffer :beg beg :end end - :type type :text text :data data)) + :type type :text text :data data + :overlay-properties overlay-properties)) ;;;###autoload (defun flymake-diagnostics (&optional beg end) @@ -600,7 +607,9 @@ associated `flymake-category' return DEFAULT." ;; properties. (cl-loop for (ov-prop . value) in - (append (reverse ; ensure ealier props override later ones + (append (reverse + (flymake--diag-overlay-properties diagnostic)) + (reverse ; ensure ealier props override later ones (flymake--lookup-type-property type 'flymake-overlay-control)) (alist-get type flymake-diagnostic-types-alist)) do (overlay-put ov ov-prop value)) commit fcccd52ab086f94fe56900cf15fbdc0ea11b428b Author: Juri Linkov Date: Thu Dec 13 01:17:05 2018 +0200 * lisp/vc/vc.el (vc-find-revision-no-save): Use decode-coding-inserted-region and after-insert-file-set-coding. Don't let-bind coding-system-for-read and coding-system-for-write. For non-interactive use, let-bind enable-local-variables to :safe and ignore errors from set-auto-mode call. (Bug#33567) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 5ff9f4d5be..48b7c98dfa 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2033,20 +2033,25 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file." (with-current-buffer filebuf (let ((failed t)) (unwind-protect - (let ((coding-system-for-read 'no-conversion) - (coding-system-for-write 'no-conversion)) - (with-current-buffer (or buffer (create-file-buffer filename)) - (unless buffer (setq buffer-file-name filename)) - (let ((outbuf (current-buffer))) - (with-current-buffer filebuf - (if backend - (vc-call-backend backend 'find-revision file revision outbuf) - (vc-call find-revision file revision outbuf)))) - (goto-char (point-min)) - (if buffer (let ((buffer-file-name file)) (normal-mode)) (normal-mode)) - (set-buffer-modified-p nil) - (setq buffer-read-only t)) - (setq failed nil)) + (with-current-buffer (or buffer (create-file-buffer filename)) + (unless buffer (setq buffer-file-name filename)) + (let ((outbuf (current-buffer))) + (with-current-buffer filebuf + (if backend + (vc-call-backend backend 'find-revision file revision outbuf) + (vc-call find-revision file revision outbuf)))) + (decode-coding-inserted-region (point-min) (point-max) file) + (after-insert-file-set-coding (- (point-max) (point-min))) + (goto-char (point-min)) + (if buffer + ;; For non-interactive, skip any questions + (let ((enable-local-variables :safe) ;; to find `mode:' + (buffer-file-name file)) + (ignore-errors (set-auto-mode))) + (normal-mode)) + (set-buffer-modified-p nil) + (setq buffer-read-only t)) + (setq failed nil) (when (and failed (unless buffer (get-file-buffer filename))) (with-current-buffer (get-file-buffer filename) (set-buffer-modified-p nil)) commit f318300959c1a72fd1f97fddfd71a22ea53e8226 Author: Glenn Morris Date: Wed Dec 12 17:01:06 2018 -0500 Improve em-ls-test-bug27844 * test/lisp/eshell/em-ls-tests.el (em-ls-test-bug27844): Skip if source-directory absent. diff --git a/test/lisp/eshell/em-ls-tests.el b/test/lisp/eshell/em-ls-tests.el index c5c9eac324..ea9dbff48f 100644 --- a/test/lisp/eshell/em-ls-tests.el +++ b/test/lisp/eshell/em-ls-tests.el @@ -78,6 +78,11 @@ (ert-deftest em-ls-test-bug27844 () "Test for https://debbugs.gnu.org/27844 ." + ;; FIXME: it would be better to use something other than source-directory + ;; in this test. + (skip-unless (and source-directory + (file-exists-p + (expand-file-name "lisp/subr.el" source-directory)))) (let ((orig eshell-ls-use-in-dired) (dired-use-ls-dired 'unspecified) buf insert-directory-program) commit 8a247f6059066636fbb60e79f6a9580ee9a81495 Author: Paul Eggert Date: Wed Dec 12 09:54:42 2018 -0800 Simplify validate_interval_range and callers * src/textprop.c (validate_interval_range): Remove useless code. Fix comment to match current behavior. (set_text_properties, copy_text_properties): Simplify, as validate_interval_range has not incremented START or END for quite some time. (copy_text_properties): Assume C99. Fix an unlikely integer overflow bug if WIDE_EMACS_INT. diff --git a/src/textprop.c b/src/textprop.c index add14eb4a7..8a06f0ffad 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -111,9 +111,6 @@ CHECK_STRING_OR_BUFFER (Lisp_Object x) to by BEGIN and END may be integers or markers; if the latter, they are coerced to integers. - When OBJECT is a string, we increment *BEGIN and *END - to make them origin-one. - Note that buffer points don't correspond to interval indices. For example, point-max is 1 greater than the index of the last character. This difference is handled in the caller, which uses @@ -175,9 +172,6 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, if (! (0 <= XFIXNUM (*begin) && XFIXNUM (*begin) <= XFIXNUM (*end) && XFIXNUM (*end) <= len)) args_out_of_range (*begin, *end); - XSETFASTINT (*begin, XFIXNAT (*begin)); - if (begin != end) - XSETFASTINT (*end, XFIXNAT (*end)); i = string_intervals (object); if (len == 0) @@ -1348,13 +1342,9 @@ Lisp_Object set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object, Lisp_Object coherent_change_p) { - register INTERVAL i; - Lisp_Object ostart, oend; + INTERVAL i; bool first_time = true; - ostart = start; - oend = end; - properties = validate_plist (properties); if (NILP (object)) @@ -1382,11 +1372,6 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, if (NILP (properties)) return Qnil; - /* Restore the original START and END values - because validate_interval_range increments them for strings. */ - start = ostart; - end = oend; - i = validate_interval_range (object, &start, &end, hard); /* This can return if start == end. */ if (!i) @@ -1887,45 +1872,30 @@ Lisp_Object copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_Object pos, Lisp_Object dest, Lisp_Object prop) { - INTERVAL i; - Lisp_Object res; - Lisp_Object stuff; - Lisp_Object plist; - ptrdiff_t s, e, e2, p, len; - bool modified = false; - - i = validate_interval_range (src, &start, &end, soft); + INTERVAL i = validate_interval_range (src, &start, &end, soft); if (!i) return Qnil; CHECK_FIXNUM_COERCE_MARKER (pos); - { - Lisp_Object dest_start, dest_end; - - e = XFIXNUM (pos) + (XFIXNUM (end) - XFIXNUM (start)); - if (MOST_POSITIVE_FIXNUM < e) - args_out_of_range (pos, end); - dest_start = pos; - XSETFASTINT (dest_end, e); - /* Apply this to a copy of pos; it will try to increment its arguments, - which we don't want. */ - validate_interval_range (dest, &dest_start, &dest_end, soft); - } - s = XFIXNUM (start); - e = XFIXNUM (end); - p = XFIXNUM (pos); + EMACS_INT dest_e = XFIXNUM (pos) + (XFIXNUM (end) - XFIXNUM (start)); + if (MOST_POSITIVE_FIXNUM < dest_e) + args_out_of_range (pos, end); + Lisp_Object dest_end = make_fixnum (dest_e); + validate_interval_range (dest, &pos, &dest_end, soft); - stuff = Qnil; + ptrdiff_t s = XFIXNUM (start), e = XFIXNUM (end), p = XFIXNUM (pos); + + Lisp_Object stuff = Qnil; while (s < e) { - e2 = i->position + LENGTH (i); + ptrdiff_t e2 = i->position + LENGTH (i); if (e2 > e) e2 = e; - len = e2 - s; + ptrdiff_t len = e2 - s; - plist = i->plist; + Lisp_Object plist = i->plist; if (! NILP (prop)) while (! NILP (plist)) { @@ -1950,9 +1920,11 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, s = i->position; } + bool modified = false; + while (! NILP (stuff)) { - res = Fcar (stuff); + Lisp_Object res = Fcar (stuff); res = Fadd_text_properties (Fcar (res), Fcar (Fcdr (res)), Fcar (Fcdr (Fcdr (res))), dest); if (! NILP (res)) commit 23e9e8abaab6f0c90412fc5fae08e5995a26d84c Author: Paul Eggert Date: Wed Dec 12 09:54:42 2018 -0800 set_text_properties_1 can assume START <= END * src/textprop.c (set_text_properties_1): Do not swap START and END. All callers do that already, and the test for swapping here is redundant. diff --git a/src/textprop.c b/src/textprop.c index 8e8baf43d9..add14eb4a7 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1421,34 +1421,25 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, /* Replace properties of text from START to END with new list of properties PROPERTIES. OBJECT is the buffer or string containing the text. This does not obey any hooks. - You should provide the interval that START is located in as I. - START and END can be in any order. */ + I is the interval that START is located in. */ void -set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object, INTERVAL i) +set_text_properties_1 (Lisp_Object start, Lisp_Object end, + Lisp_Object properties, Lisp_Object object, INTERVAL i) { - register INTERVAL prev_changed = NULL; - register ptrdiff_t s, len; - INTERVAL unchanged; + INTERVAL prev_changed = NULL; + ptrdiff_t s = XFIXNUM (start); + ptrdiff_t len = XFIXNUM (end) - s; - if (XFIXNUM (start) < XFIXNUM (end)) - { - s = XFIXNUM (start); - len = XFIXNUM (end) - s; - } - else if (XFIXNUM (end) < XFIXNUM (start)) - { - s = XFIXNUM (end); - len = XFIXNUM (start) - s; - } - else + if (len == 0) return; + eassert (0 < len); eassert (i); if (i->position != s) { - unchanged = i; + INTERVAL unchanged = i; i = split_interval_right (unchanged, s - unchanged->position); if (LENGTH (i) > len) commit 6e76e11c4200a4d4185e0b7d6cea5164d459737b Author: Eli Zaretskii Date: Wed Dec 12 18:27:05 2018 +0200 Fix regression in expand-file-name with drive-relative HOME * src/fileio.c (get_homedir) [DOS_NT]: Expand drive-relative $HOME to begin with "X:/". * test/src/fileio-tests.el (fileio-tests--relative-HOME): Add testing of drive-relative value of $HOME on MS-Windows and MS-DOS. diff --git a/src/fileio.c b/src/fileio.c index d9795715f9..687f6ec745 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1692,6 +1692,34 @@ get_homedir (void) if (!home) return ""; } +#ifdef DOS_NT + /* If home is a drive-relative directory, expand it. */ + if (IS_DRIVE (*home) + && IS_DEVICE_SEP (home[1]) + && !IS_DIRECTORY_SEP (home[2])) + { +# ifdef WINDOWSNT + static char hdir[MAX_UTF8_PATH]; +# else + static char hdir[MAXPATHLEN]; +# endif + if (!getdefdir (c_toupper (*home) - 'A' + 1, hdir)) + { + hdir[0] = c_toupper (*home); + hdir[1] = ':'; + hdir[2] = '/'; + hdir[3] = '\0'; + } + if (home[2]) + { + size_t homelen = strlen (hdir); + if (!IS_DIRECTORY_SEP (hdir[homelen - 1])) + strcat (hdir, "/"); + strcat (hdir, home + 2); + } + home = hdir; + } +#endif if (IS_ABSOLUTE_FILE_NAME (home)) return home; if (!emacs_wd) diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index b7b78bbda0..a74bcea41f 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -102,4 +102,8 @@ Also check that an encoding error can appear in a symlink." (setenv "HOME" "a/b/c") (should (equal (expand-file-name "~/foo") (expand-file-name "a/b/c/foo"))) + (when (memq system-type '(ms-dos windows-nt)) + ;; Test expansion of drive-relative file names. + (setenv "HOME" "x:foo") + (should (equal (expand-file-name "~/bar") "x:/foo/bar"))) (setenv "HOME" old-home))) commit 8c28ac8023cee235885ab0f44b73dbfef6f0a10d Author: Michael Albinus Date: Wed Dec 12 10:49:59 2018 +0100 Fix Bug#33568 * test/lisp/net/secrets-tests.el (secrets-test02-collections) (secrets-test03-items): Do not expect "login" collection to exist. (Bug#33568) diff --git a/test/lisp/net/secrets-tests.el b/test/lisp/net/secrets-tests.el index de3ce731be..d34b002195 100644 --- a/test/lisp/net/secrets-tests.el +++ b/test/lisp/net/secrets-tests.el @@ -90,10 +90,6 @@ (unwind-protect (progn (should (secrets-open-session)) - - ;; There must be at least the collections "Login" and "session". - (should (or (member "Login" (secrets-list-collections)) - (member "login" (secrets-list-collections)))) (should (member "session" (secrets-list-collections))) ;; Create a random collection. This asks for a password @@ -160,9 +156,6 @@ ;; There shall be no items in the "session" collection. (should-not (secrets-list-items "session")) - ;; There shall be items in the "Login" collection. - (should (or (secrets-list-items "Login") - (secrets-list-items "login"))) ;; Create a new item. (should (setq item-path (secrets-create-item "session" "foo" "secret")))