commit 4daca38d5c673c5b6862e10cfade9559852cce12 (HEAD, refs/remotes/origin/master) Author: Tino Calancha Date: Mon Feb 27 16:32:10 2017 +0900 Prevent for consing in cl-mapc and cl-mapl * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many): Add optional arg ACC; If non-nil, accumulate values in the result (Bug#25826). (cl-mapc): Do computations inside function instead of call cl-map. (cl-mapl): Do computations inside function instead of call cl-maplist. * lisp/emacs-lisp/cl-lib.el (mapcar): Add autoload cookie. Call cl--mapcar-many with non-nil 3rd argument. * test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-map) (cl-extra-test-mapc, cl-extra-test-mapcar, cl-extra-test-mapl) (cl-extra-test-maplist): New tests. diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index edd14b816f..8cba913710 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -89,7 +89,7 @@ strings case-insensitively." ;;; Control structures. ;;;###autoload -(defun cl--mapcar-many (cl-func cl-seqs) +(defun cl--mapcar-many (cl-func cl-seqs &optional acc) (if (cdr (cdr cl-seqs)) (let* ((cl-res nil) (cl-n (apply 'min (mapcar 'length cl-seqs))) @@ -106,20 +106,23 @@ strings case-insensitively." (setcar cl-p1 (cdr (car cl-p1)))) (aref (car cl-p1) cl-i))) (setq cl-p1 (cdr cl-p1) cl-p2 (cdr cl-p2))) - (push (apply cl-func cl-args) cl-res) + (if acc + (push (apply cl-func cl-args) cl-res) + (apply cl-func cl-args)) (setq cl-i (1+ cl-i))) - (nreverse cl-res)) + (and acc (nreverse cl-res))) (let ((cl-res nil) (cl-x (car cl-seqs)) (cl-y (nth 1 cl-seqs))) (let ((cl-n (min (length cl-x) (length cl-y))) (cl-i -1)) (while (< (setq cl-i (1+ cl-i)) cl-n) - (push (funcall cl-func - (if (consp cl-x) (pop cl-x) (aref cl-x cl-i)) - (if (consp cl-y) (pop cl-y) (aref cl-y cl-i))) - cl-res))) - (nreverse cl-res)))) + (let ((val (funcall cl-func + (if (consp cl-x) (pop cl-x) (aref cl-x cl-i)) + (if (consp cl-y) (pop cl-y) (aref cl-y cl-i))))) + (when acc + (push val cl-res))))) + (and acc (nreverse cl-res))))) ;;;###autoload (defun cl-map (cl-type cl-func cl-seq &rest cl-rest) @@ -142,7 +145,7 @@ the elements themselves. (while (not (memq nil cl-args)) (push (apply cl-func cl-args) cl-res) (setq cl-p cl-args) - (while cl-p (setcar cl-p (cdr (pop cl-p)) ))) + (while cl-p (setcar cl-p (cdr (pop cl-p))))) (nreverse cl-res)) (let ((cl-res nil)) (while cl-list @@ -155,8 +158,14 @@ the elements themselves. "Like `cl-mapcar', but does not accumulate values returned by the function. \n(fn FUNCTION SEQUENCE...)" (if cl-rest - (progn (apply 'cl-map nil cl-func cl-seq cl-rest) - cl-seq) + (if (or (cdr cl-rest) (nlistp cl-seq) (nlistp (car cl-rest))) + (progn + (cl--mapcar-many cl-func (cons cl-seq cl-rest)) + cl-seq) + (let ((cl-x cl-seq) (cl-y (car cl-rest))) + (while (and cl-x cl-y) + (funcall cl-func (pop cl-x) (pop cl-y))) + cl-seq)) (mapc cl-func cl-seq))) ;;;###autoload @@ -164,7 +173,12 @@ the elements themselves. "Like `cl-maplist', but does not accumulate values returned by the function. \n(fn FUNCTION LIST...)" (if cl-rest - (apply 'cl-maplist cl-func cl-list cl-rest) + (let ((cl-args (cons cl-list (copy-sequence cl-rest))) + cl-p) + (while (not (memq nil cl-args)) + (apply cl-func cl-args) + (setq cl-p cl-args) + (while cl-p (setcar cl-p (cdr (pop cl-p)))))) (let ((cl-p cl-list)) (while cl-p (funcall cl-func cl-p) (setq cl-p (cdr cl-p))))) cl-list) diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 5aa8f1bf65..8c4455a3da 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -347,8 +347,9 @@ Call `cl-float-limits' to set this.") (cl--defalias 'cl-copy-seq 'copy-sequence) -(declare-function cl--mapcar-many "cl-extra" (cl-func cl-seqs)) +(declare-function cl--mapcar-many "cl-extra" (cl-func cl-seqs &optional acc)) +;;;###autoload (defun cl-mapcar (cl-func cl-x &rest cl-rest) "Apply FUNCTION to each element of SEQ, and make a list of the results. If there are several SEQs, FUNCTION is called with that many arguments, @@ -358,7 +359,7 @@ SEQ, this is like `mapcar'. With several, it is like the Common Lisp \n(fn FUNCTION SEQ...)" (if cl-rest (if (or (cdr cl-rest) (nlistp cl-x) (nlistp (car cl-rest))) - (cl--mapcar-many cl-func (cons cl-x cl-rest)) + (cl--mapcar-many cl-func (cons cl-x cl-rest) 'accumulate) (let ((cl-res nil) (cl-y (car cl-rest))) (while (and cl-x cl-y) (push (funcall cl-func (pop cl-x) (pop cl-y)) cl-res)) diff --git a/test/lisp/emacs-lisp/cl-extra-tests.el b/test/lisp/emacs-lisp/cl-extra-tests.el index 3e2388acc6..5b2371e7b9 100644 --- a/test/lisp/emacs-lisp/cl-extra-tests.el +++ b/test/lisp/emacs-lisp/cl-extra-tests.el @@ -35,4 +35,63 @@ (should (eq (cl-getf plist 'y :none) nil)) (should (eq (cl-getf plist 'z :none) :none)))) +(ert-deftest cl-extra-test-mapc () + (let ((lst '(a b c)) + (lst2 '(d e f)) + (lst3 '(1 2 3)) + (fn1 (lambda (_x) nil)) + (fn2 (lambda (_x _y) nil)) + (fn3 (lambda (_x _y _z) nil))) + (should (equal lst (cl-mapc fn1 lst))) + (should (equal lst (cl-mapc fn2 lst lst2))) + (should (equal lst (cl-mapc fn3 lst lst2 lst3))))) + +(ert-deftest cl-extra-test-mapl () + (let ((lst '(a b c)) + (lst2 '(d e f)) + (lst3 '(1 2 3)) + (fn1 (lambda (x) (should (consp x)))) + (fn2 (lambda (x y) (should (and (consp x) (consp y))))) + (fn3 (lambda (x y z) (should (and (consp x) (consp y) (consp z)))))) + (should (equal lst (cl-mapl fn1 lst))) + (should (equal lst (cl-mapl fn2 lst lst2))) + (should (equal lst (cl-mapl fn3 lst lst2 lst3))))) + +(ert-deftest cl-extra-test-mapcar () + (let ((lst '(a b c)) + (lst2 '(d e f)) + (lst3 '(1 2 3)) + (fn1 (lambda (x) x)) + (fn2 (lambda (_x y) y)) + (fn3 (lambda (_x _y z) z))) + (should (equal lst (cl-mapcar fn1 lst))) + (should (equal lst2 (cl-mapcar fn2 lst lst2))) + (should (equal lst3 (cl-mapcar fn3 lst lst2 lst3))))) + +(ert-deftest cl-extra-test-map () + (let ((lst '(a b c)) + (lst2 '(d e f)) + (lst3 '(1 2 3)) + (fn1 (lambda (x) x)) + (fn2 (lambda (_x y) y)) + (fn3 (lambda (x _y _z) (string-to-char (format "%S" x))))) + (should (equal lst (cl-map 'list fn1 lst))) + (should (equal (vconcat lst2) (cl-map 'vector fn2 lst lst2))) + (should (equal (mapconcat (lambda (x) (format "%S" x)) lst "") + (cl-map 'string fn3 lst lst2 lst3))))) + +(ert-deftest cl-extra-test-maplist () + (let ((lst '(a b c)) + (lst2 '(d e f)) + (lst3 '(1 2 3)) + (fn1 (lambda (x) (should (consp x)) x)) + (fn2 (lambda (x y) (should (and (consp x) (consp y))) y)) + (fn3 (lambda (x y z) (should (and (consp x) (consp y) (consp z))) z))) + (should (equal (list lst (cdr lst) (cddr lst)) + (cl-maplist fn1 lst))) + (should (equal (list lst2 (cdr lst2) (cddr lst2)) + (cl-maplist fn2 lst lst2))) + (should (equal (list lst3 (cdr lst3) (cddr lst3)) + (cl-maplist fn3 lst lst2 lst3))))) + ;;; cl-extra-tests.el ends here commit 841e3e377c97142cfe76b9d91467f439198f5e39 Author: Tino Calancha Date: Mon Feb 27 16:26:06 2017 +0900 Choose the right target dir on dired operations Prevent from changing the input target dir when dired-dwim-target is non-nil (Bug#25609). * lisp/dired-aux.el (dired-do-create-files): If dired-dwim-target is non-nil, then bind 'default' to nil. * test/lisp/dired-tests.el (dired-test-bug25609): Add test. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index caa3b45705..d7ca052787 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1791,6 +1791,7 @@ Optional arg HOW-TO determines how to treat the target. (and (consp fn-list) (null (cdr fn-list)) (car fn-list))) (target-dir (dired-dwim-target-directory)) (default (and dired-one-file + (not dired-dwim-target) ; Bug#25609 (expand-file-name (file-name-nondirectory (car fn-list)) target-dir))) (defaults (dired-dwim-target-defaults fn-list target-dir)) diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 489f8fdfea..1863864abd 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -20,6 +20,7 @@ ;;; Code: (require 'ert) (require 'dired) +(require 'nadvice) (ert-deftest dired-autoload () @@ -52,5 +53,36 @@ ;; Clean up (delete-directory dir 'recursive)))) +(ert-deftest dired-test-bug25609 () + "Test for http://debbugs.gnu.org/25609 ." + (let* ((from (make-temp-file "foo" 'dir)) + (to (make-temp-file "bar" 'dir)) + (target (expand-file-name (file-name-nondirectory from) to)) + (nested (expand-file-name (file-name-nondirectory from) target)) + (dired-dwim-target t) + (dired-recursive-copies 'always)) ; Don't prompt me. + (advice-add 'dired-query ; Don't ask confirmation to overwrite a file. + :override + (lambda (sym prompt &rest args) (setq dired-query t)) + '((name . "advice-dired-query"))) + (advice-add 'completing-read ; Just return init. + :override + (lambda (prompt coll &optional pred match init hist def inherit keymap) + init) + '((name . "advice-completing-read"))) + (dired to) + (dired-other-window temporary-file-directory) + (dired-goto-file from) + (dired-do-copy) + (dired-do-copy); Again. + (unwind-protect + (progn + (should (file-exists-p target)) + (should-not (file-exists-p nested))) + (delete-directory from 'recursive) + (delete-directory to 'recursive) + (advice-remove 'dired-query "advice-dired-query") + (advice-remove 'completing-read "advice-completing-read")))) + (provide 'dired-tests) ;; dired-tests.el ends here commit fd8f724147b0a64c15f42dd09d21d8b2f81f6cbc Author: Stefan Monnier Date: Mon Feb 27 00:06:08 2017 -0500 * src/xdisp.c (overlay_arrows_changed_p): Fix last change. diff --git a/src/xdisp.c b/src/xdisp.c index a4c3c70655..4e87001abf 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13358,14 +13358,19 @@ overlay_arrows_changed_p (bool set_redisplay) if (!MARKERP (val)) continue; if (! EQ (COERCE_MARKER (val), + /* FIXME: Don't we have a problem, using such a global + * "last-position" if the variable is buffer-local? */ Fget (var, Qlast_arrow_position)) || ! (pstr = overlay_arrow_string_or_property (var), EQ (pstr, Fget (var, Qlast_arrow_string)))) { struct buffer *buf = XMARKER (val)->buffer; - if (set_redisplay && buf) - bset_redisplay (buf); + if (set_redisplay) + { + if (buf) + bset_redisplay (buf); + } else return true; } commit 46765420620509f17dbd6a90f6829e6e2b26b0c6 Author: Noam Postavsky Date: Wed Feb 22 21:48:29 2017 -0500 Don't record eshell/clear "command" in history (Bug#25838) `eshell/clear' is implemented by sending a series of blank lines, which is not a useful thing to have in the history. * lisp/eshell/em-hist.el (eshell-input-filter-default): Use `string-blank-p' which does check for newlines (even though newlines have comment-end syntax, not whitespace syntax class). * lisp/eshell/esh-mode.el (eshell/clear): Remove `eshell-add-to-history' from `eshell-input-filter-functions' while sending the blank lines. This change is needed to solve the bug if the user customizes `eshell-input-filter' to something that doesn't filter newlines. diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 99158c7686..5c6e629120 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -55,6 +55,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'subr-x)) ; `string-blank-p' (require 'ring) (require 'esh-opt) @@ -208,7 +209,7 @@ element, regardless of any text on the command line. In that case, (defun eshell-input-filter-default (input) "Do not add blank input to input history. Returns non-nil if INPUT is blank." - (not (string-match "\\`\\s-*\\'" input))) + (not (string-blank-p input))) (defun eshell-input-filter-initial-space (input) "Do not add input beginning with empty space to history. diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index b1195c9e1d..0fd0c18301 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -882,8 +882,10 @@ If SCROLLBACK is non-nil, clear the scrollback contents." (interactive) (if scrollback (eshell/clear-scrollback) - (insert (make-string (window-size) ?\n)) - (eshell-send-input))) + (let ((eshell-input-filter-functions + (remq 'eshell-add-to-history eshell-input-filter-functions))) + (insert (make-string (window-size) ?\n)) + (eshell-send-input)))) (defun eshell/clear-scrollback () "Clear the scrollback content of the eshell window." commit d83c75ec19b549a1700622157d0ee292ca59785e Author: Paul Eggert Date: Sun Feb 26 09:56:44 2017 -0800 Remove a few unused C functions * src/eval.c (let_shadows_global_binding_p): * src/print.c (write_string): * src/systhread.c (sys_mutex_destroy, sys_thread_equal): Remove. * src/print.c (write_string): Rename from write_string_1. All uses changed. diff --git a/src/eval.c b/src/eval.c index 22b02b4952..9b36ee04ed 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3213,18 +3213,6 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol) return 0; } -bool -let_shadows_global_binding_p (Lisp_Object symbol) -{ - union specbinding *p; - - for (p = specpdl_ptr; p > specpdl; ) - if ((--p)->kind >= SPECPDL_LET && EQ (specpdl_symbol (p), symbol)) - return 1; - - return 0; -} - static void do_specbind (struct Lisp_Symbol *sym, union specbinding *bind, Lisp_Object value, enum Set_Internal_Bind bindflag) diff --git a/src/lisp.h b/src/lisp.h index e048011a86..238c20bc18 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3707,7 +3707,6 @@ extern Lisp_Object Vprin1_to_string_buffer; extern void debug_print (Lisp_Object) EXTERNALLY_VISIBLE; extern void temp_output_buffer_setup (const char *); extern int print_level; -extern void write_string (const char *); extern void print_error_message (Lisp_Object, Lisp_Object, const char *, Lisp_Object); extern Lisp_Object internal_with_output_to_temp_buffer @@ -3848,7 +3847,6 @@ extern void mark_specpdl (union specbinding *first, union specbinding *ptr); extern void get_backtrace (Lisp_Object array); Lisp_Object backtrace_top_function (void); extern bool let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol); -extern bool let_shadows_global_binding_p (Lisp_Object symbol); #ifdef HAVE_MODULES /* Defined in alloc.c. */ diff --git a/src/print.c b/src/print.c index d8acf83874..85a6c4627e 100644 --- a/src/print.c +++ b/src/print.c @@ -522,23 +522,13 @@ print_c_string (char const *string, Lisp_Object printcharfun) Do not use this on the contents of a Lisp string. */ static void -write_string_1 (const char *data, Lisp_Object printcharfun) +write_string (const char *data, Lisp_Object printcharfun) { PRINTPREPARE; print_c_string (data, printcharfun); PRINTFINISH; } -/* Used from outside of print.c to print a C unibyte - string at DATA on the default output stream. - Do not use this on the contents of a Lisp string. */ - -void -write_string (const char *data) -{ - write_string_1 (data, Vstandard_output); -} - void temp_output_buffer_setup (const char *bufname) @@ -888,7 +878,7 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, Lisp_Object errname, errmsg, file_error, tail; if (context != 0) - write_string_1 (context, stream); + write_string (context, stream); /* If we know from where the error was signaled, show it in *Messages*. */ @@ -934,7 +924,7 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, const char *sep = ": "; if (!STRINGP (errmsg)) - write_string_1 ("peculiar error", stream); + write_string ("peculiar error", stream); else if (SCHARS (errmsg)) Fprinc (errmsg, stream); else @@ -945,7 +935,7 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, Lisp_Object obj; if (sep) - write_string_1 (sep, stream); + write_string (sep, stream); obj = XCAR (tail); if (!NILP (file_error) || EQ (errname, Qend_of_file) || EQ (errname, Quser_error)) diff --git a/src/systhread.c b/src/systhread.c index a1b3eae64a..a84060c18f 100644 --- a/src/systhread.c +++ b/src/systhread.c @@ -39,11 +39,6 @@ sys_mutex_unlock (sys_mutex_t *m) } void -sys_mutex_destroy (sys_mutex_t *m) -{ -} - -void sys_cond_init (sys_cond_t *c) { *c = 0; @@ -76,12 +71,6 @@ sys_thread_self (void) } int -sys_thread_equal (sys_thread_t x, sys_thread_t y) -{ - return x == y; -} - -int sys_thread_create (sys_thread_t *t, const char *name, thread_creation_function *func, void *datum) { @@ -120,12 +109,6 @@ sys_mutex_unlock (sys_mutex_t *mutex) } void -sys_mutex_destroy (sys_mutex_t *mutex) -{ - pthread_mutex_destroy (mutex); -} - -void sys_cond_init (sys_cond_t *cond) { pthread_cond_init (cond, NULL); @@ -162,12 +145,6 @@ sys_thread_self (void) } int -sys_thread_equal (sys_thread_t one, sys_thread_t two) -{ - return pthread_equal (one, two); -} - -int sys_thread_create (sys_thread_t *thread_ptr, const char *name, thread_creation_function *func, void *arg) { @@ -230,17 +207,6 @@ sys_mutex_unlock (sys_mutex_t *mutex) } void -sys_mutex_destroy (sys_mutex_t *mutex) -{ - /* FIXME: According to MSDN, deleting a critical session that is - owned by a thread leaves the other threads waiting for the - critical session in an undefined state. Posix docs seem to say - the same about pthread_mutex_destroy. Do we need to protect - against such calamities? */ - DeleteCriticalSection ((LPCRITICAL_SECTION)mutex); -} - -void sys_cond_init (sys_cond_t *cond) { cond->initialized = false; @@ -346,12 +312,6 @@ sys_thread_self (void) return (sys_thread_t) GetCurrentThreadId (); } -int -sys_thread_equal (sys_thread_t one, sys_thread_t two) -{ - return one == two; -} - static thread_creation_function *thread_start_address; /* _beginthread wants a void function, while we are passed a function diff --git a/src/systhread.h b/src/systhread.h index c007d3ceb5..c7999c0651 100644 --- a/src/systhread.h +++ b/src/systhread.h @@ -92,7 +92,6 @@ typedef void *(thread_creation_function) (void *); extern void sys_mutex_init (sys_mutex_t *); extern void sys_mutex_lock (sys_mutex_t *); extern void sys_mutex_unlock (sys_mutex_t *); -extern void sys_mutex_destroy (sys_mutex_t *); extern void sys_cond_init (sys_cond_t *); extern void sys_cond_wait (sys_cond_t *, sys_mutex_t *); @@ -101,7 +100,6 @@ extern void sys_cond_broadcast (sys_cond_t *); extern void sys_cond_destroy (sys_cond_t *); extern sys_thread_t sys_thread_self (void); -extern int sys_thread_equal (sys_thread_t, sys_thread_t); extern int sys_thread_create (sys_thread_t *, const char *, thread_creation_function *, commit d8899b9d1baf517b30ec4752d1458e2a06000646 Author: Eli Zaretskii Date: Sun Feb 26 19:52:22 2017 +0200 Avoid segfault in overlay_arrows_changed_p * src/xdisp.c (overlay_arrows_changed_p): Fix recent change to avoid a segfault. diff --git a/src/xdisp.c b/src/xdisp.c index cec649f590..a4c3c70655 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13362,8 +13362,10 @@ overlay_arrows_changed_p (bool set_redisplay) || ! (pstr = overlay_arrow_string_or_property (var), EQ (pstr, Fget (var, Qlast_arrow_string)))) { - if (set_redisplay) - bset_redisplay (XMARKER (val)->buffer); + struct buffer *buf = XMARKER (val)->buffer; + + if (set_redisplay && buf) + bset_redisplay (buf); else return true; } commit 6b6cc56e728a4d8b5ccac86ac393be7cd29207e2 Author: Noam Postavsky Date: Wed Feb 22 21:12:41 2017 -0500 Don't call package--ensure-init-file if initialized during startup * lisp/emacs-lisp/package.el (package-initialize): Check `after-init-time' rather than `load-file-name' to decide if `package--ensure-init-file' should be called. Depending on `load-file-name' will fail if the user calls `pacakge-initialize' in file which is loaded from the init file (Bug#24643, Bug#25819). diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6728f1b80b..8d5fac96cf 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1445,13 +1445,13 @@ individual packages after calling `package-initialize' -- this is taken care of by `package-initialize'." (interactive) (setq package-alist nil) - (if (equal user-init-file load-file-name) - ;; If `package-initialize' is being called as part of loading - ;; the init file, it's obvious we don't need to ensure-init. - (setq package--init-file-ensured t - ;; And likely we don't need to run it again after init. - package-enable-at-startup nil) - (package--ensure-init-file)) + (if after-init-time + (package--ensure-init-file) + ;; If `package-initialize' is before we finished loading the init + ;; file, it's obvious we don't need to ensure-init. + (setq package--init-file-ensured t + ;; And likely we don't need to run it again after init. + package-enable-at-startup nil)) (package-load-all-descriptors) (package-read-all-archive-contents) (unless no-activate commit 2bb467a2e2fc70d387ca9a174d5d3a1417a13008 Author: Eli Zaretskii Date: Sun Feb 26 17:56:13 2017 +0200 Fix display of before- and after-strings at invisible text * src/xdisp.c (next_overlay_string): Don't raise the ignore_overlay_strings_at_pos_p flag if the iterator is already set to continue at a buffer position different from the one where the overlay strings we just processed were loaded. (Bug#25856) diff --git a/src/xdisp.c b/src/xdisp.c index 91eef0ec47..cec649f590 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5557,9 +5557,14 @@ next_overlay_string (struct it *it) /* Since we've exhausted overlay strings at this buffer position, set the flag to ignore overlays until we move to - another position. The flag is reset in - next_element_from_buffer. */ - it->ignore_overlay_strings_at_pos_p = true; + another position. (The flag will be reset in + next_element_from_buffer.) But don't do that if the overlay + strings were loaded at position other than the current one, + which could happen if we called pop_it above, or if the + overlay strings were loaded by handle_invisible_prop at the + beginning of invisible text. */ + if (it->overlay_strings_charpos == IT_CHARPOS (*it)) + it->ignore_overlay_strings_at_pos_p = true; /* If we're at the end of the buffer, record that we have processed the overlay strings there already, so that commit 618310c22d8e26a1654e796b47cc2d248650de0d Author: Michael Albinus Date: Sun Feb 26 12:45:06 2017 +0100 Work on `tramp-completion-mode-p' * etc/NEWS: Say that `tramp-completion-mode' is obsolete. * lisp/net/tramp.el (tramp-completion-mode): Make it obsolete. (tramp-completion-mode-p): Reintroduce the check for 'tab. diff --git a/etc/NEWS b/etc/NEWS index 05f380fe19..31b7e4789e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -642,6 +642,9 @@ manual documents how to configure ssh and PuTTY accordingly. initialization files. --- +*** Variable 'tramp-completion-mode' is obsoleted. + +--- ** 'auto-revert-use-notify' is set back to t in 'global-auto-revert-mode'. --- diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 891f961245..406cd02b52 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2268,25 +2268,28 @@ This is necessary, because Tramp uses a heuristic depending on last input event. This fails when external packages use other characters but , or ?\\? for file name completion. This variable should never be set globally, the intention is to let-bind it.") +(make-obsolete-variable 'tramp-completion-mode 'non-essential "26.1") ;; Necessary because `tramp-file-name-regexp-unified' and ;; `tramp-completion-file-name-regexp-unified' aren't different. If -;; nil, `tramp-completion-run-real-handler' is called (i.e. forwarding -;; to `tramp-file-name-handler'). Otherwise, it takes -;; `tramp-run-real-handler'. Using `last-input-event' is a little bit -;; risky, because completing a file might require loading other files, -;; like "~/.netrc", and for them it shouldn't be decided based on that -;; variable. On the other hand, those files shouldn't have partial -;; Tramp file name syntax. Maybe another variable should be introduced -;; overwriting this check in such cases. Or we change Tramp file name -;; syntax in order to avoid ambiguities. +;; nil is returned, `tramp-completion-run-real-handler' is called +;; (i.e. forwarding to `tramp-file-name-handler'). Otherwise, it +;; takes `tramp-run-real-handler'. Using `last-input-event' is a +;; little bit risky, because completing a file might require loading +;; other files, like "~/.netrc", and for them it shouldn't be decided +;; based on that variable. On the other hand, those files shouldn't +;; have partial Tramp file name syntax. ;;;###autoload (progn (defun tramp-completion-mode-p () "Check, whether method / user name / host name completion is active." (or ;; Signal from outside. `non-essential' has been introduced in Emacs 24. (and (boundp 'non-essential) (symbol-value 'non-essential)) - tramp-completion-mode))) + ;; This variable has been obsoleted in Emacs 26. + tramp-completion-mode + ;; Fallback. Some completion packages still don't support + ;; `non-essential' sufficiently. + (equal last-input-event 'tab)))) (defun tramp-connectable-p (filename) "Check, whether it is possible to connect the remote host w/o side-effects.