From b20759f920f9a64a9a03f510f1ab785426d64af3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 13 Jul 2014 17:49:59 +0300 Subject: [PATCH] Fix bug #17986 with infloop in redisplay when default-directory is nil. src/xdisp.c (decode_mode_spec): Call file-remote-p on the current buffer's default-directory only if it is a string. lisp/bindings.el (mode-line-remote): If default-directory is not a string, don't call file-remote-p on it; instead state in the help-echo that it is nil. --- lisp/ChangeLog | 6 ++++++ lisp/bindings.el | 12 +++++++----- src/ChangeLog | 5 +++++ src/xdisp.c | 8 ++++++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e77058569d2..5f4c02c0670 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-07-13 Eli Zaretskii + + * bindings.el (mode-line-remote): If default-directory is not a + string, don't call file-remote-p on it; instead state in the + help-echo that it is nil. (Bug#17986) + 2014-07-12 Paul Eggert Fix bug: C-x v v discarded existing log message (Bug#17884). diff --git a/lisp/bindings.el b/lisp/bindings.el index 59aa3dfb3d3..911ab63e8d0 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -229,11 +229,13 @@ mnemonics of the following coding systems: 'help-echo (purecopy (lambda (window _object _point) (format "%s" (with-selected-window window - (concat - (if (file-remote-p default-directory) - "Current directory is remote: " - "Current directory is local: ") - default-directory))))))) + (if (stringp default-directory) + (concat + (if (file-remote-p default-directory) + "Current directory is remote: " + "Current directory is local: ") + default-directory) + "Current directory is nil"))))))) "Mode line construct to indicate a remote buffer.") ;;;###autoload (put 'mode-line-remote 'risky-local-variable t) diff --git a/src/ChangeLog b/src/ChangeLog index 9051d37fcef..ca31b10fb6a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-07-13 Eli Zaretskii + + * xdisp.c (decode_mode_spec): Call file-remote-p on the current + buffer's default-directory only if it is a string. (Bug#17986) + 2014-07-12 Eli Zaretskii * xdisp.c (display_line): Don't call FETCH_BYTE with argument less diff --git a/src/xdisp.c b/src/xdisp.c index 6918c4360d4..2f0683294fa 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22907,8 +22907,12 @@ decode_mode_spec (struct window *w, register int c, int field_width, case '@': { ptrdiff_t count = inhibit_garbage_collection (); - Lisp_Object val = call1 (intern ("file-remote-p"), - BVAR (current_buffer, directory)); + Lisp_Object curdir = BVAR (current_buffer, directory); + Lisp_Object val = Qnil; + + if (STRINGP (curdir)) + val = call1 (intern ("file-remote-p"), curdir); + unbind_to (count, Qnil); if (NILP (val)) -- 2.39.5