From beb0b7f93c2fbeb2fae08d7302686febccb3d582 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 25 Jul 2009 08:50:51 +0000 Subject: [PATCH] (syms_of_lread) : New variable. (Fload): Use it to force load messages, even if NOMESSAGES is non-nil. --- src/ChangeLog | 6 ++++++ src/lread.c | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 27df9aa1af..f9f1e33538 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-07-25 Eli Zaretskii + + * lread.c (syms_of_lread) : New variable. + (Fload): Use it to force load messages, even if NOMESSAGES is + non-nil. + 2009-07-25 Ken Raeburn * coding.h (decode_coding_string, encode_coding_string): Use diff --git a/src/lread.c b/src/lread.c index 8741bff628..0fb93031ad 100644 --- a/src/lread.c +++ b/src/lread.c @@ -214,6 +214,10 @@ static Lisp_Object Vloads_in_progress; int load_dangerous_libraries; +/* Non-zero means force printing messages when loading Lisp files. */ + +int force_load_messages; + /* A regular expression used to detect files compiled with Emacs. */ static Lisp_Object Vbytecomp_version_regexp; @@ -970,7 +974,8 @@ This function searches the directories in `load-path'. If optional second arg NOERROR is non-nil, report no error if FILE doesn't exist. Print messages at start and end of loading unless -optional third arg NOMESSAGE is non-nil. +optional third arg NOMESSAGE is non-nil (but `force-load-messages' +overrides that). If optional fourth arg NOSUFFIX is non-nil, don't try adding suffixes `.elc' or `.el' to the specified name FILE. If optional fifth arg MUST-SUFFIX is non-nil, insist on @@ -1164,7 +1169,7 @@ Return t if the file exists and loads successfully. */) error ("File `%s' was not compiled in Emacs", SDATA (found)); } - else if (!NILP (nomessage)) + else if (!NILP (nomessage) && !force_load_messages) message_with_string ("File `%s' not compiled in Emacs", found, 1); } @@ -1186,7 +1191,7 @@ Return t if the file exists and loads successfully. */) newer = 1; /* If we won't print another message, mention this anyway. */ - if (!NILP (nomessage)) + if (!NILP (nomessage) && !force_load_messages) { Lisp_Object msg_file; msg_file = Fsubstring (found, make_number (0), make_number (-1)); @@ -1208,7 +1213,7 @@ Return t if the file exists and loads successfully. */) emacs_close (fd); val = call4 (Vload_source_file_function, found, hist_file_name, NILP (noerror) ? Qnil : Qt, - NILP (nomessage) ? Qnil : Qt); + (NILP (nomessage) || force_load_messages) ? Qnil : Qt); return unbind_to (count, val); } } @@ -1231,7 +1236,7 @@ Return t if the file exists and loads successfully. */) if (! NILP (Vpurify_flag)) Vpreloaded_file_list = Fcons (file, Vpreloaded_file_list); - if (NILP (nomessage)) + if (NILP (nomessage) || force_load_messages) { if (!safe_p) message_with_string ("Loading %s (compiled; note unsafe, not compiled in Emacs)...", @@ -1280,7 +1285,7 @@ Return t if the file exists and loads successfully. */) prev_saved_doc_string = 0; prev_saved_doc_string_size = 0; - if (!noninteractive && NILP (nomessage)) + if (!noninteractive && (NILP (nomessage) || force_load_messages)) { if (!safe_p) message_with_string ("Loading %s (compiled; note unsafe, not compiled in Emacs)...done", @@ -4354,6 +4359,11 @@ incompatible byte codes can make Emacs crash when it tries to execute them. */); load_dangerous_libraries = 0; + DEFVAR_BOOL ("force-load-messages", &force_load_messages, + doc: /* Non-nil means force printing messages when loading Lisp files. +This overrides the value of the NOMESSAGE argument to `load'. */); + force_load_messages = 0; + DEFVAR_LISP ("bytecomp-version-regexp", &Vbytecomp_version_regexp, doc: /* Regular expression matching safe to load compiled Lisp files. When Emacs loads a compiled Lisp file, it reads the first 512 bytes -- 2.20.1