summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-09-30 20:28:16 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2014-09-30 20:28:16 -0700
commit27900ac72a8959291062eda9ef5eda9fc3f8595f (patch)
tree780e22aa62de9c01e3faf00e5c123b1dfb87ddd3 /src
parentcebe0e68947ec46b44f5c3c9868814f8a5464173 (diff)
downloademacs-27900ac72a8959291062eda9ef5eda9fc3f8595f.tar.gz
Use AUTO_CONS instead of SCOPED_CONS, etc.
* doc/lispref/internals.texi (Stack-allocated Objects): Adjust to match the revised, less error-prone macros. * src/frame.h (AUTO_FRAME_ARG): Rename from FRAME_PARAMETER. * src/lisp.h (AUTO_CONS): Rename from scoped_cons. (AUTO_LIST1): Rename from scoped_list1. (AUTO_LIST2): Rename from scoped_list2. (AUTO_LIST3): Rename from scoped_list3. (AUTO_LIST4): Rename from scoped_list4. (AUTO_STRING): Rename from SCOPED_STRING. * src/frame.h (AUTO_FRAME_ARG): * src/lisp.h (AUTO_CONS, AUTO_LIST1, AUTO_LIST2, AUTO_LIST3) (AUTO_LIST4, AUTO_STRING): Prepend a new argument 'name'. Declare a variable instead of yielding a value. All uses changed. * src/lisp.h (STACK_CONS, AUTO_CONS_EXPR): New internal macros.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog16
-rw-r--r--src/buffer.c22
-rw-r--r--src/charset.c10
-rw-r--r--src/chartab.c4
-rw-r--r--src/data.c21
-rw-r--r--src/dispnew.c15
-rw-r--r--src/doc.c5
-rw-r--r--src/editfns.c3
-rw-r--r--src/emacs.c10
-rw-r--r--src/fileio.c9
-rw-r--r--src/fns.c4
-rw-r--r--src/font.c32
-rw-r--r--src/fontset.c10
-rw-r--r--src/frame.c9
-rw-r--r--src/frame.h4
-rw-r--r--src/keyboard.c35
-rw-r--r--src/keymap.c21
-rw-r--r--src/lisp.h73
-rw-r--r--src/lread.c22
-rw-r--r--src/menu.c17
-rw-r--r--src/minibuf.c5
-rw-r--r--src/process.c66
-rw-r--r--src/textprop.c6
-rw-r--r--src/xdisp.c10
-rw-r--r--src/xfaces.c22
-rw-r--r--src/xfns.c42
-rw-r--r--src/xselect.c12
-rw-r--r--src/xterm.c23
28 files changed, 314 insertions, 214 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index fec13318a1c..afaca432250 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,21 @@
2014-10-01 Paul Eggert <eggert@cs.ucla.edu>
+ Use AUTO_CONS instead of SCOPED_CONS, etc.
+ * frame.h (AUTO_FRAME_ARG): Rename from FRAME_PARAMETER.
+ * lisp.h (AUTO_CONS): Rename from scoped_cons.
+ (AUTO_LIST1): Rename from scoped_list1.
+ (AUTO_LIST2): Rename from scoped_list2.
+ (AUTO_LIST3): Rename from scoped_list3.
+ (AUTO_LIST4): Rename from scoped_list4.
+ (AUTO_STRING): Rename from SCOPED_STRING.
+ * frame.h (AUTO_FRAME_ARG):
+ * lisp.h (AUTO_CONS, AUTO_LIST1, AUTO_LIST2, AUTO_LIST3)
+ (AUTO_LIST4, AUTO_STRING):
+ Prepend a new argument 'name'.
+ Declare a variable instead of yielding a value.
+ All uses changed.
+ * lisp.h (STACK_CONS, AUTO_CONS_EXPR): New internal macros.
+
* dispnew.c (adjust_decode_mode_spec_buffer): Prefer ptrdiff_t
to ssize_t since we're not using ssize_t-related syscalls here.
diff --git a/src/buffer.c b/src/buffer.c
index 9d376346a0a..b46993a3cdb 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1552,10 +1552,11 @@ exists, return the buffer `*scratch*' (creating it if necessary). */)
return notsogood;
else
{
- buf = Fget_buffer (SCOPED_STRING ("*scratch*"));
+ AUTO_STRING (scratch, "*scratch*");
+ buf = Fget_buffer (scratch);
if (NILP (buf))
{
- buf = Fget_buffer_create (SCOPED_STRING ("*scratch*"));
+ buf = Fget_buffer_create (scratch);
Fset_buffer_major_mode (buf);
}
return buf;
@@ -1575,10 +1576,11 @@ other_buffer_safely (Lisp_Object buffer)
if (candidate_buffer (buf, buffer))
return buf;
- buf = Fget_buffer (SCOPED_STRING ("*scratch*"));
+ AUTO_STRING (scratch, "*scratch*");
+ buf = Fget_buffer (scratch);
if (NILP (buf))
{
- buf = Fget_buffer_create (SCOPED_STRING ("*scratch*"));
+ buf = Fget_buffer_create (scratch);
Fset_buffer_major_mode (buf);
}
@@ -5289,7 +5291,8 @@ init_buffer (int initialized)
(void) initialized;
#endif /* USE_MMAP_FOR_BUFFERS */
- Fset_buffer (Fget_buffer_create (SCOPED_STRING ("*scratch*")));
+ AUTO_STRING (scratch, "*scratch*");
+ Fset_buffer (Fget_buffer_create (scratch));
if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
Fset_buffer_multibyte (Qnil);
@@ -5326,9 +5329,12 @@ init_buffer (int initialized)
However, it is not necessary to turn / into /:/.
So avoid doing that. */
&& strcmp ("/", SSDATA (BVAR (current_buffer, directory))))
- bset_directory
- (current_buffer,
- concat2 (SCOPED_STRING ("/:"), BVAR (current_buffer, directory)));
+ {
+ AUTO_STRING (slash_colon, "/:");
+ bset_directory (current_buffer,
+ concat2 (slash_colon,
+ BVAR (current_buffer, directory)));
+ }
temp = get_minibuffer (0);
bset_directory (XBUFFER (temp), BVAR (current_buffer, directory));
diff --git a/src/charset.c b/src/charset.c
index dee67a30c2e..171a00f23d1 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -485,14 +485,12 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile,
unsigned max_code = CHARSET_MAX_CODE (charset);
int fd;
FILE *fp;
- Lisp_Object suffixes;
struct charset_map_entries *head, *entries;
int n_entries;
- ptrdiff_t count;
-
- suffixes = scoped_list2 (SCOPED_STRING (".map"), SCOPED_STRING (".TXT"));
-
- count = SPECPDL_INDEX ();
+ AUTO_STRING (map, ".map");
+ AUTO_STRING (txt, ".txt");
+ AUTO_LIST2 (suffixes, map, txt);
+ ptrdiff_t count = SPECPDL_INDEX ();
record_unwind_protect_nothing ();
specbind (Qfile_name_handler_alist, Qnil);
fd = openp (Vcharset_map_path, mapfile, suffixes, NULL, Qnil, false);
diff --git a/src/chartab.c b/src/chartab.c
index 35362e32a03..bfbbf798f0c 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -1302,8 +1302,8 @@ uniprop_table (Lisp_Object prop)
{
struct gcpro gcpro1;
GCPRO1 (val);
- result = Fload (concat2 (SCOPED_STRING ("international/"), table),
- Qt, Qt, Qt, Qt);
+ AUTO_STRING (intl, "international/");
+ result = Fload (concat2 (intl, table), Qt, Qt, Qt, Qt);
UNGCPRO;
if (NILP (result))
return Qnil;
diff --git a/src/data.c b/src/data.c
index b71d88506d0..9977a3aaadd 100644
--- a/src/data.c
+++ b/src/data.c
@@ -979,14 +979,15 @@ wrong_choice (Lisp_Object choice, Lisp_Object wrong)
{
ptrdiff_t i = 0, len = XINT (Flength (choice));
Lisp_Object obj, *args;
- Lisp_Object should_be_specified = SCOPED_STRING (" should be specified");
- Lisp_Object or = SCOPED_STRING (" or ");
- Lisp_Object comma = SCOPED_STRING (", ");
+ AUTO_STRING (one_of, "One of ");
+ AUTO_STRING (comma, ", ");
+ AUTO_STRING (or, " or ");
+ AUTO_STRING (should_be_specified, " should be specified");
USE_SAFE_ALLOCA;
SAFE_ALLOCA_LISP (args, len * 2 + 1);
- args[i++] = SCOPED_STRING ("One of ");
+ args[i++] = one_of;
for (obj = choice; !NILP (obj); obj = XCDR (obj))
{
@@ -1006,11 +1007,13 @@ wrong_choice (Lisp_Object choice, Lisp_Object wrong)
static void
wrong_range (Lisp_Object min, Lisp_Object max, Lisp_Object wrong)
{
- xsignal2 (Qerror, Fconcat (4, ((Lisp_Object [])
- { SCOPED_STRING ("Value should be from "),
- Fnumber_to_string (min),
- SCOPED_STRING (" to "),
- Fnumber_to_string (max) })), wrong);
+ AUTO_STRING (value_should_be_from, "Value should be from ");
+ AUTO_STRING (to, " to ");
+ xsignal2 (Qerror,
+ Fconcat (4, ((Lisp_Object [])
+ {value_should_be_from, Fnumber_to_string (min),
+ to, Fnumber_to_string (max)})),
+ wrong);
}
/* Store NEWVAL into SYMBOL, where VALCONTENTS is found in the value cell
diff --git a/src/dispnew.c b/src/dispnew.c
index f40287cc3cb..5186c27ec7b 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6100,15 +6100,12 @@ init_display (void)
(*initial_terminal->delete_terminal_hook) (initial_terminal);
/* Update frame parameters to reflect the new type. */
- Fmodify_frame_parameters
- (selected_frame, FRAME_PARAMETER (Qtty_type,
- Ftty_type (selected_frame)));
- if (t->display_info.tty->name)
- Fmodify_frame_parameters
- (selected_frame,
- FRAME_PARAMETER (Qtty, build_string (t->display_info.tty->name)));
- else
- Fmodify_frame_parameters (selected_frame, FRAME_PARAMETER (Qtty, Qnil));
+ AUTO_FRAME_ARG (tty_type_arg, Qtty_type, Ftty_type (selected_frame));
+ Fmodify_frame_parameters (selected_frame, tty_type_arg);
+ AUTO_FRAME_ARG (tty_arg, Qtty, (t->display_info.tty->name
+ ? build_string (t->display_info.tty->name)
+ : Qnil));
+ Fmodify_frame_parameters (selected_frame, tty_arg);
}
{
diff --git a/src/doc.c b/src/doc.c
index 8af2c82a545..1b87c23e949 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -146,8 +146,9 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
if (fd < 0)
{
SAFE_FREE ();
- return concat3 (SCOPED_STRING ("Cannot open doc string file \""),
- file, SCOPED_STRING ("\"\n"));
+ AUTO_STRING (cannot_open, "Cannot open doc string file \"");
+ AUTO_STRING (quote_nl, "\"\n");
+ return concat3 (cannot_open, file, quote_nl);
}
}
count = SPECPDL_INDEX ();
diff --git a/src/editfns.c b/src/editfns.c
index b8a0f6fe637..e7c960dfffe 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -4362,7 +4362,8 @@ usage: (format STRING &rest OBJECTS) */)
Lisp_Object
format2 (const char *string1, Lisp_Object arg0, Lisp_Object arg1)
{
- return Fformat (3, (Lisp_Object []) { SCOPED_STRING (string1), arg0, arg1 });
+ AUTO_STRING (format, string1);
+ return Fformat (3, (Lisp_Object []) {format, arg0, arg1});
}
DEFUN ("char-equal", Fchar_equal, Schar_equal, 2, 2, 0,
diff --git a/src/emacs.c b/src/emacs.c
index 3c31827e994..60b67b5a902 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -400,6 +400,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
Lisp_Object name, dir, handler;
ptrdiff_t count = SPECPDL_INDEX ();
Lisp_Object raw_name;
+ AUTO_STRING (slash_colon, "/:");
initial_argv = argv;
initial_argc = argc;
@@ -423,7 +424,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
if it would otherwise be treated as magic. */
handler = Ffind_file_name_handler (raw_name, Qt);
if (! NILP (handler))
- raw_name = concat2 (SCOPED_STRING ("/:"), raw_name);
+ raw_name = concat2 (slash_colon, raw_name);
Vinvocation_name = Ffile_name_nondirectory (raw_name);
Vinvocation_directory = Ffile_name_directory (raw_name);
@@ -441,7 +442,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
if it would otherwise be treated as magic. */
handler = Ffind_file_name_handler (found, Qt);
if (! NILP (handler))
- found = concat2 (SCOPED_STRING ("/:"), found);
+ found = concat2 (slash_colon, found);
Vinvocation_directory = Ffile_name_directory (found);
}
}
@@ -2323,7 +2324,10 @@ decode_env_path (const char *evarname, const char *defalt, bool empty)
}
if (! NILP (tem))
- element = concat2 (SCOPED_STRING ("/:"), element);
+ {
+ AUTO_STRING (slash_colon, "/:");
+ element = concat2 (slash_colon, element);
+ }
} /* !NILP (element) */
lpath = Fcons (element, lpath);
diff --git a/src/fileio.c b/src/fileio.c
index 2590942d42e..d73d2303711 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1111,7 +1111,8 @@ filesystem tree, not (expand-file-name ".." dirname). */)
name = make_specified_string (nm, -1, p - nm, multibyte);
temp[0] = DRIVE_LETTER (drive);
- name = concat2 (SCOPED_STRING (temp), name);
+ AUTO_STRING (drive_prefix, temp);
+ name = concat2 (drive_prefix, name);
}
#ifdef WINDOWSNT
if (!NILP (Vw32_downcase_file_names))
@@ -5419,10 +5420,10 @@ auto_save_error (Lisp_Object error_val)
ring_bell (XFRAME (selected_frame));
+ AUTO_STRING (format, "Auto-saving %s: %s");
msg = Fformat (3, ((Lisp_Object [])
- { SCOPED_STRING ("Auto-saving %s: %s"),
- BVAR (current_buffer, name),
- Ferror_message_string (error_val) }));
+ {format, BVAR (current_buffer, name),
+ Ferror_message_string (error_val)}));
GCPRO1 (msg);
for (i = 0; i < 3; ++i)
diff --git a/src/fns.c b/src/fns.c
index abdc56afdb4..e891fdbf1d5 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2725,8 +2725,8 @@ if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */)
return obj;
}
- prompt = Fconcat (2, ((Lisp_Object [])
- { prompt, SCOPED_STRING ("(yes or no) ") }));
+ AUTO_STRING (yes_or_no, "(yes or no) ");
+ prompt = Fconcat (2, (Lisp_Object []) {prompt, yes_or_no});
GCPRO1 (prompt);
while (1)
diff --git a/src/font.c b/src/font.c
index ef48bbdaea6..4d99087ef7d 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1187,13 +1187,22 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font)
{
val = prop[XLFD_ENCODING_INDEX];
if (! NILP (val))
- val = concat2 (SCOPED_STRING ("*-"), SYMBOL_NAME (val));
+ {
+ AUTO_STRING (stardash, "*-");
+ val = concat2 (stardash, SYMBOL_NAME (val));
+ }
}
else if (NILP (prop[XLFD_ENCODING_INDEX]))
- val = concat2 (SYMBOL_NAME (val), SCOPED_STRING ("-*"));
+ {
+ AUTO_STRING (dashstar, "-*");
+ val = concat2 (SYMBOL_NAME (val), dashstar);
+ }
else
- val = concat3 (SYMBOL_NAME (val), SCOPED_STRING ("-"),
- SYMBOL_NAME (prop[XLFD_ENCODING_INDEX]));
+ {
+ AUTO_STRING (dash, "-");
+ val = concat3 (SYMBOL_NAME (val), dash,
+ SYMBOL_NAME (prop[XLFD_ENCODING_INDEX]));
+ }
if (! NILP (val))
ASET (font, FONT_REGISTRY_INDEX, Fintern (val, Qnil));
@@ -1789,10 +1798,8 @@ font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Objec
p1 = strchr (p0, '-');
if (! p1)
{
- if (SDATA (registry)[len - 1] == '*')
- registry = concat2 (registry, SCOPED_STRING ("-*"));
- else
- registry = concat2 (registry, SCOPED_STRING ("*-*"));
+ AUTO_STRING (extra, ("*-*" + (len && p0[len - 1] == '*')));
+ registry = concat2 (registry, extra);
}
registry = Fdowncase (registry);
ASET (font_spec, FONT_REGISTRY_INDEX, Fintern (registry, Qnil));
@@ -5019,7 +5026,7 @@ font_add_log (const char *action, Lisp_Object arg, Lisp_Object result)
if (FONTP (arg))
{
Lisp_Object tail, elt;
- Lisp_Object equalstr = SCOPED_STRING ("=");
+ AUTO_STRING (equalstr, "=");
val = Ffont_xlfd_name (arg, Qt);
for (tail = AREF (arg, FONT_EXTRA_INDEX); CONSP (tail);
@@ -5052,8 +5059,11 @@ font_add_log (const char *action, Lisp_Object arg, Lisp_Object result)
{
val = Ffont_xlfd_name (result, Qt);
if (! FONT_SPEC_P (result))
- val = concat3 (SYMBOL_NAME (AREF (result, FONT_TYPE_INDEX)),
- SCOPED_STRING (":"), val);
+ {
+ AUTO_STRING (colon, ":");
+ val = concat3 (SYMBOL_NAME (AREF (result, FONT_TYPE_INDEX)),
+ colon, val);
+ }
result = val;
}
else if (CONSP (result))
diff --git a/src/fontset.c b/src/fontset.c
index 1b750b05b7b..c415fdfa8fd 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1462,8 +1462,8 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
registry = AREF (font_spec, FONT_REGISTRY_INDEX);
if (! NILP (registry))
registry = Fdowncase (SYMBOL_NAME (registry));
- encoding = find_font_encoding (concat3 (family, SCOPED_STRING ("-"),
- registry));
+ AUTO_STRING (dash, "-");
+ encoding = find_font_encoding (concat3 (family, dash, registry));
if (NILP (encoding))
encoding = Qascii;
@@ -1575,7 +1575,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
if (ascii_changed)
{
- Lisp_Object tail, fr, alist;
+ Lisp_Object tail, fr;
int fontset_id = XINT (FONTSET_ID (fontset));
set_fontset_ascii (fontset, fontname);
@@ -1598,8 +1598,8 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
if (! NILP (font_object))
{
update_auto_fontset_alist (font_object, fontset);
- alist = FRAME_PARAMETER (Qfont, Fcons (name, font_object));
- Fmodify_frame_parameters (fr, alist);
+ AUTO_FRAME_ARG (arg, Qfont, Fcons (name, font_object));
+ Fmodify_frame_parameters (fr, arg);
}
}
}
diff --git a/src/frame.c b/src/frame.c
index 4b2ffd11e7a..d0527bf2a9c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4148,9 +4148,9 @@ x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param,
{
if (attribute && dpyinfo)
{
- tem = display_x_get_resource
- (dpyinfo, SCOPED_STRING (attribute),
- SCOPED_STRING (class), Qnil, Qnil);
+ AUTO_STRING (at, attribute);
+ AUTO_STRING (cl, class);
+ tem = display_x_get_resource (dpyinfo, at, cl, Qnil, Qnil);
if (NILP (tem))
return Qunbound;
@@ -4260,7 +4260,8 @@ x_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop,
tem = x_frame_get_arg (f, alist, prop, xprop, xclass, type);
if (EQ (tem, Qunbound))
tem = deflt;
- x_set_frame_parameters (f, FRAME_PARAMETER (prop, tem));
+ AUTO_FRAME_ARG (arg, prop, tem);
+ x_set_frame_parameters (f, arg);
return tem;
}
diff --git a/src/frame.h b/src/frame.h
index 94f080d3038..22f2fa7a24c 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1062,8 +1062,8 @@ default_pixels_per_inch_y (void)
/* Handy macro to construct an argument to Fmodify_frame_parameters. */
-#define FRAME_PARAMETER(parameter, value) \
- scoped_list1 (scoped_cons (parameter, value))
+#define AUTO_FRAME_ARG(name, parameter, value) \
+ AUTO_LIST1 (name, AUTO_CONS_EXPR (parameter, value))
/* False means there are no visible garbaged frames. */
extern bool frame_garbaged;
diff --git a/src/keyboard.c b/src/keyboard.c
index 37d33a6cdb0..8c030c7652c 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -551,6 +551,7 @@ echo_add_key (Lisp_Object c)
/* Replace a dash from echo_dash with a space, otherwise add a space
at the end as a separator between keys. */
+ AUTO_STRING (space, " ");
if (STRINGP (echo_string) && SCHARS (echo_string) > 1)
{
Lisp_Object last_char, prev_char, idx;
@@ -566,10 +567,10 @@ echo_add_key (Lisp_Object c)
if (XINT (last_char) == '-' && XINT (prev_char) != ' ')
Faset (echo_string, idx, make_number (' '));
else
- echo_string = concat2 (echo_string, SCOPED_STRING (" "));
+ echo_string = concat2 (echo_string, space);
}
else if (STRINGP (echo_string) && SCHARS (echo_string) > 0)
- echo_string = concat2 (echo_string, SCOPED_STRING (" "));
+ echo_string = concat2 (echo_string, space);
kset_echo_string
(current_kboard,
@@ -630,9 +631,9 @@ echo_dash (void)
/* Put a dash at the end of the buffer temporarily,
but make it go away when the next character is added. */
- kset_echo_string
- (current_kboard,
- concat2 (KVAR (current_kboard, echo_string), SCOPED_STRING ("-")));
+ AUTO_STRING (dash, "-");
+ kset_echo_string (current_kboard,
+ concat2 (KVAR (current_kboard, echo_string), dash));
echo_now ();
}
@@ -1890,13 +1891,11 @@ safe_run_hooks_1 (ptrdiff_t nargs, Lisp_Object *args)
static Lisp_Object
safe_run_hooks_error (Lisp_Object error, ptrdiff_t nargs, Lisp_Object *args)
{
- Lisp_Object hook, fun;
-
eassert (nargs == 2);
- hook = args[0];
- fun = args[1];
- Fmessage (4, ((Lisp_Object [])
- { SCOPED_STRING ("Error in %s (%S): %S"), hook, fun, error }));
+ AUTO_STRING (format, "Error in %s (%S): %S");
+ Lisp_Object hook = args[0];
+ Lisp_Object fun = args[1];
+ Fmessage (4, (Lisp_Object []) {format, hook, fun, error});
if (SYMBOLP (hook))
{
@@ -7885,12 +7884,12 @@ parse_menu_item (Lisp_Object item, int inmenubar)
{ /* This is a command. See if there is an equivalent key binding. */
Lisp_Object keyeq = AREF (item_properties, ITEM_PROPERTY_KEYEQ);
+ AUTO_STRING (space_space, " ");
/* The previous code preferred :key-sequence to :keys, so we
preserve this behavior. */
if (STRINGP (keyeq) && !CONSP (keyhint))
- keyeq = concat2 (SCOPED_STRING (" "),
- Fsubstitute_command_keys (keyeq));
+ keyeq = concat2 (space_space, Fsubstitute_command_keys (keyeq));
else
{
Lisp_Object prefix = keyeq;
@@ -7933,7 +7932,7 @@ parse_menu_item (Lisp_Object item, int inmenubar)
if (STRINGP (XCDR (prefix)))
tem = concat2 (tem, XCDR (prefix));
}
- keyeq = concat2 (SCOPED_STRING (" "), tem);
+ keyeq = concat2 (space_space, tem);
}
else
keyeq = Qnil;
@@ -8637,10 +8636,14 @@ read_char_minibuf_menu_prompt (int commandflag,
/* Insert button prefix. */
Lisp_Object selected
= AREF (item_properties, ITEM_PROPERTY_SELECTED);
+ AUTO_STRING (radio_yes, "(*) ");
+ AUTO_STRING (radio_no , "( ) ");
+ AUTO_STRING (check_yes, "[X] ");
+ AUTO_STRING (check_no , "[ ] ");
if (EQ (tem, QCradio))
- tem = SCOPED_STRING (NILP (selected) ? "(*) " : "( ) ");
+ tem = NILP (selected) ? radio_yes : radio_no;
else
- tem = SCOPED_STRING (NILP (selected) ? "[X] " : "[ ] ");
+ tem = NILP (selected) ? check_yes : check_no;
s = concat2 (tem, s);
}
diff --git a/src/keymap.c b/src/keymap.c
index 368903db5e6..fa2d4e942b8 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1299,7 +1299,8 @@ define_as_prefix (Lisp_Object keymap, Lisp_Object c)
static Lisp_Object
append_key (Lisp_Object key_sequence, Lisp_Object key)
{
- return Fvconcat (2, ((Lisp_Object []) { key_sequence, scoped_list1 (key) }));
+ AUTO_LIST1 (key_list, key);
+ return Fvconcat (2, ((Lisp_Object []) { key_sequence, key_list }));
}
/* Given a event type C which is a symbol,
@@ -1338,7 +1339,8 @@ silly_event_symbol_error (Lisp_Object c)
*p = 0;
c = reorder_modifiers (c);
- keystring = concat2 (SCOPED_STRING (new_mods), XCDR (assoc));
+ AUTO_STRING (new_modstring, new_mods);
+ keystring = concat2 (new_modstring, XCDR (assoc));
error ("To bind the key %s, use [?%s], not [%s]",
SDATA (SYMBOL_NAME (c)), SDATA (keystring),
@@ -2242,9 +2244,12 @@ around function keys and event symbols. */)
if (CONSP (key) && INTEGERP (XCAR (key)) && INTEGERP (XCDR (key)))
/* An interval from a map-char-table. */
- return concat3 (Fsingle_key_description (XCAR (key), no_angles),
- SCOPED_STRING (".."),
- Fsingle_key_description (XCDR (key), no_angles));
+ {
+ AUTO_STRING (dotdot, "..");
+ return concat3 (Fsingle_key_description (XCAR (key), no_angles),
+ dotdot,
+ Fsingle_key_description (XCDR (key), no_angles));
+ }
key = EVENT_HEAD (key);
@@ -3439,9 +3444,9 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
/* Call Fkey_description first, to avoid GC bug for the other string. */
if (!NILP (prefix) && XFASTINT (Flength (prefix)) > 0)
{
- Lisp_Object tem;
- tem = Fkey_description (prefix, Qnil);
- elt_prefix = concat2 (tem, SCOPED_STRING (" "));
+ Lisp_Object tem = Fkey_description (prefix, Qnil);
+ AUTO_STRING (space, " ");
+ elt_prefix = concat2 (tem, space);
}
prefix = Qnil;
}
diff --git a/src/lisp.h b/src/lisp.h
index 27751af2f5b..aeb1a71e481 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4625,24 +4625,36 @@ enum
&& alignof (union Aligned_String) % GCALIGNMENT == 0)
};
-/* Build a stack-based Lisp cons or short list if possible, a GC-based
- one otherwise. The resulting object should not be modified or made
- visible to user code. */
-
-#define scoped_cons(a, b) \
- (USE_STACK_CONS \
- ? make_lisp_ptr (&(union Aligned_Cons) { { a, { b } } }.s, Lisp_Cons) \
- : Fcons (a, b))
-#define scoped_list1(a) \
- (USE_STACK_CONS ? scoped_cons (a, Qnil) : list1 (a))
-#define scoped_list2(a, b) \
- (USE_STACK_CONS ? scoped_cons (a, scoped_list1 (b)) : list2 (a,b))
-#define scoped_list3(a, b, c) \
- (USE_STACK_CONS ? scoped_cons (a, scoped_list2 (b, c)) : list3 (a, b, c))
-#define scoped_list4(a, b, c, d) \
- (USE_STACK_CONS \
- ? scoped_cons (a, scoped_list3 (b, c, d)) : \
- list4 (a, b, c, d))
+/* Auxiliary macros used for auto allocation of Lisp objects. Please
+ use these only in macros like AUTO_CONS that declare a local
+ variable whose lifetime will be clear to the programmer. */
+#define STACK_CONS(a, b) \
+ make_lisp_ptr (&(union Aligned_Cons) { { a, { b } } }.s, Lisp_Cons)
+#define AUTO_CONS_EXPR(a, b) \
+ (USE_STACK_CONS ? STACK_CONS (a, b) : Fcons (a, b))
+
+/* Declare NAME as an auto Lisp cons or short list if possible, a
+ GC-based one otherwise. This is in the sense of the C keyword
+ 'auto'; i.e., the object has the lifetime of the containing block.
+ The resulting object should not be made visible to user Lisp code. */
+
+#define AUTO_CONS(name, a, b) Lisp_Object name = AUTO_CONS_EXPR (a, b)
+#define AUTO_LIST1(name, a) \
+ Lisp_Object name = (USE_STACK_CONS ? STACK_CONS (a, Qnil) : list1 (a))
+#define AUTO_LIST2(name, a, b) \
+ Lisp_Object name = (USE_STACK_CONS \
+ ? STACK_CONS (a, STACK_CONS (b, Qnil)) \
+ : list2 (a, b))
+#define AUTO_LIST3(name, a, b, c) \
+ Lisp_Object name = (USE_STACK_CONS \
+ ? STACK_CONS (a, STACK_CONS (b, STACK_CONS (c, Qnil))) \
+ : list3 (a, b, c))
+#define AUTO_LIST4(name, a, b, c, d) \
+ Lisp_Object name \
+ = (USE_STACK_CONS \
+ ? STACK_CONS (a, STACK_CONS (b, STACK_CONS (c, \
+ STACK_CONS (d, Qnil)))) \
+ : list4 (a, b, c, d))
/* Check whether stack-allocated strings are ASCII-only. */
@@ -4652,18 +4664,19 @@ extern const char *verify_ascii (const char *);
# define verify_ascii(str) (str)
#endif
-/* Build a stack-based Lisp string from STR if possible, a GC-based
- one if not. STR is not necessarily copied and should contain only
- ASCII characters. The resulting Lisp string should not be modified
- or made visible to user code. */
-
-#define SCOPED_STRING(str) \
- (USE_STACK_STRING \
- ? (make_lisp_ptr \
- ((&(union Aligned_String) \
- { { strlen (str), -1, 0, (unsigned char *) verify_ascii (str) } }.s), \
- Lisp_String)) \
- : build_string (verify_ascii (str)))
+/* Declare NAME as an auto Lisp string if possible, a GC-based one if not.
+ Take its value from STR. STR is not necessarily copied and should
+ contain only ASCII characters. The resulting Lisp string should
+ not be modified or made visible to user code. */
+
+#define AUTO_STRING(name, str) \
+ Lisp_Object name = \
+ (USE_STACK_STRING \
+ ? (make_lisp_ptr \
+ ((&(union Aligned_String) \
+ {{strlen (str), -1, 0, (unsigned char *) verify_ascii (str)}}.s), \
+ Lisp_String)) \
+ : build_string (verify_ascii (str)))
/* Loop over all tails of a list, checking for cycles.
FIXME: Make tortoise and n internal declarations.
diff --git a/src/lread.c b/src/lread.c
index 799635e3c83..0e71b13c5c8 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -969,9 +969,10 @@ static void
load_warn_old_style_backquotes (Lisp_Object file)
{
if (!NILP (Vold_style_backquotes))
- Fmessage (2, ((Lisp_Object [])
- { SCOPED_STRING ("Loading `%s': old-style backquotes detected!"),
- file }));
+ {
+ AUTO_STRING (format, "Loading `%s': old-style backquotes detected!");
+ Fmessage (2, (Lisp_Object []) {format, file});
+ }
}
DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0,
@@ -2888,11 +2889,8 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
if (c == '=')
{
/* Make a placeholder for #n# to use temporarily. */
- Lisp_Object placeholder;
- Lisp_Object cell;
-
- placeholder = scoped_cons (Qnil, Qnil);
- cell = Fcons (make_number (n), placeholder);
+ AUTO_CONS (placeholder, Qnil, Qnil);
+ Lisp_Object cell = Fcons (make_number (n), placeholder);
read_objects = Fcons (cell, read_objects);
/* Read the object itself. */
@@ -3371,7 +3369,7 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
substitute_in_interval contains part of the logic. */
INTERVAL root_interval = string_intervals (subtree);
- Lisp_Object arg = scoped_cons (object, placeholder);
+ AUTO_CONS (arg, object, placeholder);
traverse_intervals_noorder (root_interval,
&substitute_in_interval, arg);
@@ -3678,8 +3676,10 @@ read_list (bool flag, Lisp_Object readcharfun)
in the installed Lisp directory.
We don't use Fexpand_file_name because that would make
the directory absolute now. */
- elt = concat2 (SCOPED_STRING ("../lisp/"),
- Ffile_name_nondirectory (elt));
+ {
+ AUTO_STRING (dotdotlisp, "../lisp/");
+ elt = concat2 (dotdotlisp, Ffile_name_nondirectory (elt));
+ }
}
else if (EQ (elt, Vload_file_name)
&& ! NILP (elt)
diff --git a/src/menu.c b/src/menu.c
index e63b21f0e08..61163ae0216 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -389,8 +389,11 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
{
if (!submenu && SREF (tem, 0) != '\0'
&& SREF (tem, 0) != '-')
- ASET (menu_items, idx + MENU_ITEMS_ITEM_NAME,
- concat2 (SCOPED_STRING (" "), tem));
+ {
+ AUTO_STRING (spaces, " ");
+ ASET (menu_items, idx + MENU_ITEMS_ITEM_NAME,
+ concat2 (spaces, tem));
+ }
idx += MENU_ITEMS_ITEM_LENGTH;
}
}
@@ -409,14 +412,20 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
prefix = " ";
if (prefix)
- item_string = concat2 (SCOPED_STRING (prefix), item_string);
+ {
+ AUTO_STRING (prefix_obj, prefix);
+ item_string = concat2 (prefix_obj, item_string);
+ }
}
if ((FRAME_TERMCAP_P (XFRAME (Vmenu_updating_frame))
|| FRAME_MSDOS_P (XFRAME (Vmenu_updating_frame)))
&& !NILP (map))
/* Indicate visually that this is a submenu. */
- item_string = concat2 (item_string, SCOPED_STRING (" >"));
+ {
+ AUTO_STRING (space_gt, " >");
+ item_string = concat2 (item_string, space_gt);
+ }
push_menu_item (item_string, enabled, key,
AREF (item_properties, ITEM_PROPERTY_DEF),
diff --git a/src/minibuf.c b/src/minibuf.c
index ea525ba0f25..0b455157d52 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1157,9 +1157,10 @@ function, instead of the usual behavior. */)
STRING_MULTIBYTE (prompt));
}
+ AUTO_STRING (format, "%s (default %s): ");
prompt = Fformat (3, ((Lisp_Object [])
- { SCOPED_STRING ("%s (default %s): "),
- prompt, CONSP (def) ? XCAR (def) : def }));
+ {format, prompt,
+ CONSP (def) ? XCAR (def) : def}));
}
result = Fcompleting_read (prompt, intern ("internal-complete-buffer"),
diff --git a/src/process.c b/src/process.c
index 6d059af9cc8..f767ae05e96 100644
--- a/src/process.c
+++ b/src/process.c
@@ -596,7 +596,7 @@ status_message (struct Lisp_Process *p)
Lisp_Object symbol;
int code;
bool coredump;
- Lisp_Object string, string2;
+ Lisp_Object string;
decode_status (status, &symbol, &code, &coredump);
@@ -620,8 +620,8 @@ status_message (struct Lisp_Process *p)
if (c1 != c2)
Faset (string, make_number (0), make_number (c2));
}
- string2 = SCOPED_STRING (coredump ? " (core dumped)\n" : "\n");
- return concat2 (string, string2);
+ AUTO_STRING (suffix, coredump ? " (core dumped)\n" : "\n");
+ return concat2 (string, suffix);
}
else if (EQ (symbol, Qexit))
{
@@ -629,17 +629,17 @@ status_message (struct Lisp_Process *p)
return build_string (code == 0 ? "deleted\n" : "connection broken by remote peer\n");
if (code == 0)
return build_string ("finished\n");
+ AUTO_STRING (prefix, "exited abnormally with code ");
string = Fnumber_to_string (make_number (code));
- string2 = SCOPED_STRING (coredump ? " (core dumped)\n" : "\n");
- return concat3 (SCOPED_STRING ("exited abnormally with code "),
- string, string2);
+ AUTO_STRING (suffix, coredump ? " (core dumped)\n" : "\n");
+ return concat3 (prefix, string, suffix);
}
else if (EQ (symbol, Qfailed))
{
+ AUTO_STRING (prefix, "failed with code ");
string = Fnumber_to_string (make_number (code));
- string2 = SCOPED_STRING ("\n");
- return concat3 (SCOPED_STRING ("failed with code "),
- string, string2);
+ AUTO_STRING (suffix, "\n");
+ return concat3 (prefix, string, suffix);
}
else
return Fcopy_sequence (Fsymbol_name (symbol));
@@ -1327,7 +1327,8 @@ Returns nil if format of ADDRESS is invalid. */)
else
return Qnil;
- args[0] = SCOPED_STRING (format);
+ AUTO_STRING (format_obj, format);
+ args[0] = format_obj;
for (i = 0; i < nargs; i++)
{
@@ -1346,8 +1347,10 @@ Returns nil if format of ADDRESS is invalid. */)
}
if (CONSP (address))
- return Fformat (2, ((Lisp_Object [])
- { SCOPED_STRING ("<Family %d>"), Fcar (address) }));
+ {
+ AUTO_STRING (format, "<Family %d>");
+ return Fformat (2, (Lisp_Object []) {format, Fcar (address)});
+ }
return Qnil;
}
@@ -4062,12 +4065,13 @@ server_accept_connection (Lisp_Object server, int channel)
{
unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr;
+ AUTO_STRING (ipv4_format, "%d.%d.%d.%d");
host = Fformat (5, ((Lisp_Object [])
- { SCOPED_STRING ("%d.%d.%d.%d"), make_number (ip[0]),
+ { ipv4_format, make_number (ip[0]),
make_number (ip[1]), make_number (ip[2]), make_number (ip[3]) }));
service = make_number (ntohs (saddr.in.sin_port));
- caller = Fformat (3, ((Lisp_Object [])
- { SCOPED_STRING (" <%s:%d>"), host, service }));
+ AUTO_STRING (caller_format, " <%s:%d>");
+ caller = Fformat (3, (Lisp_Object []) {caller_format, host, service});
}
break;
@@ -4078,13 +4082,14 @@ server_accept_connection (Lisp_Object server, int channel)
uint16_t *ip6 = (uint16_t *)&saddr.in6.sin6_addr;
int i;
- args[0] = SCOPED_STRING ("%x:%x:%x:%x:%x:%x:%x:%x");
+ AUTO_STRING (ipv6_format, "%x:%x:%x:%x:%x:%x:%x:%x");
+ args[0] = ipv6_format;
for (i = 0; i < 8; i++)
args[i + 1] = make_number (ntohs (ip6[i]));
host = Fformat (9, args);
service = make_number (ntohs (saddr.in.sin_port));
- caller = Fformat (3, ((Lisp_Object [])
- { SCOPED_STRING (" <[%s]:%d>"), host, service }));
+ AUTO_STRING (caller_format, " <[%s]:%d>");
+ caller = Fformat (3, (Lisp_Object []) {caller_format, host, service});
}
break;
#endif
@@ -4094,8 +4099,9 @@ server_accept_connection (Lisp_Object server, int channel)
#endif
default:
caller = Fnumber_to_string (make_number (connect_counter));
- caller = concat3
- (SCOPED_STRING (" <"), caller, SCOPED_STRING (">"));
+ AUTO_STRING (space_lessthan, " <");
+ AUTO_STRING (greaterthan, ">");
+ caller = concat3 (space_lessthan, caller, greaterthan);
break;
}
@@ -4192,16 +4198,18 @@ server_accept_connection (Lisp_Object server, int channel)
p->inherit_coding_system_flag
= (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
+ AUTO_STRING (dash, "-");
+ AUTO_STRING (nl, "\n");
+ Lisp_Object host_string = STRINGP (host) ? host : dash;
+
if (!NILP (ps->log))
- call3 (ps->log, server, proc,
- concat3 (SCOPED_STRING ("accept from "),
- (STRINGP (host) ? host : SCOPED_STRING ("-")),
- SCOPED_STRING ("\n")));
-
- exec_sentinel (proc,
- concat3 (SCOPED_STRING ("open from "),
- (STRINGP (host) ? host : SCOPED_STRING ("-")),
- SCOPED_STRING ("\n")));
+ {
+ AUTO_STRING (accept_from, "accept from ");
+ call3 (ps->log, server, proc, concat3 (accept_from, host_string, nl));
+ }
+
+ AUTO_STRING (open_from, "open from ");
+ exec_sentinel (proc, concat3 (open_from, host_string, nl));
}
/* This variable is different from waiting_for_input in keyboard.c.
diff --git a/src/textprop.c b/src/textprop.c
index 146ee9e97d9..91ade8ae298 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1320,7 +1320,8 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */
(Lisp_Object start, Lisp_Object end, Lisp_Object property,
Lisp_Object value, Lisp_Object object)
{
- Fadd_text_properties (start, end, scoped_list2 (property, value), object);
+ AUTO_LIST2 (properties, property, value);
+ Fadd_text_properties (start, end, properties, object);
return Qnil;
}
@@ -1361,7 +1362,8 @@ into it. */)
(Lisp_Object start, Lisp_Object end, Lisp_Object face,
Lisp_Object append, Lisp_Object object)
{
- add_text_properties_1 (start, end, scoped_list2 (Qface, face), object,
+ AUTO_LIST2 (properties, Qface, face);
+ add_text_properties_1 (start, end, properties, object,
(NILP (append)
? TEXT_PROPERTY_PREPEND
: TEXT_PROPERTY_APPEND));
diff --git a/src/xdisp.c b/src/xdisp.c
index c27f46677bb..8176d81cd6e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12070,7 +12070,7 @@ build_desired_tool_bar_string (struct frame *f)
(f, Fmake_string (make_number (size_needed), make_number (' ')));
else
{
- Lisp_Object props = scoped_list4 (Qdisplay, Qnil, Qmenu_item, Qnil);
+ AUTO_LIST4 (props, Qdisplay, Qnil, Qmenu_item, Qnil);
struct gcpro gcpro1;
GCPRO1 (props);
Fremove_text_properties (make_number (0), make_number (size),
@@ -12186,9 +12186,8 @@ build_desired_tool_bar_string (struct frame *f)
the start of this item's properties in the tool-bar items
vector. */
image = Fcons (Qimage, plist);
- Lisp_Object props
- = scoped_list4 (Qdisplay, image, Qmenu_item,
- make_number (i * TOOL_BAR_ITEM_NSLOTS));
+ AUTO_LIST4 (props, Qdisplay, image, Qmenu_item,
+ make_number (i * TOOL_BAR_ITEM_NSLOTS));
struct gcpro gcpro1;
GCPRO1 (props);
@@ -20966,7 +20965,8 @@ See also `bidi-paragraph-direction'. */)
the previous non-empty line. */
if (pos >= ZV && pos > BEGV)
DEC_BOTH (pos, bytepos);
- if (fast_looking_at (SCOPED_STRING ("[\f\t ]*\n"),
+ AUTO_STRING (trailing_white_space, "[\f\t ]*\n");
+ if (fast_looking_at (trailing_white_space,
pos, bytepos, ZV, ZV_BYTE, Qnil) > 0)
{
while ((c = FETCH_BYTE (bytepos)) == '\n'
diff --git a/src/xfaces.c b/src/xfaces.c
index f788c304bd8..73704bbba8e 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3398,7 +3398,8 @@ set_font_frame_param (Lisp_Object frame, Lisp_Object lface)
ASET (lface, LFACE_FONT_INDEX, font);
}
f->default_face_done_p = 0;
- Fmodify_frame_parameters (frame, FRAME_PARAMETER (Qfont, font));
+ AUTO_FRAME_ARG (arg, Qfont, font);
+ Fmodify_frame_parameters (frame, arg);
}
}
@@ -3787,18 +3788,23 @@ Default face attributes override any local face attributes. */)
&& newface->font)
{
Lisp_Object name = newface->font->props[FONT_NAME_INDEX];
- Fmodify_frame_parameters (frame, FRAME_PARAMETER (Qfont, name));
+ AUTO_FRAME_ARG (arg, Qfont, name);
+ Fmodify_frame_parameters (frame, arg);
}
if (STRINGP (gvec[LFACE_FOREGROUND_INDEX]))
- Fmodify_frame_parameters
- (frame, FRAME_PARAMETER (Qforeground_color,
- gvec[LFACE_FOREGROUND_INDEX]));
+ {
+ AUTO_FRAME_ARG (arg, Qforeground_color,
+ gvec[LFACE_FOREGROUND_INDEX]);
+ Fmodify_frame_parameters (frame, arg);
+ }
if (STRINGP (gvec[LFACE_BACKGROUND_INDEX]))
- Fmodify_frame_parameters
- (frame, FRAME_PARAMETER (Qbackground_color,
- gvec[LFACE_BACKGROUND_INDEX]));
+ {
+ AUTO_FRAME_ARG (arg, Qbackground_color,
+ gvec[LFACE_BACKGROUND_INDEX]);
+ Fmodify_frame_parameters (frame, arg);
+ }
}
}
diff --git a/src/xfns.c b/src/xfns.c
index f474e88ba7e..81d7bac858b 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1569,11 +1569,14 @@ x_default_scroll_bar_color_parameter (struct frame *f,
/* See if an X resource for the scroll bar color has been
specified. */
- tem = display_x_get_resource
- (dpyinfo, SCOPED_STRING (foreground_p ? "foreground" : "background"),
- empty_unibyte_string,
- SCOPED_STRING ("verticalScrollBar"),
- empty_unibyte_string);
+ AUTO_STRING (foreground, "foreground");
+ AUTO_STRING (background, "foreground");
+ AUTO_STRING (verticalScrollBar, "verticalScrollBar");
+ tem = (display_x_get_resource
+ (dpyinfo, foreground_p ? foreground : background,
+ empty_unibyte_string,
+ verticalScrollBar,
+ empty_unibyte_string));
if (!STRINGP (tem))
{
/* If nothing has been specified, scroll bars will use a
@@ -1591,7 +1594,8 @@ x_default_scroll_bar_color_parameter (struct frame *f,
#endif /* not USE_TOOLKIT_SCROLL_BARS */
}
- x_set_frame_parameters (f, FRAME_PARAMETER (prop, tem));
+ AUTO_FRAME_ARG (arg, prop, tem);
+ x_set_frame_parameters (f, arg);
return tem;
}
@@ -2843,7 +2847,8 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms)
{
/* Remember the explicit font parameter, so we can re-apply it after
we've applied the `default' face settings. */
- x_set_frame_parameters (f, FRAME_PARAMETER (Qfont_param, font_param));
+ AUTO_FRAME_ARG (arg, Qfont_param, font_param);
+ x_set_frame_parameters (f, arg);
}
/* This call will make X resources override any system font setting. */
@@ -4272,9 +4277,10 @@ select_visual (struct x_display_info *dpyinfo)
Screen *screen = dpyinfo->screen;
/* See if a visual is specified. */
- Lisp_Object value = display_x_get_resource
- (dpyinfo, SCOPED_STRING ("visualClass"),
- SCOPED_STRING ("VisualClass"), Qnil, Qnil);
+ AUTO_STRING (visualClass, "visualClass");
+ AUTO_STRING (VisualClass, "VisualClass");
+ Lisp_Object value = display_x_get_resource (dpyinfo, visualClass,
+ VisualClass, Qnil, Qnil);
if (STRINGP (value))
{
@@ -5033,7 +5039,10 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
/* Add `tooltip' frame parameter's default value. */
if (NILP (Fframe_parameter (frame, Qtooltip)))
- Fmodify_frame_parameters (frame, FRAME_PARAMETER (Qtooltip, Qt));
+ {
+ AUTO_FRAME_ARG (arg, Qtooltip, Qt);
+ Fmodify_frame_parameters (frame, arg);
+ }
/* FIXME - can this be done in a similar way to normal frames?
http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00641.html */
@@ -5051,8 +5060,10 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
disptype = intern ("color");
if (NILP (Fframe_parameter (frame, Qdisplay_type)))
- Fmodify_frame_parameters
- (frame, FRAME_PARAMETER (Qdisplay_type, disptype));
+ {
+ AUTO_FRAME_ARG (arg, Qdisplay_type, disptype);
+ Fmodify_frame_parameters (frame, arg);
+ }
}
/* Set up faces after all frame parameters are known. This call
@@ -5071,7 +5082,10 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
call2 (Qface_set_after_frame_default, frame, Qnil);
if (!EQ (bg, Fframe_parameter (frame, Qbackground_color)))
- Fmodify_frame_parameters (frame, FRAME_PARAMETER (Qbackground_color, bg));
+ {
+ AUTO_FRAME_ARG (arg, Qbackground_color, bg);
+ Fmodify_frame_parameters (frame, arg);
+ }
}
f->no_split = 1;
diff --git a/src/xselect.c b/src/xselect.c
index d90d056e960..0e8a43717e0 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2159,10 +2159,9 @@ x_clipboard_manager_save (Lisp_Object frame)
static Lisp_Object
x_clipboard_manager_error_1 (Lisp_Object err)
{
- Fmessage (2, ((Lisp_Object [])
- { SCOPED_STRING ("X clipboard manager error: %s\n\
-If the problem persists, set `x-select-enable-clipboard-manager' to nil."),
- CAR (CDR (err)) }));
+ AUTO_STRING (format, "X clipboard manager error: %s\n\
+If the problem persists, set `x-select-enable-clipboard-manager' to nil.");
+ Fmessage (2, (Lisp_Object []) {format, CAR (CDR (err))});
return Qnil;
}
@@ -2229,9 +2228,8 @@ x_clipboard_manager_save_all (void)
local_frame = XCAR (XCDR (XCDR (XCDR (local_selection))));
if (FRAME_LIVE_P (XFRAME (local_frame)))
{
- Fmessage (1, ((Lisp_Object [])
- { SCOPED_STRING
- ("Saving clipboard to X clipboard manager...") }));
+ AUTO_STRING (saving, "Saving clipboard to X clipboard manager...");
+ Fmessage (1, &saving);
internal_condition_case_1 (x_clipboard_manager_save, local_frame,
Qt, x_clipboard_manager_error_2);
}
diff --git a/src/xterm.c b/src/xterm.c
index f9d95984415..8546dc426d8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10935,10 +10935,11 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
{
if (dpyinfo->visual->class == PseudoColor)
{
- Lisp_Object value;
- value = display_x_get_resource
- (dpyinfo, SCOPED_STRING ("privateColormap"),
- SCOPED_STRING ("PrivateColormap"), Qnil, Qnil);
+ AUTO_STRING (privateColormap, "privateColormap");
+ AUTO_STRING (PrivateColormap, "PrivateColormap");
+ Lisp_Object value
+ = display_x_get_resource (dpyinfo, privateColormap,
+ PrivateColormap, Qnil, Qnil);
if (STRINGP (value)
&& (!strcmp (SSDATA (value), "true")
|| !strcmp (SSDATA (value), "on")))
@@ -11142,9 +11143,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
/* See if we should run in synchronous mode. This is useful
for debugging X code. */
{
- Lisp_Object value = display_x_get_resource
- (dpyinfo, SCOPED_STRING ("synchronous"),
- SCOPED_STRING ("Synchronous"), Qnil, Qnil);
+ AUTO_STRING (synchronous, "synchronous");
+ AUTO_STRING (Synchronous, "Synchronous");
+ Lisp_Object value = display_x_get_resource (dpyinfo, synchronous,
+ Synchronous, Qnil, Qnil);
if (STRINGP (value)
&& (!strcmp (SSDATA (value), "true")
|| !strcmp (SSDATA (value), "on")))
@@ -11152,9 +11154,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
}
{
- Lisp_Object value = display_x_get_resource
- (dpyinfo, SCOPED_STRING ("useXIM"),
- SCOPED_STRING ("UseXIM"), Qnil, Qnil);
+ AUTO_STRING (useXIM, "useXIM");
+ AUTO_STRING (UseXIM, "UseXIM");
+ Lisp_Object value = display_x_get_resource (dpyinfo, useXIM, UseXIM,
+ Qnil, Qnil);
#ifdef USE_XIM
if (STRINGP (value)
&& (!strcmp (SSDATA (value), "false")